CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
BPHDecayToResFlyingBuilder.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 //-------------------------------
19 
20 //---------------
21 // C++ Headers --
22 //---------------
23 using namespace std;
24 
25 //-------------------
26 // Initializations --
27 //-------------------
28 
29 //----------------
30 // Constructors --
31 //----------------
33  const std::string& resName,
34  double resMass,
35  double resWidth,
36  const std::vector<BPHPlusMinusConstCandPtr>& resCollection,
37  const std::string& flyName,
38  double flyMass,
39  double flyMSigma,
40  const std::vector<BPHPlusMinusConstCandPtr>& flyCollection)
41  : BPHDecayConstrainedBuilder(es, resName, resMass, resWidth, resCollection),
42  fName(flyName),
43  fMass(flyMass),
44  fMSigma(flyMSigma),
45  fCollection(&flyCollection),
46  flySel(new BPHMassFitSelect(-2.0e+06, -1.0e+06)),
47  kfChi2Sel(new BPHKinFitChi2Select(-1.0)) {}
48 
49 //--------------
50 // Destructor --
51 //--------------
53  delete flySel;
54  delete kfChi2Sel;
55 }
56 
57 //--------------
58 // Operations --
59 //--------------
60 vector<BPHRecoConstCandPtr> BPHDecayToResFlyingBuilder::build() {
61  if (updated)
62  return recList;
63 
64  recList.clear();
65 
66  BPHRecoBuilder brb(*evSetup);
68  brb.add(rName, *rCollection);
69  brb.add(fName, *fCollection);
70 
71  if (resoSel->getMassMax() >= 0.0)
72  brb.filter(rName, *resoSel);
73  if (flySel->getMassMax() >= 0.0)
74  brb.filter(fName, *flySel);
75 
76  if (massSel->getMassMax() >= 0.0)
77  brb.filter(*massSel);
78 
79  vector<BPHRecoConstCandPtr> tmpList = BPHRecoCandidate::build(brb);
80  //
81  // Apply kinematic constraint on the resonance mass.
82  //
83  int iRec;
84  int nRec = tmpList.size();
85  recList.reserve(nRec);
86  for (iRec = 0; iRec < nRec; ++iRec) {
87  BPHRecoConstCandPtr ctmp = tmpList[iRec];
88  BPHRecoCandidate* cptr = ctmp->clone();
89  BPHRecoConstCandPtr cand(cptr);
90  // fit for flying reconstruction
91  // indipendent from other particles
92  cptr->setIndependentFit(fName, true, fMass, fMSigma);
93  cptr->resetKinematicFit();
94  if ((mFitSel->getMassMax() >= 0) && (!mFitSel->accept(*cptr)))
95  continue;
96  const RefCountedKinematicVertex tdv = cptr->topDecayVertex();
97  if ((kfChi2Sel->getProbMin() >= 0) && !kfChi2Sel->accept(*cptr))
98  continue;
99  dMap[cand->getComp(rName).get()] = ctmp->getComp(rName).get();
100  dMap[cand->getComp(fName).get()] = ctmp->getComp(fName).get();
101  recList.push_back(cand);
102  }
103  updated = true;
104  return recList;
105 }
106 
109  updated = false;
110  flySel->setMassMin(m);
111  return;
112 }
113 
115  updated = false;
116  flySel->setMassMax(m);
117  return;
118 }
119 
120 void BPHDecayToResFlyingBuilder::setFlyingMassRange(double mMin, double mMax) {
121  updated = false;
122  flySel->setMassMin(mMin);
123  flySel->setMassMax(mMax);
124  return;
125 }
126 
128  updated = false;
129  kfChi2Sel->setProbMin(p);
130 }
void setMinPDiffererence(double pMin)
void setMassMax(double m)
Definition: BPHMassCuts.h:52
std::vector< BPHRecoConstCandPtr > build()
build candidates
BPHGenericPtr< const BPHRecoCandidate >::type BPHRecoConstCandPtr
void setFlyingMassMin(double m)
set cuts
BPHDecayToResFlyingBuilder(const edm::EventSetup &es, const std::string &resName, double resMass, double resWidth, const std::vector< BPHPlusMinusConstCandPtr > &resCollection, const std::string &flyName, double flyMass, double flyMSigma, const std::vector< BPHPlusMinusConstCandPtr > &flyCollection)
bool accept(const BPHKinematicFit &cand) const override
select vertex
void setIndependentFit(const std::string &name, bool flag=true, double mass=-1.0, double sigma=-1.0)
set a decaying daughter as an unique particle fitted independently
double getProbMin() const
get current prob min
static std::vector< BPHRecoConstCandPtr > build(const BPHRecoBuilder &builder, double mass=-1, double msig=-1)
std::map< const BPHRecoCandidate *, const BPHRecoCandidate * > dMap
std::vector< BPHRecoConstCandPtr > recList
const std::vector< BPHPlusMinusConstCandPtr > * rCollection
virtual void resetKinematicFit() const
reset the kinematic fit
void setMassMin(double m)
set mass cuts
Definition: BPHMassCuts.h:48
void add(const std::string &name, const BPHGenericCollection *collection, double mass=-1.0, double msig=-1.0)
double getMassMax() const
Definition: BPHMassCuts.h:59
virtual BPHRecoCandidate * clone(int level=-1) const
virtual const RefCountedKinematicVertex topDecayVertex() const
void filter(const std::string &name, const BPHRecoSelect &sel) const
void setProbMin(double p)
set prob min
void setFlyingMassRange(double mMin, double mMax)
bool accept(const BPHKinematicFit &cand) const override
select particle
const std::vector< BPHPlusMinusConstCandPtr > * fCollection
const edm::EventSetup * evSetup