File indexing completed on 2024-04-06 11:58:22
0001 #include "CalibMuon/CSCCalibration/interface/CSCIndexerBase.h"
0002
0003 CSCIndexerBase::CSCIndexerBase()
0004 : chamberLabel_(271)
0005 {
0006
0007
0008
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
0027
0028
0029
0030
0031 if (ici > 468) {
0032
0033 ici -= 234;
0034 if (ici > 270)
0035 {
0036 ici -= 36;
0037 }
0038 } else
0039 {
0040 if (ici > 234)
0041 {
0042 ici -= 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;
0050
0051 if (is > 2 && ir == 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)
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
0103
0104
0105 IndexType ie = 1;
0106 if (ici > 468) {
0107
0108 ici -= 234;
0109 if (ici > 270)
0110 {
0111 ie = 2;
0112 ici -= 36;
0113 }
0114 } else
0115 {
0116 if (ici > 234)
0117 {
0118 ie = 2;
0119 ici -= 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 }