CMS 3D CMS Logo

Public Types | Public Member Functions | Public Attributes

RecoMuonValidatorPF::MuonME Struct Reference

List of all members.

Public Types

typedef MonitorElementMEP

Public Member Functions

void bookHistograms (DQMStore *dqm, const string &dirName, const HistoDimensions &hDim)
void fill (const TrackingParticle *simRef, const Muon *muonRef)

Public Attributes

bool doAbsEta_
MEP hChi2_
MEP hChi2_vs_Eta_
MEP hChi2Norm_
MEP hChi2Norm_vs_Eta_
MEP hChi2Prob_
MEP hChi2Prob_vs_Eta_
MEP hdPt_vs_Eta_
MEP hdPt_vs_Pt_
MEP hErrDxy_
MEP hErrDz_
MEP hErrEta_
MEP hErrEta_vs_Eta_
MEP hErrP_
MEP hErrP_vs_Eta_
MEP hErrP_vs_P_
MEP hErrPBarrel_
MEP hErrPEndcap_
MEP hErrPhi_
MEP hErrPOverlap_
MEP hErrPt_
MEP hErrPt_PF_
MEP hErrPt_vs_Eta_
MEP hErrPt_vs_Pt_
MEP hErrPtBarrel_
MEP hErrPtEndcap_
MEP hErrPtOverlap_
MEP hErrQPt_PF_
MEP hErrQPt_vs_Eta_
MEP hErrQPt_vs_Pt_
MEP hEta_
MEP hMisQEta_
MEP hMisQPt_
MEP hNDof_
MEP hNDof_vs_Eta_
MEP hNHits_
MEP hNHits_vs_Eta_
MEP hNHits_vs_Pt_
MEP hNLostHits_
MEP hNLostHits_vs_Eta_
MEP hNLostHits_vs_Pt_
MEP hNMuon_
MEP hNMuonHits_
MEP hNMuonHits_vs_Eta_
MEP hNMuonHits_vs_Pt_
MEP hNRecoToSim_
MEP hNSim_
MEP hNSimHits_
MEP hNSimToReco_
MEP hNTrackerHits_
MEP hNTrackerHits_vs_Eta_
MEP hNTrackerHits_vs_Pt_
MEP hNTrks_
MEP hNTrksEta_
MEP hNTrksPt_
MEP hP_
MEP hPFDirectionPicked
MEP hPFMomAssCorrectness
MEP hPFMomPicked
MEP hPhi_
MEP hPt_
MEP hPt_vs_PFDirectionPicked
MEP hPt_vs_PFMomAssCorrectness
MEP hPt_vs_PFMomPicked
MEP hPullDxy_
MEP hPullDz_
MEP hPullEta_
MEP hPullEta_vs_Eta_
MEP hPullEta_vs_Pt_
MEP hPullPhi_
MEP hPullPhi_vs_Eta_
MEP hPullPt_
MEP hPullPt_vs_Eta_
MEP hPullPt_vs_Pt_
MEP hPullQPt_
MEP hSimDxy_
MEP hSimDz_
MEP hSimEta_
MEP hSimP_
MEP hSimPhi_
MEP hSimPt_

Detailed Description

Definition at line 79 of file RecoMuonValidatorPF.cc.


Member Typedef Documentation

Definition at line 80 of file RecoMuonValidatorPF.cc.


Member Function Documentation

void RecoMuonValidatorPF::MuonME::bookHistograms ( DQMStore dqm,
const string &  dirName,
const HistoDimensions hDim 
) [inline]

Definition at line 132 of file RecoMuonValidatorPF.cc.

References DQMStore::book1D(), DQMStore::book2D(), DQMStore::cd(), HistoDimensions::doAbsEta, HistoDimensions::maxDxy, HistoDimensions::maxDz, HistoDimensions::maxErrDxy, HistoDimensions::maxErrDz, HistoDimensions::maxErrEta, HistoDimensions::maxErrP, HistoDimensions::maxErrPhi, HistoDimensions::maxErrPt, HistoDimensions::maxErrQPt, HistoDimensions::maxEta, HistoDimensions::maxP, HistoDimensions::maxPhi, HistoDimensions::maxPt, HistoDimensions::minDxy, HistoDimensions::minDz, HistoDimensions::minErrDxy, HistoDimensions::minErrDz, HistoDimensions::minErrEta, HistoDimensions::minErrP, HistoDimensions::minErrPhi, HistoDimensions::minErrPt, HistoDimensions::minErrQPt, HistoDimensions::minEta, HistoDimensions::minP, HistoDimensions::minPhi, HistoDimensions::minPt, HistoDimensions::nAssoc, HistoDimensions::nBinDxy, HistoDimensions::nBinDz, HistoDimensions::nBinErr, HistoDimensions::nBinEta, HistoDimensions::nBinP, HistoDimensions::nBinPhi, HistoDimensions::nBinPt, HistoDimensions::nBinPull, HistoDimensions::nDof, HistoDimensions::nTrks, DQMStore::setCurrentFolder(), and HistoDimensions::wPull.

