1616#define O2_GLOBAL_TRACK_ID
1717
1818#include " CommonDataFormat/AbstractRef.h"
19+ #include " DetectorsCommonDataFormats/DetID.h"
1920#include < iosfwd>
2021#include < string>
2122#include < array>
@@ -29,13 +30,15 @@ namespace dataformats
2930class GlobalTrackID : public AbstractRef <25 , 5 , 2 >
3031{
3132 public:
33+ using DetID = o2::detectors::DetID;
34+
3235 enum Source : uint8_t { // provenance of the
3336 ITS , // standalone detectors
3437 TPC ,
3538 TRD ,
3639 TOF ,
37- PHS ,
38- CPV ,
40+ PHS , // FIXME Not sure PHS ... FDD should be kept here, at the moment
41+ CPV , // they are here for completeness
3942 EMC ,
4043 HMP ,
4144 MFT ,
@@ -55,22 +58,22 @@ class GlobalTrackID : public AbstractRef<25, 5, 2>
5558 //
5659 NSources
5760 };
58- static constexpr std::array<std::string_view, NSources> SourceNames = {
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- //
64- };
6561
62+ static const std::array<DetID::mask_t , NSources> DetectorMasks; // RS cannot be made constexpr since operator| is not constexpr
6663 using AbstractRef<25 , 5 , 2 >::AbstractRef;
6764
68- static auto getSourceName (int i) { return SourceNames [i]; }
69- void print () const ;
70- std::string asString () const ;
65+ static const auto getSourceMask (int i) { return DetectorMasks [i]; }
66+ static auto getSourceName ( int i) { return DetID::getNames ( getSourceMask (i)); }
67+
7168 auto getSourceName () const { return getSourceName (getSource ()); }
69+ auto getSourceMask () const { return getSourceMask (getSource ()); }
70+ bool includesDet (DetID id) const { return (getSourceMask () & DetID::getMask (id)).any (); }
71+
7272 operator int () const { return int (getIndex ()); }
7373
74+ std::string asString () const ;
75+ void print () const ;
76+
7477 ClassDefNV (GlobalTrackID, 2 );
7578};
7679
0 commit comments