CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
CSCIndexer Class Reference

#include <CSCIndexer.h>

Public Types

typedef uint16_t IndexType
 
typedef uint32_t LongIndexType
 

Public Member Functions

IndexType chamberIndex (const CSCDetId &id) const
 
IndexType chamberIndex (IndexType ie, IndexType is, IndexType ir, IndexType ic) const
 
IndexType chamberLabelFromChamberIndex (IndexType) const
 
IndexType chambersInRingOfStation (IndexType is, IndexType ir) const
 
IndexType chipIndex (IndexType ie, IndexType is, IndexType ir, IndexType ic, IndexType il, IndexType ichip) const
 
IndexType chipIndex (const CSCDetId &id, IndexType ichip) const
 
IndexType chipIndex (IndexType istrip) const
 
IndexType chipsPerLayer (IndexType is, IndexType ir) const
 
IndexType chipStart (IndexType ie, IndexType is, IndexType ir) const
 
 CSCIndexer ()
 
int dbIndex (const CSCDetId &id, int &channel)
 
CSCDetId detIdFromChamberIndex (IndexType ici) const
 
CSCDetId detIdFromChamberIndex_OLD (IndexType ici) const
 
CSCDetId detIdFromChamberLabel (IndexType ie, IndexType icl) const
 
std::pair< CSCDetId, IndexTypedetIdFromChipIndex (IndexType ichi) const
 
CSCDetId detIdFromLayerIndex (IndexType ili) const
 
std::pair< CSCDetId, IndexTypedetIdFromStripChannelIndex (LongIndexType ichi) const
 
IndexType layerIndex (const CSCDetId &id) const
 
IndexType layerIndex (IndexType ie, IndexType is, IndexType ir, IndexType ic, IndexType il) const
 
IndexType ringsInStation (IndexType is) const
 
IndexType startChamberIndexInEndcap (IndexType ie, IndexType is, IndexType ir) const
 
LongIndexType stripChannelIndex (IndexType ie, IndexType is, IndexType ir, IndexType ic, IndexType il, IndexType istrip) const
 
LongIndexType stripChannelIndex (const CSCDetId &id, IndexType istrip) const
 
IndexType stripChannelsPerLayer (IndexType is, IndexType ir) const
 
LongIndexType stripChannelStart (IndexType ie, IndexType is, IndexType ir) const
 
 ~CSCIndexer ()
 

Private Member Functions

void fillChamberLabel () const
 

Private Attributes

std::vector< IndexTypechamberLabel
 

Detailed Description

Creates a linear index for various sublevels of the endcap muon CSC system.

It supplies a linear index for:

  1. Each chamber of the CSC system: range 1-468 (CSC system as installed 2008) 469-540 for ME42
  2. Each layer of the CSC system: range 1-2808 (CSCs 2008) 2809-3240 for ME42
  3. Each strip channel of the CSC system: range 1-217728 (CSCs 2008) 217729-252288 for ME42
  4. Each Buckeye chip (1 for each layer in each CFEB)of the CSC system: range 1-13608 (CSCs 2008) 13609-15768 for ME42

The chamber and layer may be specified by CSCDetId or labels for endcap, station, ring, chamber, layer. The strip channel is a value 1-80 (or 64: ME13 chambers have only 64 channels.) The chip number is a value 1-30 (or 24: ME13 chambers have only 24 chips.)

The main user interface is the set of functions
chamberIndex(.)
layerIndex(.)
stripChannelIndex(.)
chipIndex(.)
But the other functions are public since they may be useful in contexts other than for Conditions Data for which the above functions are intended.

Warning
This class is hard-wired for the CSC system at start-up of CMS in 2008. with rings ME11, ME12, ME13, ME21, ME22, ME31, ME32, ME41 totalling 234 chambers per endcap. But ME42 is appended (to permit simulation studies), so the chamber order is
+z ME11, ME12, ME13, ME21, ME22, ME31, ME32, ME41,
-z ME11, ME12, ME13, ME21, ME22, ME31, ME32, ME41,
+z ME42, -z ME42
This uses magic numbers galore!!
EVERY LABEL COUNTS FROM ONE NOT ZERO.

Definition at line 43 of file CSCIndexer.h.

Member Typedef Documentation