Referenced by RecoMuonValidatorPF::RecoMuonValidatorPF().

  {
    dqm->cd();
    dqm->setCurrentFolder(dirName.c_str());

    doAbsEta_ = hDim.doAbsEta;

    //histograms for efficiency plots
    hP_   = dqm->book1D("P"  , "p of recoTracks"    , hDim.nBinP  , hDim.minP  , hDim.maxP  );
    hPt_  = dqm->book1D("Pt" , "p_{T} of recoTracks", hDim.nBinPt , hDim.minPt , hDim.maxPt );
    hEta_ = dqm->book1D("Eta", "#eta of recoTracks" , hDim.nBinEta, hDim.minEta, hDim.maxEta);
    hPhi_ = dqm->book1D("Phi", "#phi of recoTracks" , hDim.nBinPhi, hDim.minPhi, hDim.maxPhi);

    hSimP_   = dqm->book1D("SimP"  , "p of simTracks"    , hDim.nBinP  , hDim.minP  , hDim.maxP  );
    hSimPt_  = dqm->book1D("SimPt" , "p_{T} of simTracks", hDim.nBinPt , hDim.minPt , hDim.maxPt );
    hSimEta_ = dqm->book1D("SimEta", "#eta of simTracks" , hDim.nBinEta, hDim.minEta, hDim.maxEta);
    hSimPhi_ = dqm->book1D("SimPhi", "#phi of simTracks" , hDim.nBinPhi, hDim.minPhi, hDim.maxPhi);
    hSimDxy_ = dqm->book1D("SimDxy", "Dxy of simTracks" , hDim.nBinDxy, hDim.minDxy, hDim.maxDxy);
    hSimDz_ = dqm->book1D("Dz", "Dz of simTracks" , hDim.nBinDz, hDim.minDz, hDim.maxDz);

    //track multiplicities
    hNSim_  = dqm->book1D("NSim" , "Number of particles per event", hDim.nTrks+1, -0.5, hDim.nTrks+0.5);
    hNMuon_ = dqm->book1D("NMuon", "Number of muons per event"    , hDim.nTrks+1, -0.5, hDim.nTrks+0.5);

    // - Misc. variables
    hNTrks_ = dqm->book1D("NTrks", "Number of reco tracks per event", hDim.nTrks+1, -0.5, hDim.nTrks+0.5);
    hNTrksEta_ = dqm->book1D("NTrksEta", "Number of reco tracks vs #eta", hDim.nBinEta, hDim.minEta, hDim.maxEta);
    hNTrksPt_ = dqm->book1D("NTrksPt", "Number of reco tracks vs p_{T}", hDim.nBinPt, hDim.minPt, hDim.maxPt);

    hMisQPt_  = dqm->book1D("MisQPt" , "Charge mis-id vs Pt" , hDim.nBinPt , hDim.minPt , hDim.maxPt );
    hMisQEta_ = dqm->book1D("MisQEta", "Charge mis-id vs Eta", hDim.nBinEta, hDim.minEta, hDim.maxEta);

    // - Resolutions
    hErrP_   = dqm->book1D("ErrP"  , "#Delta(p)/p"        , hDim.nBinErr, hDim.minErrP  , hDim.maxErrP  );
    hErrPBarrel_   = dqm->book1D("ErrP_barrel"  , "#Delta(p)/p"        , hDim.nBinErr, hDim.minErrP  , hDim.maxErrP  );
    hErrPOverlap_   = dqm->book1D("ErrP_overlap"  , "#Delta(p)/p"        , hDim.nBinErr, hDim.minErrP  , hDim.maxErrP  );
    hErrPEndcap_   = dqm->book1D("ErrP_endcap"  , "#Delta(p)/p"        , hDim.nBinErr, hDim.minErrP  , hDim.maxErrP  );
    hErrPt_  = dqm->book1D("ErrPt" , "#Delta(p_{T})/p_{T}", hDim.nBinErr, hDim.minErrPt , hDim.maxErrPt );
    hErrPtBarrel_  = dqm->book1D("ErrPt_barrel" , "#Delta(p_{T})/p_{T}", hDim.nBinErr, hDim.minErrPt , hDim.maxErrPt );
    hErrPtOverlap_  = dqm->book1D("ErrPt_overlap" , "#Delta(p_{T})/p_{T}", hDim.nBinErr, hDim.minErrPt , hDim.maxErrPt );
    hErrPtEndcap_  = dqm->book1D("ErrPt_endcap" , "#Delta(p_{T})/p_{T}", hDim.nBinErr, hDim.minErrPt , hDim.maxErrPt );
    hErrEta_ = dqm->book1D("ErrEta", "#sigma(#eta))"      , hDim.nBinErr, hDim.minErrEta, hDim.maxErrEta);
    hErrPhi_ = dqm->book1D("ErrPhi", "#sigma(#phi)"       , hDim.nBinErr, hDim.minErrPhi, hDim.maxErrPhi);
    hErrDxy_ = dqm->book1D("ErrDxy", "#sigma(d_{xy})"     , hDim.nBinErr, hDim.minErrDxy, hDim.maxErrDxy);
    hErrDz_  = dqm->book1D("ErrDz" , "#sigma(d_{z})"      , hDim.nBinErr, hDim.minErrDz , hDim.maxErrDz );

    //PF-RECO comparisons
    hErrPt_PF_  = dqm->book1D("ErrPt_PF" , "#Delta(p_{T})|_{PF}/p_{T}", hDim.nBinErr, hDim.minErrPt, hDim.maxErrPt );
    hErrQPt_PF_  = dqm->book1D("ErrQPt_PF" , "#Delta(q/p_{T})|_{PF}/(q/p_{T})", hDim.nBinErr, hDim.minErrQPt, hDim.maxErrQPt);

    hPFMomPicked  = dqm->book1D("hPFMomPicked", "Momentum picked by PF",4,0.5,4.5);
    hPFDirectionPicked  = dqm->book1D("hPFDirectionPicked", "Direction picked by PF",4,0.5,4.5);
    hPFMomAssCorrectness  = dqm->book1D("hPFMomAssCorrectness", "Corrected momentum assignement PF/RECO",2,0.5,2.5);

    hdPt_vs_Pt_  = dqm->book2D("dPt_vs_Pt", "#Delta(p_{T}) vs p_{T}", hDim.nBinPt, 0., 500., 100, 0., 5.);
    hdPt_vs_Eta_  = dqm->book2D("dPt_vs_Eta", "#Delta(p_{T}) vs #eta", hDim.nBinEta, hDim.minEta, hDim.maxEta, 100, 0., 5.);
    
    hPt_vs_PFMomPicked  = dqm->book2D("hPt_vs_PFMomPicked", "Momentum picked by PF vs recoPt", hDim.nBinPt,0.,500.,4,0.5,4.5);
    hPt_vs_PFDirectionPicked  = dqm->book2D("hPt_vs_PFDirectionPicked", "Direction picked by PF vs recoPt",100,0.,500.,4,0.5,4.5);
    hPt_vs_PFMomAssCorrectness  = dqm->book2D("hPt_vs_PFMomAssCorrectness", "Corrected momentum assignement PF/RECO", hDim.nBinPt,0.,500.,2,0.5,2.5);

    // -- Resolutions vs Eta
    hErrP_vs_Eta_   = dqm->book2D("ErrP_vs_Eta", "#Delta(p)/p vs #eta",
                                  hDim.nBinEta, hDim.minEta, hDim.maxEta, hDim.nBinErr, hDim.minErrP, hDim.maxErrP);
    hErrPt_vs_Eta_  = dqm->book2D("ErrPt_vs_Eta", "#Delta(p_{T})/p_{T} vs #eta",
                                  hDim.nBinEta, hDim.minEta, hDim.maxEta, hDim.nBinErr, hDim.minErrPt, hDim.maxErrPt);
    hErrQPt_vs_Eta_ = dqm->book2D("ErrQPt_vs_Eta", "#Delta(q/p_{T})/(q/p_{T}) vs #eta",
                                  hDim.nBinEta, hDim.minEta, hDim.maxEta, hDim.nBinErr, hDim.minErrQPt, hDim.maxErrQPt);
    hErrEta_vs_Eta_ = dqm->book2D("ErrEta_vs_Eta", "#sigma(#eta) vs #eta",
                                  hDim.nBinEta, hDim.minEta, hDim.maxEta, hDim.nBinErr, hDim.minErrEta, hDim.maxErrEta);

    // -- Resolutions vs momentum
    hErrP_vs_P_    = dqm->book2D("ErrP_vs_P", "#Delta(p)/p vs p",
                                 hDim.nBinP, hDim.minP, hDim.maxP, hDim.nBinErr, hDim.minErrP, hDim.maxErrP);
    hErrPt_vs_Pt_  = dqm->book2D("ErrPt_vs_Pt", "#Delta(p_{T})/p_{T} vs p_{T}",
                                 hDim.nBinPt, hDim.minPt, hDim.maxPt, hDim.nBinErr, hDim.minErrPt, hDim.maxErrPt);
    hErrQPt_vs_Pt_ = dqm->book2D("ErrQPt_vs_Pt", "#Delta(q/p_{T})/(q/p_{T}) vs p_{T}",
                                 hDim.nBinPt, hDim.minPt, hDim.maxPt, hDim.nBinErr, hDim.minErrQPt, hDim.maxErrQPt);

    // - Pulls
    hPullPt_  = dqm->book1D("PullPt" , "Pull(#p_{T})" , hDim.nBinPull, -hDim.wPull, hDim.wPull);
    hPullEta_ = dqm->book1D("PullEta", "Pull(#eta)"   , hDim.nBinPull, -hDim.wPull, hDim.wPull);
    hPullPhi_ = dqm->book1D("PullPhi", "Pull(#phi)"   , hDim.nBinPull, -hDim.wPull, hDim.wPull);
    hPullQPt_ = dqm->book1D("PullQPt", "Pull(q/p_{T})", hDim.nBinPull, -hDim.wPull, hDim.wPull);
    hPullDxy_ = dqm->book1D("PullDxy", "Pull(D_{xy})" , hDim.nBinPull, -hDim.wPull, hDim.wPull);
    hPullDz_  = dqm->book1D("PullDz" , "Pull(D_{z})"  , hDim.nBinPull, -hDim.wPull, hDim.wPull);

    // -- Pulls vs Eta
    hPullPt_vs_Eta_  = dqm->book2D("PullPt_vs_Eta", "Pull(p_{T}) vs #eta",
                                   hDim.nBinEta, hDim.minEta, hDim.maxEta, hDim.nBinPull, -hDim.wPull, hDim.wPull);
    hPullEta_vs_Eta_ = dqm->book2D("PullEta_vs_Eta", "Pull(#eta) vs #eta",
                                   hDim.nBinEta, hDim.minEta, hDim.maxEta, hDim.nBinPull, -hDim.wPull, hDim.wPull);
    hPullPhi_vs_Eta_ = dqm->book2D("PullPhi_vs_Eta", "Pull(#phi) vs #eta",
                                   hDim.nBinEta, hDim.minEta, hDim.maxEta, hDim.nBinPull, -hDim.wPull, hDim.wPull);

    // -- Pulls vs Pt
    hPullPt_vs_Pt_ = dqm->book2D("PullPt_vs_Pt", "Pull(p_{T}) vs p_{T}",
                                 hDim.nBinPt, hDim.minPt, hDim.maxPt, hDim.nBinPull, -hDim.wPull, hDim.wPull);
    hPullEta_vs_Pt_ = dqm->book2D("PullEta_vs_Pt", "Pull(#eta) vs p_{T}",
                                  hDim.nBinPt, hDim.minPt, hDim.maxPt, hDim.nBinPull, -hDim.wPull, hDim.wPull);

    // -- Number of Hits
    const int nHits = 100;
    hNHits_ = dqm->book1D("NHits", "Number of hits", nHits+1, -0.5, nHits+0.5);
    hNHits_vs_Pt_  = dqm->book2D("NHits_vs_Pt", "Number of hits vs p_{T}",
                                 hDim.nBinPt, hDim.minPt, hDim.maxPt, nHits/4+1, -0.25, nHits+0.25);
    hNHits_vs_Eta_ = dqm->book2D("NHits_vs_Eta", "Number of hits vs #eta",
                                 hDim.nBinEta, hDim.minEta, hDim.maxEta, nHits/4+1, -0.25, nHits+0.25);
    hNSimHits_ = dqm->book1D("NSimHits", "Number of simHits", nHits+1, -0.5, nHits+0.5);

    const int nLostHits = 5;
    hNLostHits_ = dqm->book1D("NLostHits", "Number of Lost hits", nLostHits+1, -0.5, nLostHits+0.5);
    hNLostHits_vs_Pt_  = dqm->book2D("NLostHits_vs_Pt", "Number of lost Hits vs p_{T}",
                                     hDim.nBinPt, hDim.minPt, hDim.maxPt, nLostHits+1, -0.5, nLostHits+0.5);
    hNLostHits_vs_Eta_ = dqm->book2D("NLostHits_vs_Eta", "Number of lost Hits vs #eta",
                                     hDim.nBinEta, hDim.minEta, hDim.maxEta, nLostHits+1, -0.5, nLostHits+0.5);

    const int nTrackerHits = 40;
    hNTrackerHits_ = dqm->book1D("NTrackerHits", "Number of valid tracker hits", nTrackerHits+1, -0.5, nTrackerHits+0.5);
    hNTrackerHits_vs_Pt_ = dqm->book2D("NTrackerHits_vs_Pt", "Number of valid traker hits vs p_{T}",
                                       hDim.nBinPt, hDim.minPt, hDim.maxPt, nTrackerHits/4+1, -0.25, nTrackerHits+0.25);
    hNTrackerHits_vs_Eta_ = dqm->book2D("NTrackerHits_vs_Eta", "Number of valid tracker hits vs #eta",
                                        hDim.nBinEta, hDim.minEta, hDim.maxEta, nTrackerHits/4+1, -0.25, nTrackerHits+0.25);

    const int nMuonHits = 60;
    hNMuonHits_ = dqm->book1D("NMuonHits", "Number of valid muon hits", nMuonHits+1, -0.5, nMuonHits+0.5);
    hNMuonHits_vs_Pt_  = dqm->book2D("NMuonHits_vs_Pt", "Number of valid muon hits vs p_{T}",
                                     hDim.nBinPt, hDim.minPt, hDim.maxPt, nMuonHits/4+1, -0.25, nMuonHits+0.25);
    hNMuonHits_vs_Eta_ = dqm->book2D("NMuonHits_vs_Eta", "Number of valid muon hits vs #eta",
                                     hDim.nBinEta, hDim.minEta, hDim.maxEta, nMuonHits/4+1, -0.25, nMuonHits+0.25);

    hNDof_ = dqm->book1D("NDof", "Number of DoF", hDim.nDof+1, -0.5, hDim.nDof+0.5);
    hChi2_ = dqm->book1D("Chi2", "#Chi^{2}", hDim.nBinErr, 0., 200.);
    hChi2Norm_ = dqm->book1D("Chi2Norm", "Normalized #Chi^{2}", hDim.nBinErr, 0., 50.);
    hChi2Prob_ = dqm->book1D("Chi2Prob", "Prob(#Chi^{2})", hDim.nBinErr, 0., 1.);

    hNDof_vs_Eta_ = dqm->book2D("NDof_vs_Eta", "Number of DoF vs #eta",
                                hDim.nBinEta, hDim.minEta, hDim.maxEta, hDim.nDof+1, -0.5, hDim.nDof+0.5);
    hChi2_vs_Eta_ = dqm->book2D("Chi2_vs_Eta", "#Chi^{2} vs #eta",
                                hDim.nBinEta, hDim.minEta, hDim.maxEta, hDim.nBinErr, 0., 200.);
    hChi2Norm_vs_Eta_ = dqm->book2D("Chi2Norm_vs_Eta", "Normalized #Chi^{2} vs #eta",
                                    hDim.nBinEta, hDim.minEta, hDim.maxEta, hDim.nBinErr, 0., 50.);
    hChi2Prob_vs_Eta_ = dqm->book2D("Chi2Prob_vs_Eta", "Prob(#Chi^{2}) vs #eta",
                                    hDim.nBinEta, hDim.minEta, hDim.maxEta, hDim.nBinErr, 0., 1.);

    hNSimToReco_ = dqm->book1D("NSimToReco", "Number of associated reco tracks", hDim.nAssoc+1, -0.5, hDim.nAssoc+0.5);
    hNRecoToSim_ = dqm->book1D("NRecoToSim", "Number of associated sim TP's", hDim.nAssoc+1, -0.5, hDim.nAssoc+0.5);

  };
