CMS 3D CMS Logo

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