CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes
AlignmentMuonSelector Class Reference

#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 More...
 
Muons select (const Muons &muons, const edm::Event &evt) const
 select muons More...
 
 ~AlignmentMuonSelector ()
 destructor More...
 

Private Member Functions

Muons basicCuts (const Muons &muons) const
 apply basic cuts on pt,eta,phi,nhit More...
 
Muons theBestMassPairCombinationMuons (const Muons &muons) const
 filter only those muons giving best mass pair combination More...
 
Muons theNHighestPtMuons (const Muons &muons) const
 filter the n highest pt muons More...
 

Private Attributes

bool applyBasicCuts
 private data members More...
 
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
 

Detailed Description

Definition at line 24 of file AlignmentMuonSelector.h.

Member Typedef Documentation

typedef std::vector<const reco::Muon*> AlignmentMuonSelector::Muons

Definition at line 29 of file AlignmentMuonSelector.h.

Constructor & Destructor Documentation

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.

10  :
11  applyBasicCuts( cfg.getParameter<bool>( "applyBasicCuts" ) ),
12  applyNHighestPt( cfg.getParameter<bool>( "applyNHighestPt" ) ),
13  applyMultiplicityFilter( cfg.getParameter<bool>( "applyMultiplicityFilter" ) ),
14  applyMassPairFilter( cfg.getParameter<bool>( "applyMassPairFilter" ) ),
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" ) )
36 {
37 
38  if (applyBasicCuts)
39  edm::LogInfo("AlignmentMuonSelector")
40  << "applying basic muon cuts ..."
41  << "\npmin,pmax: " << pMin << "," << pMax
42  << "\nptmin,ptmax: " << ptMin << "," << ptMax
43  << "\netamin,etamax: " << etaMin << "," << etaMax
44  << "\nphimin,phimax: " << phiMin << "," << phiMax
45  << "\nnhitminSA,nhitmaxSA: " << nHitMinSA << "," << nHitMaxSA
46  << "\nchi2nmaxSA: " << chi2nMaxSA<< ","
47  << "\nnhitminGB,nhitmaxGB: " << nHitMinGB << "," << nHitMaxGB
48  << "\nchi2nmaxGB: " << chi2nMaxGB<< ","
49  << "\nnhitminTO,nhitmaxTO: " << nHitMinTO << "," << nHitMaxTO
50  << "\nchi2nmaxTO: " << chi2nMaxTO;
51 
52  if (applyNHighestPt)
53  edm::LogInfo("AlignmentMuonSelector")
54  << "filter N muons with highest Pt N=" << nHighestPt;
55 
57  edm::LogInfo("AlignmentMuonSelector")
58  << "apply multiplicity filter N>=" << minMultiplicity;
59 
61  edm::LogInfo("AlignmentMuonSelector")
62  << "apply Mass Pair filter minMassPair=" << minMassPair << " maxMassPair=" << maxMassPair;
63 
64 }
T getParameter(std::string const &) const
bool applyBasicCuts
private data members
AlignmentMuonSelector::~AlignmentMuonSelector ( )

destructor

Definition at line 68 of file AlignmentMuonSelector.cc.

69 {}

Member Function Documentation

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, reco::LeafCandidate::p(), AlCaHLTBitMon_ParallelJobs::p, phi, reco::LeafCandidate::phi(), phiMax, phiMin, pMax, pMin, EnergyCorrector::pt, reco::LeafCandidate::pt(), ptMax, ptMin, query::result, reco::Muon::standAloneMuon(), and reco::Muon::track().

Referenced by select().

