Skip to content

Commit

Permalink
Merge branch 'AliceO2Group:dev' into destructorsFix
Browse files Browse the repository at this point in the history
  • Loading branch information
jackal1-66 authored Dec 9, 2024
2 parents 03913e4 + f8c8cd5 commit 22bfb67
Show file tree
Hide file tree
Showing 90 changed files with 4,041 additions and 2,190 deletions.
19 changes: 10 additions & 9 deletions Common/DCAFitter/include/DCAFitter/DCAFitterN.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,20 @@ struct TrackCovI {
// (otherwise for quazi-collinear tracks the X will not be constrained)
float cyy = trc.getSigmaY2(), czz = trc.getSigmaZ2(), cyz = trc.getSigmaZY(), cxx = cyy * xerrFactor;
float detYZ = cyy * czz - cyz * cyz;
if (detYZ > 0.) {
auto detYZI = 1. / detYZ;
sxx = 1. / cxx;
syy = czz * detYZI;
syz = -cyz * detYZI;
szz = cyy * detYZI;
} else {
if (detYZ <= 0.) {
#ifndef GPUCA_GPUCODE
throw std::runtime_error("invalid track covariance");
printf("overriding invalid track covariance from %s\n", trc.asString().c_str());
#else
printf("invalid track covariance\n");
printf("overriding invalid track covariance cyy:%e czz:%e cyz:%e\n", cyy, czz, cyz);
#endif
cyz = o2::gpu::GPUCommonMath::Sqrt(cyy * czz) * (cyz > 0 ? 0.98f : -0.98f);
detYZ = cyy * czz - cyz * cyz;
}
auto detYZI = 1. / detYZ;
sxx = 1. / cxx;
syy = czz * detYZI;
syz = -cyz * detYZI;
szz = cyy * detYZI;
}
};

Expand Down
66 changes: 66 additions & 0 deletions Common/Utils/include/CommonUtils/EnumBitOperators.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#ifndef O2_FRAMEWORK_ENUM_BIT_OPERATORS_H_
#define O2_FRAMEWORK_ENUM_BIT_OPERATORS_H_

#include <type_traits>

#define O2_DEFINE_ENUM_BIT_OPERATORS(enum_t) \
constexpr auto operator|(enum_t lhs, enum_t rhs) \
{ \
return static_cast<enum_t>( \
static_cast<std::underlying_type_t<enum_t>>(lhs) | \
static_cast<std::underlying_type_t<enum_t>>(rhs)); \
} \
\
constexpr auto operator&(enum_t lhs, enum_t rhs) \
{ \
return static_cast<enum_t>( \
static_cast<std::underlying_type_t<enum_t>>(lhs) & \
static_cast<std::underlying_type_t<enum_t>>(rhs)); \
} \
\
constexpr auto operator^(enum_t lhs, enum_t rhs) \
{ \
return static_cast<enum_t>( \
static_cast<std::underlying_type_t<enum_t>>(lhs) ^ \
static_cast<std::underlying_type_t<enum_t>>(rhs)); \
} \
\
constexpr auto operator~(enum_t op) \
{ \
return static_cast<enum_t>( \
~static_cast<std::underlying_type_t<enum_t>>(op)); \
} \
\
constexpr auto& operator|=(enum_t& lhs, enum_t rhs) \
{ \
lhs = lhs | rhs; \
return lhs; \
} \
\
constexpr auto& operator&=(enum_t& lhs, enum_t rhs) \
{ \
lhs = lhs & rhs; \
return lhs; \
} \
\
constexpr enum_t& operator^=(enum_t& lhs, enum_t rhs) \
{ \
lhs = lhs ^ rhs; \
return lhs; \
}

#define O2_ENUM_TEST_BIT(mask, value) ((mask & value) == value)
#define O2_ENUM_SET_BIT(bit) ((1 << bit))
#define O2_ENUM_ANY_BIT(enum) ((static_cast<std::underlying_type_t<decltype(enum)>>(enum) != 0))

