CMS 3D CMS Logo

BPHRecoCandidate.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 //-------------------------------
18 
19 //---------------
20 // C++ Headers --
21 //---------------
22 using namespace std;
23 
24 //-------------------
25 // Initializations --
26 //-------------------
27 
28 //----------------
29 // Constructors --
30 //----------------
31 BPHRecoCandidate::BPHRecoCandidate(const BPHEventSetupWrapper* es, int daugNum, int compNum)
32  : BPHDecayMomentum(daugNum, compNum), BPHDecayVertex(es), BPHKinematicFit() {}
33 
35  : BPHDecayMomentum(compList.daugMap, compList.compMap), BPHDecayVertex(this, es), BPHKinematicFit(this) {}
36 
37 //--------------
38 // Operations --
39 //--------------
40 vector<BPHRecoConstCandPtr> BPHRecoCandidate::build(const BPHRecoBuilder& builder, double mass, double msig) {
41  // create a list of pointers to BPHRecoCandidate and fill it
42  // with particle combinations selected by the BPHRecoBuilder
43  vector<BPHRecoConstCandPtr> cList;
44  fill<BPHRecoCandidate>(cList, builder, mass, msig);
45  return cList;
46 }
47 
52  fill(ptr, level);
53  return ptr;
54 }
55 
56 // function doing the job to clone reconstructed decays:
57 // copy stable particles and clone cascade decays up to chosen level
60  const vector<string>& nDaug = daugNames();
61  int id;
62  int nd = nDaug.size();
63  for (id = 0; id < nd; ++id) {
64  const string& n = nDaug[id];
65  const reco::Candidate* d = getDaug(n);
66  ptr->add(n, originalReco(d), getTrackSearchList(d), d->mass(), getMassSigma(d));
67  }
68  const vector<string>& nComp = compNames();
69  int ic;
70  int nc = nComp.size();
71  for (ic = 0; ic < nc; ++ic) {
72  const string& n = nComp[ic];
74  if (level)
75  ptr->add(n, BPHRecoConstCandPtr(c->clone(level - 1)));
76  else
77  ptr->add(n, c);
78  double m = -1;
79  double s = -1;
80  if (getIndependentFit(n, m, s))
81  ptr->setIndependentFit(n, true, m, s);
82  }
83  return;
84 }
virtual const reco::Candidate * originalReco(const reco::Candidate *daug) const
get the original particle from the clone
std::vector< BPHRecoConstCandPtr > cList
const BPHEventSetupWrapper * getEventSetup() const
retrieve EventSetup
virtual BPHRecoCandidate * clone(int level=-1) const
BPHGenericPtr< const BPHRecoCandidate >::type BPHRecoConstCandPtr
bool getIndependentFit(const std::string &name, double &mass, double &sigma) const
retrieve independent fit flag
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
const std::string & getTrackSearchList(const reco::Candidate *cand) const
retrieve track search list
virtual const reco::Candidate * getDaug(const std::string &name) const
void fill(BPHRecoCandidate *ptr, int level) const override
virtual void add(const std::string &name, const reco::Candidate *daug, double mass=-1.0, double sigma=-1.0)
BPHRecoCandidate(const BPHEventSetupWrapper *es, int daugNum=2, int compNum=2)
d
Definition: ztail.py:151
virtual const std::vector< std::string > & compNames() const
virtual BPHRecoConstCandPtr getComp(const std::string &name) const
virtual const std::vector< std::string > & daugNames() const
double constrMass() const
retrieve the constraint
void setConstraint(double mass, double sigma)
apply a mass constraint
double getMassSigma(const reco::Candidate *cand) const
retrieve particle mass sigma
virtual ParticleMass mass() const
static std::vector< BPHRecoConstCandPtr > build(const BPHRecoBuilder &builder, const BuilderParameters &par)
std::vector< std::string > nComp
double constrSigma() const