CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 26 of file AlignmentMuonSelector.h.

Member Typedef Documentation

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

Definition at line 28 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.

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  if (applyBasicCuts)
37  edm::LogInfo("AlignmentMuonSelector")
38  << "applying basic muon cuts ..."
39  << "\npmin,pmax: " << pMin << "," << pMax << "\nptmin,ptmax: " << ptMin << "," << ptMax
40  << "\netamin,etamax: " << etaMin << "," << etaMax << "\nphimin,phimax: " << phiMin << "," << phiMax
41  << "\nnhitminSA,nhitmaxSA: " << nHitMinSA << "," << nHitMaxSA << "\nchi2nmaxSA: " << chi2nMaxSA << ","
42  << "\nnhitminGB,nhitmaxGB: " << nHitMinGB << "," << nHitMaxGB << "\nchi2nmaxGB: " << chi2nMaxGB << ","
43  << "\nnhitminTO,nhitmaxTO: " << nHitMinTO << "," << nHitMaxTO << "\nchi2nmaxTO: " << chi2nMaxTO;
44 
45  if (applyNHighestPt)
46  edm::LogInfo("AlignmentMuonSelector") << "filter N muons with highest Pt N=" << nHighestPt;
47 
49  edm::LogInfo("AlignmentMuonSelector") << "apply multiplicity filter N>=" << minMultiplicity;
50 
52  edm::LogInfo("AlignmentMuonSelector")
53  << "apply Mass Pair filter minMassPair=" << minMassPair << " maxMassPair=" << maxMassPair;
54 }
bool applyBasicCuts
private data members
Log< level::Info, false > LogInfo
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
AlignmentMuonSelector::~AlignmentMuonSelector ( )

destructor

Definition at line 58 of file AlignmentMuonSelector.cc.

58 {}

Member Function Documentation

AlignmentMuonSelector::Muons AlignmentMuonSelector::basicCuts ( const Muons muons) const
private

apply basic cuts on pt,eta,phi,nhit

Definition at line 94 of file AlignmentMuonSelector.cc.

References chi2nMaxTO, reco::Muon::combinedMuon(), PVValHelper::eta, reco::LeafCandidate::eta(), 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(), phiMin, pMin, DiDispStaMuonMonitor_cfi::pt, reco::LeafCandidate::pt(), ptMin, mps_fire::result, reco::Muon::standAloneMuon(), and reco::Muon::track().

Referenced by select().

94  {
95  Muons result;
96 
97  for (Muons::const_iterator it = muons.begin(); it != muons.end(); ++it) {
98  const reco::Muon* muonp = *it;
99  float p = muonp->p();
100  float pt = muonp->pt();
101  float eta = muonp->eta();
102  float phi = muonp->phi();
103 
104  int nhitSA = 0;
105  float chi2nSA = 9999.;
106  if (muonp->isStandAloneMuon()) {
107  nhitSA = muonp->standAloneMuon()->numberOfValidHits(); // standAlone Muon
108  chi2nSA = muonp->standAloneMuon()->normalizedChi2(); // standAlone Muon
109  }
110  int nhitGB = 0;
111  float chi2nGB = 9999.;
112  if (muonp->isGlobalMuon()) {
113  nhitGB = muonp->combinedMuon()->numberOfValidHits(); // global Muon
114  chi2nGB = muonp->combinedMuon()->normalizedChi2(); // global Muon
115  }
116  int nhitTO = 0;
117  float chi2nTO = 9999.;
118  if (muonp->isTrackerMuon()) {
119  nhitTO = muonp->track()->numberOfValidHits(); // Tracker Only
120  chi2nTO = muonp->track()->normalizedChi2(); // Tracker Only
121  }
122  edm::LogInfo("AlignmentMuonSelector")
123  << " pt,eta,phi,nhitSA,chi2nSA,nhitGB,chi2nGB,nhitTO,chi2nTO: " << pt << "," << eta << "," << phi << ","
124  << nhitSA << "," << chi2nSA << "," << nhitGB << "," << chi2nGB << "," << nhitTO << "," << chi2nTO;
125 
126  if (p > pMin && p < pMax && pt > ptMin && pt < ptMax && eta > etaMin && eta < etaMax && phi > phiMin &&
127  phi < phiMax && nhitSA >= nHitMinSA && nhitSA <= nHitMaxSA && chi2nSA < chi2nMaxSA && nhitGB >= nHitMinGB &&
128  nhitGB <= nHitMaxGB && chi2nGB < chi2nMaxGB && nhitTO >= nHitMinTO && nhitTO <= nHitMaxTO &&
129  chi2nTO < chi2nMaxTO) {
130  result.push_back(muonp);
131  }
132  }
133 
134  return result;
135 }
std::vector< const reco::Muon * > Muons
TrackRef combinedMuon() const override
reference to a stand-alone muon Track
Definition: Muon.h:52
double pt() const final
transverse momentum
TrackRef track() const override
reference to a Track
Definition: Muon.h:46
bool isTrackerMuon() const override
Definition: Muon.h:300
tuple result
Definition: mps_fire.py:311
double p() const final
magnitude of momentum vector
TrackRef standAloneMuon() const override
reference to a stand-alone muon Track
Definition: Muon.h:49
Log< level::Info, false > LogInfo
tuple muons
Definition: patZpeak.py:39
double phi() const final
momentum azimuthal angle
bool isGlobalMuon() const override
Definition: Muon.h:299
bool isStandAloneMuon() const override
Definition: Muon.h:301
double eta() const final
momentum pseudorapidity
AlignmentMuonSelector::Muons AlignmentMuonSelector::select ( const Muons muons,
const edm::Event evt 
) const

