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), _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), _subsystem(TriggerPrimitive::kDT) {
53  // fill in information from theta trigger
54  _dt.theta_bti_group = theta_bti_group;
55  _dt.segment_number = digi_th.position(theta_bti_group);
56  _dt.theta_code = digi_th.code(theta_bti_group);
57  _dt.theta_quality = digi_th.quality(theta_bti_group);
58  // now phi trigger
59  _dt.bx = digi_th.bxNum();
60  _dt.wheel = digi_th.whNum();
61  _dt.sector = digi_th.scNum();
62  _dt.station = digi_th.stNum();
63  _dt.radialAngle = -1;
64  _dt.bendingAngle = -1;
65  _dt.qualityCode = -1;
66  _dt.Ts2TagCode = -1;
67  _dt.BxCntCode = -1;
68 }
69 
71  const L1MuDTChambPhDigi& digi_phi,
72  const L1MuDTChambThDigi& digi_th,
73  const int theta_bti_group)
74  : _id(detid), _subsystem(TriggerPrimitive::kDT) {
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  : _id(detid), _subsystem(TriggerPrimitive::kCSC) {
97  _csc.trknmb = digi.getTrknmb();
98  _csc.valid = digi.isValid();
99  _csc.quality = digi.getQuality();
100  _csc.keywire = digi.getKeyWG();
101  _csc.strip = digi.getStrip();
102  _csc.pattern = digi.getPattern();
103  _csc.bend = digi.getBend();
104  _csc.bx = digi.getBX();
105  _csc.mpclink = digi.getMPCLink();
106  _csc.bx0 = digi.getBX0();
107  _csc.syncErr = digi.getSyncErr();
108  _csc.cscID = digi.getCSCID();
109 
110  // Use ME1/1a --> ring 4 convention
111  if (detid.station() == 1 && detid.ring() == 1 && digi.getStrip() >= 128) {
112  _id = CSCDetId(detid.endcap(), detid.station(), 4, detid.chamber(), detid.layer());
113  _csc.strip = digi.getStrip() - 128;
114  }
115 
116  CSCCorrelatedLCTDigi digi_clone = digi; // Necessary to get around const qualifier
117  CSCALCTDigi alct = digi_clone.getALCT();
118  CSCCLCTDigi clct = digi_clone.getCLCT();
119  _csc.alct_quality = alct.getQuality();
120  _csc.clct_quality = clct.getQuality();
121 }
122 
123 // constructor from RPC data
125  : _id(detid), _subsystem(TriggerPrimitive::kRPC) {
127  _rpc.strip = digi.strip();
128  _rpc.strip_low = digi.strip();
129  _rpc.strip_hi = digi.strip();
130  _rpc.phi_int = 0;
131  _rpc.theta_int = 0;
132  _rpc.emtf_sector = 0;
133  _rpc.layer = detid.layer();
134  _rpc.bx = digi.bx();
135  _rpc.valid = 1;
136  _rpc.time = digi.time();
137 }
138 
139 TriggerPrimitive::TriggerPrimitive(const RPCDetId& detid, const unsigned strip, const unsigned layer, const int bx)
140  : _id(detid), _subsystem(TriggerPrimitive::kRPC) {
142  _rpc.strip = strip;
143  _rpc.strip_low = strip;
144  _rpc.strip_hi = strip;
145  _rpc.phi_int = 0;
146  _rpc.theta_int = 0;
147  _rpc.emtf_sector = 0;
148  _rpc.layer = layer;
149  _rpc.bx = bx;
150  _rpc.valid = 1;
151  _rpc.time = -999999.;
152 }
153 
154 // constructor from CPPF data
156  : _id(detid), _subsystem(TriggerPrimitive::kRPC) {
158  // In unpacked CPPF digis, the strip number and cluster size are not available, and are set to -99
159  _rpc.strip = (digi.first_strip() < 0 ? 0 : digi.first_strip() + (digi.cluster_size() / 2));
160  _rpc.strip_low = (digi.first_strip() < 0 ? 0 : digi.first_strip());
161  _rpc.strip_hi = (digi.first_strip() < 0 ? 0 : digi.first_strip() + digi.cluster_size() - 1);
162  _rpc.phi_int = digi.phi_int();
163  _rpc.theta_int = digi.theta_int();
164  _rpc.emtf_sector = digi.emtf_sector();
165  _rpc.layer = detid.layer();
166  _rpc.bx = digi.bx();
167  _rpc.valid = digi.valid();
168  _rpc.isCPPF = true;
169 }
170 
171 // constructor from GEM data
173  : _id(detid), _subsystem(TriggerPrimitive::kGEM) {
175  _gem.pad = digi.pad();
176  _gem.pad_low = digi.pad();
177  _gem.pad_hi = digi.pad();
178  _gem.bx = digi.bx();
179  _gem.bend = 0;
180  _gem.isME0 = false;
181 }
182 
184  : _id(detid), _subsystem(TriggerPrimitive::kGEM) {
186  _gem.pad = digi.pad();
187  _gem.pad_low = digi.pad();
188  _gem.pad_hi = digi.pad();
189  _gem.bx = digi.bx();
190  _gem.bend = 0;
191  _gem.isME0 = true;
192 }
193 
195  : _dt(tp._dt),
196  _csc(tp._csc),
197  _rpc(tp._rpc),
198  _gem(tp._gem),
199  _id(tp._id),
203  _eta(tp._eta),
204  _phi(tp._phi),
205  _rho(tp._rho),
206  _theta(tp._theta) {}
207 
209  this->_dt = tp._dt;
210  this->_csc = tp._csc;
211  this->_rpc = tp._rpc;
212  this->_gem = tp._gem;
213  this->_id = tp._id;
214  this->_subsystem = tp._subsystem;
215  this->_globalsector = tp._globalsector;
216  this->_subsector = tp._subsector;
217  this->_eta = tp._eta;
218  this->_phi = tp._phi;
219  this->_rho = tp._rho;
220  this->_theta = tp._theta;
221  return *this;
222 }
223 
225  return (this->_dt.bx == tp._dt.bx && this->_dt.wheel == tp._dt.wheel && this->_dt.sector == tp._dt.sector &&
226  this->_dt.station == tp._dt.station && this->_dt.radialAngle == tp._dt.radialAngle &&
227  this->_dt.bendingAngle == tp._dt.bendingAngle && this->_dt.qualityCode == tp._dt.qualityCode &&
228  this->_dt.Ts2TagCode == tp._dt.Ts2TagCode && this->_dt.BxCntCode == tp._dt.BxCntCode &&
229  this->_dt.theta_bti_group == tp._dt.theta_bti_group && this->_dt.segment_number == tp._dt.segment_number &&
230  this->_dt.theta_code == tp._dt.theta_code && this->_dt.theta_quality == tp._dt.theta_quality &&
231  this->_csc.trknmb == tp._csc.trknmb && this->_csc.valid == tp._csc.valid &&
232  this->_csc.quality == tp._csc.quality && this->_csc.keywire == tp._csc.keywire &&
233  this->_csc.strip == tp._csc.strip && this->_csc.pattern == tp._csc.pattern &&
234  this->_csc.bend == tp._csc.bend && this->_csc.bx == tp._csc.bx && this->_csc.mpclink == tp._csc.mpclink &&
235  this->_csc.bx0 == tp._csc.bx0 && this->_csc.syncErr == tp._csc.syncErr && this->_csc.cscID == tp._csc.cscID &&
236  this->_rpc.strip == tp._rpc.strip && this->_rpc.strip_low == tp._rpc.strip_low &&
237  this->_rpc.strip_hi == tp._rpc.strip_hi && this->_rpc.phi_int == tp._rpc.phi_int &&
238  this->_rpc.theta_int == tp._rpc.theta_int && this->_rpc.emtf_sector == tp._rpc.emtf_sector &&
239  this->_rpc.layer == tp._rpc.layer && this->_rpc.bx == tp._rpc.bx && this->_rpc.valid == tp._rpc.valid &&
240  //this->_rpc.time == tp._rpc.time &&
241  this->_rpc.isCPPF == tp._rpc.isCPPF && this->_gem.pad == tp._gem.pad &&
242  this->_gem.pad_low == tp._gem.pad_low && this->_gem.pad_hi == tp._gem.pad_hi && this->_gem.bx == tp._gem.bx &&
243  this->_gem.bend == tp._gem.bend && this->_gem.isME0 == tp._gem.isME0 && this->_id == tp._id &&
244  this->_subsystem == tp._subsystem && this->_globalsector == tp._globalsector &&
245  this->_subsector == tp._subsector);
246 }
247 
248 const int TriggerPrimitive::getBX() const {
249  switch (_subsystem) {
250  case kDT:
251  return _dt.bx;
252  case kCSC:
253  return _csc.bx;
254  case kRPC:
255  return _rpc.bx;
256  case kGEM:
257  return _gem.bx;
258  default:
259  throw cms::Exception("Invalid Subsytem")
260  << "The specified subsystem for this track stub is out of range" << std::endl;
261  }
262  return -1;
263 }
264 
265 const int TriggerPrimitive::getStrip() const {
266  switch (_subsystem) {
267  case kDT:
268  return -1;
269  case kCSC:
270  return _csc.strip;
271  case kRPC:
272  return _rpc.strip;
273  case kGEM:
274  return _gem.pad;
275  default:
276  throw cms::Exception("Invalid Subsytem")
277  << "The specified subsystem for this track stub is out of range" << std::endl;
278  }
279  return -1;
280 }
281 
282 const int TriggerPrimitive::getWire() const {
283  switch (_subsystem) {
284  case kDT:
285  return -1;
286  case kCSC:
287  return _csc.keywire;
288  case kRPC:
289  return -1;
290  case kGEM:
291  return -1;
292  default:
293  throw cms::Exception("Invalid Subsytem")
294  << "The specified subsystem for this track stub is out of range" << std::endl;
295  }
296  return -1;
297 }
298 
299 const int TriggerPrimitive::getPattern() const {
300  switch (_subsystem) {
301  case kDT:
302  return -1;
303  case kCSC:
304  return _csc.pattern;
305  case kRPC:
306  return -1;
307  case kGEM:
308  return -1;
309  default:
310  throw cms::Exception("Invalid Subsytem")
311  << "The specified subsystem for this track stub is out of range" << std::endl;
312  }
313  return -1;
314 }
315 
316 void TriggerPrimitive::print(std::ostream& out) const {
317  unsigned idx = (unsigned)_subsystem;
318  out << subsystem_names[idx] << " Trigger Primitive" << std::endl;
319  out << "eta: " << _eta << " phi: " << _phi << " rho: " << _rho << " theta: " << _theta << std::endl;
320  switch (_subsystem) {
321  case kDT:
322  out << detId<DTChamberId>() << std::endl;
323  out << "Local BX : " << _dt.bx << std::endl;
324  out << "Segment Nmb : " << _dt.segment_number << std::endl;
325  out << "Packed Phi : " << _dt.radialAngle << std::endl;
326  out << "Packed Bend : " << _dt.bendingAngle << std::endl;
327  out << "Quality Code : " << _dt.qualityCode << std::endl;
328  out << "Ts2Tag Code : " << _dt.Ts2TagCode << std::endl;
329  out << "BXCnt Code : " << _dt.BxCntCode << std::endl;
330  out << "Theta BTI Grp : " << _dt.theta_bti_group << std::endl;
331  out << "Theta Code : " << _dt.theta_code << std::endl;
332  out << "Theta Quality : " << _dt.theta_quality << std::endl;
333  break;
334  case kCSC:
335  out << detId<CSCDetId>() << std::endl;
336  out << "Local BX : " << _csc.bx << std::endl;
337  out << "Segment Nmb : " << _csc.trknmb << std::endl;
338  out << "Segment Valid : " << _csc.valid << std::endl;
339  out << "Quality Code : " << _csc.quality << std::endl;
340  out << "Key Wire Grp : " << _csc.keywire << std::endl;
341  out << "Half-Strip : " << _csc.strip << std::endl;
342  out << "CLCT Pattern : " << _csc.pattern << std::endl;
343  out << "Packed Bend : " << _csc.bend << std::endl;
344  out << "MPC Link : " << _csc.mpclink << std::endl;
345  out << "BX0 : " << _csc.bx0 << std::endl;
346  out << "Sync Error : " << _csc.syncErr << std::endl;
347  out << "CSCID : " << _csc.cscID << std::endl;
348  break;
349  case kRPC:
350  out << detId<RPCDetId>() << std::endl;
351  out << "Local BX : " << _rpc.bx << std::endl;
352  out << "Strip : " << _rpc.strip << std::endl;
353  out << "Strip Low : " << _rpc.strip_low << std::endl;
354  out << "Strip High : " << _rpc.strip_hi << std::endl;
355  out << "Integer phi : " << _rpc.phi_int << std::endl;
356  out << "Integer theta : " << _rpc.theta_int << std::endl;
357  out << "EMTF sector : " << _rpc.emtf_sector << std::endl;
358  out << "Layer : " << _rpc.layer << std::endl;
359  out << "Valid : " << _rpc.valid << std::endl;
360  out << "Time : " << _rpc.time << std::endl;
361  out << "IsCPPF : " << _rpc.isCPPF << std::endl;
362  break;
363  case kGEM:
364  if (!_gem.isME0)
365  out << detId<GEMDetId>() << std::endl;
366  else
367  out << detId<ME0DetId>() << std::endl;
368  out << "Local BX : " << _gem.bx << std::endl;
369  out << "Pad : " << _gem.pad << std::endl;
370  out << "Pad Low : " << _gem.pad_low << std::endl;
371  out << "Pad High : " << _gem.pad_hi << std::endl;
372  out << "Packed Bend : " << _gem.bend << std::endl;
373  out << "Is ME0 : " << _gem.isME0 << std::endl;
374  break;
375  default:
376  throw cms::Exception("Invalid Subsytem")
377  << "The specified subsystem for this track stub is out of range" << std::endl;
378  }
379 }
int getQuality() const
return quality of a pattern (number of layers hit!)
Definition: CSCCLCTDigi.h:41
const CSCALCTDigi & getALCT() const
int chamber() const
Definition: CSCDetId.h:62
int getStrip() const
return the key halfstrip from 0,159
int emtf_sector() const
Definition: CPPFDigi.h:58
uint16_t getSyncErr() const
int pad() const
Definition: ME0PadDigi.h:25
int bx() const
Definition: RPCDigi.h:28
int getQuality() const
return the 4 bit Correlated LCT Quality
int getBend() const
return bend
int first_strip() const
Definition: CPPFDigi.h:60
TriggerPrimitive & operator=(const TriggerPrimitive &tp)
double time() const
Definition: RPCDigi.h:29
bool operator==(const TriggerPrimitive &tp) const
int quality(const int i) const
int layer() const
Definition: CSCDetId.h:56
const CSCCLCTDigi & getCLCT() const
int cluster_size() const
Definition: CPPFDigi.h:61
int position(const int i) const
int endcap() const
Definition: CSCDetId.h:85
int bx() const
Definition: CPPFDigi.h:52
int bx() const
Definition: ME0PadDigi.h:26
int strip() const
Definition: RPCDigi.h:27
void calculateGlobalSector(const IDType &chid, unsigned &globalsector, unsigned &subsector)
int theta_int() const
Definition: CPPFDigi.h:54
int pad() const
Definition: GEMPadDigi.h:26
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:68
int layer() const
Definition: RPCDetId.h:85
int getQuality() const
return quality of a pattern
Definition: CSCALCTDigi.h:38
int bx() const
Definition: GEMPadDigi.h:27
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:79
int valid() const
Definition: CPPFDigi.h:55
void print(std::ostream &) const
int getKeyWG() const
return the key wire group. counts from 0.
int phi_int() const
Definition: CPPFDigi.h:53