#include <RecoMuonValidatorPF.h>
Classes | |
struct | CommonME |
struct | MuonME |
Public Member Functions | |
virtual void | analyze (const edm::Event &event, const edm::EventSetup &eventSetup) |
virtual void | beginRun (const edm::Run &, const edm::EventSetup &eventSetup) |
virtual int | countMuonHits (const reco::Track &track) const |
virtual int | countTrackerHits (const reco::Track &track) const |
virtual void | endRun () |
RecoMuonValidatorPF (const edm::ParameterSet &pset) | |
~RecoMuonValidatorPF () | |
Protected Attributes | |
const MuonAssociatorByHits * | assoByHits |
CommonME * | commonME_ |
bool | doAbsEta_ |
bool | doAssoc_ |
edm::InputTag | muAssocLabel_ |
edm::InputTag | muonLabel_ |
MuonME * | muonME_ |
std::string | muonSelection_ |
std::string | outputFileName_ |
edm::InputTag | simLabel_ |
std::string | subDir_ |
DQMStore * | theDQM |
MuonServiceProxy * | theMuonService |
TrackingParticleSelector | tpSelector_ |
MuonAssociatorByHits::MuonTrackType | trackType_ |
unsigned int | verbose_ |
Private Attributes | |
StringCutObjectSelector < reco::Muon > | selector_ |
Definition at line 25 of file RecoMuonValidatorPF.h.
RecoMuonValidatorPF::RecoMuonValidatorPF | ( | const edm::ParameterSet & | pset | ) |
Definition at line 575 of file RecoMuonValidatorPF.cc.
References DQMStore::book1D(), DQMStore::book2D(), RecoMuonValidatorPF::MuonME::bookHistograms(), DQMStore::cd(), commonME_, doAbsEta_, doAssoc_, Exception, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), MuonAssociatorByHits::GlobalTk, RecoMuonValidatorPF::CommonME::hMuonAllEta_, RecoMuonValidatorPF::CommonME::hMuonAllP_, RecoMuonValidatorPF::CommonME::hMuonAllPhi_, RecoMuonValidatorPF::CommonME::hMuonAllPt_, RecoMuonValidatorPF::CommonME::hMuonEta_, RecoMuonValidatorPF::CommonME::hMuonP_, RecoMuonValidatorPF::CommonME::hMuonPhi_, RecoMuonValidatorPF::CommonME::hMuonPt_, RecoMuonValidatorPF::CommonME::hMuonTrackDxy_, RecoMuonValidatorPF::CommonME::hMuonTrackDz_, RecoMuonValidatorPF::CommonME::hMuonTrackEta_, RecoMuonValidatorPF::CommonME::hMuonTrackP_, RecoMuonValidatorPF::CommonME::hMuonTrackPhi_, RecoMuonValidatorPF::CommonME::hMuonTrackPt_, RecoMuonValidatorPF::CommonME::hNDeltaInvalidHitsHitPattern_, RecoMuonValidatorPF::CommonME::hNInvalidHitsGTHitPattern_, RecoMuonValidatorPF::CommonME::hNInvalidHitsITHitPattern_, RecoMuonValidatorPF::CommonME::hNInvalidHitsOTHitPattern_, RecoMuonValidatorPF::CommonME::hStaToGlbDiffNMuonHits_, RecoMuonValidatorPF::CommonME::hStaToGlbDiffNMuonHitsEta_, RecoMuonValidatorPF::CommonME::hStaToGlbDiffNMuonHitsPt_, RecoMuonValidatorPF::CommonME::hTrkToGlbDiffNTrackerHits_, RecoMuonValidatorPF::CommonME::hTrkToGlbDiffNTrackerHitsEta_, RecoMuonValidatorPF::CommonME::hTrkToGlbDiffNTrackerHitsPt_, MuonAssociatorByHits::InnerTk, muAssocLabel_, muonLabel_, muonME_, MuonServiceProxy_cff::MuonServiceProxy, HistoDimensions::nBinP, cmsCodeRules::cppFunctionSkipper::operator, MuonAssociatorByHits::OuterTk, outputFileName_, Pi, MuonAssociatorByHits::Segments, DQMStore::setCurrentFolder(), DQMStore::showDirStructure(), simLabel_, subDir_, theDQM, theMuonService, tpSelector_, trackType_, and verbose_.
: selector_(pset.getParameter<std::string>("selection")) { verbose_ = pset.getUntrackedParameter<unsigned int>("verbose", 0); outputFileName_ = pset.getUntrackedParameter<string>("outputFileName", ""); // Set histogram dimensions from config HistoDimensions hDim; hDim.nBinP = pset.getUntrackedParameter<unsigned int>("nBinP"); hDim.minP = pset.getUntrackedParameter<double>("minP"); hDim.maxP = pset.getUntrackedParameter<double>("maxP"); hDim.nBinPt = pset.getUntrackedParameter<unsigned int>("nBinPt"); hDim.minPt = pset.getUntrackedParameter<double>("minPt"); hDim.maxPt = pset.getUntrackedParameter<double>("maxPt"); doAbsEta_ = pset.getUntrackedParameter<bool>("doAbsEta"); hDim.doAbsEta = doAbsEta_; hDim.nBinEta = pset.getUntrackedParameter<unsigned int>("nBinEta"); hDim.minEta = pset.getUntrackedParameter<double>("minEta"); hDim.maxEta = pset.getUntrackedParameter<double>("maxEta"); hDim.nBinDxy = pset.getUntrackedParameter<unsigned int>("nBinDxy"); hDim.minDxy = pset.getUntrackedParameter<double>("minDxy"); hDim.maxDxy = pset.getUntrackedParameter<double>("maxDxy"); hDim.nBinDz = pset.getUntrackedParameter<unsigned int>("nBinDz"); hDim.minDz = pset.getUntrackedParameter<double>("minDz"); hDim.maxDz = pset.getUntrackedParameter<double>("maxDz"); hDim.nBinPhi = pset.getUntrackedParameter<unsigned int>("nBinPhi"); hDim.minPhi = pset.getUntrackedParameter<double>("minPhi", -TMath::Pi()); hDim.maxPhi = pset.getUntrackedParameter<double>("maxPhi", TMath::Pi()); hDim.nBinErr = pset.getUntrackedParameter<unsigned int>("nBinErr"); hDim.nBinPull = pset.getUntrackedParameter<unsigned int>("nBinPull"); hDim.wPull = pset.getUntrackedParameter<double>("wPull"); hDim.minErrP = pset.getUntrackedParameter<double>("minErrP"); hDim.maxErrP = pset.getUntrackedParameter<double>("maxErrP"); hDim.minErrPt = pset.getUntrackedParameter<double>("minErrPt"); hDim.maxErrPt = pset.getUntrackedParameter<double>("maxErrPt"); hDim.minErrQPt = pset.getUntrackedParameter<double>("minErrQPt"); hDim.maxErrQPt = pset.getUntrackedParameter<double>("maxErrQPt"); hDim.minErrEta = pset.getUntrackedParameter<double>("minErrEta"); hDim.maxErrEta = pset.getUntrackedParameter<double>("maxErrEta"); hDim.minErrPhi = pset.getUntrackedParameter<double>("minErrPhi"); hDim.maxErrPhi = pset.getUntrackedParameter<double>("maxErrPhi"); hDim.minErrDxy = pset.getUntrackedParameter<double>("minErrDxy"); hDim.maxErrDxy = pset.getUntrackedParameter<double>("maxErrDxy"); hDim.minErrDz = pset.getUntrackedParameter<double>("minErrDz" ); hDim.maxErrDz = pset.getUntrackedParameter<double>("maxErrDz" ); hDim.nTrks = pset.getUntrackedParameter<unsigned int>("nTrks"); hDim.nAssoc = pset.getUntrackedParameter<unsigned int>("nAssoc"); hDim.nDof = pset.getUntrackedParameter<unsigned int>("nDof", 55); // Labels for simulation and reconstruction tracks simLabel_ = pset.getParameter<InputTag>("simLabel" ); muonLabel_ = pset.getParameter<InputTag>("muonLabel"); // Labels for sim-reco association doAssoc_ = pset.getUntrackedParameter<bool>("doAssoc", true); muAssocLabel_ = pset.getParameter<InputTag>("muAssocLabel"); //type of track std::string trackType = pset.getParameter< std::string >("trackType"); if (trackType == "inner") trackType_ = MuonAssociatorByHits::InnerTk; else if (trackType == "outer") trackType_ = MuonAssociatorByHits::OuterTk; else if (trackType == "global") trackType_ = MuonAssociatorByHits::GlobalTk; else if (trackType == "segments") trackType_ = MuonAssociatorByHits::Segments; else throw cms::Exception("Configuration") << "Track type '" << trackType << "' not supported.\n"; // seedPropagatorName_ = pset.getParameter<string>("SeedPropagator"); ParameterSet tpset = pset.getParameter<ParameterSet>("tpSelector"); tpSelector_ = TrackingParticleSelector(tpset.getParameter<double>("ptMin"), tpset.getParameter<double>("minRapidity"), tpset.getParameter<double>("maxRapidity"), tpset.getParameter<double>("tip"), tpset.getParameter<double>("lip"), tpset.getParameter<int>("minHit"), tpset.getParameter<bool>("signalOnly"), tpset.getParameter<bool>("chargedOnly"), tpset.getParameter<bool>("stableOnly"), tpset.getParameter<std::vector<int> >("pdgId")); // the service parameters ParameterSet serviceParameters = pset.getParameter<ParameterSet>("ServiceParameters"); theMuonService = new MuonServiceProxy(serviceParameters); // retrieve the instance of DQMService theDQM = 0; theDQM = Service<DQMStore>().operator->(); if ( ! theDQM ) { LogError("RecoMuonValidatorPF") << "DQMService not initialized\n"; return; } subDir_ = pset.getUntrackedParameter<string>("subDir"); if ( subDir_.empty() ) subDir_ = "RecoMuonV"; if ( subDir_[subDir_.size()-1] == '/' ) subDir_.erase(subDir_.size()-1); // book histograms theDQM->cd(); theDQM->setCurrentFolder(subDir_); commonME_ = new CommonME; muonME_ = new MuonME; //commonME const int nHits = 100; // - diffs commonME_->hTrkToGlbDiffNTrackerHits_ = theDQM->book1D("TrkGlbDiffNTrackerHits", "Difference of number of tracker hits (tkMuon - globalMuon)", 2*nHits+1, -nHits-0.5, nHits+0.5); commonME_->hStaToGlbDiffNMuonHits_ = theDQM->book1D("StaGlbDiffNMuonHits", "Difference of number of muon hits (staMuon - globalMuon)", 2*nHits+1, -nHits-0.5, nHits+0.5); commonME_->hTrkToGlbDiffNTrackerHitsEta_ = theDQM->book2D("TrkGlbDiffNTrackerHitsEta", "Difference of number of tracker hits (tkMuon - globalMuon)", hDim.nBinEta, hDim.minEta, hDim.maxEta, 2*nHits+1, -nHits-0.5, nHits+0.5); commonME_->hStaToGlbDiffNMuonHitsEta_ = theDQM->book2D("StaGlbDiffNMuonHitsEta", "Difference of number of muon hits (staMuon - globalMuon)", hDim.nBinEta, hDim.minEta, hDim.maxEta, 2*nHits+1, -nHits-0.5, nHits+0.5); commonME_->hTrkToGlbDiffNTrackerHitsPt_ = theDQM->book2D("TrkGlbDiffNTrackerHitsPt", "Difference of number of tracker hits (tkMuon - globalMuon)", hDim.nBinPt, hDim.minPt, hDim.maxPt, 2*nHits+1, -nHits-0.5, nHits+0.5); commonME_->hStaToGlbDiffNMuonHitsPt_ = theDQM->book2D("StaGlbDiffNMuonHitsPt", "Difference of number of muon hits (staMuon - globalMuon)", hDim.nBinPt, hDim.minPt, hDim.maxPt, 2*nHits+1, -nHits-0.5, nHits+0.5); // -global muon hit pattern commonME_->hNInvalidHitsGTHitPattern_ = theDQM->book1D("NInvalidHitsGTHitPattern", "Number of invalid hits on a global track", nHits+1, -0.5, nHits+0.5); commonME_->hNInvalidHitsITHitPattern_ = theDQM->book1D("NInvalidHitsITHitPattern", "Number of invalid hits on an inner track", nHits+1, -0.5, nHits+0.5); commonME_->hNInvalidHitsOTHitPattern_ = theDQM->book1D("NInvalidHitsOTHitPattern", "Number of invalid hits on an outer track", nHits+1, -0.5, nHits+0.5); commonME_->hNDeltaInvalidHitsHitPattern_ = theDQM->book1D("hNDeltaInvalidHitsHitPattern", "The discrepancy for Number of invalid hits on an global track and inner and outer tracks", 2.*nHits+1, -nHits-0.5, nHits+0.5); //muon based kinematics commonME_->hMuonP_ = theDQM->book1D("PMuon" , "p of muon" , hDim.nBinP , hDim.minP , hDim.maxP ); commonME_->hMuonPt_ = theDQM->book1D("PtMuon" , "p_{T} of muon", hDim.nBinPt , hDim.minPt , hDim.maxPt ); commonME_->hMuonEta_ = theDQM->book1D("EtaMuon", "#eta of muon" , hDim.nBinEta, hDim.minEta, hDim.maxEta); commonME_->hMuonPhi_ = theDQM->book1D("PhiMuon", "#phi of muon" , hDim.nBinPhi, hDim.minPhi, hDim.maxPhi); //track based kinematics commonME_->hMuonTrackP_ = theDQM->book1D("PMuonTrack" , "p of reco muon track" , hDim.nBinP , hDim.minP , hDim.maxP ); commonME_->hMuonTrackPt_ = theDQM->book1D("PtMuonTrack" , "p_{T} of reco muon track", hDim.nBinPt , hDim.minPt , hDim.maxPt ); commonME_->hMuonTrackEta_ = theDQM->book1D("EtaMuonTrack", "#eta of reco muon track" , hDim.nBinEta, hDim.minEta, hDim.maxEta); commonME_->hMuonTrackPhi_ = theDQM->book1D("PhiMuonTrack", "#phi of reco muon track" , hDim.nBinPhi, hDim.minPhi, hDim.maxPhi); commonME_->hMuonTrackDxy_ = theDQM->book1D("DxyMuonTrack", "Dxy of reco muon track" , hDim.nBinDxy, hDim.minDxy, hDim.maxDxy); commonME_->hMuonTrackDz_ = theDQM->book1D("DzMuonTrack", "Dz of reco muon track" , hDim.nBinDz, hDim.minDz, hDim.maxDz); //histograms for fractions commonME_->hMuonAllP_ = theDQM->book1D("PMuonAll" , "p of muons of all types" , hDim.nBinP , hDim.minP , hDim.maxP ); commonME_->hMuonAllPt_ = theDQM->book1D("PtMuonAll" , "p_{T} of muon of all types", hDim.nBinPt , hDim.minPt , hDim.maxPt ); commonME_->hMuonAllEta_ = theDQM->book1D("EtaMuonAll", "#eta of muon of all types" , hDim.nBinEta, hDim.minEta, hDim.maxEta); commonME_->hMuonAllPhi_ = theDQM->book1D("PhiMuonAll", "#phi of muon of all types" , hDim.nBinPhi, hDim.minPhi, hDim.maxPhi); muonME_->bookHistograms(theDQM, subDir_, hDim); if ( verbose_ > 0 ) theDQM->showDirStructure(); }
RecoMuonValidatorPF::~RecoMuonValidatorPF | ( | ) |
Definition at line 743 of file RecoMuonValidatorPF.cc.
References theMuonService.
{ if ( theMuonService ) delete theMuonService; }
void RecoMuonValidatorPF::analyze | ( | const edm::Event & | event, |
const edm::EventSetup & | eventSetup | ||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 775 of file RecoMuonValidatorPF.cc.
References assoByHits, MuonAssociatorByHits::associateMuons(), edm::View< T >::begin(), commonME_, funct::cos(), countMuonHits(), countTrackerHits(), doAbsEta_, doAssoc_, edm::View< T >::end(), MonitorElement::Fill(), RecoMuonValidatorPF::MuonME::fill(), edm::Ref< C, T, F >::get(), RecoMuonValidatorPF::CommonME::hMuonAllEta_, RecoMuonValidatorPF::CommonME::hMuonAllP_, RecoMuonValidatorPF::CommonME::hMuonAllPhi_, RecoMuonValidatorPF::CommonME::hMuonAllPt_, RecoMuonValidatorPF::CommonME::hMuonEta_, RecoMuonValidatorPF::CommonME::hMuonP_, RecoMuonValidatorPF::CommonME::hMuonPhi_, RecoMuonValidatorPF::CommonME::hMuonPt_, RecoMuonValidatorPF::CommonME::hMuonTrackDxy_, RecoMuonValidatorPF::CommonME::hMuonTrackDz_, RecoMuonValidatorPF::CommonME::hMuonTrackEta_, RecoMuonValidatorPF::CommonME::hMuonTrackP_, RecoMuonValidatorPF::CommonME::hMuonTrackPhi_, RecoMuonValidatorPF::CommonME::hMuonTrackPt_, RecoMuonValidatorPF::CommonME::hNDeltaInvalidHitsHitPattern_, RecoMuonValidatorPF::CommonME::hNInvalidHitsGTHitPattern_, RecoMuonValidatorPF::CommonME::hNInvalidHitsITHitPattern_, RecoMuonValidatorPF::CommonME::hNInvalidHitsOTHitPattern_, RecoMuonValidatorPF::MuonME::hNMuon_, RecoMuonValidatorPF::MuonME::hNMuonHits_, RecoMuonValidatorPF::MuonME::hNMuonHits_vs_Eta_, RecoMuonValidatorPF::MuonME::hNMuonHits_vs_Pt_, RecoMuonValidatorPF::MuonME::hNSim_, RecoMuonValidatorPF::MuonME::hNSimHits_, RecoMuonValidatorPF::MuonME::hNSimToReco_, RecoMuonValidatorPF::MuonME::hNTrackerHits_, RecoMuonValidatorPF::MuonME::hNTrackerHits_vs_Eta_, RecoMuonValidatorPF::MuonME::hNTrackerHits_vs_Pt_, RecoMuonValidatorPF::MuonME::hNTrksEta_, RecoMuonValidatorPF::MuonME::hNTrksPt_, RecoMuonValidatorPF::MuonME::hSimDxy_, RecoMuonValidatorPF::MuonME::hSimDz_, RecoMuonValidatorPF::MuonME::hSimEta_, RecoMuonValidatorPF::MuonME::hSimP_, RecoMuonValidatorPF::MuonME::hSimPhi_, RecoMuonValidatorPF::MuonME::hSimPt_, RecoMuonValidatorPF::CommonME::hStaToGlbDiffNMuonHits_, RecoMuonValidatorPF::CommonME::hStaToGlbDiffNMuonHitsEta_, RecoMuonValidatorPF::CommonME::hStaToGlbDiffNMuonHitsPt_, RecoMuonValidatorPF::CommonME::hTrkToGlbDiffNTrackerHits_, RecoMuonValidatorPF::CommonME::hTrkToGlbDiffNTrackerHitsEta_, RecoMuonValidatorPF::CommonME::hTrkToGlbDiffNTrackerHitsPt_, i, edm::Ref< C, T, F >::isNonnull(), Mu, muonLabel_, muonME_, edm::Handle< T >::product(), edm::RefVector< C, T, F >::push_back(), selector_, simLabel_, funct::sin(), edm::View< T >::size(), theDQM, tpSelector_, trackType_, and PV3DBase< T, PVType, FrameType >::x().
{ if ( ! theDQM ) { LogError("RecoMuonValidatorPF") << "DQMService not initialized\n"; return; } // Get TrackingParticles Handle<TrackingParticleCollection> simHandle; event.getByLabel(simLabel_, simHandle); const TrackingParticleCollection simColl = *(simHandle.product()); // Get Muons Handle<View<Muon> > muonHandle; event.getByLabel(muonLabel_, muonHandle); View<Muon> muonColl = *(muonHandle.product()); const TrackingParticleCollection::size_type nSim = simColl.size(); edm::RefToBaseVector<reco::Muon> Muons; Muons = muonHandle->refVector(); edm::RefVector<TrackingParticleCollection> allTPs; for (size_t i = 0; i < nSim; ++i) { allTPs.push_back(TrackingParticleRef(simHandle,i)); } muonME_->hNSim_->Fill(nSim); muonME_->hNMuon_->Fill(muonColl.size()); MuonAssociatorByHits::MuonToSimCollection muonToSimColl; MuonAssociatorByHits::SimToMuonCollection simToMuonColl; if ( doAssoc_ ) { assoByHits->associateMuons(muonToSimColl, simToMuonColl, Muons, trackType_, allTPs, &event, &eventSetup); } else { /* // SimToMuon associations Handle<reco::RecoToSimCollection> simToTrkMuHandle; event.getByLabel(trkMuAssocLabel_, simToTrkMuHandle); trkSimRecColl = *(simToTrkMuHandle.product()); Handle<reco::RecoToSimCollection> simToStaMuHandle; event.getByLabel(staMuAssocLabel_, simToStaMuHandle); staSimRecColl = *(simToStaMuHandle.product()); Handle<reco::RecoToSimCollection> simToGlbMuHandle; event.getByLabel(glbMuAssocLabel_, simToGlbMuHandle); glbSimRecColl = *(simToGlbMuHandle.product()); // MuonToSim associations Handle<reco::SimToRecoCollection> trkMuToSimHandle; event.getByLabel(trkMuAssocLabel_, trkMuToSimHandle); trkRecSimColl = *(trkMuToSimHandle.product()); Handle<reco::SimToRecoCollection> staMuToSimHandle; event.getByLabel(staMuAssocLabel_, staMuToSimHandle); staRecSimColl = *(staMuToSimHandle.product()); Handle<reco::SimToRecoCollection> glbMuToSimHandle; event.getByLabel(glbMuAssocLabel_, glbMuToSimHandle); glbRecSimColl = *(glbMuToSimHandle.product()); */ } int glbNTrackerHits = 0; int trkNTrackerHits = 0; int staNTrackerHits = 0; int glbNMuonHits = 0; int trkNMuonHits = 0; int staNMuonHits = 0; int NTrackerHits = 0; int NMuonHits = 0; // Analyzer reco::Muon for(View<Muon>::const_iterator iMuon = muonColl.begin(); iMuon != muonColl.end(); ++iMuon) { //histograms for commonME_->hMuonAllP_->Fill(iMuon->pfP4().P()); commonME_->hMuonAllPt_->Fill(iMuon->pfP4().Pt()); commonME_->hMuonAllEta_->Fill(iMuon->pfP4().Eta()); commonME_->hMuonAllPhi_->Fill(iMuon->pfP4().Phi()); //everything else uses track if (!selector_(*iMuon)) continue; TrackRef Track = iMuon->track(); if (Track.isNonnull()) { commonME_->hMuonTrackP_->Fill(Track->p()); commonME_->hMuonTrackPt_->Fill(Track->pt()); commonME_->hMuonTrackEta_->Fill(Track->eta()); commonME_->hMuonTrackPhi_->Fill(Track->phi()); //ip histograms commonME_->hMuonTrackDxy_->Fill(Track->dxy()); commonME_->hMuonTrackDz_->Fill(Track->dz()); } if (iMuon->isGlobalMuon()) { Track = iMuon->combinedMuon(); glbNTrackerHits = countTrackerHits(*Track); glbNMuonHits = countMuonHits(*Track); } else if (iMuon->isTrackerMuon()) { Track = iMuon->track(); trkNTrackerHits = countTrackerHits(*Track); trkNMuonHits = countMuonHits(*Track); } else { Track = iMuon->standAloneMuon(); staNTrackerHits = countTrackerHits(*Track); staNMuonHits = countMuonHits(*Track); } NTrackerHits = countTrackerHits(*Track); NMuonHits = countMuonHits(*Track); //list of histos for each type // muonME_->hNTrks_->Fill(); muonME_->hNTrksEta_->Fill(Track->eta()); muonME_->hNTrksPt_->Fill(Track->pt()); commonME_->hMuonP_->Fill(iMuon->p()); commonME_->hMuonPt_->Fill(iMuon->pt()); commonME_->hMuonEta_->Fill(iMuon->eta()); commonME_->hMuonPhi_->Fill(iMuon->phi()); if (iMuon->isGlobalMuon()) { double gtHitPat = iMuon->globalTrack()->hitPattern().numberOfHits() - iMuon->globalTrack()->hitPattern().numberOfValidHits(); double itHitPat = iMuon->innerTrack()->hitPattern().numberOfHits() - iMuon->innerTrack()->hitPattern().numberOfValidHits(); double otHitPat = iMuon->outerTrack()->hitPattern().numberOfHits() - iMuon->outerTrack()->hitPattern().numberOfValidHits(); commonME_->hNInvalidHitsGTHitPattern_->Fill(gtHitPat); commonME_->hNInvalidHitsITHitPattern_->Fill(itHitPat); commonME_->hNInvalidHitsOTHitPattern_->Fill(otHitPat); commonME_->hNDeltaInvalidHitsHitPattern_->Fill(gtHitPat - itHitPat - otHitPat); } muonME_->hNTrackerHits_->Fill(NTrackerHits); muonME_->hNTrackerHits_vs_Pt_->Fill(Track->pt(), NTrackerHits); muonME_->hNTrackerHits_vs_Eta_->Fill(Track->eta(), NTrackerHits); muonME_->hNMuonHits_->Fill(NMuonHits); muonME_->hNMuonHits_vs_Pt_->Fill(Track->pt(), NMuonHits); muonME_->hNMuonHits_vs_Eta_->Fill(Track->eta(), NMuonHits); //must be global and standalone if (iMuon->isGlobalMuon() && iMuon->isStandAloneMuon()) { commonME_->hStaToGlbDiffNMuonHitsEta_->Fill(Track->eta(),staNMuonHits-glbNMuonHits); commonME_->hStaToGlbDiffNMuonHitsPt_->Fill(Track->pt(),staNMuonHits-glbNMuonHits); commonME_->hStaToGlbDiffNMuonHits_->Fill(staNMuonHits-glbNMuonHits); } //must be global and tracker if (iMuon->isGlobalMuon() && iMuon->isTrackerMuon()) { commonME_->hTrkToGlbDiffNTrackerHitsEta_->Fill(Track->eta(),trkNTrackerHits-glbNTrackerHits); commonME_->hTrkToGlbDiffNTrackerHitsPt_->Fill(Track->pt(),trkNTrackerHits-glbNTrackerHits); commonME_->hTrkToGlbDiffNTrackerHits_->Fill(trkNTrackerHits-glbNTrackerHits); } }//end of reco muon loop // Associate by hits for(TrackingParticleCollection::size_type i=0; i<nSim; i++) { TrackingParticleRef simRef(simHandle, i); const TrackingParticle* simTP = simRef.get(); if ( ! tpSelector_(*simTP) ) continue; //denominators for efficiency plots const double simP = simRef->p(); const double simPt = simRef->pt(); const double simEta = doAbsEta_ ? fabs(simRef->eta()) : simRef->eta(); const double simPhi = simRef->phi(); GlobalPoint simVtx(simRef->vertex().x(), simRef->vertex().y(), simRef->vertex().z()); GlobalVector simMom(simRef->momentum().x(), simRef->momentum().y(), simRef->momentum().z()); const double simDxy = -simVtx.x()*sin(simPhi)+simVtx.y()*cos(simPhi); const double simDz = simVtx.z() - (simVtx.x()*simMom.x()+simVtx.y()*simMom.y())*simMom.z()/simMom.perp2(); const unsigned int nSimHits = simRef->pSimHit_end() - simRef->pSimHit_begin(); muonME_->hSimP_ ->Fill(simP ); muonME_->hSimPt_ ->Fill(simPt ); muonME_->hSimEta_->Fill(simEta); muonME_->hSimPhi_->Fill(simPhi); muonME_->hSimDxy_->Fill(simDxy); muonME_->hSimDz_->Fill(simDz); muonME_->hNSimHits_->Fill(nSimHits); // Get sim-reco association for a simRef vector<pair<RefToBase<Muon>, double> > MuRefV; if ( simToMuonColl.find(simRef) != simToMuonColl.end() ) { MuRefV = simToMuonColl[simRef]; if ( !MuRefV.empty()) { muonME_->hNSimToReco_->Fill(MuRefV.size()); const Muon* Mu = MuRefV.begin()->first.get(); if (!selector_(*Mu)) continue; muonME_->fill(&*simTP, Mu); } } } }
void RecoMuonValidatorPF::beginRun | ( | const edm::Run & | , |
const edm::EventSetup & | eventSetup | ||
) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 751 of file RecoMuonValidatorPF.cc.
References assoByHits, doAssoc_, Exception, edm::EventSetup::get(), edm::InputTag::label(), muAssocLabel_, edm::ESHandle< T >::product(), and theMuonService.
{ if ( theMuonService ) theMuonService->update(eventSetup); if ( doAssoc_ ) { edm::ESHandle<TrackAssociatorBase> associatorBase; eventSetup.get<TrackAssociatorRecord>().get(muAssocLabel_.label(), associatorBase); assoByHits = dynamic_cast<const MuonAssociatorByHits *>(associatorBase.product()); if (assoByHits == 0) throw cms::Exception("Configuration") << "The Track Associator with label '" << muAssocLabel_.label() << "' is not a MuonAssociatorByHits.\n"; } }
int RecoMuonValidatorPF::countMuonHits | ( | const reco::Track & | track | ) | const [virtual] |
Definition at line 977 of file RecoMuonValidatorPF.cc.
References prof2calltree::count, DetId::det(), DetId::Muon, reco::Track::recHitsBegin(), reco::Track::recHitsEnd(), and query::result.
Referenced by analyze().
{ TransientTrackingRecHit::ConstRecHitContainer result; int count = 0; for (trackingRecHit_iterator hit = track.recHitsBegin(); hit != track.recHitsEnd(); ++hit) { if((*hit)->isValid()) { DetId recoid = (*hit)->geographicalId(); if ( recoid.det() == DetId::Muon ) count++; } } return count; }
int RecoMuonValidatorPF::countTrackerHits | ( | const reco::Track & | track | ) | const [virtual] |
Definition at line 992 of file RecoMuonValidatorPF.cc.
References prof2calltree::count, DetId::det(), reco::Track::recHitsBegin(), reco::Track::recHitsEnd(), query::result, and align::Tracker.
Referenced by analyze().
{ TransientTrackingRecHit::ConstRecHitContainer result; int count = 0; for (trackingRecHit_iterator hit = track.recHitsBegin(); hit != track.recHitsEnd(); ++hit) { if((*hit)->isValid()) { DetId recoid = (*hit)->geographicalId(); if ( recoid.det() == DetId::Tracker ) count++; } } return count; }
void RecoMuonValidatorPF::endRun | ( | void | ) | [virtual] |
Definition at line 767 of file RecoMuonValidatorPF.cc.
References outputFileName_, DQMStore::save(), and theDQM.
{ if ( theDQM && ! outputFileName_.empty() ) theDQM->save(outputFileName_); }
const MuonAssociatorByHits* RecoMuonValidatorPF::assoByHits [protected] |
Definition at line 45 of file RecoMuonValidatorPF.h.
Referenced by analyze(), and beginRun().
CommonME* RecoMuonValidatorPF::commonME_ [protected] |
Definition at line 64 of file RecoMuonValidatorPF.h.
Referenced by analyze(), and RecoMuonValidatorPF().
bool RecoMuonValidatorPF::doAbsEta_ [protected] |
Definition at line 53 of file RecoMuonValidatorPF.h.
Referenced by analyze(), and RecoMuonValidatorPF().
bool RecoMuonValidatorPF::doAssoc_ [protected] |
Definition at line 54 of file RecoMuonValidatorPF.h.
Referenced by analyze(), beginRun(), and RecoMuonValidatorPF().
edm::InputTag RecoMuonValidatorPF::muAssocLabel_ [protected] |
Definition at line 44 of file RecoMuonValidatorPF.h.
Referenced by beginRun(), and RecoMuonValidatorPF().
edm::InputTag RecoMuonValidatorPF::muonLabel_ [protected] |
Definition at line 41 of file RecoMuonValidatorPF.h.
Referenced by analyze(), and RecoMuonValidatorPF().
MuonME* RecoMuonValidatorPF::muonME_ [protected] |
Definition at line 61 of file RecoMuonValidatorPF.h.
Referenced by analyze(), and RecoMuonValidatorPF().
std::string RecoMuonValidatorPF::muonSelection_ [protected] |
Definition at line 42 of file RecoMuonValidatorPF.h.
std::string RecoMuonValidatorPF::outputFileName_ [protected] |
Definition at line 47 of file RecoMuonValidatorPF.h.
Referenced by endRun(), and RecoMuonValidatorPF().
Definition at line 68 of file RecoMuonValidatorPF.h.
Referenced by analyze().
edm::InputTag RecoMuonValidatorPF::simLabel_ [protected] |
Definition at line 40 of file RecoMuonValidatorPF.h.
Referenced by analyze(), and RecoMuonValidatorPF().
std::string RecoMuonValidatorPF::subDir_ [protected] |
Definition at line 48 of file RecoMuonValidatorPF.h.
Referenced by RecoMuonValidatorPF().
DQMStore* RecoMuonValidatorPF::theDQM [protected] |
Definition at line 51 of file RecoMuonValidatorPF.h.
Referenced by analyze(), endRun(), and RecoMuonValidatorPF().
MuonServiceProxy* RecoMuonValidatorPF::theMuonService [protected] |
Definition at line 50 of file RecoMuonValidatorPF.h.
Referenced by beginRun(), RecoMuonValidatorPF(), and ~RecoMuonValidatorPF().
Definition at line 56 of file RecoMuonValidatorPF.h.
Referenced by analyze(), and RecoMuonValidatorPF().
Definition at line 59 of file RecoMuonValidatorPF.h.
Referenced by analyze(), and RecoMuonValidatorPF().
unsigned int RecoMuonValidatorPF::verbose_ [protected] |
Definition at line 38 of file RecoMuonValidatorPF.h.
Referenced by RecoMuonValidatorPF().