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