CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Static Private Member Functions
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 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 gasGainIndex (const CSCDetId &id, IndexType istrip, IndexType iwire) const
 
IndexType gasGainIndex (IndexType ie, IndexType is, IndexType ir, IndexType ic, IndexType il, IndexType istrip, IndexType iwire) const
 
IndexType hvSegmentIndex (IndexType is, IndexType ir, IndexType iwire) const
 
IndexType hvSegmentsPerLayer (IndexType is, IndexType ir) const
 
IndexType layerIndex (const CSCDetId &id) const
 
IndexType layerIndex (IndexType ie, IndexType is, IndexType ir, IndexType ic, IndexType il) const
 
IndexType sectorsPerLayer (IndexType is, IndexType ir) const
 
IndexType sectorStart (IndexType ie, IndexType is, IndexType ir) 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 ()
 

Static Public Member Functions

static IndexType chambersInRingOfStation (IndexType is, IndexType ir)
 
static IndexType ringsInStation (IndexType is)
 

Static Private Member Functions

static std::vector< IndexType > const & chamberLabel ()
 
static std::vector< IndexTypefillChamberLabel ()
 

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
  5. Each Gas Gain Sector (1 for each [CFEB*HV segment] combination in each layer): range 1-45144 (CSCs 2008) 45145-55944 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 44 of file CSCIndexer.h.

Member Typedef Documentation

◆ IndexType

typedef uint16_t CSCIndexer::IndexType

Definition at line 48 of file CSCIndexer.h.

◆ LongIndexType

typedef uint32_t CSCIndexer::LongIndexType

Definition at line 49 of file CSCIndexer.h.

Constructor & Destructor Documentation

◆ CSCIndexer()

CSCIndexer::CSCIndexer ( )
inline

Definition at line 51 of file CSCIndexer.h.

51 {};

◆ ~CSCIndexer()

CSCIndexer::~CSCIndexer ( )
inline

Definition at line 52 of file CSCIndexer.h.

52 {};

Member Function Documentation

◆ chamberIndex() [1/2]

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 64 of file CSCIndexer.h.

References relativeConstraints::chamber, makeMuonMisalignmentScenario::endcap, relativeConstraints::ring, and relativeConstraints::station.

Referenced by layerIndex(), and CSCChamberTimeCorrectionsValues::prefill().

◆ chamberIndex() [2/2]

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 96 of file CSCIndexer.h.

References startChamberIndexInEndcap().

96  {
97  return startChamberIndexInEndcap(ie, is, ir) + ic - 1; // -1 so start index _is_ ic=1
98  }
IndexType startChamberIndexInEndcap(IndexType ie, IndexType is, IndexType ir) const
Definition: CSCIndexer.h:86

◆ chamberLabel()

const std::vector< CSCIndexer::IndexType > & CSCIndexer::chamberLabel ( )
staticprivate

Definition at line 27 of file CSCIndexer.cc.

References fillChamberLabel().

Referenced by chamberLabelFromChamberIndex(), and detIdFromChamberIndex().

27  {
28  static const auto s_chamberLabel = fillChamberLabel();
29  return s_chamberLabel;
30 }
static std::vector< IndexType > fillChamberLabel()
Definition: CSCIndexer.cc:4

◆ chamberLabelFromChamberIndex()

CSCIndexer::IndexType CSCIndexer::chamberLabelFromChamberIndex ( IndexType  ici) const

Definition at line 91 of file CSCIndexer.cc.

References chamberLabel().

91  {
92  // This is just for cross-checking
93 
94  // Expected range of input range argument is 1-540.
95  // 1-468 for CSCs installed at 2008 start-up. 469-540 for ME42.
96 
97  if (ici > 468) {
98  // ME42
99  ici -= 234; // now in range 235-306
100  if (ici > 270) { // -z
101  ici -= 36; // now in range 235-270
102  }
103  } else { // in range 1-468
104  if (ici > 234) { // -z
105  ici -= 234; // now in range 1-234
106  }
107  }
108  return chamberLabel()[ici];
109 }
static std::vector< IndexType > const & chamberLabel()
Definition: CSCIndexer.cc:27

