CMS 3D CMS Logo

CSCTriggerNumbering.cc
Go to the documentation of this file.
4 
6  if (station < CSCDetId::minStationId() || station > CSCDetId::maxStationId() || triggerCSCID < MIN_CSCID ||
7  triggerCSCID > MAX_CSCID)
8  throw cms::Exception("CSCTriggerNumbering::InvalidInput")
9  << "CSCTriggerNumbering::ringFromTriggerLabels():"
10  << " Station: " << station << " TriggerCSCID: " << triggerCSCID << " is not a valid set of labels."
11  << " Cannot Convert!!";
12 
13  int ring = 0;
14 
15  if (station == 1)
16  if (triggerCSCID <= 3)
17  ring = 1;
18  else if (triggerCSCID <= 6)
19  ring = 2;
20  else
21  ring = 3;
22  else if (triggerCSCID <= 3)
23  ring = 1;
24  else
25  ring = 2;
26 
27  return ring;
28 }
29 
31  int TriggerSubSector,
32  int station,
33  int TriggerCSCID) {
34  if (TriggerSector < MIN_TRIGSECTOR || TriggerSector > MAX_TRIGSECTOR || TriggerSubSector < MIN_TRIGSUBSECTOR ||
35  TriggerSubSector > MAX_TRIGSUBSECTOR || station < CSCDetId::minStationId() ||
36  station > CSCDetId::maxStationId() || TriggerCSCID < MIN_CSCID || TriggerCSCID > MAX_CSCID)
37  throw cms::Exception("CSCTriggerNumbering::InvalidInput")
38  << "CSCTriggerNumbering::chamberFromTriggerLabels():"
39  << " Trigger Sector: " << TriggerSector << " Trigger SubSector: " << TriggerSubSector << " Station: " << station
40  << " TriggerCSCID: " << TriggerCSCID << " is not a valid set of labels."
41  << " Cannot Convert!!";
42 
43  int chamber = 0;
44  int realsubsector = (TriggerSubSector + 2 * (TriggerSector - 1)) % 12 + 1; // station 1 only
45 
46  if (station != 1)
47  if (TriggerCSCID <= 3)
48  // Derived from CMS Note: CMS IN 2000/04 ver 2.1 Oct/2005
49  // As far as I know this is reality.
50  chamber = (TriggerCSCID + 3 * (TriggerSector - 1)) % 18 + 1;
51 
52  else
53  chamber = (TriggerCSCID + 6 * (TriggerSector - 1) - 2) % 36 + 1;
54  else if (TriggerCSCID <= 3)
55  chamber = (TriggerCSCID + 3 * (realsubsector - 1) + 34) % 36 + 1;
56  else if (TriggerCSCID <= 6)
57  chamber = (TriggerCSCID + 3 * (realsubsector - 1) + 31) % 36 + 1;
58  else
59  chamber = (TriggerCSCID + 3 * (realsubsector - 1) + 28) % 36 + 1;
60 
61  return chamber;
62 }
63 
64 int CSCTriggerNumbering::sectorFromTriggerLabels(int TriggerSector, int TriggerSubSector, int station) {
65  if (TriggerSector < MIN_TRIGSECTOR || TriggerSector > MAX_TRIGSECTOR || TriggerSubSector < MIN_TRIGSUBSECTOR ||
67  throw cms::Exception("CSCTriggerNumbering::InvalidInput")
68  << "CSCTriggerNumbering::sectorFromTriggerLabels():"
69  << " Trigger Sector: " << TriggerSector << " Trigger SubSector: " << TriggerSubSector << " Station: " << station
70  << " is not a valid set of labels."
71  << " Cannot Convert!!";
72 
73  return ((station == 1) ? ((TriggerSubSector + 2 * (TriggerSector - 1)) % 12 + 1) : TriggerSector);
74 }
75 
79  throw cms::Exception("CSCTriggerNumbering::InvalidInput")
80  << "CSCTriggerNumbering::triggerSectorFromLabels():"
81  << " Station: " << station << " Ring: " << ring << " Chamber: " << chamber << " is not a valid set of labels."
82  << " Cannot Convert!!";
83 
84  int result;
85  // This version 16-Nov-99 ptc to match simplified chamber labelling for cms116
86  //@@ REQUIRES UPDATE TO 2005 REALITY, ONCE I UNDERSTAND WHAT THAT IS
87  // UPDATED - LGRAY Feb 2006
88 
89  if (station > 1 && ring > 1) {
90  result = ((static_cast<unsigned>(chamber - 3) & 0x7f) / 6) + 1; // ch 3-8->1, 9-14->2, ... 1,2 -> 6
91  } else {
92  result = (station != 1) ? ((static_cast<unsigned>(chamber - 2) & 0x1f) / 3) + 1 : // ch 2-4-> 1, 5-7->2, ...
93  ((static_cast<unsigned>(chamber - 3) & 0x7f) / 6) + 1;
94  }
95 
96  // Max sector is 6, some calculations give a value greater than six but this is expected
97  // and delt with.
98  return (result <= 6) ? result : 6;
99 }
100 
102  return triggerSectorFromLabels(id.station(), id.ring(), id.chamber());
103 }
104 
108  throw cms::Exception("CSCTriggerNumbering::InvalidInput")
109  << "CSCTriggerNumbering::triggerSectorFromLabels():"
110  << " Station: " << station << " Chamber: " << chamber << " is not a valid set of labels."
111  << " Cannot Convert!!";
112 
113  if (station != 1)
114  return 0; // only station one has subsectors
115 
116  switch (chamber) // first make things easier to deal with
117  {
118  case 1:
119  chamber = 36;
120  break;
121  case 2:
122  chamber = 35;
123  break;
124  default:
125  chamber -= 2;
126  }
127 
128  chamber = ((chamber - 1) % 6) + 1; // renumber all chambers to 1-6
129 
130  return ((chamber - 1) / 3) + 1; // [1,3] -> 1 , [4,6]->2
131 }
132 
134  return triggerSubSectorFromLabels(id.station(), id.chamber());
135 }
136 
138 {
141  throw cms::Exception("CSCTriggerNumbering::InvalidInput")
142  << "CSCTriggerNumbering::triggerSectorFromLabels():"
143  << " Station: " << station << " Ring: " << ring << " Chamber: " << chamber << " is not a valid set of labels."
144  << " Cannot Convert!!";
145 
146  int result;
147 
148  if (station == 1) {
149  result = (chamber) % 3 + 1; // 1,2,3
150  switch (ring) {
151  case 1:
152  break;
153  case 2:
154  result += 3; // 4,5,6
155  break;
156  case 3:
157  result += 6; // 7,8,9
158  break;
159  }
160  } else {
161  if (ring == 1) {
162  result = (chamber + 1) % 3 + 1; // 1,2,3
163  } else {
164  result = (chamber + 3) % 6 + 4; // 4,5,6,7,8,9
165  }
166  }
167  return result;
168 }
169 
171  return triggerCscIdFromLabels(id.station(), id.ring(), id.chamber());
172 }
CSCTriggerNumbering::MIN_CSCID
Definition: CSCTriggerNumbering.h:124
CSCTriggerNumbering::triggerSectorFromLabels
static int triggerSectorFromLabels(int station, int ring, int chamber)
Definition: CSCTriggerNumbering.cc:76
CSCDetId::maxStationId
static int maxStationId()
Definition: CSCDetId.h:222
relativeConstraints.station
station
Definition: relativeConstraints.py:67
CSCTriggerNumbering::MIN_TRIGSUBSECTOR
Definition: CSCTriggerNumbering.h:124
CSCTriggerNumbering::MAX_TRIGSUBSECTOR
Definition: CSCTriggerNumbering.h:121
CSCTriggerNumbering::triggerSubSectorFromLabels
static int triggerSubSectorFromLabels(int station, int chamber)
Definition: CSCTriggerNumbering.cc:105
CSCDetId::minChamberId
static int minChamberId()
Definition: CSCDetId.h:225
CSCTriggerNumbering::triggerCscIdFromLabels
static int triggerCscIdFromLabels(int station, int ring, int chamber)
Definition: CSCTriggerNumbering.cc:137
CSCDetId.h
CSCDetId::minStationId
static int minStationId()
Definition: CSCDetId.h:221
CSCDetId::maxRingId
static int maxRingId()
Definition: CSCDetId.h:224
CSCTriggerNumbering.h
CSCTriggerNumbering::MAX_TRIGSECTOR
Definition: CSCTriggerNumbering.h:121
CSCDetId
Definition: CSCDetId.h:26
CSCDetId::maxChamberId
static int maxChamberId()
Definition: CSCDetId.h:226
CSCTriggerNumbering::ringFromTriggerLabels
static int ringFromTriggerLabels(int station, int triggerCSCID)
Definition: CSCTriggerNumbering.cc:5
CSCTriggerNumbering::chamberFromTriggerLabels
static int chamberFromTriggerLabels(int TriggerSector, int TriggerSubSector, int station, int TriggerCSCID)
Definition: CSCTriggerNumbering.cc:30
CSCTriggerNumbering::MAX_CSCID
Definition: CSCTriggerNumbering.h:121
Exception
Definition: hltDiff.cc:246
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
Exception.h
mps_fire.result
result
Definition: mps_fire.py:303
CSCTriggerNumbering::sectorFromTriggerLabels
static int sectorFromTriggerLabels(int TriggerSector, int TriggerSubSector, int station)
Definition: CSCTriggerNumbering.cc:64
CSCDetId::minRingId
static int minRingId()
Definition: CSCDetId.h:223