Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:47:35

0001 #include "CalibMuon/CSCCalibration/interface/CSCIndexerBase.h"
0002 
0003 CSCIndexerBase::CSCIndexerBase()
0004     : chamberLabel_(271)  // # of physical chambers per endcap + 1. Includes ME42.
0005 {
0006   // Fill the member vector which permits decoding of the linear chamber index.
0007   // Beware that the ME42 indices 235-270 within this vector do NOT correspond
0008   // to their 'real' linear indices (which are 469-504 for +z)
0009   IndexType count = 0;
0010   chamberLabel_[count] = 0;
0011 
0012   for (IndexType is = 1; is <= 4; ++is) {
0013     IndexType irmax = ringsInStation(is);
0014     for (IndexType ir = 1; ir <= irmax; ++ir) {
0015       IndexType icmax = chambersInRingOfStation(is, ir);
0016       for (IndexType ic = 1; ic <= icmax; ++ic) {
0017         chamberLabel_[++count] = is * 1000 + ir * 100 + ic;
0018       }
0019     }
0020   }
0021 }
0022 
0023 CSCIndexerBase::~CSCIndexerBase() {}
0024 
0025 CSCIndexerBase::IndexType CSCIndexerBase::chamberLabelFromChamberIndex(IndexType ici) const {
0026   // This is just for cross-checking
0027 
0028   // Expected range of input range argument is 1-540.
0029   // 1-468 for CSCs installed at 2008 start-up. 469-540 for ME42.
0030 
0031   if (ici > 468) {
0032     // ME42
0033     ici -= 234;     // now in range 235-306
0034     if (ici > 270)  // -z
0035     {
0036       ici -= 36;  // now in range 235-270
0037     }
0038   } else  // in range 1-468
0039   {
0040     if (ici > 234)  // -z
0041     {
0042       ici -= 234;  // now in range 1-234
0043     }
0044   }
0045   return chamberLabel_[ici];
0046 }
0047 
0048 CSCIndexerBase::IndexType CSCIndexerBase::hvSegmentIndex(IndexType is, IndexType ir, IndexType iwire) const {
0049   IndexType hvSegment = 1;  // There is only one HV segment in ME1/1
0050 
0051   if (is > 2 && ir == 1)  // HV segments are the same in ME3/1 and ME4/1
0052   {
0053     if (iwire >= 33 && iwire <= 64) {
0054       hvSegment = 2;
0055     } else if (iwire >= 65 && iwire <= 96) {
0056       hvSegment = 3;
0057     }
0058   } else if (is > 1 && ir == 2)  // HV segments are the same in ME2/2, ME3/2, and ME4/2
0059   {
0060     if (iwire >= 17 && iwire <= 28) {
0061       hvSegment = 2;
0062     } else if (iwire >= 29 && iwire <= 40) {
0063       hvSegment = 3;
0064     } else if (iwire >= 41 && iwire <= 52) {
0065       hvSegment = 4;
0066     } else if (iwire >= 53 && iwire <= 64) {
0067       hvSegment = 5;
0068     }
0069   } else if (is == 1 && ir == 2) {
0070     if (iwire >= 25 && iwire <= 48) {
0071       hvSegment = 2;
0072     } else if (iwire >= 49 && iwire <= 64) {
0073       hvSegment = 3;
0074     }
0075   } else if (is == 1 && ir == 3) {
0076     if (iwire >= 13 && iwire <= 22) {
0077       hvSegment = 2;
0078     } else if (iwire >= 23 && iwire <= 32) {
0079       hvSegment = 3;
0080     }
0081   } else if (is == 2 && ir == 1) {
0082     if (iwire >= 45 && iwire <= 80) {
0083       hvSegment = 2;
0084     } else if (iwire >= 81 && iwire <= 112) {
0085       hvSegment = 3;
0086     }
0087   }
0088   return hvSegment;
0089 }
0090 
0091 CSCDetId CSCIndexerBase::detIdFromChamberLabel(IndexType ie, IndexType label) const {
0092   IndexType is = label / 1000;
0093   label -= is * 1000;
0094   IndexType ir = label / 100;
0095   label -= ir * 100;
0096   IndexType ic = label;
0097 
0098   return CSCDetId(ie, is, ir, ic);
0099 }
0100 
0101 CSCDetId CSCIndexerBase::detIdFromChamberIndex(IndexType ici) const {
0102   // Expected range of input range argument is 1-540.
0103   // 1-468 for CSCs installed at 2008 start-up. 469-540 for ME42.
0104 
0105   IndexType ie = 1;
0106   if (ici > 468) {
0107     // ME42
0108     ici -= 234;     // now in range 235-306
0109     if (ici > 270)  // -z
0110     {
0111       ie = 2;
0112       ici -= 36;  // now in range 235-270
0113     }
0114   } else  // in range 1-468
0115   {
0116     if (ici > 234)  // -z
0117     {
0118       ie = 2;
0119       ici -= 234;  // now in range 1-234
0120     }
0121   }
0122 
0123   IndexType label = chamberLabel_[ici];
0124   return detIdFromChamberLabel(ie, label);
0125 }
0126 
0127 CSCDetId CSCIndexerBase::detIdFromLayerIndex(IndexType ili) const {
0128   IndexType il = (ili - 1) % 6 + 1;
0129   IndexType ici = (ili - 1) / 6 + 1;
0130   CSCDetId id = detIdFromChamberIndex(ici);
0131 
0132   return CSCDetId(id.endcap(), id.station(), id.ring(), id.chamber(), il);
0133 }