CMS 3D CMS Logo

PrimitiveCombiner.h
Go to the documentation of this file.
1 #ifndef L1Trigger_L1IntegratedMuonTrigger_PrimitiveCombiner_h_
2 #define L1Trigger_L1IntegratedMuonTrigger_PrimitiveCombiner_h_
3 //
4 // Class: L1TwinMux:: PrimitiveCombiner
5 //
6 // Info: This class combine information from DT and/or RPC primitives
7 // in order to calculate better phi/phiBending
8 //
9 // Author: Giuseppe Codispoti
10 //
11 
14 
15 #include <cmath>
16 
17 class DTGeometry;
18 
19 
20 
21 namespace L1TwinMux {
22 
23  //class L1TwinMux::TriggerPrimitive;
24 
26 
27  public :
29  struct resolutions {
30  double xDt;
31  double xRpc;
32  double phibDtCorr;
33  double phibDtUnCorr;
34  resolutions( const double & xDtResol, const double & xRpcResol,
35  const double & phibDtCorrResol, const double & phibDtUnCorrResol )
36  : xDt( xDtResol ), xRpc( xRpcResol ),
37  phibDtCorr( phibDtCorrResol ), phibDtUnCorr( phibDtUnCorrResol ) {};
38  };
39 
40  public :
41  explicit PrimitiveCombiner( const resolutions & res, edm::ESHandle<DTGeometry> & muonGeom );
42 
44  void addDt( const L1TMuon::TriggerPrimitive & prim );
45  void addDtHI( const L1TMuon::TriggerPrimitive & prim );
46  void addDtHO( const L1TMuon::TriggerPrimitive & prim );
47  void addRpcIn( const L1TMuon::TriggerPrimitive & prim );
48  void addRpcOut( const L1TMuon::TriggerPrimitive & prim );
49 
51  void combine();
52 
54  inline int bx() const { return _bx;};
55  inline int radialAngle() const { return _radialAngle;};
56  inline int bendingAngle() const { return _bendingAngle;};
57  inline int bendingResol() const { return _bendingResol;};
58 
60  bool isValid() const {
61  int ret = _dtHI ? 1 : 0;
62  ret += _dtHO ? 1 : 0;
63  ret += _rpcIn ? 2 : 0;
64  ret += _rpcOut ? 2 : 0;
65  return ret > 1 ;
66  };
67 
69  inline float phiBCombined( const float & xDt, const float & zDt,
70  const float & xRpc, const float & zRpc )
71  {
72  return (xRpc - xDt) / (zRpc - zDt);
73  };
75 
77  inline float phiBCombinedResol( const float & resol_xDt,
78  const float & resol_xRpc,
79  const float & zDt,
80  const float & zRpc
81  )
82  {
83  return std::sqrt( resol_xRpc*resol_xRpc + resol_xDt*resol_xDt )/std::fabs(zDt-zRpc);
84  };
86 
88 
89  int qualityCode = 0;
90  if ( _dtHI && _dtHO ) {
91  if ( _rpcIn && _rpcOut ) qualityCode = 5;
92  else qualityCode = 5;
93  } else if ( _dtHO ) {// HO quality == 3
94  if ( _rpcIn && _rpcOut ) qualityCode = 4;
95  else if ( _rpcOut ) qualityCode = 4;
96  else if ( _rpcIn ) qualityCode = 4;
97  else qualityCode = 2;
98  } else if ( _dtHI ) {// HI, quality == 2
99  if ( _rpcIn && _rpcOut ) qualityCode = 3;
100  else if ( _rpcOut ) qualityCode = 3;
101  else if ( _rpcIn ) qualityCode = 3;
102  else qualityCode = 1;
103  } else {
104  if ( _rpcIn && _rpcOut ) qualityCode = 0;
105  else if ( _rpcOut ) qualityCode = -1;
106  else if ( _rpcIn ) qualityCode = -1;
107  }
108  return qualityCode;
109  }
110 
112 
113  int qualityCode = 0;
114  if ( _dtHI && _dtHO ) {
115  if ( _rpcIn && _rpcOut ) qualityCode = 12;
116  else qualityCode = 11;
117  } else if ( _dtHO ) {// HO quality == 3
118  if ( _rpcIn && _rpcOut ) qualityCode = 10;
119  else if ( _rpcOut ) qualityCode = 8;
120  else if ( _rpcIn ) qualityCode = 6;
121  else qualityCode = 4;
122  } else if ( _dtHI ) {// HI, quality == 2
123  if ( _rpcIn && _rpcOut ) qualityCode = 9;
124  else if ( _rpcOut ) qualityCode = 7;
125  else if ( _rpcIn ) qualityCode = 5;
126  else qualityCode = 3;
127  } else {
128  if ( _rpcIn && _rpcOut ) qualityCode = 2;
129  else if ( _rpcOut ) qualityCode = 1;
130  else if ( _rpcIn ) qualityCode = 0;
131  }
132  return qualityCode;
133  }
134 
135  private :
136 
138  struct results {
139  double radialAngle;
140  double bendingAngle;
141  double bendingResol;
142  results() : radialAngle(0), bendingAngle(0), bendingResol(0) {};
143  };
144 
145 
148  const L1TMuon::TriggerPrimitive * rpc );
149 
151 
154  const L1TMuon::TriggerPrimitive * rpc );
155 
158  const L1TMuon::TriggerPrimitive * rpc2 );
159 
160 
162 
163  private :
166 
167  int _bx;
171 
176 
177  };
178 }
179 
180 #endif
float dt
Definition: AMPTWrapper.h:126
const L1TMuon::TriggerPrimitive * _dtHO
int getUncorrelatedQuality7() const
FIXME END.
a struct useful for resulution info sharing
const L1TMuon::TriggerPrimitive * _rpcIn
bool isValid() const
valid if we have at least: 1 rpc; 1 dt + 1 any
resolutions(const double &xDtResol, const double &xRpcResol, const double &phibDtCorrResol, const double &phibDtUnCorrResol)
void combine()
do combine the primitives
void addDtHO(const L1TMuon::TriggerPrimitive &prim)
Definition: Electron.h:4
results combineRpcRpc(const L1TMuon::TriggerPrimitive *rpc1, const L1TMuon::TriggerPrimitive *rpc2)
Calculates new phiBending, check how to use weights.
const L1TMuon::TriggerPrimitive * _dtHI
float phiBCombined(const float &xDt, const float &zDt, const float &xRpc, const float &zRpc)
FIXME : Calculates new phiBending, check how to use.
a struct for internal usage: store results
T sqrt(T t)
Definition: SSEVec.h:18
results combineDt(const L1TMuon::TriggerPrimitive *dt, const L1TMuon::TriggerPrimitive *rpc)
Calculates new phiBending, check how to use weights.
results dummyCombineDt(const L1TMuon::TriggerPrimitive *dt)
int radialAngleFromGlobalPhi(const L1TMuon::TriggerPrimitive *rpc)
void addRpcOut(const L1TMuon::TriggerPrimitive &prim)
void addRpcIn(const L1TMuon::TriggerPrimitive &prim)
void addDtHI(const L1TMuon::TriggerPrimitive &prim)
PrimitiveCombiner(const resolutions &res, edm::ESHandle< DTGeometry > &muonGeom)
float phiBCombinedResol(const float &resol_xDt, const float &resol_xRpc, const float &zDt, const float &zRpc)
FIXME END.
const L1TMuon::TriggerPrimitive * _rpcOut
int bx() const
output result variables
void addDt(const L1TMuon::TriggerPrimitive &prim)
feed the combiner with the available primitives
results combineDtRpc(const L1TMuon::TriggerPrimitive *dt, const L1TMuon::TriggerPrimitive *rpc)
Calculates new phiBending, check how to use weights.
edm::ESHandle< DTGeometry > _muonGeom