CMS 3D CMS Logo

BTLDetId.cc
Go to the documentation of this file.
2 
4 int BTLDetId::iphi( CrysLayout lay ) const {
5  int kCrystalsInPhi = 1;
6  switch ( lay ) {
7  case CrysLayout::tile : {
8  kCrystalsInPhi = kCrystalsInPhiTile ;
9  break ;
10  }
11  case CrysLayout::bar : {
12  kCrystalsInPhi = kCrystalsInPhiBar ;
13  break ;
14  }
15  case CrysLayout::barzflat : {
16  kCrystalsInPhi = kCrystalsInPhiBarZ ;
17  break ;
18  }
19  case CrysLayout::barphiflat : {
20  kCrystalsInPhi = kCrystalsInPhiBarPhi ;
21  break ;
22  }
23  default: {
24  break ;
25  }
26  }
27  return kCrystalsInPhi * ( ( mtdRR()%HALF_ROD > 0 ? mtdRR()%HALF_ROD : HALF_ROD ) -1 )
28  + ( crystal()%kCrystalsInPhi > 0 ? crystal()%kCrystalsInPhi : kCrystalsInPhi ) ;
29 }
30 
32 int BTLDetId::ietaAbs( CrysLayout lay ) const {
33  int kCrystalsInEta = 1, kCrystalsInPhi = 1;
34  std::array<int,4> kTypeBoundaries = {};
35  switch ( lay ) {
36  case CrysLayout::tile : {
37  kCrystalsInEta = kCrystalsInEtaTile;
38  kCrystalsInPhi = kCrystalsInPhiTile;
39  kTypeBoundaries = kTypeBoundariesReference;
40  break ;
41  }
42  case CrysLayout::bar : {
43  kCrystalsInEta = kCrystalsInEtaBar ;
44  kCrystalsInPhi = kCrystalsInPhiBar ;
45  kTypeBoundaries = kTypeBoundariesReference;
46  break ;
47  }
48  case CrysLayout::barzflat : {
49  kCrystalsInEta = kCrystalsInEtaBarZ ;
50  kCrystalsInPhi = kCrystalsInPhiBarZ ;
51  kTypeBoundaries = kTypeBoundariesBarZflat ;
52  break ;
53  }
54  case CrysLayout::barphiflat : {
55  kCrystalsInEta = kCrystalsInEtaBarPhi ;
56  kCrystalsInPhi = kCrystalsInPhiBarPhi ;
57  kTypeBoundaries = kTypeBoundariesBarPhiFlat ;
58  break ;
59  }
60  default: {
61  break ;
62  }
63  }
64  int etaRowInModule = zside() > 0 ? (crystal()-1)/kCrystalsInPhi + 1 : kCrystalsInEta - (crystal()-1)/kCrystalsInPhi;
65  return kCrystalsInEta * ( module() -1 )
66  + kCrystalsInEta * kTypeBoundaries[(modType() -1)]
67  + etaRowInModule;
68 }
69 
70 int BTLDetId::hashedIndex( CrysLayout lay ) const {
71  int max_iphi = 1, max_ieta = 1;
72  switch ( lay ) {
73  case CrysLayout::tile : {
74  max_iphi = MAX_IPHI_TILE;
75  max_ieta = MAX_IETA_TILE;
76  break ;
77  }
78  case CrysLayout::bar : {
79  max_iphi = MAX_IPHI_BAR;
80  max_ieta = MAX_IETA_BAR;
81  break ;
82  }
83  case CrysLayout::barzflat : {
84  max_iphi = MAX_IPHI_BARZFLAT;
85  max_ieta = MAX_IETA_BARZFLAT;
86  break ;
87  }
88  case CrysLayout::barphiflat : {
89  max_iphi = MAX_IPHI_BARPHIFLAT;
90  max_ieta = MAX_IETA_BARPHIFLAT;
91  break ;
92  }
93  default: {
94  break ;
95  }
96  }
97  return (max_ieta + ( zside() > 0 ? ietaAbs( lay ) - 1 : -ietaAbs( lay ) ) )*max_iphi+ iphi( lay ) - 1;
98 }
99 
103  int max_iphi =1 ,max_ieta = 1, nphi = 0, keta = 0, tmphi = hi + 1;
104  std::array<int,4> kTypeBoundaries = {};
105  switch ( lay ) {
106  case CrysLayout::tile : {
107  max_iphi = MAX_IPHI_TILE;
108  max_ieta = MAX_IETA_TILE;
109  nphi = kCrystalsInPhiTile;
110  keta = kCrystalsInEtaTile;
111  kTypeBoundaries = kTypeBoundariesReference;
112  break ;
113  }
114  case CrysLayout::bar : {
115  max_iphi = MAX_IPHI_BAR;
116  max_ieta = MAX_IETA_BAR;
117  nphi = kCrystalsInPhiBar;
118  keta = kCrystalsInEtaBar;
119  kTypeBoundaries = kTypeBoundariesReference;
120  break ;
121  }
122  case CrysLayout::barzflat : {
123  max_iphi = MAX_IPHI_BARZFLAT;
124  max_ieta = MAX_IETA_BARZFLAT;
125  nphi = kCrystalsInPhiBarZ;
126  keta = kCrystalsInEtaBarZ;
127  kTypeBoundaries = kTypeBoundariesBarZflat;
128  break ;
129  }
130  case CrysLayout::barphiflat : {
131  max_iphi = MAX_IPHI_BARPHIFLAT;
132  max_ieta = MAX_IETA_BARPHIFLAT;
133  nphi = kCrystalsInPhiBarPhi;
134  keta = kCrystalsInEtaBarPhi;
135  kTypeBoundaries = kTypeBoundariesBarPhiFlat;
136  break ;
137  }
138  default: {
139  break ;
140  }
141  }
142  int zside = 0, rod = 0, module = 0, modtype = 1, crystal = 0;
143  if ( tmphi > max_ieta*max_iphi ) { zside = 1; }
144  int ip = (tmphi-1)%max_iphi+1;
145  int ie = (tmphi-1)/max_iphi - max_ieta;
146  ie = ( zside == 1 ? ie + 1 : -ie ) ;
147  rod = (ip-1)/nphi+1;
148  module = (ie-1)/keta+1 ;
149  if ( module > kTypeBoundaries[1] ) { modtype = (module > kTypeBoundaries[2] ? 3 : 2 ) ; }
150  if ( modtype > 1 ) { module = module - kTypeBoundaries[modtype-1]; }
151  crystal = zside == 1 ? ((ip-1)%nphi+1)+((ie-1)%keta)*nphi : ((ip-1)%nphi+1)+(keta - 1 - (ie-1)%keta)*nphi ;
152  return BTLDetId( zside, rod, module, modtype, crystal);
153 }
154 
156  int mod = kTypeBoundariesReference[1];
157  if ( lay == CrysLayout::barzflat ) { mod = kTypeBoundariesBarZflat[1]; }
158  else if ( lay == CrysLayout::barphiflat ) { mod = kTypeBoundariesBarPhiFlat[1]; }
159  return mod;
160 }
161 
163  // reorganize the modules to count from 0 to 54
164  // (0 to 42 in the case of BarZflat geometry)
165  // remove module type
166  // remove crystal index
167 
168  int boundRef = modulesPerType(lay);
169 
170  return BTLDetId(mtdSide(),mtdRR(),module()+boundRef*(modType()-1),0,1);
171 }
172 
173 #include <iomanip>
174 
175 std::ostream& operator<< ( std::ostream& os, const BTLDetId& id ) {
176  os << ( MTDDetId& ) id;
177  os << " BTL " << std::endl
178  << " Side : " << id.mtdSide() << std::endl
179  << " Rod : " << id.mtdRR() << std::endl
180  << " Module : " << id.module() << std::endl
181  << " Crystal type: " << id.modType() << std::endl
182  << " Crystal : " << id.crystal() << std::endl;
183  return os;
184 }
static constexpr int MAX_IETA_BAR
Definition: BTLDetId.h:54
int modulesPerType(CrysLayout lay) const
Definition: BTLDetId.cc:155
CrysLayout
Definition: BTLDetId.h:66
static constexpr int kCrystalsInPhiBarPhi
Definition: BTLDetId.h:42
int ietaAbs(CrysLayout lay) const
Definition: BTLDetId.cc:32
static constexpr std::array< int, 4 > kTypeBoundariesReference
Definition: BTLDetId.h:33
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
static constexpr int MAX_IPHI_BAR
Definition: BTLDetId.h:55
BTLDetId()
Definition: BTLDetId.h:71
BTLDetId geographicalId(CrysLayout lay) const
Definition: BTLDetId.cc:162
static constexpr int HALF_ROD
Definition: BTLDetId.h:49
static constexpr int MAX_IETA_TILE
Definition: BTLDetId.h:52
static constexpr int MAX_IPHI_BARZFLAT
Definition: BTLDetId.h:59
static constexpr int MAX_IPHI_TILE
Definition: BTLDetId.h:53
static constexpr int kCrystalsInPhiBar
Definition: BTLDetId.h:38
static constexpr int MAX_IETA_BARPHIFLAT
Definition: BTLDetId.h:60
int mtdRR() const
Definition: MTDDetId.h:66
static constexpr std::array< int, 4 > kTypeBoundariesBarZflat
Definition: BTLDetId.h:34
static constexpr std::array< int, 4 > kTypeBoundariesBarPhiFlat
Definition: BTLDetId.h:35
int hashedIndex(CrysLayout lay) const
Definition: BTLDetId.cc:70
int mtdSide() const
Definition: MTDDetId.h:61
static constexpr int kCrystalsInEtaBarPhi
Definition: BTLDetId.h:43
static constexpr int kCrystalsInPhiTile
Definition: BTLDetId.h:36
int iphi(CrysLayout lay) const
Definition: BTLDetId.cc:4
BTLDetId getUnhashedIndex(int hi, CrysLayout lay) const
Definition: BTLDetId.cc:102
static constexpr int kCrystalsInEtaBar
Definition: BTLDetId.h:39
static constexpr int MAX_IETA_BARZFLAT
Definition: BTLDetId.h:58
int module() const
Definition: BTLDetId.h:96
static constexpr int kCrystalsInEtaBarZ
Definition: BTLDetId.h:41
int zside() const
Definition: MTDDetId.h:63
Detector identifier class for the Barrel Timing Layer. The crystal count must start from 0...
Definition: BTLDetId.h:18
static constexpr int kCrystalsInEtaTile
Definition: BTLDetId.h:37
static constexpr int kCrystalsInPhiBarZ
Definition: BTLDetId.h:40
std::ostream & operator<<(std::ostream &os, const BTLDetId &id)
Definition: BTLDetId.cc:175
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
Definition: vlib.h:208
int modType() const
Definition: BTLDetId.h:99
static constexpr int MAX_IPHI_BARPHIFLAT
Definition: BTLDetId.h:61
int crystal() const
Definition: BTLDetId.h:102