select muons

Definition at line 62 of file AlignmentMuonSelector.cc.

References applyBasicCuts, applyMassPairFilter, applyMultiplicityFilter, applyNHighestPt, basicCuts(), minMultiplicity, patZpeak::muons, mps_fire::result, theBestMassPairCombinationMuons(), and theNHighestPtMuons().

Referenced by MuonConfigSelector::select().

62  {
63  Muons result = muons;
64 
65  // apply basic muon cuts (if selected)
66  if (applyBasicCuts)
67  result = this->basicCuts(result);
68 
69  // filter N muons with highest Pt (if selected)
70  if (applyNHighestPt)
71  result = this->theNHighestPtMuons(result);
72 
73  // apply minimum multiplicity requirement (if selected)
75  if (result.size() < (unsigned int)minMultiplicity)
76  result.clear();
77  }
78 
79  // apply mass pair requirement (if selected)
80  if (applyMassPairFilter) {
81  if (result.size() < 2)
82  result.clear(); // at least 2 muons are require for a mass pair...
83  else
84  result = this->theBestMassPairCombinationMuons(result);
85  }
86 
87  edm::LogInfo("AlignmentMuonSelector") << "muons all,kept: " << muons.size() << "," << result.size();
88 
89  return result;
90 }
Muons theNHighestPtMuons(const Muons &muons) const
filter the n highest pt muons
std::vector< const reco::Muon * > Muons
tuple result
Definition: mps_fire.py:311
Muons theBestMassPairCombinationMuons(const Muons &muons) const
filter only those muons giving best mass pair combination
bool applyBasicCuts
private data members
Log< level::Info, false > LogInfo
tuple muons
Definition: patZpeak.py:39
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 160 of file AlignmentMuonSelector.cc.

References ResonanceBuilder::mass, maxMassPair, minMassPair, patZpeak::muons, ptComparator, and mps_fire::result.

Referenced by select().

160  {
161  Muons sortedMuons = muons;
162  Muons result;
163  TLorentzVector mu1, mu2, pair;
164  double mass = 0, minDiff = 999999.;
165 
166  // sort in pt
167  std::sort(sortedMuons.begin(), sortedMuons.end(), ptComparator);
168 
169  // copy best mass pair combination muons to result vector
170  // Criteria:
171  // a) maxMassPair != minMassPair: the two highest pt muons with mass pair inside the given mass window
172  // b) maxMassPair == minMassPair: the muon pair with massPair closest to given mass value
173  for (Muons::const_iterator it1 = sortedMuons.begin(); it1 != sortedMuons.end(); ++it1) {
174  for (Muons::const_iterator it2 = it1 + 1; it2 != sortedMuons.end(); ++it2) {
175  mu1 = TLorentzVector((*it1)->momentum().x(), (*it1)->momentum().y(), (*it1)->momentum().z(), (*it1)->p());
176  mu2 = TLorentzVector((*it2)->momentum().x(), (*it2)->momentum().y(), (*it2)->momentum().z(), (*it2)->p());
177  pair = mu1 + mu2;
178  mass = pair.M();
179 
180  if (maxMassPair != minMassPair) {
181  if (mass < maxMassPair && mass > minMassPair) {
182  result.push_back(*it1);
183  result.push_back(*it2);
184  break;
185  }
186  } else {
187  if (fabs(mass - maxMassPair) < minDiff) {
188  minDiff = fabs(mass - maxMassPair);
189  result.clear();
190  result.push_back(*it1);
191  result.push_back(*it2);
192  }
193  }
194  }
195  }
196 
197  return result;
198 }
std::vector< const reco::Muon * > Muons
tuple result
Definition: mps_fire.py:311
tuple muons
Definition: patZpeak.py:39
AlignmentMuonSelector::Muons AlignmentMuonSelector::theNHighestPtMuons ( const Muons muons) const
private

