Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrkrDefs.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TrkrDefs.h
1 
7 #ifndef TRACKBASE_TRKRDEFS_H
8 #define TRACKBASE_TRKRDEFS_H
9 
10 #include <cstdint>
11 #include <iostream>
12 
16 namespace TrkrDefs
17 {
18  static double EdepScaleFactor __attribute__((unused)) = 0.25;
19  static double MvtxEnergyScaleup __attribute__((unused)) = 5.0e8;
20  static double InttEnergyScaleup __attribute__((unused)) = 5.0e7;
21 
23  typedef uint32_t hitkey; // 32 bit TrkrHit key type
24  typedef uint32_t hitsetkey; // 32 bit TrkrHitSet key type
25  typedef uint64_t cluskey; // 64 but TrkrCluster id type
26  typedef uint32_t clushitkey; // 32 bit hit id type in TrkrCluster
27  typedef uint16_t subsurfkey; // 16 bit sub surface key type
28 
30  static hitkey HITKEYMAX __attribute__((unused)) = UINT32_MAX;
31  static hitsetkey HITSETKEYMAX __attribute__((unused)) = UINT32_MAX;
32  static cluskey CLUSKEYMAX __attribute__((unused)) = UINT64_MAX;
33  static clushitkey CLUSHITKEYMAX __attribute__((unused)) = UINT32_MAX;
34  static subsurfkey SUBSURFKEYMAX __attribute__((unused)) = UINT16_MAX;
35 
36  // hitsetkey layout:
37  // common upper 16 bits
38  // 24 - 32 tracker id
39  // 16 - 24 layer
40  static const unsigned int kBitShiftTrkrId __attribute__((unused)) = 24; // 32 - 8
41  static const unsigned int kBitShiftLayer __attribute__((unused)) = 16; // bitshift_trackerid - 8
42 
43  // cluskey layour
44  // hitsetkey upper 32 bits
45  // cluster id lower 32 bits
46  static const unsigned int kBitShiftClusId __attribute__((unused)) = 32;
47 
48 
50  enum TrkrId
51  {
52  mvtxId = 0,
53  inttId = 1,
54  tpcId = 2,
56  ttl = 4,
57  };
58 
59 
61  void printBits(const TrkrDefs::hitsetkey key, std::ostream& os = std::cout);
62  void printBits(const TrkrDefs::cluskey key, std::ostream& os = std::cout);
63  // void print_bits(const TrkrDefs::hitkey key, std::ostream& os = std::cout);
64 
66  uint8_t getTrkrId(const TrkrDefs::hitsetkey key);
67  uint8_t getTrkrId(const TrkrDefs::cluskey key);
68 
70  uint8_t getLayer(const TrkrDefs::hitsetkey key);
71  uint8_t getLayer(const TrkrDefs::cluskey key);
72 
74  uint32_t getClusIndex(const TrkrDefs::cluskey key);
75 
77  TrkrDefs::hitsetkey genHitSetKey(const TrkrDefs::TrkrId trkrId, const uint8_t lyr);
78 
80  TrkrDefs::cluskey genClusKey(const TrkrDefs::hitsetkey hskey, const uint32_t clusid);
81 
83  uint32_t getHitSetKeyFromClusKey(const TrkrDefs::cluskey key);
84 
88  TrkrDefs::hitsetkey getHitSetKeyLo(const TrkrDefs::TrkrId trkrId, const uint8_t lyr);
89  TrkrDefs::hitsetkey getHitSetKeyHi(const TrkrDefs::TrkrId trkrId, const uint8_t lyr);
90 
94  TrkrDefs::cluskey getClusKeyLo(const TrkrDefs::TrkrId trkrId, const uint8_t lyr);
95  TrkrDefs::cluskey getClusKeyHi(const TrkrDefs::TrkrId trkrId, const uint8_t lyr);
96 
97  static const unsigned int kBitShiftPhiElement __attribute__((unused)) = 8;//sector
98  static const unsigned int kBitShiftZElement __attribute__((unused)) = 0;//side
99 
100  uint8_t getPhiElement(TrkrDefs::hitsetkey key);//sector
101  uint8_t getZElement(TrkrDefs::hitsetkey key);//side
102  uint8_t getPhiElement(TrkrDefs::cluskey key);//sector
103  uint8_t getZElement(TrkrDefs::cluskey key);//side
104 
105 }
106 
107 #endif //TRACKBASE_TRKRDEFS_H