CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MuonChamberMatch.cc
Go to the documentation of this file.
6 #include <cmath>
7 using namespace reco;
8 
10  if( detector() == MuonSubdetId::DT ) { // DT
11  DTChamberId segId(id.rawId());
12  return segId.station();
13  }
14  if( detector() == MuonSubdetId::CSC ) { // CSC
15  CSCDetId segId(id.rawId());
16  return segId.station();
17  }
18  if( detector() == MuonSubdetId::RPC ) { //RPC
19  RPCDetId segId(id.rawId());
20  return segId.station();
21  }
22  return -1; // is this appropriate? fix this
23 }
24 
25 std::pair<float,float>
26 MuonChamberMatch::getDistancePair(float edgeX, float edgeY, float xErr, float yErr) const
27 {
28  if(edgeX>9E5&&edgeY>9E5&&xErr>9E5&&yErr>9E5) // there is no track
29  return std::make_pair(999999, 999999);
30 
31  float distance = 999999;
32  float error = 999999;
33 
34  if(edgeX<0 && edgeY<0) {
35  if(edgeX<edgeY) { distance = edgeY; error = yErr; }
36  else { distance = edgeX; error = xErr; }
37  }
38  if(edgeX<0 && edgeY>0) { distance = edgeY; error = yErr; }
39  if(edgeX>0 && edgeY<0) { distance = edgeX; error = xErr; }
40  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; }
41 
42  return std::make_pair(distance, error);
43 }
static const int CSC
Definition: MuonSubdetId.h:15
T sqrt(T t)
Definition: SSEVec.h:28
static const int RPC
Definition: MuonSubdetId.h:16
int station() const
Definition: CSCDetId.h:88
static const int DT
Definition: MuonSubdetId.h:14
int station() const
Return the station number.
Definition: DTChamberId.h:53
std::pair< float, float > getDistancePair(float edgeX, float edgeY, float xErr, float yErr) const
int station() const
Definition: RPCDetId.h:98