CMS 3D CMS Logo

MuonTriggerPrimitive.cc
Go to the documentation of this file.
2 
3 // the primitive types we can use
9 
10 // detector ID types
15 
16 using namespace L1TMuon;
17 
18 namespace {
19  const char subsystem_names[][4] = {"DT","CSC","RPC","GEM"};
20 }
21 
22 //constructors from DT data
24  const L1MuDTChambPhDigi& digi_phi,
25  const int segment_number):
26  _id(detid),
27  _subsystem(TriggerPrimitive::kDT) {
29  // fill in information from theta trigger
30  _dt.theta_bti_group = -1;
31  _dt.segment_number = segment_number;
32  _dt.theta_code = -1;
33  _dt.theta_quality = -1;
34  // now phi trigger
35  _dt.bx = digi_phi.bxNum();
36  _dt.wheel = digi_phi.whNum();
37  _dt.sector = digi_phi.scNum();
38  _dt.station = digi_phi.stNum();
39  _dt.radialAngle = digi_phi.phi();
40  _dt.bendingAngle = digi_phi.phiB();
41  _dt.qualityCode = digi_phi.code();
42  _dt.Ts2TagCode = digi_phi.Ts2Tag();
43  _dt.BxCntCode = digi_phi.BxCnt();
44 }
45 
47  const L1MuDTChambThDigi& digi_th,
48  const int theta_bti_group):
49  _id(detid),
52  // fill in information from theta trigger
53  _dt.theta_bti_group = theta_bti_group;
54  _dt.segment_number = digi_th.position(theta_bti_group);
55  _dt.theta_code = digi_th.code(theta_bti_group);
56  _dt.theta_quality = digi_th.quality(theta_bti_group);
57  // now phi trigger
58  _dt.bx = digi_th.bxNum();
59  _dt.wheel = digi_th.whNum();
60  _dt.sector = digi_th.scNum();
61  _dt.station = digi_th.stNum();
62  _dt.radialAngle = -1;
63  _dt.bendingAngle = -1;
64  _dt.qualityCode = -1;
65  _dt.Ts2TagCode = -1;
66  _dt.BxCntCode = -1;
67 }
68 
70  const L1MuDTChambPhDigi& digi_phi,
71  const L1MuDTChambThDigi& digi_th,
72  const int theta_bti_group):
73  _id(detid),
76  // fill in information from theta trigger
77  _dt.theta_bti_group = theta_bti_group;
78  _dt.segment_number = digi_th.position(theta_bti_group);
79  _dt.theta_code = digi_th.code(theta_bti_group);
80  _dt.theta_quality = digi_th.quality(theta_bti_group);
81  // now phi trigger
82  _dt.bx = digi_phi.bxNum();
83  _dt.wheel = digi_phi.whNum();
84  _dt.sector = digi_phi.scNum();
85  _dt.station = digi_phi.stNum();
86  _dt.radialAngle = digi_phi.phi();
87  _dt.bendingAngle = digi_phi.phiB();
88  _dt.qualityCode = digi_phi.code();
89  _dt.Ts2TagCode = digi_phi.Ts2Tag();
90  _dt.BxCntCode = digi_phi.BxCnt();
91 }
92 
93 //constructor from CSC data
95  const CSCCorrelatedLCTDigi& digi):
96  _id(detid),
99  _csc.trknmb = digi.getTrknmb();
100  _csc.valid = digi.isValid();
101  _csc.quality = digi.getQuality();
102  _csc.keywire = digi.getKeyWG();
103  _csc.strip = digi.getStrip();
104  _csc.pattern = digi.getPattern();
105  _csc.bend = digi.getBend();
106  _csc.bx = digi.getBX();
107  _csc.mpclink = digi.getMPCLink();
108  _csc.bx0 = digi.getBX0();
109  _csc.syncErr = digi.getSyncErr();
110  _csc.cscID = digi.getCSCID();
111 
112  // Use ME1/1a --> ring 4 convention
113  if (detid.station() == 1 && detid.ring() == 1 && digi.getStrip() >= 128) {
114  _id = CSCDetId(detid.endcap(), detid.station(), 4, detid.chamber(), detid.layer());
115  _csc.strip = digi.getStrip() - 128;
116  }
117 }
118 
119 
120 // constructor from RPC data
122  const unsigned strip,
123  const unsigned layer,
124  const int bx):
125  _id(detid),
128  _rpc.strip = strip;
129  _rpc.strip_low = strip;
130  _rpc.strip_hi = strip;
131  _rpc.layer = layer;
132  _rpc.bx = bx;
133  _rpc.valid = 1;
134 }
135 
136 // constructor from GEM data
138  const GEMPadDigi& digi):
139  _id(detid),
142  _gem.pad = digi.pad();
143  _gem.pad_low = digi.pad();
144  _gem.pad_hi = digi.pad();
145  _gem.bx = digi.bx();
146 }
147 
149  _dt(tp._dt),
150  _csc(tp._csc),
151  _rpc(tp._rpc),
152  _gem(tp._gem),
153  _id(tp._id),
157  _eta(tp._eta),
158  _phi(tp._phi),
159  _rho(tp._rho),
160  _theta(tp._theta){
161 }
162 
164  this->_dt = tp._dt;
165  this->_csc = tp._csc;
166  this->_rpc = tp._rpc;
167  this->_gem = tp._gem;
168  this->_id = tp._id;
169  this->_subsystem = tp._subsystem;
170  this->_globalsector = tp._globalsector;
171  this->_subsector = tp._subsector;
172  this->_eta = tp._eta;
173  this->_phi = tp._phi;
174  this->_rho = tp._rho;
175  this->_theta = tp._theta;
176  return *this;
177 }
178 
180  return ( this->_dt.bx == tp._dt.bx &&
181  this->_dt.wheel == tp._dt.wheel &&
182  this->_dt.sector == tp._dt.sector &&
183  this->_dt.station == tp._dt.station &&
184  this->_dt.radialAngle == tp._dt.radialAngle &&
185  this->_dt.bendingAngle == tp._dt.bendingAngle &&
186  this->_dt.qualityCode == tp._dt.qualityCode &&
187  this->_dt.Ts2TagCode == tp._dt.Ts2TagCode &&
188  this->_dt.BxCntCode == tp._dt.BxCntCode &&
189  this->_dt.theta_bti_group == tp._dt.theta_bti_group &&
190  this->_dt.segment_number == tp._dt.segment_number &&
191  this->_dt.theta_code == tp._dt.theta_code &&
192  this->_dt.theta_quality == tp._dt.theta_quality &&
193  this->_csc.trknmb == tp._csc.trknmb &&
194  this->_csc.valid == tp._csc.valid &&
195  this->_csc.quality == tp._csc.quality &&
196  this->_csc.keywire == tp._csc.keywire &&
197  this->_csc.strip == tp._csc.strip &&
198  this->_csc.pattern == tp._csc.pattern &&
199  this->_csc.bend == tp._csc.bend &&
200  this->_csc.bx == tp._csc.bx &&
201  this->_csc.mpclink == tp._csc.mpclink &&
202  this->_csc.bx0 == tp._csc.bx0 &&
203  this->_csc.syncErr == tp._csc.syncErr &&
204  this->_csc.cscID == tp._csc.cscID &&
205  this->_rpc.strip == tp._rpc.strip &&
206  this->_rpc.strip_low == tp._rpc.strip_low &&
207  this->_rpc.strip_hi == tp._rpc.strip_hi &&
208  this->_rpc.layer == tp._rpc.layer &&
209  this->_rpc.bx == tp._rpc.bx &&
210  this->_rpc.valid == tp._rpc.valid &&
211  this->_gem.pad == tp._gem.pad &&
212  this->_gem.pad_low == tp._gem.pad_low &&
213  this->_gem.pad_hi == tp._gem.pad_hi &&
214  this->_gem.bx == tp._gem.bx &&
215  this->_id == tp._id &&
216  this->_subsystem == tp._subsystem &&
217  this->_globalsector == tp._globalsector &&
218  this->_subsector == tp._subsector );
219 }
220 
221 const int TriggerPrimitive::getBX() const {
222  switch(_subsystem) {
223  case kDT:
224  return _dt.bx;
225  case kCSC:
226  return _csc.bx;
227  case kRPC:
228  return _rpc.bx;
229  case kGEM:
230  return _gem.bx;
231  default:
232  throw cms::Exception("Invalid Subsytem")
233  << "The specified subsystem for this track stub is out of range"
234  << std::endl;
235  }
236  return -1;
237 }
238 
239 const int TriggerPrimitive::getStrip() const {
240  switch(_subsystem) {
241  case kDT:
242  return -1;
243  case kCSC:
244  return _csc.strip;
245  case kRPC:
246  return _rpc.strip;
247  case kGEM:
248  return _gem.pad;
249  default:
250  throw cms::Exception("Invalid Subsytem")
251  << "The specified subsystem for this track stub is out of range"
252  << std::endl;
253  }
254  return -1;
255 }
256 
257 const int TriggerPrimitive::getWire() const {
258  switch(_subsystem) {
259  case kDT:
260  return -1;
261  case kCSC:
262  return _csc.keywire;
263  case kRPC:
264  return -1;
265  case kGEM:
266  return -1;
267  default:
268  throw cms::Exception("Invalid Subsytem")
269  << "The specified subsystem for this track stub is out of range"
270  << std::endl;
271  }
272  return -1;
273 }
274 
275 const int TriggerPrimitive::getPattern() const {
276  switch(_subsystem) {
277  case kDT:
278  return -1;
279  case kCSC:
280  return _csc.pattern;
281  case kRPC:
282  return -1;
283  case kGEM:
284  return -1;
285  default:
286  throw cms::Exception("Invalid Subsytem")
287  << "The specified subsystem for this track stub is out of range"
288  << std::endl;
289  }
290  return -1;
291 }
292 
294  unsigned& global_sector,
295  unsigned& subsector ) {
296  global_sector = 0;
297  subsector = 0;
298 }
299 
301  unsigned& global_sector,
302  unsigned& subsector ) {
303  global_sector = 0;
304  subsector = 0;
305 }
306 
308  unsigned& global_sector,
309  unsigned& subsector ) {
310  global_sector = 0;
311  subsector = 0;
312 }
313 
315  unsigned& global_sector,
316  unsigned& subsector ) {
317  global_sector = 0;
318  subsector = 0;
319 }
320 
321 void TriggerPrimitive::print(std::ostream& out) const {
322  unsigned idx = (unsigned) _subsystem;
323  out << subsystem_names[idx] << " Trigger Primitive" << std::endl;
324  out << "eta: " << _eta << " phi: " << _phi
325  << " bend: " << _theta << std::endl;
326  switch(_subsystem) {
327  case kDT:
328  out << detId<DTChamberId>() << std::endl;
329  out << "Local BX : " << _dt.bx << std::endl;
330  out << "Segment Nmb : " << _dt.segment_number << std::endl;
331  out << "Packed Phi : " << _dt.radialAngle << std::endl;
332  out << "Packed Bend : " << _dt.bendingAngle << std::endl;
333  out << "Quality Code : " << _dt.qualityCode << std::endl;
334  out << "Ts2Tag Code : " << _dt.Ts2TagCode << std::endl;
335  out << "BXCnt Code : " << _dt.BxCntCode << std::endl;
336  out << "Theta BTI Grp : " << _dt.theta_bti_group << std::endl;
337  out << "Theta Code : " << _dt.theta_code << std::endl;
338  out << "Theta Quality : " << _dt.theta_quality << std::endl;
339  break;
340  case kCSC:
341  out << detId<CSCDetId>() << std::endl;
342  out << "Local BX : " << _csc.bx << std::endl;
343  out << "Segment Nmb : " << _csc.trknmb << std::endl;
344  out << "Segment Valid : " << _csc.valid << std::endl;
345  out << "Quality Code : " << _csc.quality << std::endl;
346  out << "Key Wire Grp : " << _csc.keywire << std::endl;
347  out << "Half-Strip : " << _csc.strip << std::endl;
348  out << "CLCT Pattern : " << _csc.pattern << std::endl;
349  out << "Packed Bend : " << _csc.bend << std::endl;
350  out << "MPC Link : " << _csc.mpclink << std::endl;
351  out << "BX0 : " << _csc.bx0 << std::endl;
352  out << "Sync Error : " << _csc.syncErr << std::endl;
353  out << "CSCID : " << _csc.cscID << std::endl;
354  break;
355  case kRPC:
356  out << detId<RPCDetId>() << std::endl;
357  out << "Local BX : " << _rpc.bx << std::endl;
358  out << "Strip : " << _rpc.strip << std::endl;
359  out << "Strip Low : " << _rpc.strip_low << std::endl;
360  out << "Strip High : " << _rpc.strip_hi << std::endl;
361  out << "Layer : " << _rpc.layer << std::endl;
362  out << "Valid : " << _rpc.valid << std::endl;
363  break;
364  case kGEM:
365  out << detId<GEMDetId>() << std::endl;
366  out << "Local BX : " << _gem.bx << std::endl;
367  out << "Pad : " << _gem.pad << std::endl;
368  out << "Pad Low : " << _gem.pad_low << std::endl;
369  out << "Pad High : " << _gem.pad_hi << std::endl;
370  break;
371  default:
372  throw cms::Exception("Invalid Subsytem")
373  << "The specified subsystem for this track stub is out of range"
374  << std::endl;
375  }
376 }
int chamber() const
Definition: CSCDetId.h:68
int getStrip() const
return the key halfstrip from 0,159
uint16_t getSyncErr() const
void calculateGEMGlobalSector(const GEMDetId &chid, unsigned &global_sector, unsigned &subsector)
int getQuality() const
return the 4 bit Correlated LCT Quality
int getBend() const
return bend
TriggerPrimitive & operator=(const TriggerPrimitive &tp)
void calculateDTGlobalSector(const DTChamberId &chid, unsigned &global_sector, unsigned &subsector)
bool operator==(const TriggerPrimitive &tp) const
int quality(const int i) const
int layer() const
Definition: CSCDetId.h:61
int position(const int i) const
int endcap() const
Definition: CSCDetId.h:93
int pad() const
Definition: GEMPadDigi.h:27
uint16_t getCSCID() const
int getTrknmb() const
return track number
int getBX() const
return BX
uint16_t getBX0() const
int ring() const
Definition: CSCDetId.h:75
int bx() const
Definition: GEMPadDigi.h:28
int code(const int i) const
int getMPCLink() const
return MPC link number, 0 means not sorted, 1-3 give MPC sorting rank
void calculateCSCGlobalSector(const CSCDetId &chid, unsigned &global_sector, unsigned &subsector)
bool isValid() const
return valid pattern bit
int getPattern() const
return pattern
int station() const
Definition: CSCDetId.h:86
void print(std::ostream &) const
int getKeyWG() const
return the key wire group. counts from 0.
void calculateRPCGlobalSector(const RPCDetId &chid, unsigned &global_sector, unsigned &subsector)