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  default: {
20  break ;
21  }
22  }
23  return kCrystalsInPhi * ( ( mtdRR()%HALF_ROD > 0 ? mtdRR()%HALF_ROD : HALF_ROD ) -1 )
24  + ( crystal()%kCrystalsInPhi > 0 ? crystal()%kCrystalsInPhi : kCrystalsInPhi ) ;
25 }
26 
28 int BTLDetId::ietaAbs( CrysLayout lay ) const {
29  int kCrystalsInEta = 1, kCrystalsInPhi = 1;
30  std::array<int,4> kTypeBoundaries = {};
31  switch ( lay ) {
32  case CrysLayout::tile : {
33  kCrystalsInEta = kCrystalsInEtaTile;
34  kCrystalsInPhi = kCrystalsInPhiTile;
35  kTypeBoundaries = kTypeBoundariesReference;
36  break ;
37  }
38  case CrysLayout::bar : {
39  kCrystalsInEta = kCrystalsInEtaBar ;
40  kCrystalsInPhi = kCrystalsInPhiBar ;
41  kTypeBoundaries = kTypeBoundariesReference;
42  break ;
43  }
44  case CrysLayout::barzflat : {
45  kCrystalsInEta = kCrystalsInEtaBarZ ;
46  kCrystalsInPhi = kCrystalsInPhiBarZ ;
47  kTypeBoundaries = kTypeBoundariesBarZflat ;
48  break ;
49  }
50  default: {
51  break ;
52  }
53  }
54  return kCrystalsInEta * ( module() -1 )
55  + kCrystalsInEta * kTypeBoundaries[(modType() -1)]
56  + ( (crystal()-1)/kCrystalsInPhi + 1 ) ;
57 }
58 
59 int BTLDetId::hashedIndex( CrysLayout lay ) const {
60  int max_iphi = 1, max_ieta = 1;
61  switch ( lay ) {
62  case CrysLayout::tile : {
63  max_iphi = MAX_IPHI_TILE;
64  max_ieta = MAX_IETA_TILE;
65  break ;
66  }
67  case CrysLayout::bar : {
68  max_iphi = MAX_IPHI_BAR;
69  max_ieta = MAX_IETA_BAR;
70  break ;
71  }
72  case CrysLayout::barzflat : {
73  max_iphi = MAX_IPHI_BARZFLAT;
74  max_ieta = MAX_IETA_BARZFLAT;
75  break ;
76  }
77  default: {
78  break ;
79  }
80  }
81  return (max_ieta + ( zside() > 0 ? ietaAbs( lay ) - 1 : -ietaAbs( lay ) ) )*max_iphi+ iphi( lay ) - 1;
82 }
83 
87  int max_iphi =1 ,max_ieta = 1, nphi = 0, keta = 0, tmphi = hi + 1;
88  std::array<int,4> kTypeBoundaries = {};
89  switch ( lay ) {
90  case CrysLayout::tile : {
91  max_iphi = MAX_IPHI_TILE;
92  max_ieta = MAX_IETA_TILE;
93  nphi = kCrystalsInPhiTile;
94  keta = kCrystalsInEtaTile;
95  kTypeBoundaries = kTypeBoundariesReference;
96  break ;
97  }
98  case CrysLayout::bar : {
99  max_iphi = MAX_IPHI_BAR;
100  max_ieta = MAX_IETA_BAR;
101  nphi = kCrystalsInPhiBar;
102  keta = kCrystalsInEtaBar;
103  kTypeBoundaries = kTypeBoundariesReference;
104  break ;
105  }
106  case CrysLayout::barzflat : {
107  max_iphi = MAX_IPHI_BARZFLAT;
108  max_ieta = MAX_IETA_BARZFLAT;
109  nphi = kCrystalsInPhiBarZ;
110  keta = kCrystalsInEtaBarZ;
111  kTypeBoundaries = kTypeBoundariesBarZflat;
112  break ;
113  }
114  default: {
115  break ;
116  }
117  }
118  int zside = 0, rod = 0, module = 0, modtype = 1, crystal = 0;
119  if ( tmphi > max_ieta*max_iphi ) { zside = 1; }
120  int ip = (tmphi-1)%max_iphi+1;
121  int ie = (tmphi-1)/max_iphi - max_ieta;
122  ie = ( zside == 1 ? ie + 1 : -ie ) ;
123  rod = (ip-1)/nphi+1;
124  module = (ie-1)/keta+1 ;
125  if ( module > kTypeBoundaries[1] ) { modtype = (module > kTypeBoundaries[2] ? 3 : 2 ) ; }
126  if ( modtype > 1 ) { module = module - kTypeBoundaries[modtype-1]; }
127  crystal = ((ip-1)%nphi+1)+((ie-1)%keta)*nphi;
128  return BTLDetId( zside, rod, module, modtype, crystal);
129 }
130 
131 #include <iomanip>
132 
133 std::ostream& operator<< ( std::ostream& os, const BTLDetId& id ) {
134  os << ( MTDDetId& ) id;
135  os << " BTL " << std::endl
136  << " Side : " << id.mtdSide() << std::endl
137  << " Rod : " << id.mtdRR() << std::endl
138  << " Module : " << id.module() << std::endl
139  << " Crystal type: " << id.modType() << std::endl
140  << " Crystal : " << id.crystal() << std::endl;
141  return os;
142 }
static constexpr int MAX_IETA_BAR
Definition: BTLDetId.h:49
CrysLayout
Definition: BTLDetId.h:59
int ietaAbs(CrysLayout lay) const
Definition: BTLDetId.cc:28
static constexpr std::array< int, 4 > kTypeBoundariesReference
Definition: BTLDetId.h:32
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
static constexpr int MAX_IPHI_BAR
Definition: BTLDetId.h:50
BTLDetId()
Definition: BTLDetId.h:64
static constexpr int HALF_ROD
Definition: BTLDetId.h:44
static constexpr int MAX_IETA_TILE
Definition: BTLDetId.h:47
static constexpr int MAX_IPHI_BARZFLAT
Definition: BTLDetId.h:54
static constexpr int MAX_IPHI_TILE
Definition: BTLDetId.h:48
static constexpr int kCrystalsInPhiBar
Definition: BTLDetId.h:36
int mtdRR() const
Definition: MTDDetId.h:66
static constexpr std::array< int, 4 > kTypeBoundariesBarZflat
Definition: BTLDetId.h:33
int hashedIndex(CrysLayout lay) const
Definition: BTLDetId.cc:59
static constexpr int kCrystalsInPhiTile
Definition: BTLDetId.h:34
int iphi(CrysLayout lay) const
Definition: BTLDetId.cc:4
BTLDetId getUnhashedIndex(int hi, CrysLayout lay) const
Definition: BTLDetId.cc:86
static constexpr int kCrystalsInEtaBar
Definition: BTLDetId.h:37
static constexpr int MAX_IETA_BARZFLAT
Definition: BTLDetId.h:53
int module() const
Definition: BTLDetId.h:89
static constexpr int kCrystalsInEtaBarZ
Definition: BTLDetId.h:39
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:35
static constexpr int kCrystalsInPhiBarZ
Definition: BTLDetId.h:38
std::ostream & operator<<(std::ostream &os, const BTLDetId &id)
Definition: BTLDetId.cc:133
Definition: vlib.h:208
int modType() const
Definition: BTLDetId.h:92
int crystal() const
Definition: BTLDetId.h:95