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 
5 #include <iostream>
6 
7 
9  EcalElectronicsId_=0xFFFFFFFFu;
10 }
11 
14 }
15 
16 EcalElectronicsId::EcalElectronicsId(int dccid, int towerid, int stripid, int xtalid){
17  if ( (dccid < MIN_DCCID) || (dccid > MAX_DCCID) ||
18  (towerid < MIN_TOWERID) || (towerid > MAX_TOWERID) ||
19  (stripid < MIN_STRIPID) || (stripid > MAX_STRIPID) ||
20  (xtalid < MIN_XTALID) || (xtalid > MAX_XTALID) )
21  throw cms::Exception("InvalidDetId") << "EcalElectronicsId: Cannot create object. Indexes out of bounds. Dcc tower strip xtal " << dccid << " " << towerid << " " << stripid << " " << xtalid << ".";
22  EcalElectronicsId_= (xtalid&0x7) | ( (stripid&0x7) << 3) | ( (towerid&0x7F) << 6) | ((dccid&0x7F) << 13);
23 }
24 
25 
27  int dcc = dccId();
28  if ( (dcc >= MIN_DCCID_EBM && dcc <= MAX_DCCID_EBM) ||
29  (dcc >= MIN_DCCID_EBP && dcc <= MAX_DCCID_EBP) ) return EcalBarrel;
30  else return EcalEndcap;
31 }
32 
34  int dcc = dccId();
35  if ( (dcc >= MIN_DCCID_EEM && dcc <= MAX_DCCID_EEM)) return -1;
36  if ( (dcc >= MIN_DCCID_EBM && dcc <= MAX_DCCID_EBM)) return -1;
37  if ( (dcc >= MIN_DCCID_EEP && dcc <= MAX_DCCID_EEP)) return +1;
38  if ( (dcc >= MIN_DCCID_EBP && dcc <= MAX_DCCID_EBP)) return +1;
39  return 0;
40 }
41 
42 
43 
44 static int EEQuadrant(int dcc, int dcc_channel) {
45  // Q1 = EE+N or EE-F, Top
46  // Q2 = EE+F or EE-N, Top
47  // Q3 = EE+F or EE-N, Bottom
48  // Q4 = EE+N or EE-F, Bottom
49  // (local notation)
50  // in Q1-Q3 and in Q2-Q4, the relation between strip#, channel# and xtal_id
51  // is the same
52  int q=-1;
53  if ( (dcc == EcalElectronicsId::DCC_EEP + 1) || ( dcc == EcalElectronicsId::DCC_EEP + 2) ||
55  (dcc == EcalElectronicsId::DCC_EEM + 3) || ( dcc == EcalElectronicsId::DCC_EEM + 4) ||
56  (dcc == EcalElectronicsId::DCC_EEM + 5 && dcc_channel <= EcalElectronicsId::kDCCChannelBoundary) ) q=1;
57  else if ( (dcc == EcalElectronicsId::DCC_EEP + 3) || ( dcc == EcalElectronicsId::DCC_EEP + 4) ||
60  (dcc == EcalElectronicsId::DCC_EEM + 1) || ( dcc == EcalElectronicsId::DCC_EEM + 2) ) q=2;
61  else if ( (dcc == EcalElectronicsId::DCC_EEP + 6) ||
65  (dcc == EcalElectronicsId::DCC_EEM + 8) ||
66  (dcc == EcalElectronicsId::DCC_EEM + 7 && dcc_channel > EcalElectronicsId::kDCCChannelBoundary)) q=3;
67  else
68  q=4;
69  return q;
70 }
71 
73  int dcc = dccId() ;
74  int dcc_channel = towerId();
75  int quadrant = EEQuadrant(dcc, dcc_channel);
76  int strip = stripId();
77  int xtal = xtalId();
78  int channel;
79  if (quadrant ==1 || quadrant== 3) channel = 5*(strip-1) + xtal;
80  else channel = 5*(xtal-1) + strip;
81  return channel;
82 }
83 
84 /*
85 int EcalElectronicsId::stripId() {
86  int dcc = dccId() ;
87  int dcc_channel = towerId();
88  int quadrant = EEQuadrant(dcc, dcc_channel);
89  int xtal = channelId();
90  int strip;
91  if (quadrant ==1 || quadrant== 3) strip = (xtal-1)/5 +1;
92  else strip = (xtal-1) % 5 +1;
93  return strip;
94 }
95 
96 int EcalElectronicsId::XtalInStripId() {
97  int dcc = dccId() ;
98  int dcc_channel = towerId();
99  int quadrant = EEQuadrant(dcc, dcc_channel);
100  int xtal = channelId();
101  int id;
102  if (quadrant ==1 || quadrant== 3) id = (xtal-1)%5 + 1;
103  else id = (xtal-1)/5 +1;
104  return id;
105 }
106 */
107 
108 
109 
110 std::ostream& operator<<(std::ostream& os,const EcalElectronicsId& id)
111 {
112  return os << id.dccId() << ',' << id.towerId() << ',' << id.stripId() << ',' << id.xtalId() ;
113 }
114 
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
void strip(std::string &input, const std::string &blanks=" \n\t")
Definition: stringTools.cc:16
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