CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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),
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
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 
134  bool operator==(const TriggerPrimitive& tp) const;
135 
136  // return the subsystem we belong to
137  const subsystem_type subsystem() const { return _subsystem; }
138 
139  const double getCMSGlobalEta() const { return _eta; }
140  void setCMSGlobalEta(const double eta) { _eta = eta; }
141  const double getCMSGlobalPhi() const { return _phi; }
142  void setCMSGlobalPhi(const double phi) { _phi = phi; }
143  const double getCMSGlobalRho() const { return _rho; }
144  void setCMSGlobalRho(const double rho) { _rho = rho; }
145 
146  const GlobalPoint getCMSGlobalPoint() const { double theta = 2. * atan( exp(-_eta) );
147  return GlobalPoint( GlobalPoint::Cylindrical( _rho, _phi, _rho/tan(theta)) ); };
148 
149 
150  // this is the relative bending angle with respect to the
151  // current phi position.
152  // The total angle of the track is phi + bendAngle
153  void setThetaBend(const double theta) { _theta = theta; }
154  double getThetaBend() const { return _theta; }
155 
156  template<typename IDType>
157  IDType detId() const { return IDType(_id); }
158 
159  // accessors to raw subsystem data
160  const DTData getDTData() const { return _dt; }
161  const CSCData getCSCData() const { return _csc; }
162  const RPCData getRPCData() const { return _rpc; }
163 
164  // consistent accessors to common information
165  const int getBX() const;
166  const int getStrip() const;
167  const int getWire() const;
168  const int getPattern() const;
169  const DetId rawId() const {return _id;};
170  const int Id() const;
171 
172  const unsigned getGlobalSector() const { return _globalsector; }
173  const unsigned getSubSector() const { return _subsector; }
174 
175  void print(std::ostream&) const;
176 
177  private:
178  // Translate to 'global' position information at the level of 60
179  // degree sectors. Use CSC sectors as a template
180  void calculateDTGlobalSector(const DTChamberId& chid,
181  unsigned& global_sector,
182  unsigned& subsector );
183  void calculateCSCGlobalSector(const CSCDetId& chid,
184  unsigned& global_sector,
185  unsigned& subsector );
186  void calculateRPCGlobalSector(const RPCDetId& chid,
187  unsigned& global_sector,
188  unsigned& subsector );
189 
193 
195 
197 
198  unsigned _globalsector; // [1,6] in 60 degree sectors
199  unsigned _subsector; // [1,2] in 30 degree partitions of a sector
200  double _eta,_phi,_rho; // global pseudorapidity, phi
201  double _theta; // bend angle with respect to ray from (0,0,0)
202  };
203 
204 }
205 
206 #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)