Skip to content

Commit feea3ad

Browse files
authored
Qatable (#13633)
* TreeStream: Allow also for int8_t to be dumped as signed char Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch> * AOD: Extend TrackQA table * AOD: TrackQA leave _000 as default * COMMON: Add helper macros for bitwise enum struct * AOD: Add optional streamer to producer --------- Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch>
1 parent 73a96c3 commit feea3ad

File tree

6 files changed

+324
-56
lines changed

6 files changed

+324
-56
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
#ifndef O2_FRAMEWORK_ENUM_BIT_OPERATORS_H_
12+
#define O2_FRAMEWORK_ENUM_BIT_OPERATORS_H_
13+
14+
#include <type_traits>
15+
16+
#define O2_DEFINE_ENUM_BIT_OPERATORS(enum_t) \
17+
constexpr auto operator|(enum_t lhs, enum_t rhs) \
18+
{ \
19+
return static_cast<enum_t>( \
20+
static_cast<std::underlying_type_t<enum_t>>(lhs) | \
21+
static_cast<std::underlying_type_t<enum_t>>(rhs)); \
22+
} \
23+
\
24+
constexpr auto operator&(enum_t lhs, enum_t rhs) \
25+
{ \
26+
return static_cast<enum_t>( \
27+
static_cast<std::underlying_type_t<enum_t>>(lhs) & \
28+
static_cast<std::underlying_type_t<enum_t>>(rhs)); \
29+
} \
30+
\
31+
constexpr auto operator^(enum_t lhs, enum_t rhs) \
32+
{ \
33+
return static_cast<enum_t>( \
34+
static_cast<std::underlying_type_t<enum_t>>(lhs) ^ \
35+
static_cast<std::underlying_type_t<enum_t>>(rhs)); \
36+
} \
37+
\
38+
constexpr auto operator~(enum_t op) \
39+
{ \
40+
return static_cast<enum_t>( \
41+
~static_cast<std::underlying_type_t<enum_t>>(op)); \
42+
} \
43+
\
44+
constexpr auto& operator|=(enum_t& lhs, enum_t rhs) \
45+
{ \
46+
lhs = lhs | rhs; \
47+
return lhs; \
48+
} \
49+
\
50+
constexpr auto& operator&=(enum_t& lhs, enum_t rhs) \
51+
{ \
52+
lhs = lhs & rhs; \
53+
return lhs; \
54+
} \
55+
\
56+
constexpr enum_t& operator^=(enum_t& lhs, enum_t rhs) \
57+
{ \
58+
lhs = lhs ^ rhs; \
59+
return lhs; \
60+
}
61+
62+
#define O2_ENUM_TEST_BIT(mask, value) ((mask & value) == value)
63+
#define O2_ENUM_SET_BIT(bit) ((1 << bit))
64+
#define O2_ENUM_ANY_BIT(enum) ((static_cast<std::underlying_type_t<decltype(enum)>>(enum) != 0))
65+
66+
#endif

Common/Utils/include/CommonUtils/TreeStream.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class TreeStream
6363
const char* getName() const { return mTree.GetName(); }
6464
void setID(int id) { mID = id; }
6565
int getID() const { return mID; }
66+
6667
TreeStream& operator<<(const Bool_t& b)
6768
{
6869
CheckIn('B', &b);
@@ -75,6 +76,12 @@ class TreeStream
7576
return *this;
7677
}
7778

79+
TreeStream& operator<<(const int8_t& i)
80+
{
81+
CheckIn('B', &i);
82+
return *this;
83+
}
84+
7885
TreeStream& operator<<(const UChar_t& c)
7986
{
8087
CheckIn('b', &c);

Detectors/AOD/include/AODProducerWorkflow/AODProducerWorkflowSpec.h

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@
3030
#include "TStopwatch.h"
3131
#include "ZDCBase/Constants.h"
3232
#include "GlobalTracking/MatchGlobalFwd.h"
33+
#include "CommonUtils/TreeStreamRedirector.h"
34+
#include "CommonUtils/EnumBitOperators.h"
3335

36+
#include <cstdint>
37+
#include <limits>
3438
#include <set>
3539
#include <string>
3640
#include <vector>
@@ -203,7 +207,15 @@ class BunchCrossings
203207

204208
std::vector<TimeWindow> mTimeWindows; // the time window structure covering the complete duration of mBCTimeVector
205209
double mWindowSize; // the size of a single time window
206-
}; // end internal class
210+
}; // end internal class
211+
212+
// Steering bits for additional output during AOD production
213+
enum struct AODProducerStreamerMask : uint8_t {
214+
None = 0,
215+
TrackQA = O2_ENUM_SET_BIT(0),
216+
All = std::numeric_limits<std::underlying_type_t<AODProducerStreamerMask>>::max(),
217+
};
218+
O2_DEFINE_ENUM_BIT_OPERATORS(AODProducerStreamerMask)
207219

