CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/RecoMuon/TrackingTools/src/MuonChi2MeasurementEstimator.cc

Go to the documentation of this file.
00001 
00011 #include "RecoMuon/TrackingTools/interface/MuonChi2MeasurementEstimator.h"
00012 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00013 
00014 #include "RecoMuon/TransientTrackingRecHit/interface/MuonTransientTrackingRecHit.h"
00015 #include "DataFormats/DetId/interface/DetId.h"
00016 #include "DataFormats/Common/interface/getRef.h"
00017 #include "DataFormats/MuonDetId/interface/MuonSubdetId.h"
00018 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
00019  
00020 
00021 MuonChi2MeasurementEstimator::MuonChi2MeasurementEstimator(double maxChi2, double nSigma)
00022   :Chi2MeasurementEstimatorBase(maxChi2,nSigma), 
00023    theDTChi2Estimator(maxChi2, nSigma), 
00024    theCSCChi2Estimator(maxChi2, nSigma),
00025    theRPCChi2Estimator(maxChi2, nSigma){}
00026 
00027 
00028 MuonChi2MeasurementEstimator::MuonChi2MeasurementEstimator(double dtMaxChi2, double cscMaxChi2, double rpcMaxChi2, double nSigma = 3.)
00029   :Chi2MeasurementEstimatorBase(dtMaxChi2,nSigma),
00030    theDTChi2Estimator(dtMaxChi2, nSigma), 
00031    theCSCChi2Estimator(cscMaxChi2, nSigma),
00032    theRPCChi2Estimator(rpcMaxChi2, nSigma){}
00033 
00034 
00035 std::pair<bool,double> 
00036 MuonChi2MeasurementEstimator::estimate(const TrajectoryStateOnSurface& tsos,
00037                                        const TransientTrackingRecHit& recHit) const {
00038   
00039   DetId id = recHit.geographicalId();
00040   
00041   // chi2 choise based on recHit provenance
00042   if(id.det() == DetId::Muon){
00043     if(id.subdetId() == MuonSubdetId::DT)
00044       return theDTChi2Estimator.estimate(tsos,recHit);
00045     else if(id.subdetId() == MuonSubdetId::CSC)
00046       return theCSCChi2Estimator.estimate(tsos,recHit);
00047     else if(id.subdetId() == MuonSubdetId::RPC) 
00048       return theRPCChi2Estimator.estimate(tsos,recHit);
00049     else{
00050       edm::LogWarning("Muon|RecoMuon|MuonChi2MeasurementEstimator")
00051         <<"RecHit with MuonId but not with a SubDetId neither from DT, CSC or rpc. [Use the parameters used for DTs]";
00052       return theDTChi2Estimator.estimate(tsos,recHit);
00053     }
00054   }
00055   else{
00056     edm::LogWarning("Muon|RecoMuon|MuonChi2MeasurementEstimator")
00057       <<"Rechit with a non-muon det id. [Use the parameters used for DTs]";
00058     return theDTChi2Estimator.estimate(tsos,recHit);
00059   }
00060 }