void RecoMuonValidatorPF::MuonME::fill ( const TrackingParticle simRef,
const Muon muonRef 
) [inline]

Definition at line 285 of file RecoMuonValidatorPF.cc.

References reco::LeafCandidate::charge(), ParticleBase::charge(), funct::cos(), ParticleBase::eta(), reco::LeafCandidate::eta(), reco::Muon::globalTrack(), reco::Muon::innerTrack(), reco::Muon::isGlobalMuon(), edm::Ref< C, T, F >::isNonnull(), reco::Muon::isPFMuon(), reco::Muon::isStandAloneMuon(), reco::Muon::isTrackerMuon(), ParticleBase::momentum(), reco::Muon::outerTrack(), ParticleBase::p(), reco::Muon::pfP4(), ParticleBase::phi(), reco::LeafCandidate::pt(), ParticleBase::pt(), funct::sin(), reco::Muon::track(), ParticleBase::vertex(), and PV3DBase< T, PVType, FrameType >::x().

Referenced by RecoMuonValidatorPF::analyze().

  {

    const double simP   = simRef->p();
    const double simPt  = simRef->pt();
    const double simEta = doAbsEta_ ? fabs(simRef->eta()) : simRef->eta();
    const double simPhi = simRef->phi();
    const double simQ   = simRef->charge();
    const double simQPt = simQ/simPt;

    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();

/*
    // Histograms for efficiency plots
    hSimP_  ->Fill(simP  );
    hSimPt_ ->Fill(simPt );
    hSimEta_->Fill(simEta);
    hSimPhi_->Fill(simPhi);
    hSimDxy_->Fill(simDxy);
    hSimDz_->Fill(simDz);
    hNSimHits_->Fill(nSimHits);
*/

    const double recoQ   = muonRef->charge();
    if ( simQ*recoQ < 0 ) {
      hMisQPt_ ->Fill(simPt );
      hMisQEta_->Fill(simEta);
    }

    //    const double recoP   = muonRef->p(); 
    const double recoPt  = muonRef->pt();
    const double recoEta = muonRef->eta();
    //    const double recoPhi = muonRef->phi();
    const double recoQPt = recoQ/recoPt;

    const double recoPFP = muonRef->pfP4().P();
    const double recoPFPt = muonRef->pfP4().Pt();
    const double recoPFEta = muonRef->pfP4().Eta(); 
    const double recoPFPhi = muonRef->pfP4().Phi();
    const double recoQPFPt = recoQ/recoPFPt;
    
    //matching parameters
    double MatchPFRECOMomMagn = 0.00001;
    double MatchPFRECOMomDir = 0.000000000000001;

    if (muonRef->isPFMuon()) { //in principle it will be use for PF muons only...

      hErrPt_PF_->Fill((recoPt-recoPFPt)/recoPt);
      hErrQPt_PF_->Fill((recoQPt-recoQPFPt)/recoQPt);
      hdPt_vs_Eta_->Fill(recoEta,fabs(recoPt-recoPFPt));
      hdPt_vs_Pt_->Fill(recoPt,fabs(recoPt-recoPFPt));

      if (fabs(recoPFPt - recoPt) > MatchPFRECOMomMagn) {

        // global
        if (muonRef->isGlobalMuon()) {
          //split into categories by direction
          //has direction of global track
          if (fabs((muonRef->pfP4().Px()*muonRef->globalTrack()->px()+muonRef->pfP4().Py()*muonRef->globalTrack()->py()+muonRef->pfP4().Pz()*muonRef->globalTrack()->pz())/muonRef->globalTrack()->p()/recoPFP - 1.) < MatchPFRECOMomDir) {
            //has momentum of global track
            if (fabs(recoPFPt - muonRef->globalTrack()->pt()) < MatchPFRECOMomMagn) {
              hPFMomPicked->Fill(1.);
              hPt_vs_PFMomPicked->Fill(recoPt,1.);
              //correctness
              int theCorrectPFAss = (fabs(recoPFPt-simPt) < fabs(recoPt - simPt))? 1 : 2;
              hPFMomAssCorrectness->Fill(theCorrectPFAss);
              hPt_vs_PFMomAssCorrectness->Fill(recoPt,theCorrectPFAss);
            } else {
              //just the direction
              hPFDirectionPicked->Fill(1.);
              hPFMomPicked->Fill(4.);
              hPt_vs_PFMomPicked->Fill(recoPt,4.);
            }
          }
          //has direction of inner track
          //must be also tracker muon
          if (muonRef->isTrackerMuon()) {
            if (fabs((muonRef->pfP4().x()*muonRef->innerTrack()->px()+muonRef->pfP4().y()*muonRef->innerTrack()->py()+muonRef->pfP4().z()*muonRef->innerTrack()->pz())/muonRef->innerTrack()->p()/recoPFP - 1.) < MatchPFRECOMomDir) {
              //has momentum of inner track
              if (fabs(recoPFPt - muonRef->innerTrack()->pt()) < MatchPFRECOMomMagn) {
                hPFMomPicked->Fill(2.);
                hPt_vs_PFMomPicked->Fill(recoPt,2.);
                //correctness
                int theCorrectPFAss = (fabs(recoPFPt-simPt) < fabs(recoPt - simPt))? 1 : 2;
                hPFMomAssCorrectness->Fill(theCorrectPFAss);
                hPt_vs_PFMomAssCorrectness->Fill(recoPt,theCorrectPFAss);
              } else {
                //just the direction
                hPFDirectionPicked->Fill(2.);
                hPFMomPicked->Fill(4.);
                hPt_vs_PFMomPicked->Fill(recoPt,4.);
              }
            }//has direction of inner track
          } //has direction outer track
        }//is global muon
         //is tracker not global muon
        else if (muonRef->isTrackerMuon()) {
          if (fabs((muonRef->pfP4().Px()*muonRef->innerTrack()->px()+muonRef->pfP4().Py()*muonRef->innerTrack()->py()+muonRef->pfP4().Pz()*muonRef->innerTrack()->pz())/muonRef->innerTrack()->p()/recoPFP- 1.) < MatchPFRECOMomDir) {
            //has momentum of inner track
            if (fabs(recoPFPt - muonRef->innerTrack()->pt()) < MatchPFRECOMomMagn) {
              hPFMomPicked->Fill(2.);
              hPt_vs_PFMomPicked->Fill(recoPt,2.);
              //correctness
              int theCorrectPFAss = (fabs(recoPFPt-simPt) < fabs(recoPt - simPt))? 1 : 2;
              hPFMomAssCorrectness->Fill(theCorrectPFAss);
              hPt_vs_PFMomAssCorrectness->Fill(recoPt,theCorrectPFAss);
            } else {
              //just the direction
              hPFDirectionPicked->Fill(2.);
              hPFMomPicked->Fill(4.);
              hPt_vs_PFMomPicked->Fill(recoPt,4.);
            }
          }//has direction of inner track
        }
        //is also a standalone 
        if (muonRef->isStandAloneMuon()) {
          //has direction of outer track
          if (fabs((muonRef->pfP4().Px()*muonRef->outerTrack()->px()+muonRef->pfP4().Py()*muonRef->outerTrack()->py()+muonRef->pfP4().Pz()*muonRef->outerTrack()->pz())/muonRef->outerTrack()->p()/recoPFP - 1.) < MatchPFRECOMomDir) {
            //has momentum of inner track
            if (fabs(recoPFPt - muonRef->outerTrack()->pt()) < MatchPFRECOMomMagn) {
              hPFMomPicked->Fill(3.);
              hPt_vs_PFMomPicked->Fill(recoPt,3.);
              //correctness
              int theCorrectPFAss = (fabs(recoPFPt-simPt) < fabs(recoPt - simPt))? 1 : 2;
              hPFMomAssCorrectness->Fill(theCorrectPFAss);
              hPt_vs_PFMomAssCorrectness->Fill(recoPt,theCorrectPFAss);
            } else {
              //just the direction
              hPFDirectionPicked->Fill(3.);
              hPFMomPicked->Fill(4.);
              hPt_vs_PFMomPicked->Fill(recoPt,4.);
            }
          }//has direction of outer track
        }
      }//end is tracker
      else if (muonRef->isStandAloneMuon()) {
        //has direction of outer track
        if (fabs((muonRef->pfP4().Px()*muonRef->outerTrack()->px()+muonRef->pfP4().Py()*muonRef->outerTrack()->py()+muonRef->pfP4().Pz()*muonRef->outerTrack()->pz())/muonRef->outerTrack()->p()/recoPFP - 1.) < MatchPFRECOMomDir) {
          //has momentum of inner track
          if (fabs(recoPFPt - muonRef->outerTrack()->pt()) < MatchPFRECOMomMagn) {
            hPFMomPicked->Fill(3.);
            hPt_vs_PFMomPicked->Fill(recoPt,3.);
            //correctness
            int theCorrectPFAss = (fabs(recoPFPt-simPt) < fabs(recoPt - simPt))? 1 : 2;
            hPFMomAssCorrectness->Fill(theCorrectPFAss);
            hPt_vs_PFMomAssCorrectness->Fill(recoPt,theCorrectPFAss);
          } else {
            //just the direction
            hPFDirectionPicked->Fill(3.);
            hPFMomPicked->Fill(4.);
            hPt_vs_PFMomPicked->Fill(recoPt,4.);
          }
        }//has direction of outer track
      } //end standalone
    } //end different momentum assignment 
    
    
    //pulls
    const double errP   = (recoPFP-simP)/simP;
    const double errPt  = (recoPFPt-simPt)/simPt;
    const double errEta = (recoPFEta-simEta)/simEta;
    const double errPhi = (recoPFPhi-simPhi)/simPhi;
    const double errQPt = (recoQPFPt-simQPt)/simQPt;

    hP_  ->Fill(simP);
    hPt_ ->Fill(simPt );
    hEta_->Fill(simEta);   
    hPhi_->Fill(simPhi);

    hErrP_  ->Fill(errP  );
    hErrPt_ ->Fill(errPt );
    hErrEta_->Fill(errEta);
    hErrPhi_->Fill(errPhi);

    if(fabs(simEta) > 0. && fabs(simEta) < 0.8) {
      hErrPBarrel_->Fill(errP);
      hErrPtBarrel_->Fill(errPt);
    } else if (fabs(simEta) > 0.8 && fabs(simEta) < 1.2) {
      hErrPOverlap_->Fill(errP);
      hErrPtOverlap_->Fill(errPt);
    } else if (fabs(simEta) > 1.2 ){
      hErrPEndcap_->Fill(errP);
      hErrPtEndcap_->Fill(errPt);
    }

    hErrP_vs_Eta_  ->Fill(simEta, errP  );
    hErrPt_vs_Eta_ ->Fill(simEta, errPt );
    hErrQPt_vs_Eta_->Fill(simEta, errQPt);

    hErrP_vs_P_   ->Fill(simP  , errP  );
    hErrPt_vs_Pt_ ->Fill(simPt , errPt );
    hErrQPt_vs_Pt_->Fill(simPt , errQPt);

    hErrEta_vs_Eta_->Fill(simEta, errEta);

    //access from track (same for PF and non PF)
    reco::TrackRef recoRef = muonRef->track();
    if (recoRef.isNonnull()) {

    // Number of reco-hits
    const int nRecoHits = recoRef->numberOfValidHits();
    const int nLostHits = recoRef->numberOfLostHits();

    hNHits_->Fill(nRecoHits);
    hNHits_vs_Pt_ ->Fill(simPt , nRecoHits);
    hNHits_vs_Eta_->Fill(simEta, nRecoHits);

    hNLostHits_->Fill(nLostHits);
    hNLostHits_vs_Pt_ ->Fill(simPt , nLostHits);
    hNLostHits_vs_Eta_->Fill(simEta, nLostHits);

    const double recoNDof = recoRef->ndof();
    const double recoChi2 = recoRef->chi2();
    const double recoChi2Norm = recoRef->normalizedChi2();
    const double recoChi2Prob = TMath::Prob(recoRef->chi2(), static_cast<int>(recoRef->ndof()));

    hNDof_->Fill(recoNDof);
    hChi2_->Fill(recoChi2);
    hChi2Norm_->Fill(recoChi2Norm);
    hChi2Prob_->Fill(recoChi2Prob);

    hNDof_vs_Eta_->Fill(simEta, recoNDof);
    hChi2_vs_Eta_->Fill(simEta, recoChi2);
    hChi2Norm_vs_Eta_->Fill(simEta, recoChi2Norm);
    hChi2Prob_vs_Eta_->Fill(simEta, recoChi2Prob);

    const double recoDxy = recoRef->dxy();
    const double recoDz  = recoRef->dz();

    const double errDxy = (recoDxy-simDxy)/simDxy;
    const double errDz  = (recoDz-simDz)/simDz;
    hErrDxy_->Fill(errDxy);
    hErrDz_ ->Fill(errDz );

    const double pullPt  = (recoPFPt-simPt)/recoRef->ptError();
    const double pullQPt = (recoQPFPt-simQPt)/recoRef->qoverpError();
    const double pullEta = (recoPFEta-simEta)/recoRef->etaError();
    const double pullPhi = (recoPFPhi-simPhi)/recoRef->phiError();
    const double pullDxy = (recoDxy-simDxy)/recoRef->dxyError();
    const double pullDz  = (recoDz-simDz)/recoRef->dzError();

    hPullPt_ ->Fill(pullPt );
    hPullEta_->Fill(pullEta);
    hPullPhi_->Fill(pullPhi);
    hPullQPt_->Fill(pullQPt);
    hPullDxy_->Fill(pullDxy);
    hPullDz_ ->Fill(pullDz );

    hPullPt_vs_Eta_->Fill(simEta, pullPt);
    hPullPt_vs_Pt_ ->Fill(simPt, pullPt);

    hPullEta_vs_Eta_->Fill(simEta, pullEta);
    hPullPhi_vs_Eta_->Fill(simEta, pullPhi);

    hPullEta_vs_Pt_->Fill(simPt, pullEta);
    }
  };