typedef uint16_t CSCIndexer::IndexType

Definition at line 49 of file CSCIndexer.h.

typedef uint32_t CSCIndexer::LongIndexType

Definition at line 50 of file CSCIndexer.h.

Constructor & Destructor Documentation

CSCIndexer::CSCIndexer ( )
inline

Definition at line 52 of file CSCIndexer.h.

52 {};
CSCIndexer::~CSCIndexer ( )
inline

Definition at line 53 of file CSCIndexer.h.

53 {};

Member Function Documentation

IndexType CSCIndexer::chamberIndex ( const CSCDetId id) const
inline

Linear index to label each CSC in CSC system. Argument is the CSCDetId of some CSCChamber.

Output is 1-468 (CSCs 2008) 469-540 (ME42)

WARNING: Do not input ME1a values (i.e. ring '4'): does not consider ME1a and ME1b to be separate, No sanity checking on input value: if you supply an ME1a CSCDetId then you'll get nonsense.

Definition at line 65 of file CSCIndexer.h.

References Reference_intrackfit_cff::endcap, relativeConstraints::ring, and relativeConstraints::station.

Referenced by CSCBadChambers::isInBadChamber(), CSCChamberTimeCorrections::item(), layerIndex(), and CSCChamberTimeCorrectionsValues::prefill().

65  {
66  return chamberIndex( id.endcap(), id.station(), id.ring(), id.chamber() );
67  }
IndexType chamberIndex(const CSCDetId &id) const
Definition: CSCIndexer.h:65
IndexType CSCIndexer::chamberIndex ( IndexType  ie,
IndexType  is,
IndexType  ir,
IndexType  ic 
) const
inline

Linear index for chamber 'ic' in ring 'ir' of station 'is' in endcap 'ie', in range 1-468 (CSCs 2008) or 469-540 (ME42)

Definition at line 98 of file CSCIndexer.h.

References startChamberIndexInEndcap().

98  {
99  return startChamberIndexInEndcap(ie,is,ir) + ic - 1; // -1 so start index _is_ ic=1
100  }
IndexType startChamberIndexInEndcap(IndexType ie, IndexType is, IndexType ir) const
Definition: CSCIndexer.h:87
CSCIndexer::IndexType CSCIndexer::chamberLabelFromChamberIndex ( IndexType  ici) const

Definition at line 86 of file CSCIndexer.cc.

References chamberLabel, and fillChamberLabel().

86  {
87  // This is just for cross-checking
88 
89  // Expected range of input range argument is 1-540.
90  // 1-468 for CSCs installed at 2008 start-up. 469-540 for ME42.
91 
92  if ( ici > 468 ) {
93  // ME42
94  ici -= 234; // now in range 235-306
95  if ( ici > 270 ) { // -z
96  ici -= 36; // now in range 235-270
97  }
98  }
99  else { // in range 1-468
100  if ( ici > 234 ) { // -z
101  ici -= 234; // now in range 1-234
102  }
103  }
104  if (chamberLabel.empty()) fillChamberLabel();
105  return chamberLabel[ici];
106 
107 }
void fillChamberLabel() const
Definition: CSCIndexer.cc:4
std::vector< IndexType > chamberLabel
Definition: CSCIndexer.h:293
IndexType CSCIndexer::chambersInRingOfStation ( IndexType  is,
IndexType  ir 
) const
inline

How many chambers are there in ring ir of station is?

Works for ME1a (ring 4 of ME1) too.

Definition at line 126 of file CSCIndexer.h.

Referenced by fillChamberLabel().

126  {
127  IndexType nc = 36; // most rings have 36 chambers
128  if (is >1 && ir<2 ) nc = 18; // but 21, 31, 41 have 18
129  return nc;
130  }
uint16_t IndexType
Definition: CSCIndexer.h:49
IndexType CSCIndexer::chipIndex ( IndexType  ie,
IndexType  is,
IndexType  ir,
IndexType  ic,
IndexType  il,
IndexType  ichip 
) const
inline

Linear index for Buckeye chip 'ichip' in layer 'il' of chamber 'ic' of ring 'ir' in station 'is' of endcap 'ie'.

Output is 1-13608 (CSCs 2008) or 13609-15768 (ME42).

