Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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/BPHDecayToV0SameMassBuilder.h"
0012 
0013 //-------------------------------
0014 // Collaborating Class Headers --
0015 //-------------------------------
0016 #include "HeavyFlavorAnalysis/SpecificDecay/interface/BPHDecayGenericBuilderBase.h"
0017 #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHRecoBuilder.h"
0018 #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHPlusMinusCandidate.h"
0019 #include "DataFormats/Candidate/interface/Candidate.h"
0020 
0021 //---------------
0022 // C++ Headers --
0023 //---------------
0024 #include <cmath>
0025 using namespace std;
0026 
0027 //-------------------
0028 // Initializations --
0029 //-------------------
0030 
0031 //----------------
0032 // Constructors --
0033 //----------------
0034 BPHDecayToV0SameMassBuilder::BPHDecayToV0SameMassBuilder(const BPHEventSetupWrapper& es,
0035                                                          const string& posName,
0036                                                          const string& negName,
0037                                                          double daugMass,
0038                                                          double daugSigma,
0039                                                          const BPHRecoBuilder::BPHGenericCollection* posCollection,
0040                                                          const BPHRecoBuilder::BPHGenericCollection* negCollection)
0041     : BPHDecayGenericBuilderBase(es),
0042       BPHDecayToV0Builder(es, posName, negName, posCollection, negCollection),
0043       BPHDecayToChargedXXbarBuilder(es, posName, negName, daugMass, daugSigma, posCollection, negCollection),
0044       pMass(daugMass),
0045       pSigma(daugSigma) {}
0046 
0047 BPHDecayToV0SameMassBuilder::BPHDecayToV0SameMassBuilder(const BPHEventSetupWrapper& es,
0048                                                          const string& posName,
0049                                                          const string& negName,
0050                                                          double daugMass,
0051                                                          double daugSigma,
0052                                                          const vector<reco::VertexCompositeCandidate>* v0Collection,
0053                                                          const string& searchList)
0054     : BPHDecayGenericBuilderBase(es),
0055       BPHDecayToV0Builder(es, posName, negName, v0Collection, searchList),
0056       BPHDecayToChargedXXbarBuilder(es, posName, negName, daugMass, daugSigma, nullptr, nullptr),
0057       pMass(daugMass),
0058       pSigma(daugSigma) {}
0059 
0060 BPHDecayToV0SameMassBuilder::BPHDecayToV0SameMassBuilder(const BPHEventSetupWrapper& es,
0061                                                          const string& posName,
0062                                                          const string& negName,
0063                                                          double daugMass,
0064                                                          double daugSigma,
0065                                                          const vector<reco::VertexCompositePtrCandidate>* vpCollection,
0066                                                          const string& searchList)
0067     : BPHDecayGenericBuilderBase(es),
0068       BPHDecayToV0Builder(es, posName, negName, vpCollection, searchList),
0069       BPHDecayToChargedXXbarBuilder(es, posName, negName, daugMass, daugSigma, nullptr, nullptr),
0070       pMass(daugMass),
0071       pSigma(daugSigma) {}
0072 
0073 //--------------
0074 // Operations --
0075 //--------------
0076 void BPHDecayToV0SameMassBuilder::buildFromBPHGenericCollection() {
0077   BPHDecayToChargedXXbarBuilder::fillRecList();
0078   return;
0079 }
0080 
0081 BPHPlusMinusCandidatePtr BPHDecayToV0SameMassBuilder::buildCandidate(const reco::Candidate* c1,
0082                                                                      const reco::Candidate* c2,
0083                                                                      const void* v0,
0084                                                                      v0Type type) {
0085   if (c1->p4().pt() < ptMin)
0086     return nullptr;
0087   if (c2->p4().pt() < ptMin)
0088     return nullptr;
0089   if (fabs(c1->p4().eta()) > etaMax)
0090     return nullptr;
0091   if (fabs(c2->p4().eta()) > etaMax)
0092     return nullptr;
0093   BPHPlusMinusCandidatePtr cand = BPHPlusMinusCandidateWrap::create(evSetup);
0094   if (c1->charge() > 0) {
0095     cand->add(p1Name, c1, pMass, pSigma);
0096     cand->add(p2Name, c2, pMass, pSigma);
0097   } else {
0098     cand->add(p1Name, c2, pMass, pSigma);
0099     cand->add(p2Name, c1, pMass, pSigma);
0100   }
0101   return cand;
0102 }