CMS 3D CMS Logo

MuonChamberMatch.cc
Go to the documentation of this file.
8 #include <cmath>
9 using namespace reco;
10 
12  if( detector() == MuonSubdetId::DT ) { // DT
13  DTChamberId segId(id.rawId());
14  return segId.station();
15  }
16  if( detector() == MuonSubdetId::CSC ) { // CSC
17  CSCDetId segId(id.rawId());
18  return segId.station();
19  }
20  if( detector() == MuonSubdetId::RPC ) { //RPC
21  RPCDetId segId(id.rawId());
22  return segId.station();
23  }
24  if( detector() == MuonSubdetId::GEM ) { //GEM
25  GEMDetId segId(id.rawId());
26  return segId.station();
27  }
28  if( detector() == MuonSubdetId::ME0 ) { //ME0
29  ME0DetId segId(id.rawId());
30  return segId.station();
31  }
32  return -1; // is this appropriate? fix this
33 }
34 
35 std::pair<float,float>
36 MuonChamberMatch::getDistancePair(float edgeX, float edgeY, float xErr, float yErr) const
37 {
38  if(edgeX>9E5&&edgeY>9E5&&xErr>9E5&&yErr>9E5) // there is no track
39  return std::make_pair(999999, 999999);
40 
41  float distance = 999999;
42  float error = 999999;
43 
44  if(edgeX<0 && edgeY<0) {
45  if(edgeX<edgeY) { distance = edgeY; error = yErr; }
46  else { distance = edgeX; error = xErr; }
47  }
48  if(edgeX<0 && edgeY>0) { distance = edgeY; error = yErr; }
49  if(edgeX>0 && edgeY<0) { distance = edgeX; error = xErr; }
50  if(edgeX>0 && edgeY>0) { distance = sqrt(edgeX*edgeX+edgeY*edgeY); error = distance ? sqrt(edgeX*edgeX*xErr*xErr+edgeY*edgeY*yErr*yErr)/fabs(distance) : 0; }
51 
52  return std::make_pair(distance, error);
53 }
static const int GEM
Definition: MuonSubdetId.h:15
int station() const
Definition: ME0DetId.h:76
static const int ME0
Definition: MuonSubdetId.h:16
static const int CSC
Definition: MuonSubdetId.h:13
T sqrt(T t)
Definition: SSEVec.h:18
int station() const
Station id : the station is the pair of chambers at same disk.
Definition: GEMDetId.h:64
fixed size matrix
static const int RPC
Definition: MuonSubdetId.h:14
int station() const
Definition: CSCDetId.h:86
static const int DT
Definition: MuonSubdetId.h:12
int station() const
Return the station number.
Definition: DTChamberId.h:51
std::pair< float, float > getDistancePair(float edgeX, float edgeY, float xErr, float yErr) const
int station() const
Definition: RPCDetId.h:96