test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 using namespace L1TMuon;
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 TriggerPrimitive & prim );
45  void addDtHI( const TriggerPrimitive & prim );
46  void addDtHO( const TriggerPrimitive & prim );
47  void addRpcIn( const TriggerPrimitive & prim );
48  void addRpcOut( const 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 
147  results combineDt( const TriggerPrimitive * dt,
148  const TriggerPrimitive * rpc );
149 
150  results dummyCombineDt( const TriggerPrimitive * dt);
151 
153  results combineDtRpc( const TriggerPrimitive * dt,
154  const TriggerPrimitive * rpc );
155 
157  results combineRpcRpc( const TriggerPrimitive * rpc1,
158  const TriggerPrimitive * rpc2 );
159 
160 
161  int radialAngleFromGlobalPhi( const TriggerPrimitive * rpc );
162 
163  private :
166 
167  int _bx;
171 
176 
177  };
178 }
179 
180 #endif
float dt
Definition: AMPTWrapper.h:126
tuple ret
prodAgent to be discontinued
int getUncorrelatedQuality7() const
FIXME END.
const TriggerPrimitive * _rpcOut
a struct useful for resulution info sharing
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)
const TriggerPrimitive * _dtHI
float phiBCombined(const float &xDt, const float &zDt, const float &xRpc, const float &zRpc)
FIXME : Calculates new phiBending, check how to use.
const TriggerPrimitive * _rpcIn
a struct for internal usage: store results
T sqrt(T t)
Definition: SSEVec.h:18
static type combine(const A &_1, const B &_2)
Definition: Factorize.h:186
tuple results
Definition: mps_update.py:44
float phiBCombinedResol(const float &resol_xDt, const float &resol_xRpc, const float &zDt, const float &zRpc)
FIXME END.
int bx() const
output result variables
const TriggerPrimitive * _dtHO
edm::ESHandle< DTGeometry > _muonGeom