CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalElectronicsId.cc
Go to the documentation of this file.
3 
4 #include <ostream>
5 
7  EcalElectronicsId_=0xFFFFFFFFu;
8 }
9 
12 }
13 
14 EcalElectronicsId::EcalElectronicsId(int dccid, int towerid, int stripid, int xtalid){
15  if ( (dccid < MIN_DCCID) || (dccid > MAX_DCCID) ||
16  (towerid < MIN_TOWERID) || (towerid > MAX_TOWERID) ||
17  (stripid < MIN_STRIPID) || (stripid > MAX_STRIPID) ||
18  (xtalid < MIN_XTALID) || (xtalid > MAX_XTALID) )
19  throw cms::Exception("InvalidDetId") << "EcalElectronicsId: Cannot create object. Indexes out of bounds. Dcc tower strip xtal " << dccid << " " << towerid << " " << stripid << " " << xtalid << ".";
20  EcalElectronicsId_= (xtalid&0x7) | ( (stripid&0x7) << 3) | ( (towerid&0x7F) << 6) | ((dccid&0x7F) << 13);
21 }
22 
23 
25  int dcc = dccId();
26  if ( (dcc >= MIN_DCCID_EBM && dcc <= MAX_DCCID_EBM) ||
27  (dcc >= MIN_DCCID_EBP && dcc <= MAX_DCCID_EBP) ) return EcalBarrel;
28  else return EcalEndcap;
29 }
30 
32  int dcc = dccId();
33  if ( (dcc >= MIN_DCCID_EEM && dcc <= MAX_DCCID_EEM)) return -1;
34  if ( (dcc >= MIN_DCCID_EBM && dcc <= MAX_DCCID_EBM)) return -1;
35  if ( (dcc >= MIN_DCCID_EEP && dcc <= MAX_DCCID_EEP)) return +1;
36  if ( (dcc >= MIN_DCCID_EBP && dcc <= MAX_DCCID_EBP)) return +1;
37  return 0;
38 }
39 
40 
41 
42 static int EEQuadrant(int dcc, int dcc_channel) {
43  // Q1 = EE+N or EE-F, Top
44  // Q2 = EE+F or EE-N, Top
45  // Q3 = EE+F or EE-N, Bottom
46  // Q4 = EE+N or EE-F, Bottom
47  // (local notation)
48  // in Q1-Q3 and in Q2-Q4, the relation between strip#, channel# and xtal_id
49  // is the same
50  int q=-1;
51  if ( (dcc == EcalElectronicsId::DCC_EEP + 1) || ( dcc == EcalElectronicsId::DCC_EEP + 2) ||
53  (dcc == EcalElectronicsId::DCC_EEM + 3) || ( dcc == EcalElectronicsId::DCC_EEM + 4) ||
54  (dcc == EcalElectronicsId::DCC_EEM + 5 && dcc_channel <= EcalElectronicsId::kDCCChannelBoundary) ) q=1;
55  else if ( (dcc == EcalElectronicsId::DCC_EEP + 3) || ( dcc == EcalElectronicsId::DCC_EEP + 4) ||
58  (dcc == EcalElectronicsId::DCC_EEM + 1) || ( dcc == EcalElectronicsId::DCC_EEM + 2) ) q=2;
59  else if ( (dcc == EcalElectronicsId::DCC_EEP + 6) ||
63  (dcc == EcalElectronicsId::DCC_EEM + 8) ||
64  (dcc == EcalElectronicsId::DCC_EEM + 7 && dcc_channel > EcalElectronicsId::kDCCChannelBoundary)) q=3;
65  else
66  q=4;
67  return q;
68 }
69 
71  int dcc = dccId() ;
72  int dcc_channel = towerId();
73  int quadrant = EEQuadrant(dcc, dcc_channel);
74  int strip = stripId();
75  int xtal = xtalId();
76  int channel;
77  if (quadrant ==1 || quadrant== 3) channel = 5*(strip-1) + xtal;
78  else channel = 5*(xtal-1) + strip;
79  return channel;
80 }
81 
82 /*
83 int EcalElectronicsId::stripId() {
84  int dcc = dccId() ;
85  int dcc_channel = towerId();
86  int quadrant = EEQuadrant(dcc, dcc_channel);
87  int xtal = channelId();
88  int strip;
89  if (quadrant ==1 || quadrant== 3) strip = (xtal-1)/5 +1;
90  else strip = (xtal-1) % 5 +1;
91  return strip;
92 }
93 
94 int EcalElectronicsId::XtalInStripId() {
95  int dcc = dccId() ;
96  int dcc_channel = towerId();
97  int quadrant = EEQuadrant(dcc, dcc_channel);
98  int xtal = channelId();
99  int id;
100  if (quadrant ==1 || quadrant== 3) id = (xtal-1)%5 + 1;
101  else id = (xtal-1)/5 +1;
102  return id;
103 }
104 */
105 
106 
107 
108 std::ostream& operator<<(std::ostream& os,const EcalElectronicsId& id)
109 {
110  return os << id.dccId() << ',' << id.towerId() << ',' << id.stripId() << ',' << id.xtalId() ;
111 }
112 
static const int MAX_DCCID_EBM
static int EEQuadrant(int dcc, int dcc_channel)
static const int MAX_XTALID
int xtalId() const
get the channel id
int stripId() const
get the tower id
static const int MIN_TOWERID
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
static const int MIN_STRIPID
static const int MIN_DCCID
static const int MIN_XTALID
int towerId() const
get the tower id
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
static const int MAX_DCCID_EBP
static const int MAX_DCCID
static const int MIN_DCCID_EBM
static const int DCC_EEP
static const int MAX_TOWERID
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
static const int MAX_DCCID_EEM
EcalSubdetector subdet() const
get the subdet
int zside() const
zside = +1 or -1
static const int DCC_EEM
static const int MAX_STRIPID
static const int MIN_DCCID_EBP
static const int MAX_DCCID_EEP
static const int kDCCChannelBoundary
EcalSubdetector
static const int MIN_DCCID_EEM
int channelId() const
so far for EndCap only :
static const int MIN_DCCID_EEP