filter the n highest pt muons

Definition at line 139 of file AlignmentMuonSelector.cc.

References patZpeak::muons, dqmiodumpmetadata::n, nHighestPt, ptComparator, and mps_fire::result.

Referenced by select().

139  {
140  Muons sortedMuons = muons;
141  Muons result;
142 
143  // sort in pt
144  std::sort(sortedMuons.begin(), sortedMuons.end(), ptComparator);
145 
146  // copy theMuonMult highest pt muons to result vector
147  int n = 0;
148  for (Muons::const_iterator it = sortedMuons.begin(); it != sortedMuons.end(); ++it) {
149  if (n < nHighestPt) {
150  result.push_back(*it);
151  n++;
152  }
153  }
154 
155  return result;
156 }
std::vector< const reco::Muon * > Muons
tuple result
Definition: mps_fire.py:311
tuple muons
Definition: patZpeak.py:39

Member Data Documentation

bool AlignmentMuonSelector::applyBasicCuts
private

private data members

Definition at line 56 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and select().

bool AlignmentMuonSelector::applyMassPairFilter
private

Definition at line 56 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and select().

bool AlignmentMuonSelector::applyMultiplicityFilter
private

Definition at line 56 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and select().

bool AlignmentMuonSelector::applyNHighestPt
private

Definition at line 56 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and select().

double AlignmentMuonSelector::chi2nMaxGB
private

Definition at line 60 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector().

double AlignmentMuonSelector::chi2nMaxSA
private

Definition at line 59 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector().

double AlignmentMuonSelector::chi2nMaxTO
private

Definition at line 61 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and basicCuts().

double AlignmentMuonSelector::etaMax
private

Definition at line 58 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector().

double AlignmentMuonSelector::etaMin
private

Definition at line 58 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and basicCuts().

double AlignmentMuonSelector::maxMassPair
private
double AlignmentMuonSelector::minMassPair
private
int AlignmentMuonSelector::minMultiplicity
private

Definition at line 57 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and select().

int AlignmentMuonSelector::nHighestPt
private

Definition at line 57 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and theNHighestPtMuons().

double AlignmentMuonSelector::nHitMaxGB
private

Definition at line 60 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and basicCuts().

double AlignmentMuonSelector::nHitMaxSA
private

Definition at line 59 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and basicCuts().

double AlignmentMuonSelector::nHitMaxTO
private

Definition at line 61 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and basicCuts().

double AlignmentMuonSelector::nHitMinGB
private

Definition at line 60 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and basicCuts().

double AlignmentMuonSelector::nHitMinSA
private

Definition at line 59 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and basicCuts().

double AlignmentMuonSelector::nHitMinTO
private

Definition at line 61 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and basicCuts().

double AlignmentMuonSelector::phiMax
private

Definition at line 58 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector().

double AlignmentMuonSelector::phiMin
private

Definition at line 58 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and basicCuts().

double AlignmentMuonSelector::pMax
private

Definition at line 58 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector().

double AlignmentMuonSelector::pMin
private

Definition at line 58 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and basicCuts().

ComparePt AlignmentMuonSelector::ptComparator
private

Definition at line 53 of file AlignmentMuonSelector.h.

Referenced by theBestMassPairCombinationMuons(), and theNHighestPtMuons().

double AlignmentMuonSelector::ptMax
private

Definition at line 58 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector().

double AlignmentMuonSelector::ptMin
private

Definition at line 58 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and basicCuts().