Analysis Software
Documentation for sPHENIX simulation 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  // we rely on 64 bit keys - no point using
11  // unsigned long long or whatever else C++ types
12  // are currently implemented as 64 bit
13  typedef uint64_t keytype;
14 
15  // key layout
16  // bit
17  // 48-64 detector id (scintillator slat id, layer,...)
18  // 32-48 binning method
19  //
20  // 16-32 binning dependant 1st key
21  // 0-16 binning dependant 2nd key
22 
23  /* static unsigned int layer_bits = 16; */
24  /* static unsigned int keybits = 16; */
25  // __attribute__((unused)) prevents warnings about unused variables
26  // common upper 32 bits
27  static unsigned int bitshift_layer __attribute__((unused)) = 64 - 16;
28  static unsigned int bitshift_binning __attribute__((unused)) = bitshift_layer - 16;
29  // binning dependeant bit shifts for lower 32 bits
30  static unsigned int bitshift_upperkey __attribute__((unused)) = 16;
31  static unsigned int bitshift_row __attribute__((unused)) = 16;
32  static unsigned int bitshift_phi __attribute__((unused)) = 16;
33 
35  {
36  undefined = 0,
45  };
47  short get_binning(const PHG4CellDefs::keytype key);
48  short int get_detid(const PHG4CellDefs::keytype key);
49 
50  namespace SizeBinning
51  {
52  keytype genkey(const unsigned short layer, const unsigned short zbin, const unsigned short iphibin);
53  unsigned short int get_zbin(const PHG4CellDefs::keytype key);
54  unsigned short int get_phibin(const PHG4CellDefs::keytype key);
55  } // namespace SizeBinning
56 
57  namespace EtaPhiBinning
58  {
59  keytype genkey(const unsigned short layer, const unsigned short etabin, const unsigned short phibin);
60  unsigned short int get_etabin(const PHG4CellDefs::keytype key);
61  unsigned short int get_phibin(const PHG4CellDefs::keytype key);
62  } // namespace EtaPhiBinning
63 
64  namespace SpacalBinning
65  {
66  keytype genkey(const unsigned short etabin, const unsigned short phibin, const unsigned short fiberid);
67  unsigned short get_etabin(const PHG4CellDefs::keytype key);
68  unsigned short get_phibin(const PHG4CellDefs::keytype key);
69  unsigned short get_fiberid(const PHG4CellDefs::keytype key);
70  } // namespace SpacalBinning
71 
72  namespace ScintillatorSlatBinning
73  {
74  keytype genkey(const unsigned short layer, const unsigned short irow, const unsigned short icolumn);
75  unsigned short int get_row(const PHG4CellDefs::keytype key);
76  unsigned short int get_column(const PHG4CellDefs::keytype key);
77  } // namespace ScintillatorSlatBinning
78 
79  namespace EtaXsizeBinning
80  {
81  keytype genkey(const unsigned short layer, const unsigned short etabin, const unsigned short xbin);
82  unsigned short int get_etabin(const PHG4CellDefs::keytype key);
83  unsigned short int get_xsizebin(const PHG4CellDefs::keytype key);
84  } // namespace EtaXsizeBinning
85 
86  namespace MVTXBinning
87  {
88  keytype genkey(const unsigned short layer, const unsigned int bit32_index);
89  unsigned int get_index(const PHG4CellDefs::keytype key);
90  } // namespace MVTXBinning
91 
92  namespace TPCBinning
93  {
94  keytype genkey(const unsigned short lyr, const unsigned short mod, const unsigned short pad);
95  unsigned short get_radbin(const PHG4CellDefs::keytype key);
96  unsigned short get_phibin(const PHG4CellDefs::keytype key);
97  } // namespace TPCBinning
98 
99 } // namespace PHG4CellDefs
100 
101 #endif // G4DETECTORS_PHG4CELLDEFS_H