#endif
2 changes: 2 additions & 0 deletions Common/Utils/include/CommonUtils/IRFrameSelector.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class IRFrameSelector
auto getIRFrames() const { return mFrames; }
bool isSet() const { return mIsSet; }

void setOwnList(const std::vector<o2::dataformats::IRFrame>& lst, bool toBeSorted);

private:
gsl::span<const o2::dataformats::IRFrame> mFrames{}; // externally provided span of IRFrames, must be sorted in IRFrame.getMin()
o2::dataformats::IRFrame mLastIRFrameChecked{}; // last frame which was checked
Expand Down
7 changes: 7 additions & 0 deletions Common/Utils/include/CommonUtils/TreeStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class TreeStream
const char* getName() const { return mTree.GetName(); }
void setID(int id) { mID = id; }
int getID() const { return mID; }

TreeStream& operator<<(const Bool_t& b)
{
CheckIn('B', &b);
Expand All @@ -75,6 +76,12 @@ class TreeStream
return *this;
}

TreeStream& operator<<(const int8_t& i)
{
CheckIn('B', &i);
return *this;
}

TreeStream& operator<<(const UChar_t& c)
{
CheckIn('b', &c);
Expand Down
12 changes: 12 additions & 0 deletions Common/Utils/src/IRFrameSelector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,16 @@ size_t IRFrameSelector::loadIRFrames(const std::string& fname)
return mOwnList.size();
}

void IRFrameSelector::setOwnList(const std::vector<o2::dataformats::IRFrame>& lst, bool toBeSorted)
{
clear();
mOwnList.insert(mOwnList.end(), lst.begin(), lst.end());
if (toBeSorted) {
std::sort(mOwnList.begin(), mOwnList.end(), [](const auto& a, const auto& b) { return a.getMin() < b.getMin(); });
}
setSelectedIRFrames(mOwnList, 0, 0, 0, false);
}

void IRFrameSelector::print(bool lst) const
{
LOGP(info, "Last query stopped at entry {} for IRFrame {}:{}", mLastBoundID,
Expand All @@ -183,6 +193,8 @@ void IRFrameSelector::clear()
{
mIsSet = false;
mOwnList.clear();
mLastIRFrameChecked.getMin().clear(); // invalidate
mLastBoundID = -1;
mFrames = {};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
#include <boost/functional/hash.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/unordered_map.hpp>
#include <string>
#include <vector>
#include <Framework/AnalysisHelpers.h>

namespace o2::aodhelpers
Expand Down Expand Up @@ -55,7 +53,7 @@ auto createTableCursor(framework::ProcessingContext& pc)
framework::Produces<T> c;
c.resetCursor(pc.outputs()
.make<framework::TableBuilder>(framework::OutputForTable<T>::ref()));
c.setLabel(o2::aod::MetadataTrait<T>::metadata::tableLabel());
c.setLabel(aod::label<T::ref>());
return c;
}
} // namespace o2::aodhelpers
Expand Down
54 changes: 39 additions & 15 deletions Detectors/AOD/include/AODProducerWorkflow/AODProducerWorkflowSpec.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include "DataFormatsTRD/TrackTRD.h"
#include "DetectorsBase/GRPGeomHelper.h"
#include "DetectorsBase/Propagator.h"
#include "Framework/AnalysisHelpers.h"
#include "Framework/DataProcessorSpec.h"
#include "Framework/Task.h"
#include "ReconstructionDataFormats/GlobalTrackID.h"
Expand All @@ -30,9 +29,12 @@
#include "TStopwatch.h"
#include "ZDCBase/Constants.h"
#include "GlobalTracking/MatchGlobalFwd.h"
#include "CommonUtils/TreeStreamRedirector.h"
#include "CommonUtils/EnumBitOperators.h"

#include <cstdint>
#include <limits>
#include <set>
#include <string>
#include <vector>
#include <random>
using namespace o2::framework;
Expand Down Expand Up @@ -203,7 +205,15 @@ class BunchCrossings

std::vector<TimeWindow> mTimeWindows; // the time window structure covering the complete duration of mBCTimeVector
double mWindowSize; // the size of a single time window
}; // end internal class
}; // end internal class

