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 <iostream>
23 
24 //DetId
26 //Global point (created on the fly)
28 
29 // DT digi types
30 class DTChamberId;
31 class L1MuDTChambPhDigi;
32 class L1MuDTChambThDigi;
33 
34 // CSC digi types
36 class CSCDetId;
37 
38 // RPC digi types
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 GEMPadDigi;
49 class GEMDetId;
50 
51 // ME0 digi types
52 class ME0PadDigi;
53 class ME0DetId;
54 
55 namespace L1TMuon {
56 
58  public:
59  // define the subsystems that we have available
60  enum subsystem_type { kDT, kCSC, kRPC, kGEM, kNSubsystems };
61 
62  // define the data we save locally from each subsystem type
63  // variables in these structs keep their colloquial meaning
64  // within a subsystem
65  // for RPCs you have to unroll the digi-link and raw det-id
66  struct RPCData {
68  : strip(0),
69  strip_low(0),
70  strip_hi(0),
71  phi_int(0),
72  theta_int(0),
73  emtf_sector(0),
74  layer(0),
75  bx(0),
76  valid(0),
77  time(0.),
78  isCPPF(false) {}
79  uint16_t strip;
80  uint16_t strip_low; // for use in clustering
81  uint16_t strip_hi; // for use in clustering
82  uint16_t phi_int; // for CPPFDigis in EMTF
83  uint16_t theta_int; // for CPPFDigis in EMTF
84  uint16_t emtf_sector; // for CPPFDigis in EMTF
85  uint16_t layer;
86  int16_t bx;
87  uint16_t valid;
88  double time; // why double?
89  bool isCPPF;
90  };
91 
92  struct CSCData {
94  : trknmb(0),
95  valid(0),
96  quality(0),
97  keywire(0),
98  strip(0),
99  pattern(0),
100  bend(0),
101  bx(0),
102  mpclink(0),
103  bx0(0),
104  syncErr(0),
105  cscID(0),
106  alct_quality(0),
107  clct_quality(0) {}
108  uint16_t trknmb;
109  uint16_t valid;
110  uint16_t quality;
111  uint16_t keywire;
112  uint16_t strip;
113  uint16_t pattern;
114  uint16_t bend;
115  uint16_t bx;
116  uint16_t mpclink;
117  uint16_t bx0;
118  uint16_t syncErr;
119  uint16_t cscID;
120 
121  // Extra info for ALCT (wires) and CLCT (strips)
122  uint16_t alct_quality;
123  uint16_t clct_quality;
124  };
125 
126  struct DTData {
128  : bx(0),
129  wheel(0),
130  sector(0),
131  station(0),
132  radialAngle(0),
133  bendingAngle(0),
134  qualityCode(0),
135  Ts2TagCode(0),
136  BxCntCode(0),
137  theta_bti_group(0),
138  segment_number(0),
139  theta_code(0),
140  theta_quality(0) {}
141  // from ChambPhDigi (corresponds to a TRACO)
142  // this gives us directly the phi
143  int bx; // relative? bx number
144  int wheel; // wheel number -3,-2,-1,1,2,3
145  int sector; // 1-12 in DT speak (these correspond to CSC sub-sectors)
146  int station; // 1-4 radially outwards
147  int radialAngle; // packed phi in a sector
148  int bendingAngle; // angle of segment relative to chamber
149  int qualityCode; // need to decode
150  int Ts2TagCode; // ??
151  int BxCntCode; // ????
152  // from ChambThDigi (corresponds to a BTI)
153  // we have to root out the eta manually
154  // theta super layer == SL 1
155  // station four has no theta super-layer
156  // bti_idx == -1 means there was no theta trigger for this segment
158  int segment_number; // position(i)
161  };
162 
163  struct GEMData {
164  GEMData() : pad(0), pad_low(0), pad_hi(0), bx(0), bend(0), isME0(false) {}
165  uint16_t pad;
166  uint16_t pad_low; // for use in clustering
167  uint16_t pad_hi; // for use in clustering
168  int16_t bx;
169  int16_t bend;
170  bool isME0;
171  };
172 
173  //Persistency
174  TriggerPrimitive() : _subsystem(kNSubsystems) {}
175 
176  //DT
177  TriggerPrimitive(const DTChamberId&, const L1MuDTChambPhDigi&, const int segment_number);
178  TriggerPrimitive(const DTChamberId&, const L1MuDTChambThDigi&, const int segment_number);
179  TriggerPrimitive(const DTChamberId&, const L1MuDTChambPhDigi&, const L1MuDTChambThDigi&, const int theta_bti_group);
180  //CSC
182  //RPC
183  TriggerPrimitive(const RPCDetId& detid, const RPCDigi& digi);
184  TriggerPrimitive(const RPCDetId& detid, // keep this version for backward compatibility
185  const unsigned strip,
186  const unsigned layer,
187  const int bx);
188  TriggerPrimitive(const RPCDetId& detid, // constructor from CPPFDigi
189  const l1t::CPPFDigi& digi);
190 
191  // GEM
192  TriggerPrimitive(const GEMDetId& detid, const GEMPadDigi& digi);
193  TriggerPrimitive(const ME0DetId& detid, const ME0PadDigi& digi);
194 
195  //copy
197 
198  TriggerPrimitive& operator=(const TriggerPrimitive& tp);
199  bool operator==(const TriggerPrimitive& tp) const;
200 
201  // return the subsystem we belong to
202  const subsystem_type subsystem() const { return _subsystem; }
203 
204  const double getCMSGlobalEta() const { return _eta; }
205  void setCMSGlobalEta(const double eta) { _eta = eta; }
206  const double getCMSGlobalPhi() const { return _phi; }
207  void setCMSGlobalPhi(const double phi) { _phi = phi; }
208  const double getCMSGlobalRho() const { return _rho; }
209  void setCMSGlobalRho(const double rho) { _rho = rho; }
210 
212  double theta = 2. * atan(exp(-_eta));
213  return GlobalPoint(GlobalPoint::Cylindrical(_rho, _phi, _rho / tan(theta)));
214  };
215 
216  // this is the relative bending angle with respect to the
217  // current phi position.
218  // The total angle of the track is phi + bendAngle
219  void setThetaBend(const double theta) { _theta = theta; }
220  double getThetaBend() const { return _theta; }
221 
222  template <typename IDType>
223  IDType detId() const {
224  return IDType(_id);
225  }
226 
227  // accessors to raw subsystem data
228  void setDTData(const DTData& dt) { _dt = dt; }
229  void setCSCData(const CSCData& csc) { _csc = csc; }
230  void setRPCData(const RPCData& rpc) { _rpc = rpc; }
231  void setGEMData(const GEMData& gem) { _gem = gem; }
232 
233  const DTData getDTData() const { return _dt; }
234  const CSCData getCSCData() const { return _csc; }
235  const RPCData getRPCData() const { return _rpc; }
236  const GEMData getGEMData() const { return _gem; }
237 
238  DTData& accessDTData() { return _dt; }
239  CSCData& accessCSCData() { return _csc; }
240  RPCData& accessRPCData() { return _rpc; }
241  GEMData& accessGEMData() { return _gem; }
242 
243  // consistent accessors to common information
244  const int getBX() const;
245  const int getStrip() const;
246  const int getWire() const;
247  const int getPattern() const;
248  const DetId rawId() const { return _id; };
249 
250  const unsigned getGlobalSector() const { return _globalsector; }
251  const unsigned getSubSector() const { return _subsector; }
252 
253  void print(std::ostream&) const;
254 
255  private:
256  // Translate to 'global' position information at the level of 60
257  // degree sectors. Use CSC sectors as a template
258  template <typename IDType>
259  void calculateGlobalSector(const IDType& chid, unsigned& globalsector, unsigned& subsector) {
260  // Not sure if this is ever going to get implemented
261  globalsector = 0;
262  subsector = 0;
263  }
264 
269 
271 
273 
274  unsigned _globalsector; // [1,6] in 60 degree sectors
275  unsigned _subsector; // [1,2] in 30 degree partitions of a sector
276  double _eta, _phi, _rho; // global pseudorapidity, phi, rho
277  double _theta; // bend angle with respect to ray from (0,0,0)
278  };
279 
280 } // namespace L1TMuon
281 
282 #endif
void setCMSGlobalEta(const double eta)
float dt
Definition: AMPTWrapper.h:136
const subsystem_type subsystem() const
const unsigned getSubSector() const
void setDTData(const DTData &dt)
const DTData getDTData() const
const GEMData getGEMData() const
void setThetaBend(const double theta)
void setGEMData(const GEMData &gem)
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Geom::Theta< T > theta() const
bool isME0(GeomDetEnumerators::SubDetector m)
delete x;
Definition: CaloConfig.h:22
const CSCData getCSCData() const
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
const RPCData getRPCData() const
const double getCMSGlobalPhi() const
Definition: AMC13Event.h:6
const double getCMSGlobalEta() const
void calculateGlobalSector(const IDType &chid, unsigned &globalsector, unsigned &subsector)
bool operator==(const QGLikelihoodParameters &lhs, const QGLikelihoodCategory &rhs)
Test if parameters are compatible with category.
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
L1TMuon::TriggerPrimitive TriggerPrimitive
Definition: Common.h:33
const double getCMSGlobalRho() const
Definition: L1Track.h:19
Definition: DetId.h:17
void setCMSGlobalRho(const double rho)
const GlobalPoint getCMSGlobalPoint() const
void setRPCData(const RPCData &rpc)
void setCSCData(const CSCData &csc)
const unsigned getGlobalSector() const
void setCMSGlobalPhi(const double phi)