CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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);
205  TriggerPrimitive(const DTChamberId& detid,
206  const L1MuDTChambPhDigi& digi_phi,
207  const L1MuDTChambThDigi& digi_th,
208  const int theta_bti_group);
209 
210  // Constructor from CSC data
211  TriggerPrimitive(const CSCDetId& detid, const CSCCorrelatedLCTDigi& digi);
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 
226  // Copy constructor
229  bool operator==(const TriggerPrimitive& tp) const;
230 
231  // return the subsystem we belong to
232  subsystem_type subsystem() const { return _subsystem; }
233 
234  void setCMSGlobalEta(double eta) { _eta = eta; }
235  void setCMSGlobalPhi(double phi) { _phi = phi; }
236  void setCMSGlobalRho(double rho) { _rho = rho; }
237 
238  double getCMSGlobalEta() const { return _eta; }
239  double getCMSGlobalPhi() const { return _phi; }
240  double getCMSGlobalRho() const { return _rho; }
241 
243  double theta = 2. * std::atan(std::exp(-_eta));
245  }
246 
247  // this is the relative bending angle with respect to the
248  // current phi position.
249  // The total angle of the track is phi + bendAngle
250  void setThetaBend(double theta) { _theta = theta; }
251  double getThetaBend() const { return _theta; }
252 
253  template <typename IDType>
254  IDType detId() const {
255  return IDType(_id);
256  }
257 
258  // accessors to raw subsystem data
259  void setDTData(const DTData& dt) { _dt = dt; }
260  void setCSCData(const CSCData& csc) { _csc = csc; }
261  void setRPCData(const RPCData& rpc) { _rpc = rpc; }
262  void setGEMData(const GEMData& gem) { _gem = gem; }
263  void setME0Data(const ME0Data& me0) { _me0 = me0; }
264 
265  DTData getDTData() const { return _dt; }
266  CSCData getCSCData() const { return _csc; }
267  RPCData getRPCData() const { return _rpc; }
268  GEMData getGEMData() const { return _gem; }
269  ME0Data getME0Data() const { return _me0; }
270 
271  DTData& accessDTData() { return _dt; }
272  CSCData& accessCSCData() { return _csc; }
273  RPCData& accessRPCData() { return _rpc; }
274  GEMData& accessGEMData() { return _gem; }
275  ME0Data& accessME0Data() { return _me0; }
276 
277  // consistent accessors to common information
278  int getBX() const;
279  int getStrip() const;
280  int getWire() const;
281  int getPattern() const;
282  DetId rawId() const { return _id; }
283 
284  unsigned getGlobalSector() const { return _globalsector; }
285  unsigned getSubSector() const { return _subsector; }
286 
287  void print(std::ostream&) const;
288 
289  private:
290  // Translate to 'global' position information at the level of 60
291  // degree sectors. Use CSC sectors as a template
292  template <typename IDType>
293  void calculateGlobalSector(const IDType& chid, unsigned& globalsector, unsigned& subsector) const {
294  // Not sure if this is ever going to get implemented
295  globalsector = 0;
296  subsector = 0;
297  }
298 
304 
306 
308 
309  unsigned _globalsector; // [1,6] in 60 degree sectors
310  unsigned _subsector; // [1,2] in 30 degree partitions of a sector
311  double _eta, _phi, _rho; // global pseudorapidity, phi, rho
312  double _theta; // bend angle with respect to ray from (0,0,0)
313  };
314 
315 } // namespace L1TMuon
316 
317 #endif
float dt
Definition: AMPTWrapper.h:136
void setDTData(const DTData &dt)
void setGEMData(const GEMData &gem)
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Geom::Theta< T > theta() const
TriggerPrimitive & operator=(const TriggerPrimitive &tp)
GlobalPoint getCMSGlobalPoint() const
void setME0Data(const ME0Data &me0)
void calculateGlobalSector(const IDType &chid, unsigned &globalsector, unsigned &subsector) const
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
bool operator==(const TriggerPrimitive &tp) const
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
subsystem_type subsystem() const
Definition: DetId.h:17
void setRPCData(const RPCData &rpc)
void setCSCData(const CSCData &csc)
void print(std::ostream &) const