208220
class AODProducerWorkflowDPL : public Task
209221
{
@@ -241,6 +253,9 @@ class AODProducerWorkflowDPL : public Task
241253
std::unordered_set<GIndex> mGIDUsedBySVtx;
242254
std::unordered_set<GIndex> mGIDUsedByStr;
243255

256+
AODProducerStreamerMask mStreamerMask;
257+
std::shared_ptr<o2::utils::TreeStreamRedirector> mStreamer;
258+
244259
int mNThreads = 1;
245260
bool mUseMC = true;
246261
bool mEnableSV = true; // enable secondary vertices
@@ -339,6 +354,7 @@ class AODProducerWorkflowDPL : public Task
339354
uint32_t mTrackCovOffDiag = 0xFFFF0000; // 7 bits
340355
uint32_t mTrackSignal = 0xFFFFFF00; // 15 bits
341356
uint32_t mTrackTime = 0xFFFFFFFF; // use full float precision for time
357+
uint32_t mTPCTime0 = 0xFFFFFFE0; // 18 bits, providing 14256./(1<<19) = 0.027 TB precision e.g., ~0.13 mm in z
342358
uint32_t mTrackTimeError = 0xFFFFFF00; // 15 bits
343359
uint32_t mTrackPosEMCAL = 0xFFFFFF00; // 15 bits
344360
uint32_t mTracklets = 0xFFFFFF00; // 15 bits
@@ -397,18 +413,28 @@ class AODProducerWorkflowDPL : public Task
397413

398414
struct TrackQA {
399415
GID trackID;
400-
float tpcTime0;
401-
int16_t tpcdcaR;
402-
int16_t tpcdcaZ;
403-
uint8_t tpcClusterByteMask;
404-
uint8_t tpcdEdxMax0R;
405-
uint8_t tpcdEdxMax1R;
406-
uint8_t tpcdEdxMax2R;
407-
uint8_t tpcdEdxMax3R;
408-
uint8_t tpcdEdxTot0R;
409-
uint8_t tpcdEdxTot1R;
410-
uint8_t tpcdEdxTot2R;
411-
uint8_t tpcdEdxTot3R;
416+
float tpcTime0{};
417+
int16_t tpcdcaR{};
418+
int16_t tpcdcaZ{};
419+
uint8_t tpcClusterByteMask{};
420+
uint8_t tpcdEdxMax0R{};
421+
uint8_t tpcdEdxMax1R{};
422+
uint8_t tpcdEdxMax2R{};
423+
uint8_t tpcdEdxMax3R{};
424+
uint8_t tpcdEdxTot0R{};
425+
uint8_t tpcdEdxTot1R{};
426+
uint8_t tpcdEdxTot2R{};
427+
uint8_t tpcdEdxTot3R{};
428+
int8_t dRefContY{std::numeric_limits<int8_t>::min()};
429+
int8_t dRefContZ{std::numeric_limits<int8_t>::min()};
430+
int8_t dRefContSnp{std::numeric_limits<int8_t>::min()};
431+
int8_t dRefContTgl{std::numeric_limits<int8_t>::min()};
432+
int8_t dRefContQ2Pt{std::numeric_limits<int8_t>::min()};
433+
int8_t dRefGloY{std::numeric_limits<int8_t>::min()};
434+
int8_t dRefGloZ{std::numeric_limits<int8_t>::min()};
435+
int8_t dRefGloSnp{std::numeric_limits<int8_t>::min()};
436+
int8_t dRefGloTgl{std::numeric_limits<int8_t>::min()};
437+
int8_t dRefGloQ2Pt{std::numeric_limits<int8_t>::min()};
412438
};
413439

414440
// helper struct for addToFwdTracksTable()

0 commit comments

Comments
 (0)