CMS 3D CMS Logo

MuonTriggerPrimitive.h
Go to the documentation of this file.
1 #ifndef __L1TMuon_TriggerPrimitive_h__
2 #define __L1TMuon_TriggerPrimitive_h__
3 //
4 // Class: L1TMuon::TriggerPrimitive
5 //
6 // Info: This class implements a unifying layer between DT, CSC and RPC
7 // trigger primitives (TPs) such that TPs from different subsystems
8 // can be queried for their position and orientation information
9 // in a consistent way amongst all subsystems.
10 //
11 // Note: Not all input data types are persistable, so we make local
12 // copies of all data from various digi types.
13 //
14 // At the end of the day this should represent the output of some
15 // common sector receiver module.
16 //
17 // Author: L. Gray (FNAL)
18 //
19 
20 #include <cstdint>
21 #include <vector>
22 #include <iosfwd>
23 
27 
28 // DT digi types
29 class DTChamberId;
30 class L1MuDTChambPhDigi;
31 class L1MuDTChambThDigi;
32 
33 // CSC digi types
35 class CSCDetId;
36 
37 // RPC digi types
38 class RPCRecHit;
39 class RPCDigi;
40 class RPCDetId;
41 
42 // CPPF digi types
43 namespace l1t {
44  class CPPFDigi;
45 }
46 
47 // GEM digi types
48 class GEMPadDigiCluster;
49 class GEMDetId;
50 
51 // ME0 digi types
52 class ME0TriggerDigi;
53 class ME0DetId;
54 
55 namespace L1TMuon {
56 
58  public:
59  // define the data we save locally from each subsystem type
60  // variables in these structs keep their colloquial meaning
61  // within a subsystem
62  // for RPCs you have to unroll the digi-link and raw det-id
63  struct RPCData {
65  : strip(0),
66  strip_low(0),
67  strip_hi(0),
68  phi_int(0),
69  theta_int(0),
70  emtf_sector(0),
71  emtf_link(0),
72  bx(0),
73  valid(0),
74  x(0.),
75  y(0.),
76  time(0.),
77  isCPPF(false) {}
78  uint16_t strip;
79  uint16_t strip_low; // for use in clustering
80  uint16_t strip_hi; // for use in clustering
81  uint16_t phi_int; // for CPPFDigis in EMTF
82  uint16_t theta_int; // for CPPFDigis in EMTF
83  uint16_t emtf_sector; // for CPPFDigis in EMTF
84  uint16_t emtf_link; // for CPPFDigis in EMTF
85  int16_t bx;
86  int16_t valid;
87  float x; // local coordinate x (use floating-point for now)
88  float y; // local coordinate y (use floating-point for now)
89  float time; // time (use floating-point for now)
90  bool isCPPF;
91  };
92 
93  struct CSCData {
95  : trknmb(0),
96  valid(0),
97  quality(0),
98  keywire(0),
99  strip(0),
100  pattern(0),
101  bend(0),
102  bx(0),
103  mpclink(0),
104  bx0(0),
105  syncErr(0),
106  cscID(0),
107  alct_quality(0),
108  clct_quality(0),
109  // run-3
110  pattern_run3(0),
111  strip_quart_bit(0),
112  strip_eighth_bit(0),
113  strip_quart(0),
114  strip_eighth(0),
115  slope(0) {}
116  uint16_t trknmb;
117  uint16_t valid;
118  uint16_t quality;
119  uint16_t keywire;
120  uint16_t strip;
121  uint16_t pattern;
122  uint16_t bend;
123  uint16_t bx;
124  uint16_t mpclink;
125  uint16_t bx0;
126  uint16_t syncErr;
127  uint16_t cscID;
128  uint16_t alct_quality; // extra info for ALCT (wires)
129  uint16_t clct_quality; // extra info for CLCT (strips)
130  // run-3
131  uint16_t pattern_run3;
132  uint16_t strip_quart_bit;
134  uint16_t strip_quart;
135  uint16_t strip_eighth;
136  uint16_t slope;
137  };
138 
139  struct DTData {
141  : bx(0),
142  wheel(0),
143  sector(0),
144  station(0),
145  radialAngle(0),
146  bendingAngle(0),
147  qualityCode(0),
148  Ts2TagCode(0),
149  BxCntCode(0),
150  RpcBit(-10),
151  theta_bti_group(0),
152  segment_number(0),
153  theta_code(0),
154  theta_quality(0) {}
155  // from ChambPhDigi (corresponds to a TRACO)
156  // this gives us directly the phi
157  int bx; // relative? bx number
158  int wheel; // wheel number -3,-2,-1,1,2,3
159  int sector; // 1-12 in DT speak (these correspond to CSC sub-sectors)
160  int station; // 1-4 radially outwards
161  int radialAngle; // packed phi in a sector
162  int bendingAngle; // angle of segment relative to chamber
163  int qualityCode; // need to decode
164  int Ts2TagCode; // ??
165  int BxCntCode; // ????
166  int RpcBit; // 0: DT only, 1: DT segment BX corrected by RPC, 2: RPC only
167  // from ChambThDigi (corresponds to a BTI)
168  // we have to root out the eta manually
169  // theta super layer == SL 1
170  // station four has no theta super-layer
171  // bti_idx == -1 means there was no theta trigger for this segment
173  int segment_number; // position(i)
176  };
177 
178  // See documentation in DataFormats/GEMDigi/interface/GEMPadDigiCluster.h
179  struct GEMData {
180  GEMData() : pad(0), pad_low(0), pad_hi(0), bx(0) {}
181  uint16_t pad;
182  uint16_t pad_low; // for use in clustering
183  uint16_t pad_hi; // for use in clustering
184  int16_t bx;
185  };
186 
187  // See documentation in DataFormats/GEMDigi/interface/ME0TriggerDigi.h
188  struct ME0Data {
189  ME0Data() : chamberid(0), quality(0), phiposition(0), partition(0), deltaphi(0), bend(0), bx(0) {}
190  uint16_t chamberid;
191  uint16_t quality;
192  uint16_t phiposition;
193  uint16_t partition;
194  uint16_t deltaphi;
195  uint16_t bend;
196  uint16_t bx;
197  };
198 
199  // Persistency
201 
202  // Constructors from DT data
203  TriggerPrimitive(const DTChamberId& detid, const L1MuDTChambPhDigi& digi_phi, const int segment_number);
204  TriggerPrimitive(const DTChamberId& detid, const L1MuDTChambThDigi& digi_th, const int theta_bti_group);
206  const L1MuDTChambPhDigi& digi_phi,
207  const L1MuDTChambThDigi& digi_th,
208  const int theta_bti_group);
209 
210  // Constructor from CSC data
212 
213  // Constructors from RPC data
214  TriggerPrimitive(const RPCDetId& detid, const RPCDigi& digi);
215  TriggerPrimitive(const RPCDetId& detid, const RPCRecHit& rechit);
216 
217  // Constructor from CPPF data
218  TriggerPrimitive(const RPCDetId& detid, const l1t::CPPFDigi& digi);
219 
220  // Constructor from GEM data
221  TriggerPrimitive(const GEMDetId& detid, const GEMPadDigiCluster& digi);
222 
223  // Constructor from ME0 data
224  TriggerPrimitive(const ME0DetId& detid, const ME0TriggerDigi& digi);
225  // Constructor from GE0 data
226  TriggerPrimitive(const GEMDetId& detid, const ME0TriggerDigi& digi);
227 
228  // Copy constructor
231  bool operator==(const TriggerPrimitive& tp) const;
232 
233  // return the subsystem we belong to
234  subsystem_type subsystem() const { return _subsystem; }
235 
236  void setCMSGlobalEta(double eta) { _eta = eta; }
237  void setCMSGlobalPhi(double phi) { _phi = phi; }
238  void setCMSGlobalRho(double rho) { _rho = rho; }
239 
240  double getCMSGlobalEta() const { return _eta; }
241  double getCMSGlobalPhi() const { return _phi; }
242  double getCMSGlobalRho() const { return _rho; }
243 
245  double theta = 2. * std::atan(std::exp(-_eta));
247  }
248 
249  // this is the relative bending angle with respect to the
250  // current phi position.
251  // The total angle of the track is phi + bendAngle
252  void setThetaBend(double theta) { _theta = theta; }
253  double getThetaBend() const { return _theta; }
254 
255  template <typename IDType>
256  IDType detId() const {
257  return IDType(_id);
258  }
259 
260  // accessors to raw subsystem data
261  void setDTData(const DTData& dt) { _dt = dt; }
262  void setCSCData(const CSCData& csc) { _csc = csc; }
263  void setRPCData(const RPCData& rpc) { _rpc = rpc; }
264  void setGEMData(const GEMData& gem) { _gem = gem; }
265  void setME0Data(const ME0Data& me0) { _me0 = me0; }
266 
267  DTData getDTData() const { return _dt; }
268  CSCData getCSCData() const { return _csc; }
269  RPCData getRPCData() const { return _rpc; }
270  GEMData getGEMData() const { return _gem; }
271  ME0Data getME0Data() const { return _me0; }
272 
273  DTData& accessDTData() { return _dt; }
274  CSCData& accessCSCData() { return _csc; }
275  RPCData& accessRPCData() { return _rpc; }
276  GEMData& accessGEMData() { return _gem; }
277  ME0Data& accessME0Data() { return _me0; }
278 
279  // consistent accessors to common information
280  int getBX() const;
281  int getStrip() const;
282  int getWire() const;
283  int getPattern() const;
284  DetId rawId() const { return _id; }
285 
286  unsigned getGlobalSector() const { return _globalsector; }
287  unsigned getSubSector() const { return _subsector; }
288 
289  void print(std::ostream&) const;
290 
291  private:
292  // Translate to 'global' position information at the level of 60
293  // degree sectors. Use CSC sectors as a template
294  template <typename IDType>
295  void calculateGlobalSector(const IDType& chid, unsigned& globalsector, unsigned& subsector) const {
296  // Not sure if this is ever going to get implemented
297  globalsector = 0;
298  subsector = 0;
299  }
300 
306 
308 
310 
311  unsigned _globalsector; // [1,6] in 60 degree sectors
312  unsigned _subsector; // [1,2] in 30 degree partitions of a sector
313  double _eta, _phi, _rho; // global pseudorapidity, phi, rho
314  double _theta; // bend angle with respect to ray from (0,0,0)
315  };
316 
317 } // namespace L1TMuon
318 
319 #endif
float dt
Definition: AMPTWrapper.h:136
void print(std::ostream &) const
void setDTData(const DTData &dt)
bool operator==(const TriggerPrimitive &tp) const
void setGEMData(const GEMData &gem)
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
TriggerPrimitive & operator=(const TriggerPrimitive &tp)
void setME0Data(const ME0Data &me0)
delete x;
Definition: CaloConfig.h:22
void calculateGlobalSector(const IDType &chid, unsigned &globalsector, unsigned &subsector) const
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Definition: L1Track.h:19
Definition: DetId.h:17
GlobalPoint getCMSGlobalPoint() const
void setRPCData(const RPCData &rpc)
subsystem_type subsystem() const
void setCSCData(const CSCData &csc)