WARNING: Use at your own risk! You must input labels within hardware ranges. No trapping on out-of-range values!

Definition at line 236 of file CSCIndexer.h.

References chipsPerLayer(), and chipStart().

Referenced by CSCConditions::chipCorrection(), chipIndex(), CSCDBChipSpeedCorrection::item(), and CSCChipSpeedCorrectionDBConditions::prefillDBChipSpeedCorrection().

236  {
237  //printf("ME%d/%d/%d/%d layer %d chip %d chipindex %d\n",ie,is,ir,ic,il,ichip,chipStart(ie,is,ir)+( (ic-1)*6 + il - 1 )*chipsPerLayer(is,ir) + (ichip-1));
238  return chipStart(ie,is,ir)+( (ic-1)*6 + il - 1 )*chipsPerLayer(is,ir) + (ichip-1);
239 
240  }
IndexType chipsPerLayer(IndexType is, IndexType ir) const
Definition: CSCIndexer.h:201
IndexType chipStart(IndexType ie, IndexType is, IndexType ir) const
Definition: CSCIndexer.h:214
IndexType CSCIndexer::chipIndex ( const CSCDetId id,
IndexType  ichip 
) const
inline

Linear index for Buckeye chip 'ichip' in layer labelled by CSCDetId 'id'.

Output is 1-13608 (CSCs 2008) or 13609-15768 (ME42).

WARNING: Use at your own risk! The supplied CSCDetId must be a layer id. No trapping on out-of-range values!

Definition at line 251 of file CSCIndexer.h.

References chipIndex(), Reference_intrackfit_cff::endcap, relativeConstraints::ring, and relativeConstraints::station.

251  {
252  return chipIndex(id.endcap(), id.station(), id.ring(), id.chamber(), id.layer(), ichip );
253  }
IndexType chipIndex(IndexType ie, IndexType is, IndexType ir, IndexType ic, IndexType il, IndexType ichip) const
Definition: CSCIndexer.h:236
IndexType CSCIndexer::chipIndex ( IndexType  istrip) const
inline

Linear index for Buckeye chip processing strip 'istrip'.

Output is 1-5.

WARNING: Use at your own risk! The supplied CSCDetId must be a strip id 1-80 ME1/1a strips must be 65-80 No trapping on out-of-range values!

Definition at line 265 of file CSCIndexer.h.

265  {
266  return (istrip-1)/16+1;
267  }
IndexType CSCIndexer::chipsPerLayer ( IndexType  is,
IndexType  ir 
) const
inline

Number of Buckeye chips per layer in a chamber in ring ir of station is.

Station label range 1-4, Ring label range 1-3.

WARNING: ME1a channels are the last 1 of the 5 total in each layer of an ME11 chamber, and an input ir=4 is invalid and will give nonsense.
Considers ME42 as standard 5 chip per layer chambers.

Definition at line 201 of file CSCIndexer.h.

Referenced by chipIndex().

201  {
202  const IndexType nCinL[12] = { 5,5,4, 5,5,0, 5,5,0, 5,5,0 };
203  return nCinL[(is-1)*3 + ir - 1];
204  }
uint16_t IndexType
Definition: CSCIndexer.h:49
IndexType CSCIndexer::chipStart ( IndexType  ie,
IndexType  is,
IndexType  ir 
) const
inline

Linear index for 1st Buckey chip in ring 'ir' of station 'is' in endcap 'ie'.

Endcap label range 1-2, Station label range 1-4, Ring label range 1-3.

WARNING: ME1a channels are the last 1 of the 5 chips total in each layer of an ME11 chamber, and an input ir=4 is invalid and will give nonsense.

Definition at line 214 of file CSCIndexer.h.

Referenced by chipIndex().

214  {
215 
216  // These are in the ranges 1-13608 (CSCs 2008) and 13609-15768 (ME42).
217  // There are 1-6804 chips per endcap (CSCs 2008) and 1080 channels per endcap (ME42).
218  // Start of -z channels (CSCs 2008) is 6804 + 1 = 6805
219  // Start of +z (ME42) is 13608 + 1 = 13609
220  // Start of -z (ME42) is 13608 + 1 + 1080 = 14689
221  const IndexType nStart[24] = {1, 1081, 2161, 3025, 3565, 0, 4645, 5185, 0, 6265, 13609,0,
222  6805, 7885, 8965, 9829, 10369,0, 11449, 11989, 0, 13069, 14689 ,0 };
223 
224  return nStart[(ie-1)*12 + (is-1)*3 + ir - 1];
225  }
uint16_t IndexType
Definition: CSCIndexer.h:49
int CSCIndexer::dbIndex ( const CSCDetId id,
int &  channel 
)

