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: L1TwinMux::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 <boost/cstdint.hpp>
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 RPCDigiL1Link;
40 class RPCDetId;
41 
43 
44 namespace L1TMuon {
45 
47  public:
48  // define the subsystems that we have available
50 
51  // define the data we save locally from each subsystem type
52  // variables in these structs keep their colloquial meaning
53  // within a subsystem
54  // for RPCs you have to unroll the digi-link and raw det-id
55  struct RPCData {
56  RPCData() : strip(0), layer(0), bx(0) {}
57  unsigned strip;
58  unsigned layer;
59  uint16_t bx;
60  };
61 
62  struct CSCData {
63  CSCData() : trknmb(0), valid(0), quality(0), keywire(0), strip(0),
64  pattern(0), bend(0), bx(0), mpclink(0), bx0(0), syncErr(0),
65  cscID(0) {}
66  uint16_t trknmb;
67  uint16_t valid;
68  uint16_t quality;
69  uint16_t keywire;
70  uint16_t strip;
71  uint16_t pattern;
72  uint16_t bend;
73  uint16_t bx;
74  uint16_t mpclink;
75  uint16_t bx0;
76  uint16_t syncErr;
77  uint16_t cscID;
78  };
79 
80  struct DTData {
81  DTData() : bx(0), wheel(0), sector(0), station(0), radialAngle(0),
82  bendingAngle(0), qualityCode(0), Ts2TagCode(0), BxCntCode(0),
83  theta_bti_group(0), segment_number(0), theta_code(0),
84  theta_quality(0) {}
85  // from ChambPhDigi (corresponds to a TRACO)
86  // this gives us directly the phi
87  int bx; // relative? bx number
88  int wheel; // wheel number -3,-2,-1,1,2,3
89  int sector; // 1-12 in DT speak (these correspond to CSC sub-sectors)
90  int station; // 1-4 radially outwards
91  int radialAngle; // packed phi in a sector
92  int bendingAngle; // angle of segment relative to chamber
93  int qualityCode; // need to decode
94  int Ts2TagCode; // ??
95  int BxCntCode; // ????
96  // from ChambThDigi (corresponds to a BTI)
97  // we have to root out the eta manually
98  // theta super layer == SL 1
99  // station four has no theta super-layer
100  // bti_idx == -1 means there was no theta trigger for this segment
102  int segment_number; // position(i)
105  };
106 
107  //Persistency
108  TriggerPrimitive(): _subsystem(kNSubsystems) {}
109 
110  //DT
112  const L1MuDTChambPhDigi&,
113  const int segment_number);
115  const L1MuDTChambThDigi&,
116  const int segment_number);
118  const L1MuDTChambPhDigi&,
119  const L1MuDTChambThDigi&,
120  const int theta_bti_group);
121  //CSC
122  TriggerPrimitive(const CSCDetId&,
123  const CSCCorrelatedLCTDigi&);
124  //RPC
125  TriggerPrimitive(const RPCDetId& detid,
126  const unsigned strip,
127  const unsigned layer,
128  const uint16_t bx);
129 
130  //copy
132 
133  // Create a copy of TP1 with wire of TP2
134  TriggerPrimitive(const TriggerPrimitive& tp1, const TriggerPrimitive& tp2);
135 
137  bool operator==(const TriggerPrimitive& tp) const;
138 
139  // return the subsystem we belong to
140  const subsystem_type subsystem() const { return _subsystem; }
141 
142  const double getCMSGlobalEta() const { return _eta; }
143  void setCMSGlobalEta(const double eta) { _eta = eta; }
144  const double getCMSGlobalPhi() const { return _phi; }
145  void setCMSGlobalPhi(const double phi) { _phi = phi; }
146  const double getCMSGlobalRho() const { return _rho; }
147  void setCMSGlobalRho(const double rho) { _rho = rho; }
148 
149  const GlobalPoint getCMSGlobalPoint() const { double theta = 2. * atan( exp(-_eta) );
150  return GlobalPoint( GlobalPoint::Cylindrical( _rho, _phi, _rho/tan(theta)) ); };
151 
152 
153  // this is the relative bending angle with respect to the
154  // current phi position.
155  // The total angle of the track is phi + bendAngle
156  void setThetaBend(const double theta) { _theta = theta; }
157  double getThetaBend() const { return _theta; }
158 
159  template<typename IDType>
160  IDType detId() const { return IDType(_id); }
161 
162  // accessors to raw subsystem data
163  const DTData getDTData() const { return _dt; }
164  const CSCData getCSCData() const { return _csc; }
165  const RPCData getRPCData() const { return _rpc; }
166 
167  // consistent accessors to common information
168  const int getBX() const;
169  const int getStrip() const;
170  const int getWire() const;
171  const int getPattern() const;
172  const DetId rawId() const {return _id;};
173  const int Id() const;
174 
175  const unsigned getGlobalSector() const { return _globalsector; }
176  const unsigned getSubSector() const { return _subsector; }
177 
178  void print(std::ostream&) const;
179 
180  private:
181  // Translate to 'global' position information at the level of 60
182  // degree sectors. Use CSC sectors as a template
183  void calculateDTGlobalSector(const DTChamberId& chid,
184  unsigned& global_sector,
185  unsigned& subsector );
186  void calculateCSCGlobalSector(const CSCDetId& chid,
187  unsigned& global_sector,
188  unsigned& subsector );
189  void calculateRPCGlobalSector(const RPCDetId& chid,
190  unsigned& global_sector,
191  unsigned& subsector );
192 
196 
198 
200 
201  unsigned _globalsector; // [1,6] in 60 degree sectors
202  unsigned _subsector; // [1,2] in 30 degree partitions of a sector
203  double _eta,_phi,_rho; // global pseudorapidity, phi
204  double _theta; // bend angle with respect to ray from (0,0,0)
205  };
206 
207 }
208 
209 #endif
void setCMSGlobalEta(const double eta)
const subsystem_type subsystem() const
const unsigned getSubSector() const
const DTData getDTData() const
void setThetaBend(const double theta)
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
const double getCMSGlobalEta() const
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
const double getCMSGlobalRho() const
Definition: DetId.h:18
void setCMSGlobalRho(const double rho)
const GlobalPoint getCMSGlobalPoint() const
void calculateCSCGlobalSector(const CSCDetId &chid, unsigned &global_sector, unsigned &subsector)
const unsigned getGlobalSector() const
void setCMSGlobalPhi(const double phi)
void print(std::ostream &) const
void calculateRPCGlobalSector(const RPCDetId &chid, unsigned &global_sector, unsigned &subsector)