Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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/SpecificDecay/interface/BPHDecayToResTrkBuilderBase.h"
0012 
0013 //-------------------------------
0014 // Collaborating Class Headers --
0015 //-------------------------------
0016 #include "HeavyFlavorAnalysis/SpecificDecay/interface/BPHDecayGenericBuilderBase.h"
0017 #include "HeavyFlavorAnalysis/SpecificDecay/interface/BPHParticleNeutralVeto.h"
0018 #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHRecoBuilder.h"
0019 #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHPlusMinusCandidate.h"
0020 #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHRecoCandidate.h"
0021 
0022 //---------------
0023 // C++ Headers --
0024 //---------------
0025 using namespace std;
0026 
0027 //-------------------
0028 // Initializations --
0029 //-------------------
0030 
0031 //----------------
0032 // Constructors --
0033 //----------------
0034 BPHDecayToResTrkBuilderBase::BPHDecayToResTrkBuilderBase(const BPHEventSetupWrapper& es,
0035                                                          const string& resName,
0036                                                          double resMass,
0037                                                          double resWidth,
0038                                                          const string& trkName,
0039                                                          double trkMass,
0040                                                          double trkSigma,
0041                                                          const BPHRecoBuilder::BPHGenericCollection* trkCollection)
0042     : BPHDecayGenericBuilderBase(es, nullptr),
0043       BPHDecayConstrainedBuilderBase(resName, resMass, resWidth),
0044       tName(trkName),
0045       tMass(trkMass),
0046       tSigma(trkSigma),
0047       tCollection(trkCollection),
0048       tknVeto(new BPHParticleNeutralVeto),
0049       ptSel(new BPHParticlePtSelect(0.0)),
0050       etaSel(new BPHParticleEtaSelect(100.0)) {}
0051 
0052 BPHDecayToResTrkBuilderBase::BPHDecayToResTrkBuilderBase(const string& trkName,
0053                                                          double trkMass,
0054                                                          double trkSigma,
0055                                                          const BPHRecoBuilder::BPHGenericCollection* trkCollection)
0056     : tName(trkName),
0057       tMass(trkMass),
0058       tSigma(trkSigma),
0059       tCollection(trkCollection),
0060       tknVeto(new BPHParticleNeutralVeto),
0061       ptSel(new BPHParticlePtSelect(0.0)),
0062       etaSel(new BPHParticleEtaSelect(100.0)) {}
0063 
0064 //--------------
0065 // Destructor --
0066 //--------------
0067 BPHDecayToResTrkBuilderBase::~BPHDecayToResTrkBuilderBase() {
0068   delete tknVeto;
0069   delete ptSel;
0070   delete etaSel;
0071 }
0072 
0073 //--------------
0074 // Operations --
0075 //--------------
0076 
0077 /// set cuts
0078 void BPHDecayToResTrkBuilderBase::setTrkPtMin(double pt) {
0079   outdated = true;
0080   ptSel->setPtMin(pt);
0081   return;
0082 }
0083 
0084 void BPHDecayToResTrkBuilderBase::setTrkEtaMax(double eta) {
0085   outdated = true;
0086   etaSel->setEtaMax(eta);
0087   return;
0088 }
0089 
0090 /// build candidates
0091 void BPHDecayToResTrkBuilderBase::fill(BPHRecoBuilder& brb, void* parameters) {
0092   brb.setMinPDiffererence(minPDiff);
0093   addResCollection(brb);
0094   int i;
0095   int n = tCollection->size();
0096   tCollectSel1.clear();
0097   tCollectSel1.reserve(n);
0098   for (i = 0; i < n; ++i) {
0099     const reco::Candidate& cand = tCollection->get(i);
0100     if (cand.charge() != 0)
0101       tCollectSel1.push_back(&cand);
0102   }
0103   vector<const reco::Candidate*>* dv = &tCollectSel1;
0104   vector<const reco::Candidate*>* sv = &tCollectSel2;
0105   if (ptSel->getPtMin() >= 0.0) {
0106     swap(sv, dv);
0107     filter(sv, dv, ptSel);
0108   }
0109   if (etaSel->getEtaMax() >= 0.0) {
0110     swap(sv, dv);
0111     filter(sv, dv, etaSel);
0112   }
0113   brb.add(tName, BPHRecoBuilder::createCollection(*dv, this->tCollection->searchList()), tMass, tSigma);
0114 
0115   if (massSel->getMassMax() >= 0.0)
0116     brb.filter(*massSel);
0117   if (chi2Sel->getProbMin() >= 0.0)
0118     brb.filter(*chi2Sel);
0119   if (mFitSel->getMassMax() >= 0.0)
0120     brb.filter(*mFitSel);
0121 
0122   setup(parameters);
0123 
0124   return;
0125 }