◆ chambersInRingOfStation()

static IndexType CSCIndexer::chambersInRingOfStation ( IndexType  is,
IndexType  ir 
)
inlinestatic

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

Works for ME1a (ring 4 of ME1) too.

Definition at line 124 of file CSCIndexer.h.

Referenced by fillChamberLabel().

124  {
125  IndexType nc = 36; // most rings have 36 chambers
126  if (is > 1 && ir < 2)
127  nc = 18; // but 21, 31, 41 have 18
128  return nc;
129  }
uint16_t IndexType
Definition: CSCIndexer.h:48

◆ chipIndex() [1/3]

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 234 of file CSCIndexer.h.

References chipsPerLayer(), and chipStart().

Referenced by chipIndex(), gasGainIndex(), and CSCChipSpeedCorrectionDBConditions::prefillDBChipSpeedCorrection().

234  {
235  //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));
236  return chipStart(ie, is, ir) + ((ic - 1) * 6 + il - 1) * chipsPerLayer(is, ir) + (ichip - 1);
237  }
IndexType chipsPerLayer(IndexType is, IndexType ir) const
Definition: CSCIndexer.h:200
IndexType chipStart(IndexType ie, IndexType is, IndexType ir) const
Definition: CSCIndexer.h:213

◆ chipIndex() [2/3]

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 248 of file CSCIndexer.h.

References relativeConstraints::chamber, chipIndex(), makeMuonMisalignmentScenario::endcap, pixelTopology::layer, relativeConstraints::ring, and relativeConstraints::station.

248  {
249  return chipIndex(id.endcap(), id.station(), id.ring(), id.chamber(), id.layer(), ichip);
250  }
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
IndexType chipIndex(IndexType ie, IndexType is, IndexType ir, IndexType ic, IndexType il, IndexType ichip) const
Definition: CSCIndexer.h:234

◆ chipIndex() [3/3]

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 262 of file CSCIndexer.h.

262 { return (istrip - 1) / 16 + 1; }

◆ chipsPerLayer()

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 200 of file CSCIndexer.h.

Referenced by chipIndex(), gasGainIndex(), and sectorsPerLayer().

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

◆ chipStart()

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 213 of file CSCIndexer.h.

Referenced by chipIndex().

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

◆ dbIndex()

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 235 of file CSCIndexer.cc.

Referenced by CSCNoiseMatrix::item(), CSCPedestals::item(), CSCGains::item(), and CSCcrosstalk::item().

235  {
236  int ec = id.endcap();
237  int st = id.station();
238  int rg = id.ring();
239  int ch = id.chamber();
240  int la = id.layer();
241 
242  // The channels of ME1A are channels 65-80 of ME11
243  if (st == 1 && rg == 4) {
244  rg = 1;
245  if (channel <= 16)
246  channel += 64; // no trapping for any bizarreness
247  }
248  return ec * 100000 + st * 10000 + rg * 1000 + ch * 10 + la;
249 }

◆ detIdFromChamberIndex()

CSCDetId CSCIndexer::detIdFromChamberIndex ( IndexType  ici) const

Definition at line 69 of file CSCIndexer.cc.

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

Referenced by detIdFromLayerIndex(), and CSCChipSpeedCorrectionDBConditions::prefillDBChipSpeedCorrection().