Build index used internally in online CSC conditions databases (the 'Igor Index')

This is the decimal integer ie*100000 + is*10000 + ir*1000 + ic*10 + il
(ie=1-2, is=1-4, ir=1-4, ic=1-36, il=1-6)
Channels 1-16 in ME1A (is=1, ir=4) are reset to channels 65-80 of ME11.

Definition at line 240 of file CSCIndexer.cc.

Referenced by CSCValidation::doADCTiming(), CSCValidation::doAFEBTiming(), CSCValidation::doCompTiming(), CSCValidation::doGasGain(), CSCPedestals::item(), CSCGains::item(), CSCNoiseMatrix::item(), and CSCcrosstalk::item().

241 {
242  int ec = id.endcap();
243  int st = id.station();
244  int rg = id.ring();
245  int ch = id.chamber();
246  int la = id.layer();
247 
248  // The channels of ME1A are channels 65-80 of ME11
249  if(st == 1 && rg == 4)
250  {
251  rg = 1;
252  if(channel <= 16) channel += 64; // no trapping for any bizarreness
253  }
254  return ec*100000 + st*10000 + rg*1000 + ch*10 + la;
255 }
CSCDetId CSCIndexer::detIdFromChamberIndex ( IndexType  ici) const

Definition at line 62 of file CSCIndexer.cc.

References chamberLabel, detIdFromChamberLabel(), fillChamberLabel(), and label.

Referenced by detIdFromLayerIndex(), CSCConditions::fillBadStripWords(), CSCConditions::fillBadWireWords(), and CSCChipSpeedCorrectionDBConditions::prefillDBChipSpeedCorrection().

62  {
63  // Expected range of input range argument is 1-540.
64  // 1-468 for CSCs installed at 2008 start-up. 469-540 for ME42.
65 
66  IndexType ie = 1;
67  if ( ici > 468 ) {
68  // ME42
69  ici -= 234; // now in range 235-306
70  if ( ici > 270 ) { // -z
71  ie = 2;
72  ici -= 36; // now in range 235-270
73  }
74  }
75  else { // in range 1-468
76  if ( ici > 234 ) { // -z
77  ie = 2;
78  ici -= 234; // now in range 1-234
79  }
80  }
81  if (chamberLabel.empty()) fillChamberLabel();
83  return detIdFromChamberLabel( ie, label );
84 }
const std::string & label
Definition: MVAComputer.cc:186
void fillChamberLabel() const
Definition: CSCIndexer.cc:4
uint16_t IndexType
Definition: CSCIndexer.h:49
CSCDetId detIdFromChamberLabel(IndexType ie, IndexType icl) const
Definition: CSCIndexer.cc:109
std::vector< IndexType > chamberLabel
Definition: CSCIndexer.h:293
CSCDetId CSCIndexer::detIdFromChamberIndex_OLD ( IndexType  ici) const

Definition at line 24 of file CSCIndexer.cc.

References CSCDetId, i, relativeConstraints::ring, startChamberIndexInEndcap(), and relativeConstraints::station.

