CMS 3D CMS Logo

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