69  {
70  // Expected range of input range argument is 1-540.
71  // 1-468 for CSCs installed at 2008 start-up. 469-540 for ME42.
72 
73  IndexType ie = 1;
74  if (ici > 468) {
75  // ME42
76  ici -= 234; // now in range 235-306
77  if (ici > 270) { // -z
78  ie = 2;
79  ici -= 36; // now in range 235-270
80  }
81  } else { // in range 1-468
82  if (ici > 234) { // -z
83  ie = 2;
84  ici -= 234; // now in range 1-234
85  }
86  }
87  IndexType label = chamberLabel()[ici];
88  return detIdFromChamberLabel(ie, label);
89 }
char const * label
static std::vector< IndexType > const & chamberLabel()
Definition: CSCIndexer.cc:27
uint16_t IndexType
Definition: CSCIndexer.h:48
CSCDetId detIdFromChamberLabel(IndexType ie, IndexType icl) const
Definition: CSCIndexer.cc:111

◆ detIdFromChamberIndex_OLD()

CSCDetId CSCIndexer::detIdFromChamberIndex_OLD ( IndexType  ici) const

Definition at line 32 of file CSCIndexer.cc.

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

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

◆ detIdFromChamberLabel()

CSCDetId CSCIndexer::detIdFromChamberLabel ( IndexType  ie,
IndexType  icl 
) const

Definition at line 111 of file CSCIndexer.cc.

References label.

Referenced by detIdFromChamberIndex().

111  {
112  IndexType is = label / 1000;
113  label -= is * 1000;
114  IndexType ir = label / 100;
115  label -= ir * 100;
116  IndexType ic = label;
117 
118  return CSCDetId(ie, is, ir, ic);
119 }
char const * label
uint16_t IndexType
Definition: CSCIndexer.h:48

◆ detIdFromChipIndex()

std::pair< CSCDetId, CSCIndexer::IndexType > CSCIndexer::detIdFromChipIndex ( IndexType  ichi) const

Definition at line 182 of file CSCIndexer.cc.

References detIdFromLayerIndex().

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

◆ detIdFromLayerIndex()

CSCDetId CSCIndexer::detIdFromLayerIndex ( IndexType  ili) const

Decode CSCDetId from various indexes and labels

Definition at line 121 of file CSCIndexer.cc.

References relativeConstraints::chamber, detIdFromChamberIndex(), makeMuonMisalignmentScenario::endcap, relativeConstraints::ring, and relativeConstraints::station.

Referenced by detIdFromChipIndex(), and detIdFromStripChannelIndex().

121  {
122  IndexType il = (ili - 1) % 6 + 1;
123  IndexType ici = (ili - 1) / 6 + 1;
125 
126  return CSCDetId(id.endcap(), id.station(), id.ring(), id.chamber(), il);
127 }
CSCDetId detIdFromChamberIndex(IndexType ici) const
Definition: CSCIndexer.cc:69
uint16_t IndexType
Definition: CSCIndexer.h:48

◆ detIdFromStripChannelIndex()

std::pair< CSCDetId, CSCIndexer::IndexType > CSCIndexer::detIdFromStripChannelIndex ( LongIndexType  ichi) const

Definition at line 129 of file CSCIndexer.cc.

References detIdFromLayerIndex().

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

◆ fillChamberLabel()

std::vector< CSCIndexer::IndexType > CSCIndexer::fillChamberLabel ( )
staticprivate

Definition at line 4 of file CSCIndexer.cc.

References chambersInRingOfStation(), submitPVResolutionJobs::count, and ringsInStation().

Referenced by chamberLabel().

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  std::vector<IndexType> tChamberLabel;
10 
11  tChamberLabel.resize(271); // one more than #chambers per endcap. Includes ME42.
12  IndexType count = 0;
13  tChamberLabel[count] = 0;
14 
15  for (IndexType is = 1; is != 5; ++is) {
16  IndexType irmax = ringsInStation(is);
17  for (IndexType ir = 1; ir != irmax + 1; ++ir) {
18  IndexType icmax = chambersInRingOfStation(is, ir);
19  for (IndexType ic = 1; ic != icmax + 1; ++ic) {
20  tChamberLabel[++count] = is * 1000 + ir * 100 + ic;
21  }
22  }
23  }
24  return tChamberLabel;
25 }
uint16_t IndexType
Definition: CSCIndexer.h:48
static IndexType ringsInStation(IndexType is)
Definition: CSCIndexer.h:114
static IndexType chambersInRingOfStation(IndexType is, IndexType ir)
Definition: CSCIndexer.h:124

