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, 3.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 
82 
83  map<oniaType, OniaParameters>::iterator iter = oniaPar.begin();
84  map<oniaType, OniaParameters>::iterator iend = oniaPar.end();
85  while (iter != iend) {
86  OniaParameters& par = iter++->second;
87  ptSel.include(*par.ptSel);
88  etaSel.include(*par.etaSel);
89  mSel.include(*par.massSel);
90  vSel.include(*par.chi2Sel);
91  }
92 
93  BPHRecoBuilder bOnia(*evSetup);
96  bOnia.filter(muPosName, ptSel);
97  bOnia.filter(muNegName, ptSel);
98  bOnia.filter(muPosName, etaSel);
99  bOnia.filter(muNegName, etaSel);
100  bOnia.filter(mSel);
101  bOnia.filter(vSel);
102 
104  updated = true;
105  return fullList;
106 }
107 
108 vector<BPHPlusMinusConstCandPtr> BPHOniaToMuMuBuilder::getList(
110  extractList(type);
111  vector<BPHPlusMinusConstCandPtr>& list = oniaList[type];
112  int i;
113  int n = list.size();
114  vector<BPHPlusMinusConstCandPtr> lsub;
115  lsub.reserve(n);
116  for (i = 0; i < n; ++i) {
117  BPHPlusMinusConstCandPtr ptr = list[i];
118  const reco::Candidate* muPos = ptr->originalReco(ptr->getDaug(muPosName));
119  const reco::Candidate* muNeg = ptr->originalReco(ptr->getDaug(muNegName));
120  if ((dSel != nullptr) && (!dSel->accept(*muPos)))
121  continue;
122  if ((dSel != nullptr) && (!dSel->accept(*muNeg)))
123  continue;
124  if ((mSel != nullptr) && (!mSel->accept(*ptr)))
125  continue;
126  if ((vSel != nullptr) && (!vSel->accept(*ptr)))
127  continue;
128  if ((kSel != nullptr) && (!kSel->accept(*ptr)))
129  continue;
130  lsub.push_back(list[i]);
131  }
132  return lsub;
133 }
134 
136  const reco::Candidate* mp = cand.originalReco(cand.getDaug(muPosName));
137  const reco::Candidate* mn = cand.originalReco(cand.getDaug(muNegName));
138  int nc = fullList.size();
139  int ic;
140  for (ic = 0; ic < nc; ++ic) {
142  const BPHPlusMinusCandidate* pmc = pmp.get();
143  if (pmc->originalReco(pmc->getDaug(muPosName)) != mp)
144  continue;
145  if (pmc->originalReco(pmc->getDaug(muNegName)) != mn)
146  continue;
147  return pmp;
148  }
149  return BPHPlusMinusConstCandPtr(nullptr);
150 }
151 
154  setNotUpdated();
155  OniaParameters& par = oniaPar[type];
156  par.ptSel->setPtMin(pt);
157  return;
158 }
159 
161  setNotUpdated();
162  OniaParameters& par = oniaPar[type];
163  par.etaSel->setEtaMax(eta);
164  return;
165 }
166 
168  setNotUpdated();
169  OniaParameters& par = oniaPar[type];
170  par.massSel->setMassMin(m);
171  return;
172 }
173 
175  setNotUpdated();
176  OniaParameters& par = oniaPar[type];
177  par.massSel->setMassMax(m);
178  return;
179 }
180 
182  setNotUpdated();
183  OniaParameters& par = oniaPar[type];
184  par.chi2Sel->setProbMin(p);
185  return;
186 }
187 
188 void BPHOniaToMuMuBuilder::setConstr(oniaType type, double mass, double sigma) {
189  setNotUpdated();
190  OniaParameters& par = oniaPar[type];
191  par.mass = mass;
192  par.sigma = sigma;
193  return;
194 }
195 
198  const OniaParameters& par = oniaPar.at(type);
199  return par.ptSel->getPtMin();
200 }
201 
203  const OniaParameters& par = oniaPar.at(type);
204  return par.etaSel->getEtaMax();
205 }
206 
208  const OniaParameters& par = oniaPar.at(type);
209  return par.massSel->getMassMin();
210 }
211 
213  const OniaParameters& par = oniaPar.at(type);
214  return par.massSel->getMassMax();
215 }
216 
218  const OniaParameters& par = oniaPar.at(type);
219  return par.chi2Sel->getProbMin();
220 }
221 
223  const OniaParameters& par = oniaPar.at(type);
224  return par.mass;
225 }
226 
228  const OniaParameters& par = oniaPar.at(type);
229  return par.sigma;
230 }
231 
233  map<oniaType, OniaParameters>::iterator iter = oniaPar.begin();
234  map<oniaType, OniaParameters>::iterator iend = oniaPar.end();
235  while (iter != iend)
236  iter++->second.updated = false;
237  updated = false;
238  return;
239 }
240 
242  double ptMin,
243  double etaMax,
244  double massMin,
245  double massMax,
246  double probMin,
247  double mass,
248  double sigma) {
249  OniaParameters& par = oniaPar[type];
250  par.ptSel = new BPHMuonPtSelect(ptMin);
251  par.etaSel = new BPHMuonEtaSelect(etaMax);
252  par.massSel = new BPHMassSelect(massMin, massMax);
253  par.chi2Sel = new BPHChi2Select(probMin);
254  par.mass = mass;
255  par.sigma = sigma;
256  par.updated = false;
257  return;
258 }
259 
261  if (!updated)
262  build();
263  OniaParameters& par = oniaPar[type];
264  vector<BPHPlusMinusConstCandPtr>& list = oniaList[type];
265  if (par.updated)
266  return;
267  int i;
268  int n = fullList.size();
269  list.clear();
270  list.reserve(n);
271  for (i = 0; i < n; ++i) {
273  const reco::Candidate* mcPos = ptr->getDaug("MuPos");
274  const reco::Candidate* mcNeg = ptr->getDaug("MuNeg");
275  const reco::Candidate* muPos = ptr->originalReco(mcPos);
276  const reco::Candidate* muNeg = ptr->originalReco(mcNeg);
277  if (!par.massSel->accept(*ptr))
278  continue;
279  if (!par.ptSel->accept(*muPos))
280  continue;
281  if (!par.etaSel->accept(*muPos))
282  continue;
283  if (!par.ptSel->accept(*muNeg))
284  continue;
285  if (!par.etaSel->accept(*muNeg))
286  continue;
287  if (!par.chi2Sel->accept(*ptr))
288  continue;
290  np->add("MuPos", muPos, ptr->getTrackSearchList(mcPos), BPHParticleMasses::muonMass);
291  np->add("MuNeg", muNeg, ptr->getTrackSearchList(mcNeg), BPHParticleMasses::muonMass);
292  if (par.mass > 0.0)
293  np->setConstraint(par.mass, par.sigma);
294  list.push_back(BPHPlusMinusConstCandPtr(np));
295  }
296  par.updated = true;
297  return;
298 }
static const double ups2MWidth
static std::vector< BPHPlusMinusConstCandPtr > build(const BPHRecoBuilder &builder, const std::string &nPos, const std::string &nNeg, double mass=-1, double msig=-1)
type
Definition: HCALResponse.h:21
const BPHRecoBuilder::BPHGenericCollection * posCollection
void setMassMax(double m)
Definition: BPHMassCuts.h:48
bool accept(const reco::Candidate &cand) const override
select muon
double getMassMax(oniaType type) const
void setMassMax(oniaType type, double m)
static const double ups3Mass
static const double ups2Mass
static const double jPsiMWidth
double getConstrMass(oniaType type) const
static const double muonMSigma
double getProbMin(oniaType type) const
bool accept(const BPHDecayMomentum &cand) const override
select particle
Definition: BPHMassSelect.h:44
static const double jPsiMass
void setPtMin(double pt)
set pt min
virtual bool accept(const BPHDecayMomentum &cand) const =0
accept function
BPHPlusMinusConstCandPtr getOriginalCandidate(const BPHRecoCandidate &cand)
virtual bool accept(const BPHDecayVertex &cand) const =0
accept function
void setProbMin(oniaType type, double p)
void include(T &s, bool m=true)
include selection
bool accept(const BPHDecayVertex &cand) const override
select vertex
Definition: BPHChi2Select.h:44
std::map< oniaType, std::vector< BPHPlusMinusConstCandPtr > > oniaList
double getMassMin(oniaType type) const
void setParameters(oniaType type, double ptMin, double etaMax, double massMin, double massMax, double probMin, double mass, double sigma)
virtual bool accept(const reco::Candidate &cand) const
void add(const std::string &name, const reco::Candidate *daug, double mass=-1.0, double sigma=-1.0) override
BPHGenericPtr< const BPHPlusMinusCandidate >::type BPHPlusMinusConstCandPtr
static const double ups1MWidth
double getPtMin() const
get current pt min
void setProbMin(double p)
set prob min
Definition: BPHChi2Select.h:54
int np
Definition: AMPTWrapper.h:43
double getConstrSigma(oniaType type) const
void extractList(oniaType type)
BPHOniaToMuMuBuilder(const edm::EventSetup &es, const BPHRecoBuilder::BPHGenericCollection *muPosCollection, const BPHRecoBuilder::BPHGenericCollection *muNegCollection)
static const double phiMWidth
double getEtaMax(oniaType type) const
void setEtaMax(double eta)
set eta max
double getProbMin() const
get current prob min
Definition: BPHChi2Select.h:60
virtual const reco::Candidate * originalReco(const reco::Candidate *daug) const
get the original particle from the clone
static const double phiMass
void setMassMin(double m)
set mass cuts
Definition: BPHMassCuts.h:44
void add(const std::string &name, const BPHGenericCollection *collection, double mass=-1.0, double msig=-1.0)
double getMassMax() const
Definition: BPHMassCuts.h:55
static const double psi2Mass
double getMassMin() const
get current mass cuts
Definition: BPHMassCuts.h:54
static const double ups1Mass
const BPHRecoBuilder::BPHGenericCollection * negCollection
virtual bool accept(const BPHKinematicFit &cand) const =0
accept function
double getPtMin(oniaType type) const
get current cuts
static const double muonMass
void filter(const std::string &name, const BPHRecoSelect &sel) const
static const double ups3MWidth
std::vector< BPHPlusMinusConstCandPtr > build()
build resonance candidates
std::map< oniaType, OniaParameters > oniaPar
void setConstr(oniaType type, double mass, double sigma)
void setEtaMax(oniaType type, double eta)
std::vector< BPHPlusMinusConstCandPtr > fullList
bool accept(const reco::Candidate &cand) const override
select muon
std::vector< BPHPlusMinusConstCandPtr > getList(oniaType type, BPHRecoSelect *dSel=0, BPHMomentumSelect *mSel=0, BPHVertexSelect *vSel=0, BPHFitSelect *kSel=0)
void setConstraint(double mass, double sigma)
apply a mass constraint
double getEtaMax() const
get current eta max
virtual const reco::Candidate * getDaug(const std::string &name) const
void setMassMin(oniaType type, double m)
const edm::EventSetup * evSetup
static const double psi2MWidth
void setPtMin(oniaType type, double pt)
set cuts
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run