EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4CellDefs.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4CellDefs.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef G4DETECTORS_PHG4CELLDEFS_H
4 #define G4DETECTORS_PHG4CELLDEFS_H
5 
6 #include <cstdint>
7 
8 namespace PHG4CellDefs
9 {
10 
11 // we rely on 64 bit keys - no point using
12 // unsigned long long or whatever else C++ types
13 // are currently implemented as 64 bit
14  typedef uint64_t keytype;
15 
16  // key layout
17  // bit
18  // 48-64 detector id (scintillator slat id, layer,...)
19  // 32-48 binning method
20  //
21  // 16-32 binning dependant 1st key
22  // 0-16 binning dependant 2nd key
23 
24  /* static unsigned int layer_bits = 16; */
25  /* static unsigned int keybits = 16; */
26  // __attribute__((unused)) prevents warnings about unused variables
27  // common upper 32 bits
28  static unsigned int bitshift_layer __attribute__((unused)) = 64 - 16;
29  static unsigned int bitshift_binning __attribute__((unused)) = bitshift_layer - 16;
30  // binning dependeant bit shifts for lower 32 bits
31  static unsigned int bitshift_upperkey __attribute__((unused)) = 16;
32  static unsigned int bitshift_row __attribute__((unused)) = 16;
33  static unsigned int bitshift_phi __attribute__((unused)) = 16;
34 
37  short get_binning(const PHG4CellDefs::keytype key);
38  short int get_detid(const PHG4CellDefs::keytype key);
39 
40  namespace SizeBinning
41  {
42  keytype genkey(const unsigned short layer, const unsigned short zbin, const unsigned short iphibin);
43  unsigned short int get_zbin(const PHG4CellDefs::keytype key);
44  unsigned short int get_phibin(const PHG4CellDefs::keytype key);
45  }
46 
47  namespace EtaPhiBinning
48  {
49  keytype genkey(const unsigned short layer, const unsigned short etabin, const unsigned short phibin);
50  unsigned short int get_etabin(const PHG4CellDefs::keytype key);
51  unsigned short int get_phibin(const PHG4CellDefs::keytype key);
52  }
53 
54  namespace SpacalBinning
55  {
56  keytype genkey(const unsigned short etabin, const unsigned short phibin, const unsigned short fiberid);
57  unsigned short get_etabin(const PHG4CellDefs::keytype key);
58  unsigned short get_phibin(const PHG4CellDefs::keytype key);
59  unsigned short get_fiberid(const PHG4CellDefs::keytype key);
60  }
61 
62  namespace ScintillatorSlatBinning
63  {
64  keytype genkey(const unsigned short layer, const unsigned short irow, const unsigned short icolumn);
65  unsigned short int get_row(const PHG4CellDefs::keytype key);
66  unsigned short int get_column(const PHG4CellDefs::keytype key);
67  }
68 
69  namespace EtaXsizeBinning
70  {
71  keytype genkey(const unsigned short layer, const unsigned short etabin, const unsigned short xbin);
72  unsigned short int get_etabin(const PHG4CellDefs::keytype key);
73  unsigned short int get_xsizebin(const PHG4CellDefs::keytype key);
74  }
75 
76  namespace MVTXBinning
77  {
78  keytype genkey(const unsigned short layer, const unsigned int bit32_index);
79  unsigned int get_index(const PHG4CellDefs::keytype key);
80  }
81 
82  namespace TPCBinning
83  {
84  keytype genkey(const unsigned short lyr, const unsigned short mod, const unsigned short pad);
85  unsigned short get_radbin(const PHG4CellDefs::keytype key);
86  unsigned short get_phibin(const PHG4CellDefs::keytype key);
87  }
88 
89 
90 }
91 
92 #endif // G4DETECTORS_PHG4CELLDEFS_H