Member Data Documentation

Definition at line 127 of file RecoMuonValidatorPF.cc.

Definition at line 124 of file RecoMuonValidatorPF.cc.

Definition at line 125 of file RecoMuonValidatorPF.cc.

Definition at line 124 of file RecoMuonValidatorPF.cc.

Definition at line 125 of file RecoMuonValidatorPF.cc.

Definition at line 124 of file RecoMuonValidatorPF.cc.

Definition at line 125 of file RecoMuonValidatorPF.cc.

Definition at line 104 of file RecoMuonValidatorPF.cc.

Definition at line 105 of file RecoMuonValidatorPF.cc.

Definition at line 96 of file RecoMuonValidatorPF.cc.

Definition at line 96 of file RecoMuonValidatorPF.cc.

Definition at line 93 of file RecoMuonValidatorPF.cc.

Definition at line 99 of file RecoMuonValidatorPF.cc.

Definition at line 93 of file RecoMuonValidatorPF.cc.

Definition at line 98 of file RecoMuonValidatorPF.cc.

Definition at line 99 of file RecoMuonValidatorPF.cc.

Definition at line 94 of file RecoMuonValidatorPF.cc.

Definition at line 94 of file RecoMuonValidatorPF.cc.

Definition at line 93 of file RecoMuonValidatorPF.cc.

