CMS 3D CMS Logo

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

◆ Muons

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

Definition at line 28 of file AlignmentMuonSelector.h.

Constructor & Destructor Documentation

◆ AlignmentMuonSelector()

AlignmentMuonSelector::AlignmentMuonSelector ( const edm::ParameterSet cfg)

constructor

Definition at line 10 of file AlignmentMuonSelector.cc.

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 }

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.

◆ ~AlignmentMuonSelector()

AlignmentMuonSelector::~AlignmentMuonSelector ( )

destructor

Definition at line 58 of file AlignmentMuonSelector.cc.

58 {}

Member Function Documentation

◆ basicCuts()

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.

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 }

References chi2nMaxTO, reco::Muon::combinedMuon(), PVValHelper::eta, reco::LeafCandidate::eta(), etaMin, reco::Muon::isGlobalMuon(), reco::Muon::isStandAloneMuon(), reco::Muon::isTrackerMuon(), PDWG_BPHSkim_cff::muons, 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().

◆ select()

AlignmentMuonSelector::Muons AlignmentMuonSelector::select ( const Muons muons,
const edm::Event evt 
) const

select muons

Definition at line 62 of file AlignmentMuonSelector.cc.

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
85  }
86 
87  edm::LogInfo("AlignmentMuonSelector") << "muons all,kept: " << muons.size() << "," << result.size();
88 
89  return result;
90 }

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

Referenced by MuonConfigSelector::select().

◆ theBestMassPairCombinationMuons()

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.

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 }

References EgHLTOffHistBins_cfi::mass, maxMassPair, minMassPair, PDWG_BPHSkim_cff::muons, ptComparator, and mps_fire::result.

Referenced by select().

◆ theNHighestPtMuons()

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

filter the n highest pt muons

Definition at line 139 of file AlignmentMuonSelector.cc.

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 }

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

Referenced by select().

Member Data Documentation

◆ applyBasicCuts

bool AlignmentMuonSelector::applyBasicCuts
private

private data members

Definition at line 56 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and select().

◆ applyMassPairFilter

bool AlignmentMuonSelector::applyMassPairFilter
private

Definition at line 56 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and select().

◆ applyMultiplicityFilter

bool AlignmentMuonSelector::applyMultiplicityFilter
private

Definition at line 56 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and select().

◆ applyNHighestPt

bool AlignmentMuonSelector::applyNHighestPt
private

Definition at line 56 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and select().

◆ chi2nMaxGB

double AlignmentMuonSelector::chi2nMaxGB
private

Definition at line 60 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector().

◆ chi2nMaxSA

double AlignmentMuonSelector::chi2nMaxSA
private

Definition at line 59 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector().

◆ chi2nMaxTO

double AlignmentMuonSelector::chi2nMaxTO
private

Definition at line 61 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and basicCuts().

◆ etaMax

double AlignmentMuonSelector::etaMax
private

Definition at line 58 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector().

◆ etaMin

double AlignmentMuonSelector::etaMin
private

Definition at line 58 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and basicCuts().

◆ maxMassPair

double AlignmentMuonSelector::maxMassPair
private

◆ minMassPair

double AlignmentMuonSelector::minMassPair
private

◆ minMultiplicity

int AlignmentMuonSelector::minMultiplicity
private

Definition at line 57 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and select().

◆ nHighestPt

int AlignmentMuonSelector::nHighestPt
private

Definition at line 57 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and theNHighestPtMuons().

◆ nHitMaxGB

double AlignmentMuonSelector::nHitMaxGB
private

Definition at line 60 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and basicCuts().

◆ nHitMaxSA

double AlignmentMuonSelector::nHitMaxSA
private

Definition at line 59 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and basicCuts().

◆ nHitMaxTO

double AlignmentMuonSelector::nHitMaxTO
private

Definition at line 61 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and basicCuts().

◆ nHitMinGB

double AlignmentMuonSelector::nHitMinGB
private

Definition at line 60 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and basicCuts().

◆ nHitMinSA

double AlignmentMuonSelector::nHitMinSA
private

Definition at line 59 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and basicCuts().

◆ nHitMinTO

double AlignmentMuonSelector::nHitMinTO
private

Definition at line 61 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and basicCuts().

◆ phiMax

double AlignmentMuonSelector::phiMax
private

Definition at line 58 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector().

◆ phiMin

double AlignmentMuonSelector::phiMin
private

Definition at line 58 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and basicCuts().

◆ pMax

double AlignmentMuonSelector::pMax
private

Definition at line 58 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector().

◆ pMin

double AlignmentMuonSelector::pMin
private

Definition at line 58 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and basicCuts().

◆ ptComparator

ComparePt AlignmentMuonSelector::ptComparator
private

Definition at line 53 of file AlignmentMuonSelector.h.

Referenced by theBestMassPairCombinationMuons(), and theNHighestPtMuons().

◆ ptMax

double AlignmentMuonSelector::ptMax
private

Definition at line 58 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector().

◆ ptMin

double AlignmentMuonSelector::ptMin
private

Definition at line 58 of file AlignmentMuonSelector.h.

Referenced by AlignmentMuonSelector(), and basicCuts().

PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
AlignmentMuonSelector::pMin
double pMin
Definition: AlignmentMuonSelector.h:58
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
AlignmentMuonSelector::pMax
double pMax
Definition: AlignmentMuonSelector.h:58
AlignmentMuonSelector::applyNHighestPt
bool applyNHighestPt
Definition: AlignmentMuonSelector.h:56
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
edm::LogInfo
Definition: MessageLogger.h:254
AlignmentMuonSelector::phiMax
double phiMax
Definition: AlignmentMuonSelector.h:58
AlignmentMuonSelector::chi2nMaxTO
double chi2nMaxTO
Definition: AlignmentMuonSelector.h:61
reco::LeafCandidate::pt
double pt() const final
transverse momentum
Definition: LeafCandidate.h:146
AlignmentMuonSelector::applyMassPairFilter
bool applyMassPairFilter
Definition: AlignmentMuonSelector.h:56
AlignmentMuonSelector::nHitMaxSA
double nHitMaxSA
Definition: AlignmentMuonSelector.h:59
reco::Muon
Definition: Muon.h:27
AlignmentMuonSelector::minMultiplicity
int minMultiplicity
Definition: AlignmentMuonSelector.h:57
AlignmentMuonSelector::nHighestPt
int nHighestPt
Definition: AlignmentMuonSelector.h:57
AlignmentMuonSelector::applyBasicCuts
bool applyBasicCuts
private data members
Definition: AlignmentMuonSelector.h:56
PVValHelper::eta
Definition: PVValidationHelpers.h:69
AlignmentMuonSelector::etaMin
double etaMin
Definition: AlignmentMuonSelector.h:58
AlignmentMuonSelector::ptMax
double ptMax
Definition: AlignmentMuonSelector.h:58
AlignmentMuonSelector::nHitMaxTO
double nHitMaxTO
Definition: AlignmentMuonSelector.h:61
reco::Muon::combinedMuon
TrackRef combinedMuon() const override
reference to a stand-alone muon Track
Definition: Muon.h:52
AlignmentMuonSelector::phiMin
double phiMin
Definition: AlignmentMuonSelector.h:58
reco::Muon::isGlobalMuon
bool isGlobalMuon() const override
Definition: Muon.h:299
AlignmentMuonSelector::applyMultiplicityFilter
bool applyMultiplicityFilter
Definition: AlignmentMuonSelector.h:56
reco::LeafCandidate::eta
double eta() const final
momentum pseudorapidity
Definition: LeafCandidate.h:152
AlignmentMuonSelector::nHitMinTO
double nHitMinTO
Definition: AlignmentMuonSelector.h:61
AlignmentMuonSelector::etaMax
double etaMax
Definition: AlignmentMuonSelector.h:58
createfilelist.int
int
Definition: createfilelist.py:10
AlignmentMuonSelector::maxMassPair
double maxMassPair
Definition: AlignmentMuonSelector.h:62
looper.cfg
cfg
Definition: looper.py:297
AlignmentMuonSelector::ptComparator
ComparePt ptComparator
Definition: AlignmentMuonSelector.h:53
reco::Muon::track
TrackRef track() const override
reference to a Track
Definition: Muon.h:46
DDAxes::phi
AlignmentMuonSelector::minMassPair
double minMassPair
Definition: AlignmentMuonSelector.h:62
reco::Muon::isTrackerMuon
bool isTrackerMuon() const override
Definition: Muon.h:300
reco::LeafCandidate::phi
double phi() const final
momentum azimuthal angle
Definition: LeafCandidate.h:148
AlignmentMuonSelector::chi2nMaxSA
double chi2nMaxSA
Definition: AlignmentMuonSelector.h:59
AlignmentMuonSelector::basicCuts
Muons basicCuts(const Muons &muons) const
apply basic cuts on pt,eta,phi,nhit
Definition: AlignmentMuonSelector.cc:94
AlignmentMuonSelector::ptMin
double ptMin
Definition: AlignmentMuonSelector.h:58
reco::LeafCandidate::p
double p() const final
magnitude of momentum vector
Definition: LeafCandidate.h:123
EgHLTOffHistBins_cfi.mass
mass
Definition: EgHLTOffHistBins_cfi.py:34
AlignmentMuonSelector::Muons
std::vector< const reco::Muon * > Muons
Definition: AlignmentMuonSelector.h:28
AlignmentMuonSelector::theBestMassPairCombinationMuons
Muons theBestMassPairCombinationMuons(const Muons &muons) const
filter only those muons giving best mass pair combination
Definition: AlignmentMuonSelector.cc:160
reco::Muon::isStandAloneMuon
bool isStandAloneMuon() const override
Definition: Muon.h:301
AlignmentMuonSelector::nHitMaxGB
double nHitMaxGB
Definition: AlignmentMuonSelector.h:60
mps_fire.result
result
Definition: mps_fire.py:303
AlignmentMuonSelector::theNHighestPtMuons
Muons theNHighestPtMuons(const Muons &muons) const
filter the n highest pt muons
Definition: AlignmentMuonSelector.cc:139
AlignmentMuonSelector::nHitMinGB
double nHitMinGB
Definition: AlignmentMuonSelector.h:60
AlignmentMuonSelector::chi2nMaxGB
double chi2nMaxGB
Definition: AlignmentMuonSelector.h:60
reco::Muon::standAloneMuon
TrackRef standAloneMuon() const override
reference to a stand-alone muon Track
Definition: Muon.h:49
AlignmentMuonSelector::nHitMinSA
double nHitMinSA
Definition: AlignmentMuonSelector.h:59