Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:05:35

0001 #ifndef HeavyFlavorAnalysis_SpecificDecay_BPHDecayConstrainedBuilder_h
0002 #define HeavyFlavorAnalysis_SpecificDecay_BPHDecayConstrainedBuilder_h
0003 /** \class BPHDecayConstrainedBuilder
0004  *
0005  *  Description: 
0006  *     Class to build a particle decaying to a resonance, decaying itself
0007  *     to an opposite charged particles pair, applying a mass constraint
0008  *
0009  *  \author Paolo Ronchese INFN Padova
0010  *
0011  */
0012 
0013 //----------------------
0014 // Base Class Headers --
0015 //----------------------
0016 #include "HeavyFlavorAnalysis/SpecificDecay/interface/BPHDecayGenericBuilder.h"
0017 #include "HeavyFlavorAnalysis/SpecificDecay/interface/BPHDecayConstrainedBuilderBase.h"
0018 
0019 //------------------------------------
0020 // Collaborating Class Declarations --
0021 //------------------------------------
0022 #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHRecoCandidate.h"
0023 #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHPlusMinusCandidate.h"
0024 
0025 #include "FWCore/Framework/interface/EventSetup.h"
0026 
0027 class BPHEventSetupWrapper;
0028 
0029 //---------------
0030 // C++ Headers --
0031 //---------------
0032 #include <string>
0033 #include <vector>
0034 
0035 //              ---------------------
0036 //              -- Class Interface --
0037 //              ---------------------
0038 
0039 template <class ProdType, class ResType>
0040 class BPHDecayConstrainedBuilder : public virtual BPHDecayConstrainedBuilderBase,
0041                                    public virtual BPHDecayGenericBuilder<ProdType> {
0042 public:
0043   using typename BPHDecayGenericBuilder<ProdType>::prod_ptr;
0044   typedef typename ResType::const_pointer res_ptr;
0045 
0046   /** Constructor
0047    */
0048   BPHDecayConstrainedBuilder(const BPHEventSetupWrapper& es,
0049                              const std::string& resName,
0050                              double resMass,
0051                              double resWidth,
0052                              const std::vector<res_ptr>& resCollection)
0053       : BPHDecayGenericBuilderBase(es),
0054         BPHDecayConstrainedBuilderBase(resName, resMass, resWidth),
0055         BPHDecayGenericBuilder<ProdType>(new BPHMassFitSelect(resName, resMass, resWidth, -2.0e+06, -1.0e+06)),
0056         rCollection(&resCollection) {}
0057 
0058   // deleted copy constructor and assignment operator
0059   BPHDecayConstrainedBuilder(const BPHDecayConstrainedBuilder& x) = delete;
0060   BPHDecayConstrainedBuilder& operator=(const BPHDecayConstrainedBuilder& x) = delete;
0061 
0062   /** Destructor
0063    */
0064   ~BPHDecayConstrainedBuilder() override = default;
0065 
0066 protected:
0067   BPHDecayConstrainedBuilder(const std::vector<res_ptr>& resCollection) : rCollection(&resCollection) {}
0068 
0069   const std::vector<res_ptr>* rCollection;
0070 
0071   void addResCollection(BPHRecoBuilder& brb) override {
0072     const std::vector<res_ptr>& rc = *this->rCollection;
0073     if (resoSel->getMassMax() > 0.0) {
0074       rCollectSel.clear();
0075       rCollectSel.reserve(rc.size());
0076       for (const res_ptr& r : rc) {
0077         if (resoSel->accept(*r))
0078           rCollectSel.push_back(r);
0079       }
0080       brb.add(rName, rCollectSel);
0081     } else
0082       brb.add(rName, *this->rCollection);
0083   }
0084 
0085 private:
0086   std::vector<res_ptr> rCollectSel;
0087 };
0088 
0089 #endif