6 #include "TLorentzVector.h"
12 applyNHighestPt( cfg.getParameter<bool>(
"applyNHighestPt" ) ),
13 applyMultiplicityFilter( cfg.getParameter<bool>(
"applyMultiplicityFilter" ) ),
15 nHighestPt( cfg.getParameter<int>(
"nHighestPt" ) ),
16 minMultiplicity ( cfg.getParameter<int>(
"minMultiplicity" ) ),
17 pMin( cfg.getParameter<double>(
"pMin" ) ),
18 pMax( cfg.getParameter<double>(
"pMax" ) ),
19 ptMin( cfg.getParameter<double>(
"ptMin" ) ),
20 ptMax( cfg.getParameter<double>(
"ptMax" ) ),
21 etaMin( cfg.getParameter<double>(
"etaMin" ) ),
22 etaMax( cfg.getParameter<double>(
"etaMax" ) ),
23 phiMin( cfg.getParameter<double>(
"phiMin" ) ),
24 phiMax( cfg.getParameter<double>(
"phiMax" ) ),
25 nHitMinSA( cfg.getParameter<double>(
"nHitMinSA" ) ),
26 nHitMaxSA( cfg.getParameter<double>(
"nHitMaxSA" ) ),
27 chi2nMaxSA( cfg.getParameter<double>(
"chi2nMaxSA") ),
28 nHitMinGB( cfg.getParameter<double>(
"nHitMinGB" ) ),
29 nHitMaxGB( cfg.getParameter<double>(
"nHitMaxGB" ) ),
30 chi2nMaxGB( cfg.getParameter<double>(
"chi2nMaxGB") ),
31 nHitMinTO( cfg.getParameter<double>(
"nHitMinTO" ) ),
32 nHitMaxTO( cfg.getParameter<double>(
"nHitMaxTO" ) ),
33 chi2nMaxTO( cfg.getParameter<double>(
"chi2nMaxTO" ) ),
34 minMassPair( cfg.getParameter<double>(
"minMassPair" ) ),
35 maxMassPair( cfg.getParameter<double>(
"maxMassPair" ) )
40 <<
"applying basic muon cuts ..."
41 <<
"\npmin,pmax: " <<
pMin <<
"," <<
pMax
54 <<
"filter N muons with highest Pt N=" <<
nHighestPt;
92 if (result.size()<2) result.clear();
96 edm::LogInfo(
"AlignmentMuonSelector") <<
"muons all,kept: " << muons.size() <<
"," << result.size();
109 for(Muons::const_iterator it=muons.begin();
110 it!=muons.end();++it) {
113 float pt=muonp->
pt();
117 int nhitSA=0;
float chi2nSA=9999.;
122 int nhitGB=0;
float chi2nGB=9999.;
127 int nhitTO=0;
float chi2nTO=9999.;
129 nhitTO = muonp->
track()->numberOfValidHits();
130 chi2nTO = muonp->
track()->normalizedChi2();
132 edm::LogInfo(
"AlignmentMuonSelector") <<
" pt,eta,phi,nhitSA,chi2nSA,nhitGB,chi2nGB,nhitTO,chi2nTO: "
133 <<pt<<
","<<eta<<
","<<phi<<
","<<nhitSA<<
","<<chi2nSA<<
","<<nhitGB<<
","<<chi2nGB<<
","<<nhitTO<<
","<<chi2nTO;
145 result.push_back(muonp);
161 std::sort(sortedMuons.begin(),sortedMuons.end(),
ptComparator);
165 for (Muons::const_iterator it=sortedMuons.begin();
166 it!=sortedMuons.end(); ++it) {
167 if (n<
nHighestPt) { result.push_back(*it); n++; }
180 TLorentzVector mu1,mu2,pair;
181 double mass=0, minDiff=999999.;
184 std::sort(sortedMuons.begin(),sortedMuons.end(),
ptComparator);
190 for (Muons::const_iterator it1=sortedMuons.begin();
191 it1!=sortedMuons.end(); ++it1) {
192 for (Muons::const_iterator it2=it1+1;
193 it2!=sortedMuons.end(); ++it2) {
194 mu1 = TLorentzVector((*it1)->momentum().x(),(*it1)->momentum().y(),(*it1)->momentum().z(),(*it1)->p());
195 mu2 = TLorentzVector((*it2)->momentum().x(),(*it2)->momentum().y(),(*it2)->momentum().z(),(*it2)->p());
200 if(mass<maxMassPair && mass>
minMassPair) { result.push_back(*it1); result.push_back(*it2);
break;}
203 if(fabs(mass-
maxMassPair)< minDiff) { minDiff=fabs(mass-
maxMassPair); result.clear(); result.push_back(*it1); result.push_back(*it2);}
Muons theNHighestPtMuons(const Muons &muons) const
filter the n highest pt muons
std::vector< const reco::Muon * > Muons
bool isTrackerMuon() const
virtual TrackRef track() const
reference to a Track
bool isGlobalMuon() const
virtual double phi() const final
momentum azimuthal angle
bool isStandAloneMuon() const
AlignmentMuonSelector(const edm::ParameterSet &cfg)
constructor
Muons theBestMassPairCombinationMuons(const Muons &muons) const
filter only those muons giving best mass pair combination
bool applyBasicCuts
private data members
tuple nHitMinGB
globalMuons
virtual TrackRef combinedMuon() const
reference to a stand-alone muon Track
bool applyMultiplicityFilter
virtual double p() const final
magnitude of momentum vector
tuple applyMassPairFilter
~AlignmentMuonSelector()
destructor
Muons basicCuts(const Muons &muons) const
apply basic cuts on pt,eta,phi,nhit
virtual double eta() const final
momentum pseudorapidity
Muons select(const Muons &muons, const edm::Event &evt) const
select muons
virtual double pt() const final
transverse momentum
virtual TrackRef standAloneMuon() const
reference to a stand-alone muon Track