24  {
25 
26  // Will not work as is for ME42
27  // ============================
28 
29  IndexType ie = 1;
30  if (ici > 234 ) {
31  ie = 2;
32  ici -= 234;
33  }
34  // Now ici is in range 1-234 (assuming valid input in range 1-468)
35 
36  // MEij pairs...
37  const IndexType station[] = {0,1,1,1,2,2,3,3,4};
38  const IndexType ring[] = {0,1,2,3,1,2,1,2,1};
39 
40  // MEij preceding a given MEij matching linear index above
41  const IndexType prevs[] = {0,0,1,1,1,2,2,3,3};
42  const IndexType prevr[] = {0,0,1,2,3,1,2,1,2};
43 
44  IndexType is = 4;
45  IndexType ir = 1;
46  for ( IndexType i = 2; i<=8; ++i) {
47  IndexType js = station[i];
48  IndexType jr = ring[i];
49  // if it's before start of MEjs/jr then it's in the previous MEis/ir
50  if ( ici < startChamberIndexInEndcap(ie,js,jr) ) {
51  is = prevs[i];
52  ir = prevr[i];
53  break;
54  }
55  // otherwise it's in ME41
56  }
57  IndexType ic = ici - startChamberIndexInEndcap(ie,is,ir) + 1;
58 
59  return CSCDetId( ie, is, ir, ic );
60 }
int i
Definition: DBlmapReader.cc:9
uint16_t IndexType
Definition: CSCIndexer.h:49
IndexType startChamberIndexInEndcap(IndexType ie, IndexType is, IndexType ir) const
Definition: CSCIndexer.h:87
CSCDetId CSCIndexer::detIdFromChamberLabel ( IndexType  ie,
IndexType  icl 
) const

Definition at line 109 of file CSCIndexer.cc.

References CSCDetId, and label.

Referenced by detIdFromChamberIndex().

109  {
110 
111  IndexType is = label/1000;
112  label -= is*1000;
113  IndexType ir = label/100;
114  label -= ir*100;
115  IndexType ic = label;
116 
117  return CSCDetId( ie, is, ir, ic );
118 }
const std::string & label
Definition: MVAComputer.cc:186
uint16_t IndexType
Definition: CSCIndexer.h:49
std::pair< CSCDetId, CSCIndexer::IndexType > CSCIndexer::detIdFromChipIndex ( IndexType  ichi) const

Definition at line 185 of file CSCIndexer.cc.

References detIdFromLayerIndex().

185  {
186 
187  const LongIndexType lastnonme42 = 13608; // chips in 2008 installed chambers
188  const LongIndexType lastplusznonme42 = 6804; // = 13608/2
189  const LongIndexType firstme13 = 2161; // First channel of ME13
190  const LongIndexType lastme13 = 3024; // Last channel of ME13
191 
192  const IndexType lastnonme42layer = 2808;
193  const IndexType lastplusznonme42layer = 1404; // = 2808/2
194  const IndexType firstme13layer = 433; // = 72*6 + 1 (ME13 chambers are 72-108 in range 1-234)
195  const IndexType lastme13layer = 648; // = 108*6
196 
197  // All chambers but ME13 have 5 chips/layer
198  IndexType nchipPerLayer = 5;
199 
200  // Set endcap to +z. This should work for ME42 channels too, since we don't need to calculate its endcap explicitly.
201  IndexType ie = 1;
202 
203  LongIndexType istart = 0;
204  IndexType layerOffset = 0;
205 
206  if ( ici <= lastnonme42 ) {
207  // Chambers as of 2008 Installation
208 
209  if ( ici > lastplusznonme42 ) {
210  ie = 2;
211  ici -= lastplusznonme42;
212  }
213 
214  if ( ici > lastme13 ) { // after ME13
215  istart = lastme13;
216  layerOffset = lastme13layer;
217  }
218  else if ( ici >= firstme13 ) { // ME13
219  istart = firstme13 - 1;
220  layerOffset = firstme13layer - 1;
221  nchipPerLayer = 4;
222  }
223  }
224  else {
225  // ME42 chambers
226 
227  istart = lastnonme42;
228  layerOffset = lastnonme42layer;
229  }
230 
231  ici -= istart; // remove earlier group(s)
232  IndexType ichip = (ici-1)%nchipPerLayer + 1;
233  IndexType ili = (ici-1)/nchipPerLayer + 1;
234  ili += layerOffset; // add appropriate offset for earlier group(s)
235  if ( ie != 1 ) ili+= lastplusznonme42layer; // add offset to -z endcap; ME42 doesn't need this.
236 
237  return std::pair<CSCDetId, IndexType>(detIdFromLayerIndex(ili), ichip);
238 }
uint16_t IndexType
Definition: CSCIndexer.h:49
uint32_t LongIndexType
Definition: CSCIndexer.h:50
CSCDetId detIdFromLayerIndex(IndexType ili) const
Definition: CSCIndexer.cc:120
CSCDetId CSCIndexer::detIdFromLayerIndex ( IndexType  ili) const