// Steering bits for additional output during AOD production
enum struct AODProducerStreamerMask : uint8_t {
None = 0,
TrackQA = O2_ENUM_SET_BIT(0),
All = std::numeric_limits<std::underlying_type_t<AODProducerStreamerMask>>::max(),
};
O2_DEFINE_ENUM_BIT_OPERATORS(AODProducerStreamerMask)

class AODProducerWorkflowDPL : public Task
{
Expand Down Expand Up @@ -241,6 +251,9 @@ class AODProducerWorkflowDPL : public Task
std::unordered_set<GIndex> mGIDUsedBySVtx;
std::unordered_set<GIndex> mGIDUsedByStr;

AODProducerStreamerMask mStreamerMask{0};
std::shared_ptr<o2::utils::TreeStreamRedirector> mStreamer;

int mNThreads = 1;
bool mUseMC = true;
bool mEnableSV = true; // enable secondary vertices
Expand Down Expand Up @@ -339,6 +352,7 @@ class AODProducerWorkflowDPL : public Task
uint32_t mTrackCovOffDiag = 0xFFFF0000; // 7 bits
uint32_t mTrackSignal = 0xFFFFFF00; // 15 bits
uint32_t mTrackTime = 0xFFFFFFFF; // use full float precision for time
uint32_t mTPCTime0 = 0xFFFFFFE0; // 18 bits, providing 14256./(1<<19) = 0.027 TB precision e.g., ~0.13 mm in z
uint32_t mTrackTimeError = 0xFFFFFF00; // 15 bits
uint32_t mTrackPosEMCAL = 0xFFFFFF00; // 15 bits
uint32_t mTracklets = 0xFFFFFF00; // 15 bits
Expand Down Expand Up @@ -397,18 +411,28 @@ class AODProducerWorkflowDPL : public Task

struct TrackQA {
GID trackID;
float tpcTime0;
int16_t tpcdcaR;
int16_t tpcdcaZ;
uint8_t tpcClusterByteMask;
uint8_t tpcdEdxMax0R;
uint8_t tpcdEdxMax1R;
uint8_t tpcdEdxMax2R;
uint8_t tpcdEdxMax3R;
uint8_t tpcdEdxTot0R;
uint8_t tpcdEdxTot1R;
uint8_t tpcdEdxTot2R;
uint8_t tpcdEdxTot3R;
float tpcTime0{};
int16_t tpcdcaR{};
int16_t tpcdcaZ{};
uint8_t tpcClusterByteMask{};
uint8_t tpcdEdxMax0R{};
uint8_t tpcdEdxMax1R{};
uint8_t tpcdEdxMax2R{};
uint8_t tpcdEdxMax3R{};
uint8_t tpcdEdxTot0R{};
uint8_t tpcdEdxTot1R{};
uint8_t tpcdEdxTot2R{};
uint8_t tpcdEdxTot3R{};
int8_t dRefContY{std::numeric_limits<int8_t>::min()};
int8_t dRefContZ{std::numeric_limits<int8_t>::min()};
int8_t dRefContSnp{std::numeric_limits<int8_t>::min()};
int8_t dRefContTgl{std::numeric_limits<int8_t>::min()};
int8_t dRefContQ2Pt{std::numeric_limits<int8_t>::min()};
int8_t dRefGloY{std::numeric_limits<int8_t>::min()};
int8_t dRefGloZ{std::numeric_limits<int8_t>::min()};
int8_t dRefGloSnp{std::numeric_limits<int8_t>::min()};
int8_t dRefGloTgl{std::numeric_limits<int8_t>::min()};
int8_t dRefGloQ2Pt{std::numeric_limits<int8_t>::min()};
};

// helper struct for addToFwdTracksTable()
Expand Down
Loading

0 comments on commit 22bfb67

Please sign in to comment.