◆ gasGainIndex() [1/2]

IndexType CSCIndexer::gasGainIndex ( const CSCDetId id,
IndexType  istrip,
IndexType  iwire 
) const
inline

Linear index for Gas gain sector, based on CSCDetId 'id', cathode strip 'istrip' and anode wire 'iwire'

Output is 1-45144 (CSCs 2008) and 45145-55944 (ME42).

WARNING: Use at your own risk! You must input labels within hardware ranges (e.g., 'id' must correspond to a specific layer 1-6). No trapping on out-of-range values!

Definition at line 379 of file CSCIndexer.h.

References relativeConstraints::chamber, makeMuonMisalignmentScenario::endcap, pixelTopology::layer, relativeConstraints::ring, and relativeConstraints::station.

379  {
380  return gasGainIndex(id.endcap(), id.station(), id.ring(), id.chamber(), id.layer(), istrip, iwire);
381  }
IndexType gasGainIndex(const CSCDetId &id, IndexType istrip, IndexType iwire) const
Definition: CSCIndexer.h:379
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer

◆ gasGainIndex() [2/2]

IndexType CSCIndexer::gasGainIndex ( IndexType  ie,
IndexType  is,
IndexType  ir,
IndexType  ic,
IndexType  il,
IndexType  istrip,
IndexType  iwire 
) const
inline

Linear index for Gas gain sector, based on the cathode strip 'istrip' and anode wire 'iwire' located in layer 'il' of chamber 'ic' of ring 'ir' in station 'is' of endcap 'ie'.

Output is 1-45144 (CSCs 2008) and 45145-55944 (ME42).

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

Definition at line 392 of file CSCIndexer.h.

References chipIndex(), chipsPerLayer(), hvSegmentIndex(), sectorsPerLayer(), and sectorStart().

393  {
394  IndexType ichip = this->chipIndex(istrip);
395  IndexType ihvsegment = this->hvSegmentIndex(is, ir, iwire);
396  return sectorStart(ie, is, ir) + ((ic - 1) * 6 + il - 1) * sectorsPerLayer(is, ir) +
397  (ihvsegment - 1) * chipsPerLayer(is, ir) + (ichip - 1);
398  }
IndexType sectorsPerLayer(IndexType is, IndexType ir) const
Definition: CSCIndexer.h:285
IndexType hvSegmentIndex(IndexType is, IndexType ir, IndexType iwire) const
Definition: CSCIndexer.h:297
IndexType chipsPerLayer(IndexType is, IndexType ir) const
Definition: CSCIndexer.h:200
IndexType sectorStart(IndexType ie, IndexType is, IndexType ir) const
Definition: CSCIndexer.h:351
IndexType chipIndex(IndexType ie, IndexType is, IndexType ir, IndexType ic, IndexType il, IndexType ichip) const
Definition: CSCIndexer.h:234
uint16_t IndexType
Definition: CSCIndexer.h:48

◆ hvSegmentIndex()

IndexType CSCIndexer::hvSegmentIndex ( IndexType  is,
IndexType  ir,
IndexType  iwire 
) const
inline

Linear index for HV segment

Output is 1-5.

WARNING: Use at your own risk! The supplied CSCDetId must be chamber station, ring, and wire. No trapping on out-of-range values!

Definition at line 297 of file CSCIndexer.h.

Referenced by gasGainIndex().

