Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:49:20

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/BPHRecoBuilder.h"
0017 
0018 //---------------
0019 // C++ Headers --
0020 //---------------
0021 using namespace std;
0022 
0023 //-------------------
0024 // Initializations --
0025 //-------------------
0026 
0027 //----------------
0028 // Constructors --
0029 //----------------
0030 BPHRecoCandidate::BPHRecoCandidate(const edm::EventSetup* es) : BPHDecayVertex(es) {}
0031 
0032 BPHRecoCandidate::BPHRecoCandidate(const edm::EventSetup* es, const BPHRecoBuilder::ComponentSet& compList)
0033     : BPHDecayMomentum(compList.daugMap, compList.compMap), BPHDecayVertex(this, es), BPHKinematicFit(this) {}
0034 
0035 //--------------
0036 // Destructor --
0037 //--------------
0038 BPHRecoCandidate::~BPHRecoCandidate() {}
0039 
0040 //--------------
0041 // Operations --
0042 //--------------
0043 vector<BPHRecoConstCandPtr> BPHRecoCandidate::build(const BPHRecoBuilder& builder, double mass, double msig) {
0044   // create a list of pointers to BPHRecoCandidate and fill it
0045   // with particle combinations selected by the BPHRecoBuilder
0046   vector<BPHRecoConstCandPtr> cList;
0047   fill<BPHRecoCandidate>(cList, builder, mass, msig);
0048   return cList;
0049 }
0050 
0051 /// clone object, cloning daughters as well up to required depth
0052 /// level = -1 to clone all levels
0053 BPHRecoCandidate* BPHRecoCandidate::clone(int level) const {
0054   BPHRecoCandidate* ptr = new BPHRecoCandidate(getEventSetup());
0055   fill(ptr, level);
0056   return ptr;
0057 }
0058 
0059 // function doing the job to clone reconstructed decays:
0060 // copy stable particles and clone cascade decays up to chosen level
0061 void BPHRecoCandidate::fill(BPHRecoCandidate* ptr, int level) const {
0062   ptr->setConstraint(constrMass(), constrSigma());
0063   const std::vector<std::string>& nDaug = daugNames();
0064   int id;
0065   int nd = nDaug.size();
0066   for (id = 0; id < nd; ++id) {
0067     const string& n = nDaug[id];
0068     const reco::Candidate* d = getDaug(n);
0069     ptr->add(n, originalReco(d), getTrackSearchList(d), d->mass(), getMassSigma(d));
0070   }
0071   const std::vector<std::string>& nComp = compNames();
0072   int ic;
0073   int nc = nComp.size();
0074   for (ic = 0; ic < nc; ++ic) {
0075     const string& n = nComp[ic];
0076     BPHRecoConstCandPtr c = getComp(n);
0077     if (level)
0078       ptr->add(n, BPHRecoConstCandPtr(c->clone(level - 1)));
0079     else
0080       ptr->add(n, c);
0081     if (getIndependentFit(n))
0082       ptr->setIndependentFit(n);
0083   }
0084   return;
0085 }