CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MuonTriggerPrimitive.cc
Go to the documentation of this file.
2 
3 // the primitive types we can use
8 
9 // detector ID types
13 
14 using namespace L1TMuon;
15 
16 namespace {
17  const char subsystem_names[][4] = {"DT","CSC","RPC"};
18 }
19 
20 //constructors from DT data
22  const L1MuDTChambPhDigi& digi_phi,
23  const int segment_number):
24  _id(detid),
25  _subsystem(TriggerPrimitive::kDT) {
27  // fill in information from theta trigger
28  _dt.theta_bti_group = -1;
29  _dt.segment_number = segment_number;
30  _dt.theta_code = -1;
31  _dt.theta_quality = -1;
32  // now phi trigger
33  _dt.bx = digi_phi.bxNum();
34  _dt.wheel = digi_phi.whNum();
35  _dt.sector = digi_phi.scNum();
36  _dt.station = digi_phi.stNum();
37  _dt.radialAngle = digi_phi.phi();
38  _dt.bendingAngle = digi_phi.phiB();
39  _dt.qualityCode = digi_phi.code();
40  _dt.Ts2TagCode = digi_phi.Ts2Tag();
41  _dt.BxCntCode = digi_phi.BxCnt();
42 }
43 
45  const L1MuDTChambThDigi& digi_th,
46  const int theta_bti_group):
47  _id(detid),
48  _subsystem(TriggerPrimitive::kDT) {
50  // fill in information from theta trigger
51  _dt.theta_bti_group = theta_bti_group;
52  _dt.segment_number = digi_th.position(theta_bti_group);
53  _dt.theta_code = digi_th.code(theta_bti_group);
54  _dt.theta_quality = digi_th.quality(theta_bti_group);
55  // now phi trigger
56  _dt.bx = digi_th.bxNum();
57  _dt.wheel = digi_th.whNum();
58  _dt.sector = digi_th.scNum();
59  _dt.station = digi_th.stNum();
60  _dt.radialAngle = -1;
61  _dt.bendingAngle = -1;
62  _dt.qualityCode = -1;
63  _dt.Ts2TagCode = -1;
64  _dt.BxCntCode = -1;
65 }
66 
68  const L1MuDTChambPhDigi& digi_phi,
69  const L1MuDTChambThDigi& digi_th,
70  const int theta_bti_group):
71  _id(detid),
72  _subsystem(TriggerPrimitive::kDT) {
74  // fill in information from theta trigger
75  _dt.theta_bti_group = theta_bti_group;
76  _dt.segment_number = digi_th.position(theta_bti_group);
77  _dt.theta_code = digi_th.code(theta_bti_group);
78  _dt.theta_quality = digi_th.quality(theta_bti_group);
79  // now phi trigger
80  _dt.bx = digi_phi.bxNum();
81  _dt.wheel = digi_phi.whNum();
82  _dt.sector = digi_phi.scNum();
83  _dt.station = digi_phi.stNum();
84  _dt.radialAngle = digi_phi.phi();
85  _dt.bendingAngle = digi_phi.phiB();
86  _dt.qualityCode = digi_phi.code();
87  _dt.Ts2TagCode = digi_phi.Ts2Tag();
88  _dt.BxCntCode = digi_phi.BxCnt();
89 }
90 
91 //constructor from CSC data
93  const CSCCorrelatedLCTDigi& digi):
94  _id(detid),
95  _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 
111 // Create copy of TP1 with wire from TP2
113 
115  _id = tp1.detId<CSCDetId>();
116  _csc.trknmb = tp1._csc.trknmb;
117  _csc.valid = tp1._csc.valid;
118  _csc.quality = tp1._csc.quality;
119  _csc.keywire = tp2._csc.keywire;
120  _csc.strip = tp1._csc.strip;
121  _csc.pattern = tp1._csc.pattern;
122  _csc.bend = tp1._csc.bend;
123  _csc.bx = tp1._csc.bx;
124  _csc.mpclink = tp1._csc.mpclink;
125  _csc.bx0 = tp1._csc.bx0;
126  _csc.syncErr = tp1._csc.syncErr;
127  _csc.cscID = tp1._csc.cscID;
128 
129 }
130 
131 
132 // constructor from RPC data
134  const unsigned strip,
135  const unsigned layer,
136  const uint16_t bx):
137  _id(detid),
138  _subsystem(TriggerPrimitive::kRPC) {
140  _rpc.strip = strip;
141  _rpc.layer = layer;
142  _rpc.bx = bx;
143 }
144 /*
145 TriggerPrimitive::TriggerPrimitive(const TriggerPrimitive& tp):
146  _dt(tp._dt),
147  _csc(tp._csc),
148  _rpc(tp._rpc),
149  _id(tp._id),
150  _subsystem(tp._subsystem),
151  _globalsector(tp._globalsector),
152  _subsector(tp._subsector),
153  _eta(tp._eta),
154  _phi(tp._phi),
155  _theta(tp._theta){
156 }*/
157 
159  this->_dt = tp._dt;
160  this->_csc = tp._csc;
161  this->_rpc = tp._rpc;
162  this->_id = tp._id;
163  this->_subsystem = tp._subsystem;
164  this->_globalsector = tp._globalsector;
165  this->_subsector = tp._subsector;
166  this->_eta = tp._eta;
167  this->_phi = tp._phi;
168  return *this;
169 }
170 
171 
173  _dt(tp._dt),
174  _csc(tp._csc),
175  _rpc(tp._rpc),
176  _id(tp._id),
177  _subsystem(tp._subsystem),
178  _globalsector(tp._globalsector),
179  _subsector(tp._subsector),
180  _eta(tp._eta),
181  _phi(tp._phi),
182  _rho(tp._rho),
183  _theta(tp._theta){
184 }
185 
187  return ( this->_dt.bx == tp._dt.bx &&
188  this->_dt.wheel == tp._dt.wheel &&
189  this->_dt.sector == tp._dt.sector &&
190  this->_dt.station == tp._dt.station &&
191  this->_dt.radialAngle == tp._dt.radialAngle &&
192  this->_dt.bendingAngle == tp._dt.bendingAngle &&
193  this->_dt.qualityCode == tp._dt.qualityCode &&
194  this->_dt.Ts2TagCode == tp._dt.Ts2TagCode &&
195  this->_dt.BxCntCode == tp._dt.BxCntCode &&
196  this->_dt.theta_bti_group == tp._dt.theta_bti_group &&
197  this->_dt.segment_number == tp._dt.segment_number &&
198  this->_dt.theta_code == tp._dt.theta_code &&
199  this->_dt.theta_quality == tp._dt.theta_quality &&
200  this->_csc.trknmb == tp._csc.trknmb &&
201  this->_csc.valid == tp._csc.valid &&
202  this->_csc.quality == tp._csc.quality &&
203  this->_csc.keywire == tp._csc.keywire &&
204  this->_csc.strip == tp._csc.strip &&
205  this->_csc.pattern == tp._csc.pattern &&
206  this->_csc.bend == tp._csc.bend &&
207  this->_csc.bx == tp._csc.bx &&
208  this->_csc.mpclink == tp._csc.mpclink &&
209  this->_csc.bx0 == tp._csc.bx0 &&
210  this->_csc.syncErr == tp._csc.syncErr &&
211  this->_csc.cscID == tp._csc.cscID &&
212  this->_rpc.strip == tp._rpc.strip &&
213  this->_rpc.layer == tp._rpc.layer &&
214  this->_rpc.bx == tp._rpc.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  default:
230  throw cms::Exception("Invalid Subsytem")
231  << "The specified subsystem for this track stub is out of range"
232  << std::endl;
233  }
234  return -1;
235 }
236 
237 const int TriggerPrimitive::getStrip() const {
238  switch(_subsystem) {
239  case kDT:
240  return -1;
241  case kCSC:
242  return _csc.strip;
243  case kRPC:
244  return _rpc.strip;
245  default:
246  throw cms::Exception("Invalid Subsytem")
247  << "The specified subsystem for this track stub is out of range"
248  << std::endl;
249  }
250  return -1;
251 }
252 
253 const int TriggerPrimitive::getWire() const {
254  switch(_subsystem) {
255  case kDT:
256  return -1;
257  case kCSC:
258  return _csc.keywire;
259  case kRPC:
260  return -1;
261  default:
262  throw cms::Exception("Invalid Subsytem")
263  << "The specified subsystem for this track stub is out of range"
264  << std::endl;
265  }
266  return -1;
267 }
268 
269 const int TriggerPrimitive::getPattern() const {
270  switch(_subsystem) {
271  case kDT:
272  return -1;
273  case kCSC:
274  return _csc.pattern;
275  case kRPC:
276  return -1;
277  default:
278  throw cms::Exception("Invalid Subsytem")
279  << "The specified subsystem for this track stub is out of range"
280  << std::endl;
281  }
282  return -1;
283 }
284 const int TriggerPrimitive::Id() const {
285  switch(_subsystem) {
286  case kDT:
287  return -1;
288  case kCSC:
289  return _csc.cscID;
290  case kRPC:
291  return -1;
292  default:
293  throw cms::Exception("Invalid Subsytem")
294  << "The specified subsystem for this track stub is out of range"
295  << std::endl;
296  }
297  return -1;
298 }
299 
301  unsigned& global_sector,
302  unsigned& subsector ) {
303 }
304 
306  unsigned& global_sector,
307  unsigned& subsector ) {
308 }
309 
311  unsigned& global_sector,
312  unsigned& subsector ) {
313 }
314 
315 void TriggerPrimitive::print(std::ostream& out) const {
316  unsigned idx = (unsigned) _subsystem;
317  out << subsystem_names[idx] << " Trigger Primitive" << std::endl;
318  out << "eta: " << _eta << " phi: " << _phi
319  << " bend: " << _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 << "Layer : " << _rpc.layer << std::endl;
354  break;
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 }
int getStrip() const
return the key halfstrip from 0,159
uint16_t getSyncErr() const
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 position(const int i) const
uint16_t getCSCID() const
int getTrknmb() const
return track number
int getBX() const
return BX
uint16_t getBX0() const
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
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
void print(std::ostream &) const
int getKeyWG() const
return the key wire group
void calculateRPCGlobalSector(const RPCDetId &chid, unsigned &global_sector, unsigned &subsector)