CMS 3D CMS Logo

BPHOniaToMuMuBuilder.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * \author Paolo Ronchese INFN Padova
5  *
6  */
7 
8 //-----------------------
9 // This Class' Header --
10 //-----------------------
12 
13 //-------------------------------
14 // Collaborating Class Headers --
15 //-------------------------------
25 
26 //---------------
27 // C++ Headers --
28 //---------------
29 using namespace std;
30 
31 //-------------------
32 // Initializations --
33 //-------------------
34 
35 //----------------
36 // Constructors --
37 //----------------
39  const BPHRecoBuilder::BPHGenericCollection* muPosCollection,
40  const BPHRecoBuilder::BPHGenericCollection* muNegCollection)
41  : muPosName("MuPos"),
42  muNegName("MuNeg"),
43  evSetup(&es),
44  posCollection(muPosCollection),
45  negCollection(muNegCollection) {
49  setParameters(Ups, 2.0, 10.0, 6.00, 12.00, 0.0, -1.0, 0.0);
53  updated = false;
54 }
55 
56 //--------------
57 // Destructor --
58 //--------------
60  map<oniaType, OniaParameters>::iterator iter = oniaPar.begin();
61  map<oniaType, OniaParameters>::iterator iend = oniaPar.end();
62  while (iter != iend) {
63  OniaParameters& par = iter++->second;
64  delete par.ptSel;
65  delete par.etaSel;
66  delete par.massSel;
67  delete par.chi2Sel;
68  }
69 }
70 
71 //--------------
72 // Operations --
73 //--------------
74 vector<BPHPlusMinusConstCandPtr> BPHOniaToMuMuBuilder::build() {
75  if (updated)
76  return fullList;
77 
78  fullList.clear();
79 
84 
85  map<oniaType, OniaParameters>::iterator iter = oniaPar.begin();
86  map<oniaType, OniaParameters>::iterator iend = oniaPar.end();
87  while (iter != iend) {
88  OniaParameters& par = iter++->second;
89  ptSel.include(*par.ptSel);
90  etaSel.include(*par.etaSel);
91  mSel.include(*par.massSel);
92  vSel.include(*par.chi2Sel);
93  }
94 
95  BPHRecoBuilder bOnia(*evSetup);
98  bOnia.filter(muPosName, ptSel);
99  bOnia.filter(muNegName, ptSel);
100  bOnia.filter(muPosName, etaSel);
101  bOnia.filter(muNegName, etaSel);
102  bOnia.filter(mSel);
103  bOnia.filter(vSel);
104 
106  updated = true;
107  return fullList;
108 }
109 
110 vector<BPHPlusMinusConstCandPtr> BPHOniaToMuMuBuilder::getList(
112  extractList(type);
113  vector<BPHPlusMinusConstCandPtr>& list = oniaList[type];
114  int i;
115  int n = list.size();
116  vector<BPHPlusMinusConstCandPtr> lsub;
117  lsub.reserve(n);
118  for (i = 0; i < n; ++i) {
119  BPHPlusMinusConstCandPtr ptr = list[i];
120  const reco::Candidate* muPos = ptr->originalReco(ptr->getDaug(muPosName));
121  const reco::Candidate* muNeg = ptr->originalReco(ptr->getDaug(muNegName));
122  if ((dSel != nullptr) && (!dSel->accept(*muPos)))
123  continue;
124  if ((dSel != nullptr) && (!dSel->accept(*muNeg)))
125  continue;
126  if ((mSel != nullptr) && (!mSel->accept(*ptr)))
127  continue;
128  if ((vSel != nullptr) && (!vSel->accept(*ptr)))
129  continue;
130  if ((kSel != nullptr) && (!kSel->accept(*ptr)))
131  continue;
132  lsub.push_back(list[i]);
133  }
134  return lsub;
135 }
136 
138  const reco::Candidate* mp = cand.originalReco(cand.getDaug(muPosName));
139  const reco::Candidate* mn = cand.originalReco(cand.getDaug(muNegName));
140  int nc = fullList.size();
141  int ic;
142  for (ic = 0; ic < nc; ++ic) {
144  const BPHPlusMinusCandidate* pmc = pmp.get();
145  if (pmc->originalReco(pmc->getDaug(muPosName)) != mp)
146  continue;
147  if (pmc->originalReco(pmc->getDaug(muNegName)) != mn)
148  continue;
149  return pmp;
150  }
151  return BPHPlusMinusConstCandPtr(nullptr);
152 }
153 
156  setNotUpdated();
157  OniaParameters& par = oniaPar[type];
158  par.ptSel->setPtMin(pt);
159  return;
160 }
161 
163  setNotUpdated();
164  OniaParameters& par = oniaPar[type];
165  par.etaSel->setEtaMax(eta);
166  return;
167 }
168 
170  setNotUpdated();
171  OniaParameters& par = oniaPar[type];
172  par.massSel->setMassMin(m);
173  return;
174 }
175 
177  setNotUpdated();
178  OniaParameters& par = oniaPar[type];
179  par.massSel->setMassMax(m);
180  return;
181 }
182 
184  setNotUpdated();
185  OniaParameters& par = oniaPar[type];
186  par.chi2Sel->setProbMin(p);
187  return;
188 }
189 
190 void BPHOniaToMuMuBuilder::setConstr(oniaType type, double mass, double sigma) {
191  setNotUpdated();
192  OniaParameters& par = oniaPar[type];
193  par.mass = mass;
194  par.sigma = sigma;
195  return;
196 }
197 
200  const OniaParameters& par = oniaPar.at(type);
201  return par.ptSel->getPtMin();
202 }
203 
205  const OniaParameters& par = oniaPar.at(type);
206  return par.etaSel->getEtaMax();
207 }
208 
210  const OniaParameters& par = oniaPar.at(type);
211  return par.massSel->getMassMin();
212 }
213 
215  const OniaParameters& par = oniaPar.at(type);
216  return par.massSel->getMassMax();
217 }
218 
220  const OniaParameters& par = oniaPar.at(type);
221  return par.chi2Sel->getProbMin();
222 }
223 
225  const OniaParameters& par = oniaPar.at(type);
226  return par.mass;
227 }
228 
230  const OniaParameters& par = oniaPar.at(type);
231  return par.sigma;
232 }
233 
235  map<oniaType, OniaParameters>::iterator iter = oniaPar.begin();
236  map<oniaType, OniaParameters>::iterator iend = oniaPar.end();
237  while (iter != iend)
238  iter++->second.updated = false;
239  updated = false;
240  return;
241 }
242 
244  double ptMin,
245  double etaMax,
246  double massMin,
247  double massMax,
248  double probMin,
249  double mass,
250  double sigma) {
251  OniaParameters& par = oniaPar[type];
252  par.ptSel = new BPHMuonPtSelect(ptMin);
253  par.etaSel = new BPHMuonEtaSelect(etaMax);
254  par.massSel = new BPHMassSelect(massMin, massMax);
255  par.chi2Sel = new BPHChi2Select(probMin);
256  par.mass = mass;
257  par.sigma = sigma;
258  par.updated = false;
259  return;
260 }
261 
263  if (!updated)
264  build();
265  OniaParameters& par = oniaPar[type];
266  vector<BPHPlusMinusConstCandPtr>& list = oniaList[type];
267  if (par.updated)
268  return;
269  int i;
270  int n = fullList.size();
271  list.clear();
272  list.reserve(n);
273  for (i = 0; i < n; ++i) {
275  const reco::Candidate* mcPos = ptr->getDaug("MuPos");
276  const reco::Candidate* mcNeg = ptr->getDaug("MuNeg");
277  const reco::Candidate* muPos = ptr->originalReco(mcPos);
278  const reco::Candidate* muNeg = ptr->originalReco(mcNeg);
279  if (!par.massSel->accept(*ptr))
280  continue;
281  if (!par.ptSel->accept(*muPos))
282  continue;
283  if (!par.etaSel->accept(*muPos))
284  continue;
285  if (!par.ptSel->accept(*muNeg))
286  continue;
287  if (!par.etaSel->accept(*muNeg))
288  continue;
289  if (!par.chi2Sel->accept(*ptr))
290  continue;
292  np->add("MuPos", muPos, ptr->getTrackSearchList(mcPos), BPHParticleMasses::muonMass, BPHParticleMasses::muonMSigma);
293  np->add("MuNeg", muNeg, ptr->getTrackSearchList(mcNeg), BPHParticleMasses::muonMass, BPHParticleMasses::muonMSigma);
294  if (par.mass > 0.0)
295  np->setConstraint(par.mass, par.sigma);
296  list.push_back(BPHPlusMinusConstCandPtr(np));
297  }
298  par.updated = true;
299  return;
300 }
BPHOniaToMuMuBuilder::updated
bool updated
Definition: BPHOniaToMuMuBuilder.h:113
BPHParticleMasses::psi2MWidth
static const double psi2MWidth
Definition: BPHParticleMasses.h:56
BPHChi2Select::setProbMin
void setProbMin(double p)
set prob min
Definition: BPHChi2Select.h:60
BPHOniaToMuMuBuilder::Psi1
Definition: BPHOniaToMuMuBuilder.h:46
BPHMassCuts::setMassMax
void setMassMax(double m)
Definition: BPHMassCuts.h:52
BPHParticleEtaSelect::setEtaMax
void setEtaMax(double eta)
set eta max
Definition: BPHParticleEtaSelect.h:50
BPHFitSelect::accept
virtual bool accept(const BPHKinematicFit &cand) const =0
accept function
BPHRecoBuilder::filter
void filter(const std::string &name, const BPHRecoSelect &sel) const
BPHChi2Select.h
BPHOniaToMuMuBuilder::getConstrMass
double getConstrMass(oniaType type) const
Definition: BPHOniaToMuMuBuilder.cc:224
BPHOniaToMuMuBuilder::OniaParameters::ptSel
BPHMuonPtSelect * ptSel
Definition: BPHOniaToMuMuBuilder.h:105
BPHFitSelect
Definition: BPHFitSelect.h:29
mps_fire.i
i
Definition: mps_fire.py:428
BPHOniaToMuMuBuilder::Ups3
Definition: BPHOniaToMuMuBuilder.h:46
BPHRecoSelect
Definition: BPHRecoSelect.h:35
BPHMuonPtSelect::accept
bool accept(const reco::Candidate &cand) const override
select muon
Definition: BPHMuonPtSelect.h:47
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
BPHOniaToMuMuBuilder::OniaParameters
Definition: BPHOniaToMuMuBuilder.h:104
BPHMuonEtaSelect::accept
bool accept(const reco::Candidate &cand) const override
select muon
Definition: BPHMuonEtaSelect.h:47
BPHOniaToMuMuBuilder::BPHOniaToMuMuBuilder
BPHOniaToMuMuBuilder(const edm::EventSetup &es, const BPHRecoBuilder::BPHGenericCollection *muPosCollection, const BPHRecoBuilder::BPHGenericCollection *muNegCollection)
Definition: BPHOniaToMuMuBuilder.cc:38
BPHOniaToMuMuBuilder::setParameters
void setParameters(oniaType type, double ptMin, double etaMax, double massMin, double massMax, double probMin, double mass, double sigma)
Definition: BPHOniaToMuMuBuilder.cc:243
BPHParticleMasses::jPsiMass
static const double jPsiMass
Definition: BPHParticleMasses.h:40
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
BPHChi2Select::getProbMin
double getProbMin() const
get current prob min
Definition: BPHChi2Select.h:66
recoSelectForWrite_cfi.probMin
probMin
Definition: recoSelectForWrite_cfi.py:8
np
int np
Definition: AMPTWrapper.h:43
BPHParticlePtSelect::getPtMin
double getPtMin() const
get current pt min
Definition: BPHParticlePtSelect.h:56
BPHMassCuts::getMassMin
double getMassMin() const
get current mass cuts
Definition: BPHMassCuts.h:58
ptMin
constexpr float ptMin
Definition: PhotonIDValueMapProducer.cc:155
BPHPlusMinusCandidate
Definition: BPHPlusMinusCandidate.h:32
BPHOniaToMuMuBuilder::setNotUpdated
void setNotUpdated()
Definition: BPHOniaToMuMuBuilder.cc:234
BPHRecoSelect.h
BPHOniaToMuMuBuilder::OniaParameters::updated
bool updated
Definition: BPHOniaToMuMuBuilder.h:111
BPHMomentumSelect
Definition: BPHMomentumSelect.h:29
BPHParticleMasses::muonMSigma
static const double muonMSigma
Definition: BPHParticleMasses.h:46
BPHOniaToMuMuBuilder::OniaParameters::massSel
BPHMassSelect * massSel
Definition: BPHOniaToMuMuBuilder.h:107
BPHOniaToMuMuBuilder::setPtMin
void setPtMin(oniaType type, double pt)
set cuts
Definition: BPHOniaToMuMuBuilder.cc:155
BPHOniaToMuMuBuilder::Ups
Definition: BPHOniaToMuMuBuilder.h:46
BPHMuonPtSelect.h
BPHOniaToMuMuBuilder::OniaParameters::mass
double mass
Definition: BPHOniaToMuMuBuilder.h:109
BPHMomentumSelect::accept
virtual bool accept(const BPHDecayMomentum &cand) const =0
accept function
BPHOniaToMuMuBuilder::getConstrSigma
double getConstrSigma(oniaType type) const
Definition: BPHOniaToMuMuBuilder.cc:229
BPHOniaToMuMuBuilder::getList
std::vector< BPHPlusMinusConstCandPtr > getList(oniaType type, BPHRecoSelect *dSel=nullptr, BPHMomentumSelect *mSel=nullptr, BPHVertexSelect *vSel=nullptr, BPHFitSelect *kSel=nullptr)
Definition: BPHOniaToMuMuBuilder.cc:110
BPHOniaToMuMuBuilder::getPtMin
double getPtMin(oniaType type) const
get current cuts
Definition: BPHOniaToMuMuBuilder.cc:199
BPHDecayMomentum::getDaug
virtual const reco::Candidate * getDaug(const std::string &name) const
Definition: BPHDecayMomentum.cc:94
BPHParticleMasses::ups2Mass
static const double ups2Mass
Definition: BPHParticleMasses.h:43
BPHOniaToMuMuBuilder::setMassMax
void setMassMax(oniaType type, double m)
Definition: BPHOniaToMuMuBuilder.cc:176
BPHOniaToMuMuBuilder::Ups2
Definition: BPHOniaToMuMuBuilder.h:46
BPHOniaToMuMuBuilder::Phi
Definition: BPHOniaToMuMuBuilder.h:46
BPHMultiSelect.h
BPHOniaToMuMuBuilder::evSetup
const edm::EventSetup * evSetup
Definition: BPHOniaToMuMuBuilder.h:100
BPHMuonEtaSelect
Definition: BPHMuonEtaSelect.h:30
BPHParticleMasses::ups1MWidth
static const double ups1MWidth
Definition: BPHParticleMasses.h:57
BPHParticleMasses.h
PVValHelper::eta
Definition: PVValidationHelpers.h:70
BPHRecoBuilder
Definition: BPHRecoBuilder.h:50
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:78
BPHOniaToMuMuBuilder::OniaParameters::sigma
double sigma
Definition: BPHOniaToMuMuBuilder.h:110
BPHMassSelect
Definition: BPHMassSelect.h:31
BPHOniaToMuMuBuilder.h
BPHOniaToMuMuBuilder::getProbMin
double getProbMin(oniaType type) const
Definition: BPHOniaToMuMuBuilder.cc:219
BPHMassCuts::setMassMin
void setMassMin(double m)
set mass cuts
Definition: BPHMassCuts.h:48
BPHOniaToMuMuBuilder::getMassMax
double getMassMax(oniaType type) const
Definition: BPHOniaToMuMuBuilder.cc:214
BPHOniaToMuMuBuilder::getMassMin
double getMassMin(oniaType type) const
Definition: BPHOniaToMuMuBuilder.cc:209
BPHParticleEtaSelect::getEtaMax
double getEtaMax() const
get current eta max
Definition: BPHParticleEtaSelect.h:56
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
BPHOniaToMuMuBuilder::oniaList
std::map< oniaType, std::vector< BPHPlusMinusConstCandPtr > > oniaList
Definition: BPHOniaToMuMuBuilder.h:116
BPHOniaToMuMuBuilder::fullList
std::vector< BPHPlusMinusConstCandPtr > fullList
Definition: BPHOniaToMuMuBuilder.h:117
type
type
Definition: SiPixelVCal_PayloadInspector.cc:39
BPHOniaToMuMuBuilder::negCollection
const BPHRecoBuilder::BPHGenericCollection * negCollection
Definition: BPHOniaToMuMuBuilder.h:102
gainCalibHelper::gainCalibPI::type
type
Definition: SiPixelGainCalibHelper.h:40
BPHOniaToMuMuBuilder::oniaType
oniaType
Definition: BPHOniaToMuMuBuilder.h:46
BPHMassSelect.h
cand
Definition: decayParser.h:32
BPHMuonPtSelect
Definition: BPHMuonPtSelect.h:30
BPHOniaToMuMuBuilder::setMassMin
void setMassMin(oniaType type, double m)
Definition: BPHOniaToMuMuBuilder.cc:169
BPHVertexSelect
Definition: BPHVertexSelect.h:29
BPHMassCuts::getMassMax
double getMassMax() const
Definition: BPHMassCuts.h:59
BPHOniaToMuMuBuilder::setConstr
void setConstr(oniaType type, double mass, double sigma)
Definition: BPHOniaToMuMuBuilder.cc:190
BPHParticleMasses::ups1Mass
static const double ups1Mass
Definition: BPHParticleMasses.h:42
BPHOniaToMuMuBuilder::OniaParameters::chi2Sel
BPHChi2Select * chi2Sel
Definition: BPHOniaToMuMuBuilder.h:108
BPHMultiSelect
Definition: BPHMultiSelect.h:168
edm::EventSetup
Definition: EventSetup.h:58
BPHChi2Select
Definition: BPHChi2Select.h:31
BPHOniaToMuMuBuilder::setProbMin
void setProbMin(oniaType type, double p)
Definition: BPHOniaToMuMuBuilder.cc:183
BPHPlusMinusConstCandPtr
BPHGenericPtr< const BPHPlusMinusCandidate >::type BPHPlusMinusConstCandPtr
Definition: BPHPlusMinusCandidatePtr.h:9
BPHOniaToMuMuBuilder::muPosName
std::string muPosName
Definition: BPHOniaToMuMuBuilder.h:97
BPHRecoBuilder.h
BPHMuonEtaSelect.h
BPHParticleMasses::phiMWidth
static const double phiMWidth
Definition: BPHParticleMasses.h:54
BPHParticleMasses::phiMass
static const double phiMass
Definition: BPHParticleMasses.h:39
reco::Candidate
Definition: Candidate.h:27
BPHOniaToMuMuBuilder::getEtaMax
double getEtaMax(oniaType type) const
Definition: BPHOniaToMuMuBuilder.cc:204
BPHPlusMinusCandidate::build
static std::vector< BPHPlusMinusConstCandPtr > build(const BPHRecoBuilder &builder, const std::string &nPos, const std::string &nNeg, double mass=-1, double msig=-1)
Definition: BPHPlusMinusCandidate.cc:86
BPHRecoBuilder::BPHGenericCollection
Definition: BPHRecoBuilder.h:70
BPHParticlePtSelect::setPtMin
void setPtMin(double pt)
set pt min
Definition: BPHParticlePtSelect.h:50
BPHParticleMasses::psi2Mass
static const double psi2Mass
Definition: BPHParticleMasses.h:41
std
Definition: JetResolutionObject.h:76
BPHPlusMinusCandidate.h
BPHDecayMomentum::originalReco
virtual const reco::Candidate * originalReco(const reco::Candidate *daug) const
get the original particle from the clone
Definition: BPHDecayMomentum.cc:82
BPHOniaToMuMuBuilder::posCollection
const BPHRecoBuilder::BPHGenericCollection * posCollection
Definition: BPHOniaToMuMuBuilder.h:101
BPHOniaToMuMuBuilder::Psi2
Definition: BPHOniaToMuMuBuilder.h:46
BPHOniaToMuMuBuilder::build
std::vector< BPHPlusMinusConstCandPtr > build()
build resonance candidates
Definition: BPHOniaToMuMuBuilder.cc:74
BPHParticleMasses::muonMass
static const double muonMass
Definition: BPHParticleMasses.h:31
BPHSelectOperation::or_mode
Definition: BPHMultiSelect.h:42
EgHLTOffHistBins_cfi.mass
mass
Definition: EgHLTOffHistBins_cfi.py:34
ALCARECOTkAlBeamHalo_cff.etaMax
etaMax
Definition: ALCARECOTkAlBeamHalo_cff.py:33
BPHOniaToMuMuBuilder::oniaPar
std::map< oniaType, OniaParameters > oniaPar
Definition: BPHOniaToMuMuBuilder.h:115
BPHOniaToMuMuBuilder::setEtaMax
void setEtaMax(oniaType type, double eta)
Definition: BPHOniaToMuMuBuilder.cc:162
BPHRecoBuilder::add
void add(const std::string &name, const BPHGenericCollection *collection, double mass=-1.0, double msig=-1.0)
BPHParticleMasses::ups2MWidth
static const double ups2MWidth
Definition: BPHParticleMasses.h:58
BPHMassSelect::accept
bool accept(const BPHDecayMomentum &cand) const override
select particle
Definition: BPHMassSelect.h:48
BPHOniaToMuMuBuilder::OniaParameters::etaSel
BPHMuonEtaSelect * etaSel
Definition: BPHOniaToMuMuBuilder.h:106
BPHOniaToMuMuBuilder::extractList
void extractList(oniaType type)
Definition: BPHOniaToMuMuBuilder.cc:262
BPHChi2Select::accept
bool accept(const BPHDecayVertex &cand) const override
select vertex
Definition: BPHChi2Select.h:48
BPHRecoCandidate
Definition: BPHRecoCandidate.h:46
BPHOniaToMuMuBuilder::~BPHOniaToMuMuBuilder
virtual ~BPHOniaToMuMuBuilder()
Definition: BPHOniaToMuMuBuilder.cc:59
BPHOniaToMuMuBuilder::getOriginalCandidate
BPHPlusMinusConstCandPtr getOriginalCandidate(const BPHRecoCandidate &cand)
Definition: BPHOniaToMuMuBuilder.cc:137
BPHParticleMasses::ups3MWidth
static const double ups3MWidth
Definition: BPHParticleMasses.h:59
BPHOniaToMuMuBuilder::muNegName
std::string muNegName
Definition: BPHOniaToMuMuBuilder.h:98
recoSelectForWrite_cfi.massMax
massMax
Definition: recoSelectForWrite_cfi.py:7
BPHVertexSelect::accept
virtual bool accept(const BPHDecayVertex &cand) const =0
accept function
BPHRecoSelect::accept
virtual bool accept(const reco::Candidate &cand) const =0
recoSelectForWrite_cfi.massMin
massMin
Definition: recoSelectForWrite_cfi.py:6
BPHParticleMasses::ups3Mass
static const double ups3Mass
Definition: BPHParticleMasses.h:44
BPHParticleMasses::jPsiMWidth
static const double jPsiMWidth
Definition: BPHParticleMasses.h:55
BPHOniaToMuMuBuilder::Ups1
Definition: BPHOniaToMuMuBuilder.h:46