297  {
298  IndexType hvSegment = 1; // There is only one HV segment in ME1/1
299 
300  if (is > 2 && ir == 1) { // HV segments are the same in ME3/1 and ME4/1
301  if (iwire >= 33 && iwire <= 64) {
302  hvSegment = 2;
303  } else if (iwire >= 65 && iwire <= 96) {
304  hvSegment = 3;
305  }
306 
307  } else if (is > 1 && ir == 2) { // HV segments are the same in ME2/2, ME3/2, and ME4/2
308  if (iwire >= 17 && iwire <= 28) {
309  hvSegment = 2;
310  } else if (iwire >= 29 && iwire <= 40) {
311  hvSegment = 3;
312  } else if (iwire >= 41 && iwire <= 52) {
313  hvSegment = 4;
314  } else if (iwire >= 53 && iwire <= 64) {
315  hvSegment = 5;
316  }
317 
318  } else if (is == 1 && ir == 2) {
319  if (iwire >= 25 && iwire <= 48) {
320  hvSegment = 2;
321  } else if (iwire >= 49 && iwire <= 64) {
322  hvSegment = 3;
323  }
324 
325  } else if (is == 1 && ir == 3) {
326  if (iwire >= 13 && iwire <= 22) {
327  hvSegment = 2;
328  } else if (iwire >= 23 && iwire <= 32) {
329  hvSegment = 3;
330  }
331 
332  } else if (is == 2 && ir == 1) {
333  if (iwire >= 45 && iwire <= 80) {
334  hvSegment = 2;
335  } else if (iwire >= 81 && iwire <= 112) {
336  hvSegment = 3;
337  }
338  }
339 
340  return hvSegment;
341  }
uint16_t IndexType
Definition: CSCIndexer.h:48

◆ hvSegmentsPerLayer()

IndexType CSCIndexer::hvSegmentsPerLayer ( IndexType  is,
IndexType  ir 
) const
inline

Number of HV segments 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.

Definition at line 272 of file CSCIndexer.h.

Referenced by sectorsPerLayer().

272  {
273  const IndexType nSinL[12] = {1, 3, 3, 3, 5, 0, 3, 5, 0, 3, 5, 0};
274  return nSinL[(is - 1) * 3 + ir - 1];
275  }
uint16_t IndexType
Definition: CSCIndexer.h:48

◆ layerIndex() [1/2]

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 78 of file CSCIndexer.h.

References relativeConstraints::chamber, makeMuonMisalignmentScenario::endcap, pixelTopology::layer, relativeConstraints::ring, and relativeConstraints::station.

78  {
79  return layerIndex(id.endcap(), id.station(), id.ring(), id.chamber(), id.layer());
80  }
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
IndexType layerIndex(const CSCDetId &id) const
Definition: CSCIndexer.h:78

◆ layerIndex() [2/2]

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 104 of file CSCIndexer.h.

References chamberIndex().

104  {
105  const IndexType layersInChamber = 6;
106  return (chamberIndex(ie, is, ir, ic) - 1) * layersInChamber + il;
107  }
IndexType chamberIndex(const CSCDetId &id) const
Definition: CSCIndexer.h:64
uint16_t IndexType
Definition: CSCIndexer.h:48

◆ ringsInStation()

static IndexType CSCIndexer::ringsInStation ( IndexType  is)
inlinestatic

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 114 of file CSCIndexer.h.

Referenced by fillChamberLabel().

114  {
115  const IndexType nrins[5] = {0, 3, 2, 2, 2}; // rings per station
116  return nrins[is];
117  }
uint16_t IndexType
Definition: CSCIndexer.h:48

◆ sectorsPerLayer()

IndexType CSCIndexer::sectorsPerLayer ( IndexType  is,
IndexType  ir 
) const
inline

Number of Gas Gain sectors 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.

Definition at line 285 of file CSCIndexer.h.

References chipsPerLayer(), and hvSegmentsPerLayer().

Referenced by gasGainIndex().

