CMS 3D CMS Logo

MuonTriggerPrimitive.cc
Go to the documentation of this file.
2 
3 // the primitive types we can use
11 
12 // detector ID types
18 
19 using namespace L1TMuon;
20 
21 namespace {
22  const char subsystem_names[][4] = {"DT","CSC","RPC","GEM"};
23 }
24 
25 //constructors from DT data
27  const L1MuDTChambPhDigi& digi_phi,
28  const int segment_number):
29  _id(detid),
30  _subsystem(TriggerPrimitive::kDT) {
32  // fill in information from theta trigger
33  _dt.theta_bti_group = -1;
34  _dt.segment_number = segment_number;
35  _dt.theta_code = -1;
36  _dt.theta_quality = -1;
37  // now phi trigger
38  _dt.bx = digi_phi.bxNum();
39  _dt.wheel = digi_phi.whNum();
40  _dt.sector = digi_phi.scNum();
41  _dt.station = digi_phi.stNum();
42  _dt.radialAngle = digi_phi.phi();
43  _dt.bendingAngle = digi_phi.phiB();
44  _dt.qualityCode = digi_phi.code();
45  _dt.Ts2TagCode = digi_phi.Ts2Tag();
46  _dt.BxCntCode = digi_phi.BxCnt();
47 }
48 
50  const L1MuDTChambThDigi& digi_th,
51  const int theta_bti_group):
52  _id(detid),
55  // fill in information from theta trigger
56  _dt.theta_bti_group = theta_bti_group;
57  _dt.segment_number = digi_th.position(theta_bti_group);
58  _dt.theta_code = digi_th.code(theta_bti_group);
59  _dt.theta_quality = digi_th.quality(theta_bti_group);
60  // now phi trigger
61  _dt.bx = digi_th.bxNum();
62  _dt.wheel = digi_th.whNum();
63  _dt.sector = digi_th.scNum();
64  _dt.station = digi_th.stNum();
65  _dt.radialAngle = -1;
66  _dt.bendingAngle = -1;
67  _dt.qualityCode = -1;
68  _dt.Ts2TagCode = -1;
69  _dt.BxCntCode = -1;
70 }
71 
73  const L1MuDTChambPhDigi& digi_phi,
74  const L1MuDTChambThDigi& digi_th,
75  const int theta_bti_group):
76  _id(detid),
79  // fill in information from theta trigger
80  _dt.theta_bti_group = theta_bti_group;
81  _dt.segment_number = digi_th.position(theta_bti_group);
82  _dt.theta_code = digi_th.code(theta_bti_group);
83  _dt.theta_quality = digi_th.quality(theta_bti_group);
84  // now phi trigger
85  _dt.bx = digi_phi.bxNum();
86  _dt.wheel = digi_phi.whNum();
87  _dt.sector = digi_phi.scNum();
88  _dt.station = digi_phi.stNum();
89  _dt.radialAngle = digi_phi.phi();
90  _dt.bendingAngle = digi_phi.phiB();
91  _dt.qualityCode = digi_phi.code();
92  _dt.Ts2TagCode = digi_phi.Ts2Tag();
93  _dt.BxCntCode = digi_phi.BxCnt();
94 }
95 
96 //constructor from CSC data
98  const CSCCorrelatedLCTDigi& digi):
99  _id(detid),
102  _csc.trknmb = digi.getTrknmb();
103  _csc.valid = digi.isValid();
104  _csc.quality = digi.getQuality();
105  _csc.keywire = digi.getKeyWG();
106  _csc.strip = digi.getStrip();
107  _csc.pattern = digi.getPattern();
108  _csc.bend = digi.getBend();
109  _csc.bx = digi.getBX();
110  _csc.mpclink = digi.getMPCLink();
111  _csc.bx0 = digi.getBX0();
112  _csc.syncErr = digi.getSyncErr();
113  _csc.cscID = digi.getCSCID();
114 
115  // Use ME1/1a --> ring 4 convention
116  if (detid.station() == 1 && detid.ring() == 1 && digi.getStrip() >= 128) {
117  _id = CSCDetId(detid.endcap(), detid.station(), 4, detid.chamber(), detid.layer());
118  _csc.strip = digi.getStrip() - 128;
119  }
120 
121  CSCCorrelatedLCTDigi digi_clone = digi; // Necessary to get around const qualifier
122  CSCALCTDigi alct = digi_clone.getALCT();
123  CSCCLCTDigi clct = digi_clone.getCLCT();
124  _csc.alct_quality = alct.getQuality();
125  _csc.clct_quality = clct.getQuality();
126 }
127 
128 // constructor from RPC data
130  const RPCDigi& digi):
131  _id(detid),
134  _rpc.strip = digi.strip();
135  _rpc.strip_low = digi.strip();
136  _rpc.strip_hi = digi.strip();
137  _rpc.phi_int = 0;
138  _rpc.theta_int = 0;
139  _rpc.emtf_sector = 0;
140  _rpc.layer = detid.layer();
141  _rpc.bx = digi.bx();
142  _rpc.valid = 1;
143  _rpc.time = digi.time();
144 }
145 
147  const unsigned strip,
148  const unsigned layer,
149  const int bx):
150  _id(detid),
153  _rpc.strip = strip;
154  _rpc.strip_low = strip;
155  _rpc.strip_hi = strip;
156  _rpc.phi_int = 0;
157  _rpc.theta_int = 0;
158  _rpc.emtf_sector = 0;
159  _rpc.layer = layer;
160  _rpc.bx = bx;
161  _rpc.valid = 1;
162  _rpc.time = -999999.;
163 }
164 
165 // constructor from CPPF data
167  const l1t::CPPFDigi& digi):
168  _id(detid),
171  // In unpacked CPPF digis, the strip number and cluster size are not available, and are set to -99
172  _rpc.strip = ( digi.first_strip() < 0 ? 0 : digi.first_strip() + (digi.cluster_size() / 2) );
173  _rpc.strip_low = ( digi.first_strip() < 0 ? 0 : digi.first_strip() );
174  _rpc.strip_hi = ( digi.first_strip() < 0 ? 0 : digi.first_strip() + digi.cluster_size() - 1 );
175  _rpc.phi_int = digi.phi_int();
176  _rpc.theta_int = digi.theta_int();
177  _rpc.emtf_sector = digi.emtf_sector();
178  _rpc.layer = detid.layer();
179  _rpc.bx = digi.bx();
180  _rpc.valid = digi.valid();
181  _rpc.isCPPF = true;
182 }
183 
184 // constructor from GEM data
186  const GEMPadDigi& digi):
187  _id(detid),
190  _gem.pad = digi.pad();
191  _gem.pad_low = digi.pad();
192  _gem.pad_hi = digi.pad();
193  _gem.bx = digi.bx();
194  _gem.bend = 0;
195  _gem.isME0 = false;
196 }
197 
199  const ME0PadDigi& digi):
200  _id(detid),
203  _gem.pad = digi.pad();
204  _gem.pad_low = digi.pad();
205  _gem.pad_hi = digi.pad();
206  _gem.bx = digi.bx();
207  _gem.bend = 0;
208  _gem.isME0 = true;
209 }
210 
212  _dt(tp._dt),
213  _csc(tp._csc),
214  _rpc(tp._rpc),
215  _gem(tp._gem),
216  _id(tp._id),
220  _eta(tp._eta),
221  _phi(tp._phi),
222  _rho(tp._rho),
223  _theta(tp._theta){
224 }
225 
227  this->_dt = tp._dt;
228  this->_csc = tp._csc;
229  this->_rpc = tp._rpc;
230  this->_gem = tp._gem;
231  this->_id = tp._id;
232  this->_subsystem = tp._subsystem;
233  this->_globalsector = tp._globalsector;
234  this->_subsector = tp._subsector;
235  this->_eta = tp._eta;
236  this->_phi = tp._phi;
237  this->_rho = tp._rho;
238  this->_theta = tp._theta;
239  return *this;
240 }
241 
243  return ( this->_dt.bx == tp._dt.bx &&
244  this->_dt.wheel == tp._dt.wheel &&
245  this->_dt.sector == tp._dt.sector &&
246  this->_dt.station == tp._dt.station &&
247  this->_dt.radialAngle == tp._dt.radialAngle &&
248  this->_dt.bendingAngle == tp._dt.bendingAngle &&
249  this->_dt.qualityCode == tp._dt.qualityCode &&
250  this->_dt.Ts2TagCode == tp._dt.Ts2TagCode &&
251  this->_dt.BxCntCode == tp._dt.BxCntCode &&
252  this->_dt.theta_bti_group == tp._dt.theta_bti_group &&
253  this->_dt.segment_number == tp._dt.segment_number &&
254  this->_dt.theta_code == tp._dt.theta_code &&
255  this->_dt.theta_quality == tp._dt.theta_quality &&
256  this->_csc.trknmb == tp._csc.trknmb &&
257  this->_csc.valid == tp._csc.valid &&
258  this->_csc.quality == tp._csc.quality &&
259  this->_csc.keywire == tp._csc.keywire &&
260  this->_csc.strip == tp._csc.strip &&
261  this->_csc.pattern == tp._csc.pattern &&
262  this->_csc.bend == tp._csc.bend &&
263  this->_csc.bx == tp._csc.bx &&
264  this->_csc.mpclink == tp._csc.mpclink &&
265  this->_csc.bx0 == tp._csc.bx0 &&
266  this->_csc.syncErr == tp._csc.syncErr &&
267  this->_csc.cscID == tp._csc.cscID &&
268  this->_rpc.strip == tp._rpc.strip &&
269  this->_rpc.strip_low == tp._rpc.strip_low &&
270  this->_rpc.strip_hi == tp._rpc.strip_hi &&
271  this->_rpc.phi_int == tp._rpc.phi_int &&
272  this->_rpc.theta_int == tp._rpc.theta_int &&
273  this->_rpc.emtf_sector == tp._rpc.emtf_sector &&
274  this->_rpc.layer == tp._rpc.layer &&
275  this->_rpc.bx == tp._rpc.bx &&
276  this->_rpc.valid == tp._rpc.valid &&
277  //this->_rpc.time == tp._rpc.time &&
278  this->_rpc.isCPPF == tp._rpc.isCPPF &&
279  this->_gem.pad == tp._gem.pad &&
280  this->_gem.pad_low == tp._gem.pad_low &&
281  this->_gem.pad_hi == tp._gem.pad_hi &&
282  this->_gem.bx == tp._gem.bx &&
283  this->_gem.bend == tp._gem.bend &&
284  this->_gem.isME0 == tp._gem.isME0 &&
285  this->_id == tp._id &&
286  this->_subsystem == tp._subsystem &&
287  this->_globalsector == tp._globalsector &&
288  this->_subsector == tp._subsector );
289 }
290 
291 const int TriggerPrimitive::getBX() const {
292  switch(_subsystem) {
293  case kDT:
294  return _dt.bx;
295  case kCSC:
296  return _csc.bx;
297  case kRPC:
298  return _rpc.bx;
299  case kGEM:
300  return _gem.bx;
301  default:
302  throw cms::Exception("Invalid Subsytem")
303  << "The specified subsystem for this track stub is out of range"
304  << std::endl;
305  }
306  return -1;
307 }
308 
309 const int TriggerPrimitive::getStrip() const {
310  switch(_subsystem) {
311  case kDT:
312  return -1;
313  case kCSC:
314  return _csc.strip;
315  case kRPC:
316  return _rpc.strip;
317  case kGEM:
318  return _gem.pad;
319  default:
320  throw cms::Exception("Invalid Subsytem")
321  << "The specified subsystem for this track stub is out of range"
322  << std::endl;
323  }
324  return -1;
325 }
326 
327 const int TriggerPrimitive::getWire() const {
328  switch(_subsystem) {
329  case kDT:
330  return -1;
331  case kCSC:
332  return _csc.keywire;
333  case kRPC:
334  return -1;
335  case kGEM:
336  return -1;
337  default:
338  throw cms::Exception("Invalid Subsytem")
339  << "The specified subsystem for this track stub is out of range"
340  << std::endl;
341  }
342  return -1;
343 }
344 
345 const int TriggerPrimitive::getPattern() const {
346  switch(_subsystem) {
347  case kDT:
348  return -1;
349  case kCSC:
350  return _csc.pattern;
351  case kRPC:
352  return -1;
353  case kGEM:
354  return -1;
355  default:
356  throw cms::Exception("Invalid Subsytem")
357  << "The specified subsystem for this track stub is out of range"
358  << std::endl;
359  }
360  return -1;
361 }
362 
363 void TriggerPrimitive::print(std::ostream& out) const {
364  unsigned idx = (unsigned) _subsystem;
365  out << subsystem_names[idx] << " Trigger Primitive" << std::endl;
366  out << "eta: " << _eta << " phi: " << _phi << " rho: " << _rho
367  << " theta: " << _theta << std::endl;
368  switch(_subsystem) {
369  case kDT:
370  out << detId<DTChamberId>() << std::endl;
371  out << "Local BX : " << _dt.bx << std::endl;
372  out << "Segment Nmb : " << _dt.segment_number << std::endl;
373  out << "Packed Phi : " << _dt.radialAngle << std::endl;
374  out << "Packed Bend : " << _dt.bendingAngle << std::endl;
375  out << "Quality Code : " << _dt.qualityCode << std::endl;
376  out << "Ts2Tag Code : " << _dt.Ts2TagCode << std::endl;
377  out << "BXCnt Code : " << _dt.BxCntCode << std::endl;
378  out << "Theta BTI Grp : " << _dt.theta_bti_group << std::endl;
379  out << "Theta Code : " << _dt.theta_code << std::endl;
380  out << "Theta Quality : " << _dt.theta_quality << std::endl;
381  break;
382  case kCSC:
383  out << detId<CSCDetId>() << std::endl;
384  out << "Local BX : " << _csc.bx << std::endl;
385  out << "Segment Nmb : " << _csc.trknmb << std::endl;
386  out << "Segment Valid : " << _csc.valid << std::endl;
387  out << "Quality Code : " << _csc.quality << std::endl;
388  out << "Key Wire Grp : " << _csc.keywire << std::endl;
389  out << "Half-Strip : " << _csc.strip << std::endl;
390  out << "CLCT Pattern : " << _csc.pattern << std::endl;
391  out << "Packed Bend : " << _csc.bend << std::endl;
392  out << "MPC Link : " << _csc.mpclink << std::endl;
393  out << "BX0 : " << _csc.bx0 << std::endl;
394  out << "Sync Error : " << _csc.syncErr << std::endl;
395  out << "CSCID : " << _csc.cscID << std::endl;
396  break;
397  case kRPC:
398  out << detId<RPCDetId>() << std::endl;
399  out << "Local BX : " << _rpc.bx << std::endl;
400  out << "Strip : " << _rpc.strip << std::endl;
401  out << "Strip Low : " << _rpc.strip_low << std::endl;
402  out << "Strip High : " << _rpc.strip_hi << std::endl;
403  out << "Integer phi : " << _rpc.phi_int << std::endl;
404  out << "Integer theta : " << _rpc.theta_int << std::endl;
405  out << "EMTF sector : " << _rpc.emtf_sector << std::endl;
406  out << "Layer : " << _rpc.layer << std::endl;
407  out << "Valid : " << _rpc.valid << std::endl;
408  out << "Time : " << _rpc.time << std::endl;
409  out << "IsCPPF : " << _rpc.isCPPF << std::endl;
410  break;
411  case kGEM:
412  if (!_gem.isME0)
413  out << detId<GEMDetId>() << std::endl;
414  else
415  out << detId<ME0DetId>() << std::endl;
416  out << "Local BX : " << _gem.bx << std::endl;
417  out << "Pad : " << _gem.pad << std::endl;
418  out << "Pad Low : " << _gem.pad_low << std::endl;
419  out << "Pad High : " << _gem.pad_hi << std::endl;
420  out << "Packed Bend : " << _gem.bend << std::endl;
421  out << "Is ME0 : " << _gem.isME0 << std::endl;
422  break;
423  default:
424  throw cms::Exception("Invalid Subsytem")
425  << "The specified subsystem for this track stub is out of range"
426  << std::endl;
427  }
428 }
int getQuality() const
return quality of a pattern (number of layers hit!)
Definition: CSCCLCTDigi.h:36
const CSCALCTDigi & getALCT() const
int chamber() const
Definition: CSCDetId.h:68
int getStrip() const
return the key halfstrip from 0,159
int emtf_sector() const
Definition: CPPFDigi.h:42
uint16_t getSyncErr() const
int pad() const
Definition: ME0PadDigi.h:26
int bx() const
Definition: RPCDigi.h:29
int getQuality() const
return the 4 bit Correlated LCT Quality
int getBend() const
return bend
int first_strip() const
Definition: CPPFDigi.h:44
TriggerPrimitive & operator=(const TriggerPrimitive &tp)
double time() const
Definition: RPCDigi.h:30
bool operator==(const TriggerPrimitive &tp) const
int quality(const int i) const
int layer() const
Definition: CSCDetId.h:61
const CSCCLCTDigi & getCLCT() const
int cluster_size() const
Definition: CPPFDigi.h:45
int position(const int i) const
int endcap() const
Definition: CSCDetId.h:93
int bx() const
Definition: CPPFDigi.h:36
int bx() const
Definition: ME0PadDigi.h:27
int strip() const
Definition: RPCDigi.h:28
void calculateGlobalSector(const IDType &chid, unsigned &globalsector, unsigned &subsector)
int theta_int() const
Definition: CPPFDigi.h:38
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 layer() const
Definition: RPCDetId.h:108
int getQuality() const
return quality of a pattern
Definition: CSCALCTDigi.h:36
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
bool isValid() const
return valid pattern bit
int getPattern() const
return pattern
int station() const
Definition: CSCDetId.h:86
int valid() const
Definition: CPPFDigi.h:39
void print(std::ostream &) const
int getKeyWG() const
return the key wire group. counts from 0.
int phi_int() const
Definition: CPPFDigi.h:37