Definition at line 94 of file RecoMuonValidatorPF.cc.

Definition at line 93 of file RecoMuonValidatorPF.cc.

Definition at line 102 of file RecoMuonValidatorPF.cc.

Definition at line 98 of file RecoMuonValidatorPF.cc.

Definition at line 99 of file RecoMuonValidatorPF.cc.

Definition at line 95 of file RecoMuonValidatorPF.cc.

Definition at line 95 of file RecoMuonValidatorPF.cc.

Definition at line 95 of file RecoMuonValidatorPF.cc.

Definition at line 103 of file RecoMuonValidatorPF.cc.

Definition at line 98 of file RecoMuonValidatorPF.cc.

Definition at line 99 of file RecoMuonValidatorPF.cc.

Definition at line 85 of file RecoMuonValidatorPF.cc.

Definition at line 90 of file RecoMuonValidatorPF.cc.

Definition at line 90 of file RecoMuonValidatorPF.cc.

Definition at line 124 of file RecoMuonValidatorPF.cc.

Definition at line 125 of file RecoMuonValidatorPF.cc.

Definition at line 113 of file RecoMuonValidatorPF.cc.

Definition at line 114 of file RecoMuonValidatorPF.cc.

Definition at line 114 of file RecoMuonValidatorPF.cc.

