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;
49  if ((dcc == EcalElectronicsId::DCC_EEP + 1) || (dcc == EcalElectronicsId::DCC_EEP + 2) ||
51  (dcc == EcalElectronicsId::DCC_EEM + 3) || (dcc == EcalElectronicsId::DCC_EEM + 4) ||
53  q = 1;
54  else if ((dcc == EcalElectronicsId::DCC_EEP + 3) || (dcc == EcalElectronicsId::DCC_EEP + 4) ||
57  (dcc == EcalElectronicsId::DCC_EEM + 1) || (dcc == EcalElectronicsId::DCC_EEM + 2))
58  q = 2;
59  else if ((dcc == EcalElectronicsId::DCC_EEP + 6) ||
63  (dcc == EcalElectronicsId::DCC_EEM + 8) ||
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 }
EcalElectronicsId.h
EcalElectronicsId::MIN_XTALID
static const int MIN_XTALID
Definition: EcalElectronicsId.h:60
EcalElectronicsId::MIN_TOWERID
static const int MIN_TOWERID
Definition: EcalElectronicsId.h:54
operator<<
std::ostream & operator<<(std::ostream &os, const EcalElectronicsId &id)
Definition: EcalElectronicsId.cc:109
EcalElectronicsId::zside
int zside() const
zside = +1 or -1
Definition: EcalElectronicsId.cc:27
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
EcalElectronicsId::MIN_STRIPID
static const int MIN_STRIPID
Definition: EcalElectronicsId.h:56
EcalElectronicsId::MAX_XTALID
static const int MAX_XTALID
Definition: EcalElectronicsId.h:59
EcalSubdetector
EcalSubdetector
Definition: EcalSubdetector.h:10
EcalElectronicsId::dccId
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
Definition: EcalElectronicsId.h:31
EcalElectronicsId::MIN_DCCID
static const int MIN_DCCID
Definition: EcalElectronicsId.h:52
EcalBarrel
Definition: EcalSubdetector.h:10
EcalElectronicsId::towerId
int towerId() const
get the tower id
Definition: EcalElectronicsId.h:33
EcalElectronicsId::MIN_DCCID_EBM
static const int MIN_DCCID_EBM
Definition: EcalElectronicsId.h:64
SiPixelPI::quadrant
int quadrant(const DetId &detid, const TrackerTopology *tTopo_, bool phase_)
Definition: SiPixelPayloadInspectorHelper.h:124
EcalElectronicsId::channelId
int channelId() const
so far for EndCap only :
Definition: EcalElectronicsId.cc:71
EcalElectronicsId::MAX_DCCID
static const int MAX_DCCID
Definition: EcalElectronicsId.h:51
EcalElectronicsId
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
Definition: EcalElectronicsId.h:18
EcalElectronicsId::DCC_EEP
static const int DCC_EEP
Definition: EcalElectronicsId.h:78
EcalEndcap
Definition: EcalSubdetector.h:10
EEQuadrant
static int EEQuadrant(int dcc, int dcc_channel)
Definition: EcalElectronicsId.cc:40
EcalElectronicsId::MAX_DCCID_EBP
static const int MAX_DCCID_EBP
Definition: EcalElectronicsId.h:67
EcalElectronicsId::MAX_DCCID_EEM
static const int MAX_DCCID_EEM
Definition: EcalElectronicsId.h:63
submitPVResolutionJobs.q
q
Definition: submitPVResolutionJobs.py:84
EcalElectronicsId::MAX_STRIPID
static const int MAX_STRIPID
Definition: EcalElectronicsId.h:55
EcalElectronicsId::MAX_TOWERID
static const int MAX_TOWERID
Definition: EcalElectronicsId.h:53
EcalElectronicsId::subdet
EcalSubdetector subdet() const
get the subdet
Definition: EcalElectronicsId.cc:19
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
Exception
Definition: hltDiff.cc:245
EcalElectronicsId::DCC_EEM
static const int DCC_EEM
Definition: EcalElectronicsId.h:77
EcalElectronicsId::MAX_DCCID_EEP
static const int MAX_DCCID_EEP
Definition: EcalElectronicsId.h:69
Exception.h
EcalElectronicsId::kDCCChannelBoundary
static const int kDCCChannelBoundary
Definition: EcalElectronicsId.h:74
EcalElectronicsId::EcalElectronicsId
EcalElectronicsId()
Definition: EcalElectronicsId.cc:6
EcalElectronicsId::MAX_DCCID_EBM
static const int MAX_DCCID_EBM
Definition: EcalElectronicsId.h:65
EcalElectronicsId::stripId
int stripId() const
get the tower id
Definition: EcalElectronicsId.h:35
EcalElectronicsId::MIN_DCCID_EEM
static const int MIN_DCCID_EEM
Definition: EcalElectronicsId.h:62
EcalElectronicsId::MIN_DCCID_EEP
static const int MIN_DCCID_EEP
Definition: EcalElectronicsId.h:68
EcalElectronicsId::EcalElectronicsId_
uint32_t EcalElectronicsId_
Definition: EcalElectronicsId.h:88
EcalElectronicsId::xtalId
int xtalId() const
get the channel id
Definition: EcalElectronicsId.h:37
EcalElectronicsId::MIN_DCCID_EBP
static const int MIN_DCCID_EBP
Definition: EcalElectronicsId.h:66