Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:15:34

0001 /*
0002  *  See header file for a description of this class.
0003  *
0004  *  \author Paolo Ronchese INFN Padova
0005  *
0006  */
0007 
0008 //-----------------------
0009 // This Class' Header --
0010 //-----------------------
0011 #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHRecoCandidate.h"
0012 
0013 //-------------------------------
0014 // Collaborating Class Headers --
0015 //-------------------------------
0016 #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHAnalyzerTokenWrapper.h"
0017 #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHRecoBuilder.h"
0018 
0019 //---------------
0020 // C++ Headers --
0021 //---------------
0022 using namespace std;
0023 
0024 //-------------------
0025 // Initializations --
0026 //-------------------
0027 
0028 //----------------
0029 // Constructors --
0030 //----------------
0031 BPHRecoCandidate::BPHRecoCandidate(const BPHEventSetupWrapper* es, int daugNum, int compNum)
0032     : BPHDecayMomentum(daugNum, compNum), BPHDecayVertex(es), BPHKinematicFit() {}
0033 
0034 BPHRecoCandidate::BPHRecoCandidate(const BPHEventSetupWrapper* es, const BPHRecoBuilder::ComponentSet& compList)
0035     : BPHDecayMomentum(compList.daugMap, compList.compMap), BPHDecayVertex(this, es), BPHKinematicFit(this) {}
0036 
0037 //--------------
0038 // Operations --
0039 //--------------
0040 vector<BPHRecoConstCandPtr> BPHRecoCandidate::build(const BPHRecoBuilder& builder, double mass, double msig) {
0041   // create a list of pointers to BPHRecoCandidate and fill it
0042   // with particle combinations selected by the BPHRecoBuilder
0043   vector<BPHRecoConstCandPtr> cList;
0044   fill<BPHRecoCandidate>(cList, builder, mass, msig);
0045   return cList;
0046 }
0047 
0048 /// clone object, cloning daughters as well up to required depth
0049 /// level = -1 to clone all levels
0050 BPHRecoCandidate* BPHRecoCandidate::clone(int level) const {
0051   BPHRecoCandidate* ptr = new BPHRecoCandidate(getEventSetup());
0052   fill(ptr, level);
0053   return ptr;
0054 }
0055 
0056 // function doing the job to clone reconstructed decays:
0057 // copy stable particles and clone cascade decays up to chosen level
0058 void BPHRecoCandidate::fill(BPHRecoCandidate* ptr, int level) const {
0059   ptr->setConstraint(constrMass(), constrSigma());
0060   const vector<string>& nDaug = daugNames();
0061   int id;
0062   int nd = nDaug.size();
0063   for (id = 0; id < nd; ++id) {
0064     const string& n = nDaug[id];
0065     const reco::Candidate* d = getDaug(n);
0066     ptr->add(n, originalReco(d), getTrackSearchList(d), d->mass(), getMassSigma(d));
0067   }
0068   const vector<string>& nComp = compNames();
0069   int ic;
0070   int nc = nComp.size();
0071   for (ic = 0; ic < nc; ++ic) {
0072     const string& n = nComp[ic];
0073     BPHRecoConstCandPtr c = getComp(n);
0074     if (level)
0075       ptr->add(n, BPHRecoConstCandPtr(c->clone(level - 1)));
0076     else
0077       ptr->add(n, c);
0078     double m = -1;
0079     double s = -1;
0080     if (getIndependentFit(n, m, s))
0081       ptr->setIndependentFit(n, true, m, s);
0082   }
0083   return;
0084 }