Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:26:16

0001 /** \class MuonChi2MeasurementEstimator
0002  *  Class to handle different chi2 cut parameters for each muon sub-system.
0003  *  MuonChi2MeasurementEstimator inherits from the Chi2MeasurementEstimatorBase class and uses
0004  *  3 different estimators.
0005  *
0006  *  \author Giorgia Mila - INFN Torino
0007  */
0008 
0009 #include "RecoMuon/TrackingTools/interface/MuonChi2MeasurementEstimator.h"
0010 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0011 
0012 #include "RecoMuon/TransientTrackingRecHit/interface/MuonTransientTrackingRecHit.h"
0013 #include "DataFormats/DetId/interface/DetId.h"
0014 #include "DataFormats/Common/interface/getRef.h"
0015 #include "DataFormats/MuonDetId/interface/MuonSubdetId.h"
0016 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
0017 
0018 MuonChi2MeasurementEstimator::MuonChi2MeasurementEstimator(double maxChi2, double nSigma)
0019     : Chi2MeasurementEstimatorBase(maxChi2, nSigma),
0020       theDTChi2Estimator(maxChi2, nSigma),
0021       theCSCChi2Estimator(maxChi2, nSigma),
0022       theRPCChi2Estimator(maxChi2, nSigma) {}
0023 
0024 MuonChi2MeasurementEstimator::MuonChi2MeasurementEstimator(double dtMaxChi2,
0025                                                            double cscMaxChi2,
0026                                                            double rpcMaxChi2,
0027                                                            double nSigma = 3.)
0028     : Chi2MeasurementEstimatorBase(dtMaxChi2, nSigma),
0029       theDTChi2Estimator(dtMaxChi2, nSigma),
0030       theCSCChi2Estimator(cscMaxChi2, nSigma),
0031       theRPCChi2Estimator(rpcMaxChi2, nSigma) {}
0032 
0033 std::pair<bool, double> MuonChi2MeasurementEstimator::estimate(const TrajectoryStateOnSurface& tsos,
0034                                                                const TrackingRecHit& recHit) const {
0035   DetId id = recHit.geographicalId();
0036 
0037   // chi2 choise based on recHit provenance
0038   if (id.det() == DetId::Muon) {
0039     if (id.subdetId() == MuonSubdetId::DT)
0040       return theDTChi2Estimator.estimate(tsos, recHit);
0041     else if (id.subdetId() == MuonSubdetId::CSC)
0042       return theCSCChi2Estimator.estimate(tsos, recHit);
0043     else if (id.subdetId() == MuonSubdetId::RPC)
0044       return theRPCChi2Estimator.estimate(tsos, recHit);
0045     else {
0046       edm::LogWarning("Muon|RecoMuon|MuonChi2MeasurementEstimator")
0047           << "RecHit with MuonId but not with a SubDetId neither from DT, CSC or rpc. [Use the parameters used for "
0048              "DTs]";
0049       return theDTChi2Estimator.estimate(tsos, recHit);
0050     }
0051   } else {
0052     edm::LogWarning("Muon|RecoMuon|MuonChi2MeasurementEstimator")
0053         << "Rechit with a non-muon det id. [Use the parameters used for DTs]";
0054     return theDTChi2Estimator.estimate(tsos, recHit);
0055   }
0056 }