106 {
107  Muons result;
108 
109  for(Muons::const_iterator it=muons.begin();
110  it!=muons.end();++it) {
111  const reco::Muon* muonp=*it;
112  float p=muonp->p();
113  float pt=muonp->pt();
114  float eta=muonp->eta();
115  float phi=muonp->phi();
116 
117  int nhitSA=0;float chi2nSA=9999.;
118  if(muonp->isStandAloneMuon()){
119  nhitSA = muonp->standAloneMuon()->numberOfValidHits();// standAlone Muon
120  chi2nSA = muonp->standAloneMuon()->normalizedChi2(); // standAlone Muon
121  }
122  int nhitGB=0;float chi2nGB=9999.;
123  if(muonp->isGlobalMuon()){
124  nhitGB = muonp->combinedMuon()->numberOfValidHits();// global Muon
125  chi2nGB = muonp->combinedMuon()->normalizedChi2(); // global Muon
126  }
127  int nhitTO=0;float chi2nTO=9999.;
128  if(muonp->isTrackerMuon()){
129  nhitTO = muonp->track()->numberOfValidHits(); // Tracker Only
130  chi2nTO = muonp->track()->normalizedChi2(); // Tracker Only
131  }
132  edm::LogInfo("AlignmentMuonSelector") << " pt,eta,phi,nhitSA,chi2nSA,nhitGB,chi2nGB,nhitTO,chi2nTO: "
133  <<pt<<","<<eta<<","<<phi<<","<<nhitSA<< ","<<chi2nSA<<","<<nhitGB<< ","<<chi2nGB<<","<<nhitTO<< ","<<chi2nTO;
134 
135  if (p>pMin && p<pMax
136  && pt>ptMin && pt<ptMax
137  && eta>etaMin && eta<etaMax
138  && phi>phiMin && phi<phiMax
139  && nhitSA>=nHitMinSA && nhitSA<=nHitMaxSA
140  && chi2nSA<chi2nMaxSA
141  && nhitGB>=nHitMinGB && nhitGB<=nHitMaxGB
142  && chi2nGB<chi2nMaxGB
143  && nhitTO>=nHitMinTO && nhitTO<=nHitMaxTO
144  && chi2nTO<chi2nMaxTO) {
145  result.push_back(muonp);
146  }
147  }
148 
149  return result;
150 }
virtual double p() const
magnitude of momentum vector
std::vector< const reco::Muon * > Muons
bool isTrackerMuon() const
Definition: Muon.h:219
virtual TrackRef track() const
reference to a Track
Definition: Muon.h:49
bool isGlobalMuon() const
Definition: Muon.h:218
bool isStandAloneMuon() const
Definition: Muon.h:220
virtual double eta() const
momentum pseudorapidity
virtual double pt() const
transverse momentum
tuple result
Definition: query.py:137
virtual TrackRef combinedMuon() const
reference to a stand-alone muon Track
Definition: Muon.h:55
tuple muons
Definition: patZpeak.py:38
virtual double phi() const
momentum azimuthal angle
virtual TrackRef standAloneMuon() const
reference to a stand-alone muon Track
Definition: Muon.h:52
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 Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Views.LineDecayView.LineDecayContainer::mousePressEvent(), Vispa.Gui.PortConnection.PointToPointConnection::mousePressEvent(), Vispa.Gui.VispaWidget.VispaWidget::mousePressEvent(), Vispa.Views.AbstractView.AbstractView::restoreSelection(), and MuonConfigSelector::select().

76 {
78 
79  // apply basic muon cuts (if selected)
80  if (applyBasicCuts) result= this->basicCuts(result);
81 
82  // filter N muons with highest Pt (if selected)
83  if (applyNHighestPt) result= this->theNHighestPtMuons(result);
84 
85  // apply minimum multiplicity requirement (if selected)
87  if (result.size()<(unsigned int)minMultiplicity) result.clear();
88  }
89 
90  // apply mass pair requirement (if selected)
91  if (applyMassPairFilter) {
92  if (result.size()<2) result.clear(); // at least 2 muons are require for a mass pair...
93  else result = this->theBestMassPairCombinationMuons(result);
94  }
95 
96  edm::LogInfo("AlignmentMuonSelector") << "muons all,kept: " << muons.size() << "," << result.size();
97 
98  return result;
99 
100 }
Muons theNHighestPtMuons(const Muons &muons) const
filter the n highest pt muons
std::vector< const reco::Muon * > Muons
tuple result
Definition: query.py:137
Muons theBestMassPairCombinationMuons(const Muons &muons) const
filter only those muons giving best mass pair combination
bool applyBasicCuts
private data members
tuple muons
Definition: patZpeak.py:38
Muons basicCuts(const Muons &muons) const
apply basic cuts on pt,eta,phi,nhit
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().

177 {
178  Muons sortedMuons=muons;
179  Muons result;
180  TLorentzVector mu1,mu2,pair;
181  double mass=0, minDiff=999999.;
182 
183  // sort in pt
184  std::sort(sortedMuons.begin(),sortedMuons.end(),ptComparator);
185 
186  // copy best mass pair combination muons to result vector
187  // Criteria:
188  // a) maxMassPair != minMassPair: the two highest pt muons with mass pair inside the given mass window
189  // b) maxMassPair == minMassPair: the muon pair with massPair closest to given mass value
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());
196  pair=mu1+mu2;
197  mass = pair.M();
198 
199  if( maxMassPair != minMassPair){
200  if(mass<maxMassPair && mass>minMassPair) { result.push_back(*it1); result.push_back(*it2); break;}
201  }
202  else{
203  if(fabs(mass-maxMassPair)< minDiff) { minDiff=fabs(mass-maxMassPair); result.clear(); result.push_back(*it1); result.push_back(*it2);}
204  }
205  }
206  }
207 
208  return result;
209 }
std::vector< const reco::Muon * > Muons
tuple result
Definition: query.py:137
tuple muons
Definition: patZpeak.py:38
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, gen::n, nHighestPt, ptComparator, query::result, and python.multivaluedict::sort().

Referenced by select().

156 {
157  Muons sortedMuons=muons;
158  Muons result;
159 
160  // sort in pt
161  std::sort(sortedMuons.begin(),sortedMuons.end(),ptComparator);
162 
163  // copy theMuonMult highest pt muons to result vector
164  int n=0;
165  for (Muons::const_iterator it=sortedMuons.begin();
166  it!=sortedMuons.end(); ++it) {
167  if (n<nHighestPt) { result.push_back(*it); n++; }
168  }
169 
170  return result;
171 }
std::vector< const reco::Muon * > Muons
tuple result
Definition: query.py:137
tuple muons
Definition: patZpeak.py:38

Member Data Documentation

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
double AlignmentMuonSelector::minMassPair
private
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().