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