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 // GEM digi types
43 class GEMPadDigi;
44 class GEMDetId;
45 
46 // ME0 digi types
47 class ME0PadDigi;
48 class ME0DetId;
49 
50 
51 namespace L1TMuon {
52 
54  public:
55  // define the subsystems that we have available
57 
58  // define the data we save locally from each subsystem type
59  // variables in these structs keep their colloquial meaning
60  // within a subsystem
61  // for RPCs you have to unroll the digi-link and raw det-id
62  struct RPCData {
63  RPCData() : strip(0), strip_low(0), strip_hi(0), layer(0), bx(0), valid(0), time(0.) {}
64  uint16_t strip;
65  uint16_t strip_low; // for use in clustering
66  uint16_t strip_hi; // for use in clustering
67  uint16_t layer;
68  int16_t bx;
69  uint16_t valid;
70  double time; // why double?
71  };
72 
73  struct CSCData {
74  CSCData() : trknmb(0), valid(0), quality(0), keywire(0), strip(0),
75  pattern(0), bend(0), bx(0), mpclink(0), bx0(0), syncErr(0),
76  cscID(0), alct_quality(0), clct_quality(0) {}
77  uint16_t trknmb;
78  uint16_t valid;
79  uint16_t quality;
80  uint16_t keywire;
81  uint16_t strip;
82  uint16_t pattern;
83  uint16_t bend;
84  uint16_t bx;
85  uint16_t mpclink;
86  uint16_t bx0;
87  uint16_t syncErr;
88  uint16_t cscID;
89 
90  // Extra info for ALCT (wires) and CLCT (strips)
91  uint16_t alct_quality;
92  uint16_t clct_quality;
93  };
94 
95  struct DTData {
96  DTData() : bx(0), wheel(0), sector(0), station(0), radialAngle(0),
99  theta_quality(0) {}
100  // from ChambPhDigi (corresponds to a TRACO)
101  // this gives us directly the phi
102  int bx; // relative? bx number
103  int wheel; // wheel number -3,-2,-1,1,2,3
104  int sector; // 1-12 in DT speak (these correspond to CSC sub-sectors)
105  int station; // 1-4 radially outwards
106  int radialAngle; // packed phi in a sector
107  int bendingAngle; // angle of segment relative to chamber
108  int qualityCode; // need to decode
109  int Ts2TagCode; // ??
110  int BxCntCode; // ????
111  // from ChambThDigi (corresponds to a BTI)
112  // we have to root out the eta manually
113  // theta super layer == SL 1
114  // station four has no theta super-layer
115  // bti_idx == -1 means there was no theta trigger for this segment
117  int segment_number; // position(i)
120  };
121 
122  struct GEMData {
123  GEMData() : pad(0), pad_low(0), pad_hi(0), bx(0), bend(0), isME0(false) {}
124  uint16_t pad;
125  uint16_t pad_low; // for use in clustering
126  uint16_t pad_hi; // for use in clustering
127  int16_t bx;
128  int16_t bend;
129  bool isME0;
130  };
131 
132  //Persistency
133  TriggerPrimitive(): _subsystem(kNSubsystems) {}
134 
135  //DT
137  const L1MuDTChambPhDigi&,
138  const int segment_number);
140  const L1MuDTChambThDigi&,
141  const int segment_number);
143  const L1MuDTChambPhDigi&,
144  const L1MuDTChambThDigi&,
145  const int theta_bti_group);
146  //CSC
147  TriggerPrimitive(const CSCDetId&,
148  const CSCCorrelatedLCTDigi&);
149  //RPC
150  TriggerPrimitive(const RPCDetId& detid,
151  const RPCDigi& digi);
152  TriggerPrimitive(const RPCDetId& detid, // keep this version for backward compatibility
153  const unsigned strip,
154  const unsigned layer,
155  const int bx);
156 
157  // GEM
158  TriggerPrimitive(const GEMDetId& detid,
159  const GEMPadDigi& digi);
160  TriggerPrimitive(const ME0DetId& detid,
161  const ME0PadDigi& digi);
162 
163  //copy
165 
167  bool operator==(const TriggerPrimitive& tp) const;
168 
169  // return the subsystem we belong to
170  const subsystem_type subsystem() const { return _subsystem; }
171 
172  const double getCMSGlobalEta() const { return _eta; }
173  void setCMSGlobalEta(const double eta) { _eta = eta; }
174  const double getCMSGlobalPhi() const { return _phi; }
175  void setCMSGlobalPhi(const double phi) { _phi = phi; }
176  const double getCMSGlobalRho() const { return _rho; }
177  void setCMSGlobalRho(const double rho) { _rho = rho; }
178 
179  const GlobalPoint getCMSGlobalPoint() const { double theta = 2. * atan( exp(-_eta) );
180  return GlobalPoint( GlobalPoint::Cylindrical( _rho, _phi, _rho/tan(theta)) ); };
181 
182 
183  // this is the relative bending angle with respect to the
184  // current phi position.
185  // The total angle of the track is phi + bendAngle
186  void setThetaBend(const double theta) { _theta = theta; }
187  double getThetaBend() const { return _theta; }
188 
189  template<typename IDType>
190  IDType detId() const { return IDType(_id); }
191 
192  // accessors to raw subsystem data
193  void setDTData(const DTData& dt) { _dt = dt; }
194  void setCSCData(const CSCData& csc) { _csc = csc; }
195  void setRPCData(const RPCData& rpc) { _rpc = rpc; }
196  void setGEMData(const GEMData& gem) { _gem = gem; }
197 
198  const DTData getDTData() const { return _dt; }
199  const CSCData getCSCData() const { return _csc; }
200  const RPCData getRPCData() const { return _rpc; }
201  const GEMData getGEMData() const { return _gem; }
202 
203  DTData& accessDTData() { return _dt; }
204  CSCData& accessCSCData() { return _csc; }
205  RPCData& accessRPCData() { return _rpc; }
206  GEMData& accessGEMData() { return _gem; }
207 
208  // consistent accessors to common information
209  const int getBX() const;
210  const int getStrip() const;
211  const int getWire() const;
212  const int getPattern() const;
213  const DetId rawId() const {return _id;};
214 
215  const unsigned getGlobalSector() const { return _globalsector; }
216  const unsigned getSubSector() const { return _subsector; }
217 
218  void print(std::ostream&) const;
219 
220  private:
221  // Translate to 'global' position information at the level of 60
222  // degree sectors. Use CSC sectors as a template
223  template<typename IDType>
224  void calculateGlobalSector(const IDType& chid,
225  unsigned& globalsector,
226  unsigned& subsector ) {
227  // Not sure if this is ever going to get implemented
228  globalsector = 0;
229  subsector = 0;
230  }
231 
236 
238 
240 
241  unsigned _globalsector; // [1,6] in 60 degree sectors
242  unsigned _subsector; // [1,2] in 30 degree partitions of a sector
243  double _eta,_phi,_rho; // global pseudorapidity, phi, rho
244  double _theta; // bend angle with respect to ray from (0,0,0)
245  };
246 
247 }
248 
249 #endif
void setCMSGlobalEta(const double eta)
float dt
Definition: AMPTWrapper.h:126
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
TriggerPrimitive & operator=(const TriggerPrimitive &tp)
const CSCData getCSCData() const
bool operator==(const TriggerPrimitive &tp) const
const RPCData getRPCData() const
const double getCMSGlobalPhi() const
A class for AMC data.
Definition: AMC13Event.h:6
const double getCMSGlobalEta() const
void calculateGlobalSector(const IDType &chid, unsigned &globalsector, unsigned &subsector)
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
const double getCMSGlobalRho() const
Definition: L1Track.h:19
Definition: DetId.h:18
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)
void print(std::ostream &) const