Decode CSCDetId from various indexes and labels

Definition at line 120 of file CSCIndexer.cc.

References CSCDetId, detIdFromChamberIndex(), Reference_intrackfit_cff::endcap, relativeConstraints::ring, and relativeConstraints::station.

Referenced by detIdFromChipIndex(), and detIdFromStripChannelIndex().

120  {
121 
122  IndexType il = (ili-1)%6 + 1;
123  IndexType ici = (ili-1)/6 + 1;
124  CSCDetId id = detIdFromChamberIndex( ici );
125 
126  return CSCDetId(id.endcap(), id.station(), id.ring(), id.chamber(), il);
127 }
CSCDetId detIdFromChamberIndex(IndexType ici) const
Definition: CSCIndexer.cc:62
uint16_t IndexType
Definition: CSCIndexer.h:49
std::pair< CSCDetId, CSCIndexer::IndexType > CSCIndexer::detIdFromStripChannelIndex ( LongIndexType  ichi) const

Definition at line 129 of file CSCIndexer.cc.

References detIdFromLayerIndex(), and nchan.

Referenced by operator<<().

129  {
130 
131  const LongIndexType lastnonme42 = 217728; // channels in 2008 installed chambers
132  const LongIndexType lastplusznonme42 = 108864; // = 217728/2
133  const LongIndexType firstme13 = 34561; // First channel of ME13
134  const LongIndexType lastme13 = 48384; // Last channel of ME13
135 
136  const IndexType lastnonme42layer = 2808;
137  const IndexType lastplusznonme42layer = 1404; // = 2808/2
138  const IndexType firstme13layer = 433; // = 72*6 + 1 (ME13 chambers are 72-108 in range 1-234)
139  const IndexType lastme13layer = 648; // = 108*6
140 
141  // All chambers but ME13 have 80 channels
142  IndexType nchan = 80;
143 
144  // Set endcap to +z. This should work for ME42 channels too, since we don't need to calculate its endcap explicitly.
145  IndexType ie = 1;
146 
147  LongIndexType istart = 0;
148  IndexType layerOffset = 0;
149 
150  if ( isi <= lastnonme42 ) {
151  // Chambers as of 2008 Installation
152 
153  if ( isi > lastplusznonme42 ) {
154  ie = 2;
155  isi -= lastplusznonme42;
156  }
157 
158  if ( isi > lastme13 ) { // after ME13
159  istart = lastme13;
160  layerOffset = lastme13layer;
161  }
162  else if ( isi >= firstme13 ) { // ME13
163  istart = firstme13 - 1;
164  layerOffset = firstme13layer - 1;
165  nchan = 64;
166  }
167  }
168  else {
169  // ME42 chambers
170 
171  istart = lastnonme42;
172  layerOffset = lastnonme42layer;
173  }
174 
175  isi -= istart; // remove earlier group(s)
176  IndexType ichan = (isi-1)%nchan + 1;
177  IndexType ili = (isi-1)/nchan + 1;
178  ili += layerOffset; // add appropriate offset for earlier group(s)
179  if ( ie != 1 ) ili+= lastplusznonme42layer; // add offset to -z endcap; ME42 doesn't need this.
180 
181  return std::pair<CSCDetId, IndexType>(detIdFromLayerIndex(ili), ichan);
182 }
int nchan
Definition: TauolaWrapper.h:80
uint16_t IndexType
Definition: CSCIndexer.h:49
uint32_t LongIndexType
Definition: CSCIndexer.h:50
CSCDetId detIdFromLayerIndex(IndexType ili) const
Definition: CSCIndexer.cc:120
void CSCIndexer::fillChamberLabel ( ) const
private

Definition at line 4 of file CSCIndexer.cc.

References chamberLabel, chambersInRingOfStation(), prof2calltree::count, and ringsInStation().

Referenced by chamberLabelFromChamberIndex(), and detIdFromChamberIndex().