285  {
286  return chipsPerLayer(is, ir) * hvSegmentsPerLayer(is, ir);
287  }
IndexType chipsPerLayer(IndexType is, IndexType ir) const
Definition: CSCIndexer.h:200
IndexType hvSegmentsPerLayer(IndexType is, IndexType ir) const
Definition: CSCIndexer.h:272

◆ sectorStart()

IndexType CSCIndexer::sectorStart ( IndexType  ie,
IndexType  is,
IndexType  ir 
) const
inline

Linear index for 1st Gas gain sector 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 351 of file CSCIndexer.h.

Referenced by gasGainIndex().

351  {
352  // There are 36 chambers * 6 layers * 5 CFEB's * 1 HV segment = 1080 gas-gain sectors in ME1/1
353  // There are 36*6*5*3 = 3240 gas-gain sectors in ME1/2
354  // There are 36*6*4*3 = 2592 gas-gain sectors in ME1/3
355  // There are 18*6*5*3 = 1620 gas-gain sectors in ME[2-4]/1
356  // There are 36*6*5*5 = 5400 gas-gain sectors in ME[2-4]/2
357  // Start of -z channels (CSCs 2008) is 22572 + 1 = 22573
358  // Start of +z (ME42) is 45144 + 1 = 45145
359  // Start of -z (ME42) is 45144 + 1 + 5400 = 50545
360  const IndexType nStart[24] = {1, 1081, 4321, //ME+1/1,ME+1/2,ME+1/3
361  6913, 8533, 0, //ME+2/1,ME+2/2,ME+2/3
362  13933, 15553, 0, //ME+3/1,ME+3/2,ME+3/3
363  20953, 45145, 0, //ME+4/1,ME+4/2,ME+4/3 (note, ME+4/2 index follows ME-4/1...)
364  22573, 23653, 26893, //ME-1/1,ME-1/2,ME-1/3
365  29485, 31105, 0, //ME-2/1,ME-2/2,ME-2/3
366  36505, 38125, 0, //ME-3/1,ME-3/2,ME-3/3
367  43525, 50545, 0}; //ME-4/1,ME-4/2,ME-4/3 (note, ME-4/2 index follows ME+4/2...)
368  return nStart[(ie - 1) * 12 + (is - 1) * 3 + ir - 1];
369  }
uint16_t IndexType
Definition: CSCIndexer.h:48

◆ startChamberIndexInEndcap()

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 86 of file CSCIndexer.h.

Referenced by chamberIndex(), and detIdFromChamberIndex_OLD().

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

◆ stripChannelIndex() [1/2]

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 173 of file CSCIndexer.h.

References stripChannelsPerLayer(), and stripChannelStart().

Referenced by stripChannelIndex().

174  {
175  return stripChannelStart(ie, is, ir) + ((ic - 1) * 6 + il - 1) * stripChannelsPerLayer(is, ir) + (istrip - 1);
176  }
IndexType stripChannelsPerLayer(IndexType is, IndexType ir) const
Definition: CSCIndexer.h:140
LongIndexType stripChannelStart(IndexType ie, IndexType is, IndexType ir) const
Definition: CSCIndexer.h:153

◆ stripChannelIndex() [2/2]

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 187 of file CSCIndexer.h.

References relativeConstraints::chamber, makeMuonMisalignmentScenario::endcap, pixelTopology::layer, relativeConstraints::ring, relativeConstraints::station, and stripChannelIndex().

187  {
188  return stripChannelIndex(id.endcap(), id.station(), id.ring(), id.chamber(), id.layer(), istrip);
189  }
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
LongIndexType stripChannelIndex(IndexType ie, IndexType is, IndexType ir, IndexType ic, IndexType il, IndexType istrip) const
Definition: CSCIndexer.h:173

◆ stripChannelsPerLayer()

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 140 of file CSCIndexer.h.

Referenced by stripChannelIndex().

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

◆ stripChannelStart()

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 153 of file CSCIndexer.h.

Referenced by stripChannelIndex().

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