CMS 3D CMS Logo

MuonChamberMatch.cc

Go to the documentation of this file.
00001 #include "DataFormats/MuonDetId/interface/DTChamberId.h"
00002 #include <DataFormats/MuonDetId/interface/MuonSubdetId.h> 
00003 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
00004 #include "DataFormats/MuonDetId/interface/RPCDetId.h"
00005 #include "DataFormats/MuonReco/interface/MuonChamberMatch.h"
00006 #include <cmath>
00007 using namespace reco;
00008 
00009 int MuonChamberMatch::station()  const {
00010    if( detector() ==  MuonSubdetId::DT ) {    // DT
00011       DTChamberId segId(id.rawId());
00012       return segId.station();
00013    }
00014    if( detector() == MuonSubdetId::CSC ) {    // CSC
00015       CSCDetId segId(id.rawId());
00016       return segId.station();
00017    }
00018    if( detector() == MuonSubdetId::RPC ) {    //RPC
00019       RPCDetId segId(id.rawId());
00020       return segId.station();
00021    }
00022    return -1; // is this appropriate? fix this
00023 }
00024 
00025 std::pair<float,float>
00026 MuonChamberMatch::getDistancePair(float edgeX, float edgeY, float xErr, float yErr) const
00027 {
00028    if(edgeX>9E5&&edgeY>9E5&&xErr>9E5&&yErr>9E5) // there is no track
00029       return std::make_pair(999999, 999999);
00030 
00031    float distance = 999999;
00032    float error    = 999999;
00033 
00034    if(edgeX<0 && edgeY<0) {
00035       if(edgeX<edgeY) { distance = edgeY; error = yErr; }
00036       else { distance = edgeX; error = xErr; }
00037    }
00038    if(edgeX<0 && edgeY>0) { distance = edgeY; error = yErr; }
00039    if(edgeX>0 && edgeY<0) { distance = edgeX; error = xErr; }
00040    if(edgeX>0 && edgeY>0) { distance = sqrt(edgeX*edgeX+edgeY*edgeY); error = sqrt(xErr*xErr+yErr*yErr); }
00041 
00042    return std::make_pair(distance, error);
00043 }

Generated on Tue Jun 9 17:31:21 2009 for CMSSW by  doxygen 1.5.4