Definition at line 113 of file RecoMuonValidatorPF.cc.

Definition at line 115 of file RecoMuonValidatorPF.cc.

Definition at line 115 of file RecoMuonValidatorPF.cc.

Definition at line 86 of file RecoMuonValidatorPF.cc.

Referenced by RecoMuonValidatorPF::analyze().

Definition at line 113 of file RecoMuonValidatorPF.cc.

Referenced by RecoMuonValidatorPF::analyze().

Definition at line 117 of file RecoMuonValidatorPF.cc.

Referenced by RecoMuonValidatorPF::analyze().

Definition at line 117 of file RecoMuonValidatorPF.cc.

Referenced by RecoMuonValidatorPF::analyze().

Definition at line 111 of file RecoMuonValidatorPF.cc.

Definition at line 86 of file RecoMuonValidatorPF.cc.

Referenced by RecoMuonValidatorPF::analyze().

Definition at line 110 of file RecoMuonValidatorPF.cc.

Referenced by RecoMuonValidatorPF::analyze().

Definition at line 111 of file RecoMuonValidatorPF.cc.

Referenced by RecoMuonValidatorPF::analyze().

Definition at line 113 of file RecoMuonValidatorPF.cc.

Referenced by RecoMuonValidatorPF::analyze().

Definition at line 116 of file RecoMuonValidatorPF.cc.

