test
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 // constructor from RPC data
113  const unsigned strip,
114  const unsigned layer,
115  const uint16_t bx):
116  _id(detid),
117  _subsystem(TriggerPrimitive::kRPC) {
119  _rpc.strip = strip;
120  _rpc.layer = layer;
121  _rpc.bx = bx;
122 }
123 /*
124 TriggerPrimitive::TriggerPrimitive(const TriggerPrimitive& tp):
125  _dt(tp._dt),
126  _csc(tp._csc),
127  _rpc(tp._rpc),
128  _id(tp._id),
129  _subsystem(tp._subsystem),
130  _globalsector(tp._globalsector),
131  _subsector(tp._subsector),
132  _eta(tp._eta),
133  _phi(tp._phi),
134  _theta(tp._theta){
135 }*/
136 
138  this->_dt = tp._dt;
139  this->_csc = tp._csc;
140  this->_rpc = tp._rpc;
141  this->_id = tp._id;
142  this->_subsystem = tp._subsystem;
143  this->_globalsector = tp._globalsector;
144  this->_subsector = tp._subsector;
145  this->_eta = tp._eta;
146  this->_phi = tp._phi;
147  return *this;
148 }
149 
150 
152  _dt(tp._dt),
153  _csc(tp._csc),
154  _rpc(tp._rpc),
155  _id(tp._id),
156  _subsystem(tp._subsystem),
157  _globalsector(tp._globalsector),
158  _subsector(tp._subsector),
159  _eta(tp._eta),
160  _phi(tp._phi),
161  _rho(tp._rho),
162  _theta(tp._theta){
163 }
164 
166  return ( this->_dt.bx == tp._dt.bx &&
167  this->_dt.wheel == tp._dt.wheel &&
168  this->_dt.sector == tp._dt.sector &&
169  this->_dt.station == tp._dt.station &&
170  this->_dt.radialAngle == tp._dt.radialAngle &&
171  this->_dt.bendingAngle == tp._dt.bendingAngle &&
172  this->_dt.qualityCode == tp._dt.qualityCode &&
173  this->_dt.Ts2TagCode == tp._dt.Ts2TagCode &&
174  this->_dt.BxCntCode == tp._dt.BxCntCode &&
175  this->_dt.theta_bti_group == tp._dt.theta_bti_group &&
176  this->_dt.segment_number == tp._dt.segment_number &&
177  this->_dt.theta_code == tp._dt.theta_code &&
178  this->_dt.theta_quality == tp._dt.theta_quality &&
179  this->_csc.trknmb == tp._csc.trknmb &&
180  this->_csc.valid == tp._csc.valid &&
181  this->_csc.quality == tp._csc.quality &&
182  this->_csc.keywire == tp._csc.keywire &&
183  this->_csc.strip == tp._csc.strip &&
184  this->_csc.pattern == tp._csc.pattern &&
185  this->_csc.bend == tp._csc.bend &&
186  this->_csc.bx == tp._csc.bx &&
187  this->_csc.mpclink == tp._csc.mpclink &&
188  this->_csc.bx0 == tp._csc.bx0 &&
189  this->_csc.syncErr == tp._csc.syncErr &&
190  this->_csc.cscID == tp._csc.cscID &&
191  this->_rpc.strip == tp._rpc.strip &&
192  this->_rpc.layer == tp._rpc.layer &&
193  this->_rpc.bx == tp._rpc.bx &&
194  this->_id == tp._id &&
195  this->_subsystem == tp._subsystem &&
196  this->_globalsector == tp._globalsector &&
197  this->_subsector == tp._subsector );
198 }
199 
200 const int TriggerPrimitive::getBX() const {
201  switch(_subsystem) {
202  case kDT:
203  return _dt.bx;
204  case kCSC:
205  return _csc.bx;
206  case kRPC:
207  return _rpc.bx;
208  default:
209  throw cms::Exception("Invalid Subsytem")
210  << "The specified subsystem for this track stub is out of range"
211  << std::endl;
212  }
213  return -1;
214 }
215 
216 const int TriggerPrimitive::getStrip() const {
217  switch(_subsystem) {
218  case kDT:
219  return -1;
220  case kCSC:
221  return _csc.strip;
222  case kRPC:
223  return _rpc.strip;
224  default:
225  throw cms::Exception("Invalid Subsytem")
226  << "The specified subsystem for this track stub is out of range"
227  << std::endl;
228  }
229  return -1;
230 }
231 
232 const int TriggerPrimitive::getWire() const {
233  switch(_subsystem) {
234  case kDT:
235  return -1;
236  case kCSC:
237  return _csc.keywire;
238  case kRPC:
239  return -1;
240  default:
241  throw cms::Exception("Invalid Subsytem")
242  << "The specified subsystem for this track stub is out of range"
243  << std::endl;
244  }
245  return -1;
246 }
247 
248 const int TriggerPrimitive::getPattern() const {
249  switch(_subsystem) {
250  case kDT:
251  return -1;
252  case kCSC:
253  return _csc.pattern;
254  case kRPC:
255  return -1;
256  default:
257  throw cms::Exception("Invalid Subsytem")
258  << "The specified subsystem for this track stub is out of range"
259  << std::endl;
260  }
261  return -1;
262 }
263 const int TriggerPrimitive::Id() const {
264  switch(_subsystem) {
265  case kDT:
266  return -1;
267  case kCSC:
268  return _csc.cscID;
269  case kRPC:
270  return -1;
271  default:
272  throw cms::Exception("Invalid Subsytem")
273  << "The specified subsystem for this track stub is out of range"
274  << std::endl;
275  }
276  return -1;
277 }
278 
280  unsigned& global_sector,
281  unsigned& subsector ) {
282 }
283 
285  unsigned& global_sector,
286  unsigned& subsector ) {
287 }
288 
290  unsigned& global_sector,
291  unsigned& subsector ) {
292 }
293 
294 void TriggerPrimitive::print(std::ostream& out) const {
295  unsigned idx = (unsigned) _subsystem;
296  out << subsystem_names[idx] << " Trigger Primitive" << std::endl;
297  out << "eta: " << _eta << " phi: " << _phi
298  << " bend: " << _theta << std::endl;
299  switch(_subsystem) {
300  case kDT:
301  out << detId<DTChamberId>() << std::endl;
302  out << "Local BX : " << _dt.bx << std::endl;
303  out << "Segment Nmb : " << _dt.segment_number << std::endl;
304  out << "Packed Phi : " << _dt.radialAngle << std::endl;
305  out << "Packed Bend : " << _dt.bendingAngle << std::endl;
306  out << "Quality Code : " << _dt.qualityCode << std::endl;
307  out << "Ts2Tag Code : " << _dt.Ts2TagCode << std::endl;
308  out << "BXCnt Code : " << _dt.BxCntCode << std::endl;
309  out << "Theta BTI Grp : " << _dt.theta_bti_group << std::endl;
310  out << "Theta Code : " << _dt.theta_code << std::endl;
311  out << "Theta Quality : " << _dt.theta_quality << std::endl;
312  break;
313  case kCSC:
314  out << detId<CSCDetId>() << std::endl;
315  out << "Local BX : " << _csc.bx << std::endl;
316  out << "Segment Nmb : " << _csc.trknmb << std::endl;
317  out << "Segment Valid : " << _csc.valid << std::endl;
318  out << "Quality Code : " << _csc.quality << std::endl;
319  out << "Key Wire Grp : " << _csc.keywire << std::endl;
320  out << "Half-Strip : " << _csc.strip << std::endl;
321  out << "CLCT Pattern : " << _csc.pattern << std::endl;
322  out << "Packed Bend : " << _csc.bend << std::endl;
323  out << "MPC Link : " << _csc.mpclink << std::endl;
324  out << "BX0 : " << _csc.bx0 << std::endl;
325  out << "Sync Error : " << _csc.syncErr << std::endl;
326  out << "CSCID : " << _csc.cscID << std::endl;
327  break;
328  case kRPC:
329  out << detId<RPCDetId>() << std::endl;
330  out << "Local BX : " << _rpc.bx << std::endl;
331  out << "Strip : " << _rpc.strip << std::endl;
332  out << "Layer : " << _rpc.layer << std::endl;
333  break;
334  default:
335  throw cms::Exception("Invalid Subsytem")
336  << "The specified subsystem for this track stub is out of range"
337  << std::endl;
338  }
339 }
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)