4  {
5  // Fill the member vector which permits decoding of the linear chamber index
6  // Logically const since initializes cache only,
7  // Beware that the ME42 indices 235-270 within this vector do NOT correspond to
8  // their 'real' linear indices (which are 469-504 for +z)
9  chamberLabel.resize( 271 ); // one more than #chambers per endcap. Includes ME42.
10  IndexType count = 0;
11  chamberLabel[count] = 0;
12 
13  for ( IndexType is = 1 ; is != 5; ++is ) {
14  IndexType irmax = ringsInStation(is);
15  for ( IndexType ir = 1; ir != irmax+1; ++ir ) {
16  IndexType icmax = chambersInRingOfStation(is, ir);
17  for ( IndexType ic = 1; ic != icmax+1; ++ic ) {
18  chamberLabel[ ++count ] = is*1000 + ir*100 + ic ;
19  }
20  }
21  }
22 }
IndexType chambersInRingOfStation(IndexType is, IndexType ir) const
Definition: CSCIndexer.h:126
IndexType ringsInStation(IndexType is) const
Definition: CSCIndexer.h:116
uint16_t IndexType
Definition: CSCIndexer.h:49
std::vector< IndexType > chamberLabel
Definition: CSCIndexer.h:293
IndexType CSCIndexer::layerIndex ( const CSCDetId id) const
inline

Linear index to label each hardware layer in CSC system. Argument is the CSCDetId of some CSCLayer.

Output is 1-2808 (CSCs 2008) 2809-3240 (ME42)

WARNING: Do not input ME1a values (i.e. ring '4'): does not consider ME1a and ME1b to be separate, No sanity checking on input value: if you supply an ME1a CSCDetId then you'll get nonsense.

Definition at line 79 of file CSCIndexer.h.

References Reference_intrackfit_cff::endcap, relativeConstraints::ring, and relativeConstraints::station.

Referenced by CSCConditions::badStripWord(), CSCConditions::badWireWord(), CSCConditions::fillBadStripWords(), and CSCConditions::fillBadWireWords().

79  {
80  return layerIndex(id.endcap(), id.station(), id.ring(), id.chamber(), id.layer());
81  }
IndexType layerIndex(const CSCDetId &id) const
Definition: CSCIndexer.h:79
IndexType CSCIndexer::layerIndex ( IndexType  ie,
IndexType  is,
IndexType  ir,
IndexType  ic,
IndexType  il 
) const
inline

Linear index for layer 'il' of chamber 'ic' in ring 'ir' of station 'is' in endcap 'ie', in range 1-2808 (CSCs 2008) or 2809-3240 (ME42).

Definition at line 106 of file CSCIndexer.h.

References chamberIndex().

106  {
107  const IndexType layersInChamber = 6;
108  return (chamberIndex(ie,is,ir,ic) - 1 ) * layersInChamber + il;
109  }
IndexType chamberIndex(const CSCDetId &id) const
Definition: CSCIndexer.h:65
uint16_t IndexType
Definition: CSCIndexer.h:49
IndexType CSCIndexer::ringsInStation ( IndexType  is) const
inline

How many rings are there in station is=1, 2, 3, 4 ?

BEWARE! Includes ME42 so claims 2 rings in station 4. There is only 1 at CSC installation 2008.

Definition at line 116 of file CSCIndexer.h.

Referenced by fillChamberLabel().

116  {
117  const IndexType nrins[5] = {0,3,2,2,2}; // rings per station
118  return nrins[is];
119  }
uint16_t IndexType
Definition: CSCIndexer.h:49
IndexType CSCIndexer::startChamberIndexInEndcap ( IndexType  ie,
IndexType  is,
IndexType  ir 
) const
inline

Starting index for first chamber in ring 'ir' of station 'is' in endcap 'ie', in range 1-468 (CSCs 2008) or 469-540 (ME42).

Definition at line 87 of file CSCIndexer.h.

Referenced by chamberIndex(), and detIdFromChamberIndex_OLD().

87  {
88  const IndexType nschin[24] = {1,37,73, 109,127,0, 163,181,0, 217,469,0,
89  235,271,307, 343,361,0, 397,415,0, 451,505,0 };
90  return nschin[(ie-1)*12 + (is-1)*3 + ir-1];
91 
92  }
uint16_t IndexType
Definition: CSCIndexer.h:49
LongIndexType CSCIndexer::stripChannelIndex ( IndexType  ie,
IndexType  is,
IndexType  ir,
IndexType  ic,
IndexType  il,
IndexType  istrip 
) const
inline