Referenced by RecoMuonValidatorPF::analyze().

Definition at line 116 of file RecoMuonValidatorPF.cc.

Referenced by RecoMuonValidatorPF::analyze().

Definition at line 89 of file RecoMuonValidatorPF.cc.

Definition at line 89 of file RecoMuonValidatorPF.cc.

Referenced by RecoMuonValidatorPF::analyze().

Definition at line 89 of file RecoMuonValidatorPF.cc.

Referenced by RecoMuonValidatorPF::analyze().

Definition at line 85 of file RecoMuonValidatorPF.cc.

Definition at line 106 of file RecoMuonValidatorPF.cc.

Definition at line 106 of file RecoMuonValidatorPF.cc.

Definition at line 106 of file RecoMuonValidatorPF.cc.

Definition at line 85 of file RecoMuonValidatorPF.cc.

Definition at line 85 of file RecoMuonValidatorPF.cc.

Definition at line 107 of file RecoMuonValidatorPF.cc.

Definition at line 107 of file RecoMuonValidatorPF.cc.

Definition at line 107 of file RecoMuonValidatorPF.cc.

Definition at line 120 of file RecoMuonValidatorPF.cc.

Definition at line 120 of file RecoMuonValidatorPF.cc.

Definition at line 120 of file RecoMuonValidatorPF.cc.

