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