#include <AlignmentMuonSelector.h>
Classes | |
struct | ComparePt |
compare two muons in pt (used by theNHighestPtMuons) More... | |
Public Types | |
typedef std::vector< const reco::Muon * > | Muons |
Public Member Functions | |
AlignmentMuonSelector (const edm::ParameterSet &cfg) | |
constructor | |
Muons | select (const Muons &muons, const edm::Event &evt) const |
select muons | |
~AlignmentMuonSelector () | |
destructor | |
Private Member Functions | |
Muons | basicCuts (const Muons &muons) const |
apply basic cuts on pt,eta,phi,nhit | |
Muons | theBestMassPairCombinationMuons (const Muons &muons) const |
filter only those muons giving best mass pair combination | |
Muons | theNHighestPtMuons (const Muons &muons) const |
filter the n highest pt muons | |
Private Attributes | |
bool | applyBasicCuts |
private data members | |
bool | applyMassPairFilter |
bool | applyMultiplicityFilter |
bool | applyNHighestPt |
double | chi2nMaxGB |
double | chi2nMaxSA |
double | chi2nMaxTO |
double | etaMax |
double | etaMin |
double | maxMassPair |
double | minMassPair |
int | minMultiplicity |
int | nHighestPt |
double | nHitMaxGB |
double | nHitMaxSA |
double | nHitMaxTO |
double | nHitMinGB |
double | nHitMinSA |
double | nHitMinTO |
double | phiMax |
double | phiMin |
double | pMax |
double | pMin |
ComparePt | ptComparator |
double | ptMax |
double | ptMin |
Definition at line 24 of file AlignmentMuonSelector.h.
typedef std::vector<const reco::Muon*> AlignmentMuonSelector::Muons |
Definition at line 29 of file AlignmentMuonSelector.h.
AlignmentMuonSelector::AlignmentMuonSelector | ( | const edm::ParameterSet & | cfg | ) |
constructor
Definition at line 10 of file AlignmentMuonSelector.cc.
References applyBasicCuts, applyMassPairFilter, applyMultiplicityFilter, applyNHighestPt, chi2nMaxGB, chi2nMaxSA, chi2nMaxTO, etaMax, etaMin, maxMassPair, minMassPair, minMultiplicity, nHighestPt, nHitMaxGB, nHitMaxSA, nHitMaxTO, nHitMinGB, nHitMinSA, nHitMinTO, phiMax, phiMin, pMax, pMin, ptMax, and ptMin.
: applyBasicCuts( cfg.getParameter<bool>( "applyBasicCuts" ) ), applyNHighestPt( cfg.getParameter<bool>( "applyNHighestPt" ) ), applyMultiplicityFilter( cfg.getParameter<bool>( "applyMultiplicityFilter" ) ), applyMassPairFilter( cfg.getParameter<bool>( "applyMassPairFilter" ) ), nHighestPt( cfg.getParameter<int>( "nHighestPt" ) ), minMultiplicity ( cfg.getParameter<int>( "minMultiplicity" ) ), pMin( cfg.getParameter<double>( "pMin" ) ), pMax( cfg.getParameter<double>( "pMax" ) ), ptMin( cfg.getParameter<double>( "ptMin" ) ), ptMax( cfg.getParameter<double>( "ptMax" ) ), etaMin( cfg.getParameter<double>( "etaMin" ) ), etaMax( cfg.getParameter<double>( "etaMax" ) ), phiMin( cfg.getParameter<double>( "phiMin" ) ), phiMax( cfg.getParameter<double>( "phiMax" ) ), nHitMinSA( cfg.getParameter<double>( "nHitMinSA" ) ), nHitMaxSA( cfg.getParameter<double>( "nHitMaxSA" ) ), chi2nMaxSA( cfg.getParameter<double>( "chi2nMaxSA") ), nHitMinGB( cfg.getParameter<double>( "nHitMinGB" ) ), nHitMaxGB( cfg.getParameter<double>( "nHitMaxGB" ) ), chi2nMaxGB( cfg.getParameter<double>( "chi2nMaxGB") ), nHitMinTO( cfg.getParameter<double>( "nHitMinTO" ) ), nHitMaxTO( cfg.getParameter<double>( "nHitMaxTO" ) ), chi2nMaxTO( cfg.getParameter<double>( "chi2nMaxTO" ) ), minMassPair( cfg.getParameter<double>( "minMassPair" ) ), maxMassPair( cfg.getParameter<double>( "maxMassPair" ) ) { if (applyBasicCuts) edm::LogInfo("AlignmentMuonSelector") << "applying basic muon cuts ..." << "\npmin,pmax: " << pMin << "," << pMax << "\nptmin,ptmax: " << ptMin << "," << ptMax << "\netamin,etamax: " << etaMin << "," << etaMax << "\nphimin,phimax: " << phiMin << "," << phiMax << "\nnhitminSA,nhitmaxSA: " << nHitMinSA << "," << nHitMaxSA << "\nchi2nmaxSA: " << chi2nMaxSA<< "," << "\nnhitminGB,nhitmaxGB: " << nHitMinGB << "," << nHitMaxGB << "\nchi2nmaxGB: " << chi2nMaxGB<< "," << "\nnhitminTO,nhitmaxTO: " << nHitMinTO << "," << nHitMaxTO << "\nchi2nmaxTO: " << chi2nMaxTO; if (applyNHighestPt) edm::LogInfo("AlignmentMuonSelector") << "filter N muons with highest Pt N=" << nHighestPt; if (applyMultiplicityFilter) edm::LogInfo("AlignmentMuonSelector") << "apply multiplicity filter N>=" << minMultiplicity; if (applyMassPairFilter) edm::LogInfo("AlignmentMuonSelector") << "apply Mass Pair filter minMassPair=" << minMassPair << " maxMassPair=" << maxMassPair; }
AlignmentMuonSelector::~AlignmentMuonSelector | ( | ) |
AlignmentMuonSelector::Muons AlignmentMuonSelector::basicCuts | ( | const Muons & | muons | ) | const [private] |
apply basic cuts on pt,eta,phi,nhit
Definition at line 105 of file AlignmentMuonSelector.cc.
References chi2nMaxGB, chi2nMaxSA, chi2nMaxTO, reco::Muon::combinedMuon(), eta, reco::LeafCandidate::eta(), etaMax, etaMin, reco::Muon::isGlobalMuon(), reco::Muon::isStandAloneMuon(), reco::Muon::isTrackerMuon(), nHitMaxGB, nHitMaxSA, nHitMaxTO, nHitMinGB, nHitMinSA, nHitMinTO, AlCaHLTBitMon_ParallelJobs::p, reco::LeafCandidate::p(), reco::LeafCandidate::phi(), phi, phiMax, phiMin, pMax, pMin, reco::LeafCandidate::pt(), ptMax, ptMin, query::result, reco::Muon::standAloneMuon(), and reco::Muon::track().
Referenced by select().
{ Muons result; for(Muons::const_iterator it=muons.begin(); it!=muons.end();it++) { const reco::Muon* muonp=*it; float p=muonp->p(); float pt=muonp->pt(); float eta=muonp->eta(); float phi=muonp->phi(); int nhitSA=0;float chi2nSA=9999.; if(muonp->isStandAloneMuon()){ nhitSA = muonp->standAloneMuon()->numberOfValidHits();// standAlone Muon chi2nSA = muonp->standAloneMuon()->normalizedChi2(); // standAlone Muon } int nhitGB=0;float chi2nGB=9999.; if(muonp->isGlobalMuon()){ nhitGB = muonp->combinedMuon()->numberOfValidHits();// global Muon chi2nGB = muonp->combinedMuon()->normalizedChi2(); // global Muon } int nhitTO=0;float chi2nTO=9999.; if(muonp->isTrackerMuon()){ nhitTO = muonp->track()->numberOfValidHits(); // Tracker Only chi2nTO = muonp->track()->normalizedChi2(); // Tracker Only } edm::LogInfo("AlignmentMuonSelector") << " pt,eta,phi,nhitSA,chi2nSA,nhitGB,chi2nGB,nhitTO,chi2nTO: " <<pt<<","<<eta<<","<<phi<<","<<nhitSA<< ","<<chi2nSA<<","<<nhitGB<< ","<<chi2nGB<<","<<nhitTO<< ","<<chi2nTO; if (p>pMin && p<pMax && pt>ptMin && pt<ptMax && eta>etaMin && eta<etaMax && phi>phiMin && phi<phiMax && nhitSA>=nHitMinSA && nhitSA<=nHitMaxSA && chi2nSA<chi2nMaxSA && nhitGB>=nHitMinGB && nhitGB<=nHitMaxGB && chi2nGB<chi2nMaxGB && nhitTO>=nHitMinTO && nhitTO<=nHitMaxTO && chi2nTO<chi2nMaxTO) { result.push_back(muonp); } } return result; }
AlignmentMuonSelector::Muons AlignmentMuonSelector::select | ( | const Muons & | muons, |
const edm::Event & | evt | ||
) | const |
select muons
Definition at line 75 of file AlignmentMuonSelector.cc.
References applyBasicCuts, applyMassPairFilter, applyMultiplicityFilter, applyNHighestPt, basicCuts(), minMultiplicity, patZpeak::muons, query::result, theBestMassPairCombinationMuons(), and theNHighestPtMuons().
Referenced by MuonConfigSelector::select().
{ Muons result=muons; // apply basic muon cuts (if selected) if (applyBasicCuts) result= this->basicCuts(result); // filter N muons with highest Pt (if selected) if (applyNHighestPt) result= this->theNHighestPtMuons(result); // apply minimum multiplicity requirement (if selected) if (applyMultiplicityFilter) { if (result.size()<(unsigned int)minMultiplicity) result.clear(); } // apply mass pair requirement (if selected) if (applyMassPairFilter) { if (result.size()<2) result.clear(); // at least 2 muons are require for a mass pair... else result = this->theBestMassPairCombinationMuons(result); } edm::LogInfo("AlignmentMuonSelector") << "muons all,kept: " << muons.size() << "," << result.size(); return result; }
AlignmentMuonSelector::Muons AlignmentMuonSelector::theBestMassPairCombinationMuons | ( | const Muons & | muons | ) | const [private] |
filter only those muons giving best mass pair combination
Definition at line 176 of file AlignmentMuonSelector.cc.
References maxMassPair, minMassPair, patZpeak::muons, ptComparator, query::result, and python::multivaluedict::sort().
Referenced by select().
{ Muons sortedMuons=muons; Muons result; TLorentzVector mu1,mu2,pair; double mass=0, minDiff=999999.; // sort in pt std::sort(sortedMuons.begin(),sortedMuons.end(),ptComparator); // copy best mass pair combination muons to result vector // Criteria: // a) maxMassPair != minMassPair: the two highest pt muons with mass pair inside the given mass window // b) maxMassPair == minMassPair: the muon pair with massPair closest to given mass value for (Muons::const_iterator it1=sortedMuons.begin(); it1!=sortedMuons.end(); it1++) { for (Muons::const_iterator it2=it1+1; it2!=sortedMuons.end(); it2++) { mu1 = TLorentzVector((*it1)->momentum().x(),(*it1)->momentum().y(),(*it1)->momentum().z(),(*it1)->p()); mu2 = TLorentzVector((*it2)->momentum().x(),(*it2)->momentum().y(),(*it2)->momentum().z(),(*it2)->p()); pair=mu1+mu2; mass = pair.M(); if( maxMassPair != minMassPair){ if(mass<maxMassPair && mass>minMassPair) { result.push_back(*it1); result.push_back(*it2); break;} } else{ if(fabs(mass-maxMassPair)< minDiff) { minDiff=fabs(mass-maxMassPair); result.clear(); result.push_back(*it1); result.push_back(*it2);} } } } return result; }
AlignmentMuonSelector::Muons AlignmentMuonSelector::theNHighestPtMuons | ( | const Muons & | muons | ) | const [private] |
filter the n highest pt muons
Definition at line 155 of file AlignmentMuonSelector.cc.
References patZpeak::muons, n, nHighestPt, ptComparator, query::result, and python::multivaluedict::sort().
Referenced by select().
{ Muons sortedMuons=muons; Muons result; // sort in pt std::sort(sortedMuons.begin(),sortedMuons.end(),ptComparator); // copy theMuonMult highest pt muons to result vector int n=0; for (Muons::const_iterator it=sortedMuons.begin(); it!=sortedMuons.end(); it++) { if (n<nHighestPt) { result.push_back(*it); n++; } } return result; }
bool AlignmentMuonSelector::applyBasicCuts [private] |
private data members
Definition at line 60 of file AlignmentMuonSelector.h.
Referenced by AlignmentMuonSelector(), and select().
bool AlignmentMuonSelector::applyMassPairFilter [private] |
Definition at line 60 of file AlignmentMuonSelector.h.
Referenced by AlignmentMuonSelector(), and select().
bool AlignmentMuonSelector::applyMultiplicityFilter [private] |
Definition at line 60 of file AlignmentMuonSelector.h.
Referenced by AlignmentMuonSelector(), and select().
bool AlignmentMuonSelector::applyNHighestPt [private] |
Definition at line 60 of file AlignmentMuonSelector.h.
Referenced by AlignmentMuonSelector(), and select().
double AlignmentMuonSelector::chi2nMaxGB [private] |
Definition at line 64 of file AlignmentMuonSelector.h.
Referenced by AlignmentMuonSelector(), and basicCuts().
double AlignmentMuonSelector::chi2nMaxSA [private] |
Definition at line 63 of file AlignmentMuonSelector.h.
Referenced by AlignmentMuonSelector(), and basicCuts().
double AlignmentMuonSelector::chi2nMaxTO [private] |
Definition at line 65 of file AlignmentMuonSelector.h.
Referenced by AlignmentMuonSelector(), and basicCuts().
double AlignmentMuonSelector::etaMax [private] |
Definition at line 62 of file AlignmentMuonSelector.h.
Referenced by AlignmentMuonSelector(), and basicCuts().
double AlignmentMuonSelector::etaMin [private] |
Definition at line 62 of file AlignmentMuonSelector.h.
Referenced by AlignmentMuonSelector(), and basicCuts().
double AlignmentMuonSelector::maxMassPair [private] |
Definition at line 66 of file AlignmentMuonSelector.h.
Referenced by AlignmentMuonSelector(), and theBestMassPairCombinationMuons().
double AlignmentMuonSelector::minMassPair [private] |
Definition at line 66 of file AlignmentMuonSelector.h.
Referenced by AlignmentMuonSelector(), and theBestMassPairCombinationMuons().
int AlignmentMuonSelector::minMultiplicity [private] |
Definition at line 61 of file AlignmentMuonSelector.h.
Referenced by AlignmentMuonSelector(), and select().
int AlignmentMuonSelector::nHighestPt [private] |
Definition at line 61 of file AlignmentMuonSelector.h.
Referenced by AlignmentMuonSelector(), and theNHighestPtMuons().
double AlignmentMuonSelector::nHitMaxGB [private] |
Definition at line 64 of file AlignmentMuonSelector.h.
Referenced by AlignmentMuonSelector(), and basicCuts().
double AlignmentMuonSelector::nHitMaxSA [private] |
Definition at line 63 of file AlignmentMuonSelector.h.
Referenced by AlignmentMuonSelector(), and basicCuts().
double AlignmentMuonSelector::nHitMaxTO [private] |
Definition at line 65 of file AlignmentMuonSelector.h.
Referenced by AlignmentMuonSelector(), and basicCuts().
double AlignmentMuonSelector::nHitMinGB [private] |
Definition at line 64 of file AlignmentMuonSelector.h.
Referenced by AlignmentMuonSelector(), and basicCuts().
double AlignmentMuonSelector::nHitMinSA [private] |
Definition at line 63 of file AlignmentMuonSelector.h.
Referenced by AlignmentMuonSelector(), and basicCuts().
double AlignmentMuonSelector::nHitMinTO [private] |
Definition at line 65 of file AlignmentMuonSelector.h.
Referenced by AlignmentMuonSelector(), and basicCuts().
double AlignmentMuonSelector::phiMax [private] |
Definition at line 62 of file AlignmentMuonSelector.h.
Referenced by AlignmentMuonSelector(), and basicCuts().
double AlignmentMuonSelector::phiMin [private] |
Definition at line 62 of file AlignmentMuonSelector.h.
Referenced by AlignmentMuonSelector(), and basicCuts().
double AlignmentMuonSelector::pMax [private] |
Definition at line 62 of file AlignmentMuonSelector.h.
Referenced by AlignmentMuonSelector(), and basicCuts().
double AlignmentMuonSelector::pMin [private] |
Definition at line 62 of file AlignmentMuonSelector.h.
Referenced by AlignmentMuonSelector(), and basicCuts().
ComparePt AlignmentMuonSelector::ptComparator [private] |
Definition at line 57 of file AlignmentMuonSelector.h.
Referenced by theBestMassPairCombinationMuons(), and theNHighestPtMuons().
double AlignmentMuonSelector::ptMax [private] |
Definition at line 62 of file AlignmentMuonSelector.h.
Referenced by AlignmentMuonSelector(), and basicCuts().
double AlignmentMuonSelector::ptMin [private] |
Definition at line 62 of file AlignmentMuonSelector.h.
Referenced by AlignmentMuonSelector(), and basicCuts().