Definition at line 121 of file RecoMuonValidatorPF.cc.

Definition at line 121 of file RecoMuonValidatorPF.cc.

Definition at line 120 of file RecoMuonValidatorPF.cc.

Definition at line 121 of file RecoMuonValidatorPF.cc.

Definition at line 120 of file RecoMuonValidatorPF.cc.

Definition at line 121 of file RecoMuonValidatorPF.cc.

Definition at line 121 of file RecoMuonValidatorPF.cc.

Definition at line 120 of file RecoMuonValidatorPF.cc.

Definition at line 83 of file RecoMuonValidatorPF.cc.

Referenced by RecoMuonValidatorPF::analyze().

Definition at line 83 of file RecoMuonValidatorPF.cc.

Referenced by RecoMuonValidatorPF::analyze().

Definition at line 83 of file RecoMuonValidatorPF.cc.

Referenced by RecoMuonValidatorPF::analyze().

Definition at line 83 of file RecoMuonValidatorPF.cc.

Referenced by RecoMuonValidatorPF::analyze().

Definition at line 83 of file RecoMuonValidatorPF.cc.

Referenced by RecoMuonValidatorPF::analyze().

Definition at line 83 of file RecoMuonValidatorPF.cc.

Referenced by RecoMuonValidatorPF::analyze().