Linear index for strip channel istrip in layer 'il' of chamber 'ic' of ring 'ir' in station 'is' of endcap 'ie'.

Output is 1-217728 (CSCs 2008) or 217729-252288 (ME42).

WARNING: Use at your own risk! You must input labels within hardware ranges. No trapping on out-of-range values!

Definition at line 175 of file CSCIndexer.h.

References stripChannelsPerLayer(), and stripChannelStart().

Referenced by CSCDBNoiseMatrix::item(), CSCDBPedestals::item(), CSCDBGains::item(), CSCDBCrosstalk::item(), and stripChannelIndex().

175  {
176  return stripChannelStart(ie,is,ir)+( (ic-1)*6 + il - 1 )*stripChannelsPerLayer(is,ir) + (istrip-1);
177  }
IndexType stripChannelsPerLayer(IndexType is, IndexType ir) const
Definition: CSCIndexer.h:141
LongIndexType stripChannelStart(IndexType ie, IndexType is, IndexType ir) const
Definition: CSCIndexer.h:154
LongIndexType CSCIndexer::stripChannelIndex ( const CSCDetId id,
IndexType  istrip 
) const
inline

Linear index for strip channel 'istrip' in layer labelled by CSCDetId 'id'.

Output is 1-217728 (CSCs 2008) or 217729-252288 (ME42).

WARNING: Use at your own risk! The supplied CSCDetId must be a layer id. No trapping on out-of-range values!

Definition at line 188 of file CSCIndexer.h.

References Reference_intrackfit_cff::endcap, relativeConstraints::ring, relativeConstraints::station, and stripChannelIndex().

188  {
189  return stripChannelIndex(id.endcap(), id.station(), id.ring(), id.chamber(), id.layer(), istrip );
190  }
LongIndexType stripChannelIndex(IndexType ie, IndexType is, IndexType ir, IndexType ic, IndexType il, IndexType istrip) const
Definition: CSCIndexer.h:175
IndexType CSCIndexer::stripChannelsPerLayer ( IndexType  is,
IndexType  ir 
) const
inline

Number of strip channels per layer in a chamber in ring ir of station is.

Station label range 1-4, Ring label range 1-3.

WARNING: ME1a channels are the last 16 of the 80 total in each layer of an ME11 chamber, and an input ir=4 is invalid and will give nonsense.
Considers ME42 as standard 80-strip per layer chambers.

Definition at line 141 of file CSCIndexer.h.

Referenced by stripChannelIndex().

141  {
142  const IndexType nSCinC[12] = { 80,80,64, 80,80,0, 80,80,0, 80,80,0 };
143  return nSCinC[(is-1)*3 + ir - 1];
144  }
uint16_t IndexType
Definition: CSCIndexer.h:49
LongIndexType CSCIndexer::stripChannelStart ( IndexType  ie,
IndexType  is,
IndexType  ir 
) const
inline

Linear index for 1st strip channel in ring 'ir' of station 'is' in endcap 'ie'.

Endcap label range 1-2, Station label range 1-4, Ring label range 1-3.

WARNING: ME1a channels are the last 16 of the 80 total in each layer of an ME11 chamber, and an input ir=4 is invalid and will give nonsense.

Definition at line 154 of file CSCIndexer.h.

Referenced by stripChannelIndex().

154  {
155 
156  // These are in the ranges 1-217728 (CSCs 2008) and 217729-252288 (ME42).
157  // There are 1-108884 channels per endcap (CSCs 2008) and 17280 channels per endcap (ME42).
158  // Start of -z channels (CSCs 2008) is 108864 + 1 = 108865
159  // Start of +z (ME42) is 217728 + 1 = 217729
160  // Start of -z (ME42) is 217728 + 1 + 17280 = 235009
161  const LongIndexType nStart[24] = { 1,17281,34561, 48385,57025,0, 74305,82945,0, 100225,217729,0,
162  108865,126145,143425, 157249,165889,0, 183169,191809,0, 209089,235009,0 };
163  return nStart[(ie-1)*12 + (is-1)*3 + ir - 1];
164  }
uint32_t LongIndexType
Definition: CSCIndexer.h:50

Member Data Documentation

std::vector<IndexType> CSCIndexer::chamberLabel
mutableprivate