Skip to content

Commit 245bac2

Browse files
committed
Expand GlobalTrackID enums, reduce flags to 2, fixes
1 parent 8804012 commit 245bac2

5 files changed

Lines changed: 37 additions & 21 deletions

File tree

DataFormats/Reconstruction/include/ReconstructionDataFormats/GlobalTrackID.h

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,38 +26,52 @@ namespace o2
2626
namespace dataformats
2727
{
2828

29-
class GlobalTrackID : public AbstractRef<25, 4, 3>
29+
class GlobalTrackID : public AbstractRef<25, 5, 2>
3030
{
3131
public:
3232
enum Source : uint8_t { // provenance of the
33-
ITS,
33+
ITS, // standalone detectors
3434
TPC,
35-
TRD, // standalone tracks
36-
ITSTPC,
35+
TRD,
36+
TOF,
37+
PHS,
38+
CPV,
39+
EMC,
40+
HMP,
41+
MFT,
42+
MCH,
43+
MID,
44+
ZDC,
45+
FT0,
46+
FV0,
47+
FDD,
48+
ITSTPC, // 2-detector tracks
3749
TPCTOF,
38-
TPCTRD, // 2-detector tracks
39-
ITSTPCTRD,
50+
TPCTRD,
51+
ITSTPCTRD, // 3-detector tracks
4052
ITSTPCTOF,
41-
TPCTRDTOF, // 3-detector tracks
53+
TPCTRDTOF,
4254
ITSTPCTRDTOF, // full barrel track
55+
//
4356
NSources
4457
};
4558
static constexpr std::array<std::string_view, NSources> SourceNames = {
46-
"ITS", "TPC", "TRD", // standalone tracks
47-
"ITSTPC", "TPCTOF", "TPCTRD", // 2-detector tracks
48-
"ITSTPCTRD", "ITSTPCTOF", "TPCTRDTOF", // 3-detector tracks
49-
"ITSTPCTRDTOF" // full barrel track
59+
"ITS", "TPC", "TRD", "TOF", "PHS", "CPV", "EMC", "HMP", "MFT", "MCH", "MID", "ZDC", "FT0", "FV0", "FDD", // standalone tracks
60+
"ITSTPC", "TPCTOF", "TPCTRD", // 2-detector tracks
61+
"ITSTPCTRD", "ITSTPCTOF", "TPCTRDTOF", // 3-detector tracks
62+
"ITSTPCTRDTOF" // full barrel track
63+
//
5064
};
5165

52-
using AbstractRef<25, 4, 3>::AbstractRef;
66+
using AbstractRef<25, 5, 2>::AbstractRef;
5367

54-
static constexpr std::string_view getSourceName(int i) { return SourceNames[i]; }
68+
static auto getSourceName(int i) { return SourceNames[i]; }
5569
void print() const;
5670
std::string asString() const;
57-
71+
auto getSourceName() const { return getSourceName(getSource()); }
5872
operator int() const { return int(getIndex()); }
5973

60-
ClassDefNV(GlobalTrackID, 1);
74+
ClassDefNV(GlobalTrackID, 2);
6175
};
6276

6377
std::ostream& operator<<(std::ostream& os, const o2::dataformats::GlobalTrackID& v);

DataFormats/Reconstruction/include/ReconstructionDataFormats/VtxTrackIndex.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ class VtxTrackIndex : public GlobalTrackID
3131
public:
3232
enum Flags : uint8_t {
3333
Contributor, // flag that it contributes to vertex fit
34-
Reserved, //
3534
Ambiguous, // flag that attachment is ambiguous
3635
NFlags
3736
};

DataFormats/common/include/CommonDataFormat/AbstractRef.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,15 @@ class AbstractRef
6666
bool testBit(int i) const { return (mRef >> (NBIdx + NBSrc)) & ((0x1U << i) & FlgMask); }
6767
void setBit(int i) { mRef = (mRef & (BaseMask & ~(0x1U << (i + NBIdx + NBSrc)))) | (((0x1U << i) & FlgMask) << (NBIdx + NBSrc)); }
6868
void resetBit(int i) { mRef = (mRef & (BaseMask & ~(0x1U << (i + NBIdx + NBSrc)))); }
69-
void set(Idx_t idx, Src_t src) { mRef = (mRef & (BaseMask & ~((SrcMask << NBIdx) | (BaseMask & ~IdxMask)))) | ((SrcMask & Src_t(src)) << NBIdx) | (IdxMask & Idx_t(idx)); }
69+
void set(Idx_t idx, Src_t src) { mRef = (mRef & (FlgMask << (NBIdx + NBSrc))) | ((SrcMask & Src_t(src)) << NBIdx) | (IdxMask & Idx_t(idx)); }
7070

7171
Base_t getRaw() const { return mRef; }
7272

73+
bool isIndexSet() const { return getIndex() != IdxMask; }
74+
bool isSourceSet() const { return getSource() != SrcMask; }
75+
7376
protected:
74-
Base_t mRef = 0; // packed reference
77+
Base_t mRef = IdxMask | (SrcMask << NBIdx); // packed reference, dummy by default
7578

7679
ClassDefNV(AbstractRef, 1);
7780
};

DataFormats/common/src/CommonDataFormatLinkDef.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
#pragma link C++ class std::vector < o2::dataformats::RangeReference < int, int>> + ;
4444

45-
#pragma link C++ class o2::dataformats::AbstractRef < 25, 4, 3> + ;
45+
#pragma link C++ class o2::dataformats::AbstractRef < 25, 5, 2> + ;
4646

4747
#pragma link C++ class o2::InteractionRecord + ;
4848
#pragma link C++ class o2::InteractionTimeRecord + ;

DataFormats/common/test/testAbstractRefAccessor.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ struct Bar1 : public Base {
3535
double b1 = 0.;
3636
};
3737

38-
struct GloIdx : public AbstractRef<25, 4, 3> {
38+
struct GloIdx : public AbstractRef<25, 5, 2> {
3939
enum Source : uint8_t { // provenance of the
4040
ID0,
4141
ID1,
4242
ID2,
4343
ID3,
4444
NSources
4545
};
46-
using AbstractRef<25, 4, 3>::AbstractRef;
46+
using AbstractRef<25, 5, 2>::AbstractRef;
4747
};
4848

4949
// basic AbstractRefAccessor

0 commit comments

Comments
 (0)