CMS 3D CMS Logo

BPHDecayToResResBuilder.h
Go to the documentation of this file.
1 #ifndef HeavyFlavorAnalysis_SpecificDecay_BPHDecayToResResBuilder_h
2 #define HeavyFlavorAnalysis_SpecificDecay_BPHDecayToResResBuilder_h
3 
13 //----------------------
14 // Base Class Headers --
15 //----------------------
19 
20 //------------------------------------
21 // Collaborating Class Declarations --
22 //------------------------------------
24 
26 
27 //---------------
28 // C++ Headers --
29 //---------------
30 #include <iostream>
31 #include <string>
32 #include <vector>
33 
34 // ---------------------
35 // -- Class Interface --
36 // ---------------------
37 
38 template <class ProdType, class Res1Type, class Res2Type>
40  public BPHDecayConstrainedBuilder<ProdType, Res1Type>,
41  public BPHDecaySpecificBuilder<ProdType> {
42 public:
44  typedef typename Res1Type::const_pointer res1_ptr;
45  typedef typename Res2Type::const_pointer res2_ptr;
46 
50  const std::string& res1Name,
51  double res1Mass,
52  double res1Width,
53  const std::vector<res1_ptr>& res1Collection,
54  const std::string& res2Name,
55  const std::vector<res2_ptr>& res2Collection)
56  : BPHDecayGenericBuilderBase(es, nullptr),
57  BPHDecayConstrainedBuilderBase(res1Name, res1Mass, res1Width),
59  BPHDecayConstrainedBuilder<ProdType, Res2Type>(res1Collection),
60  sCollection(&res2Collection) {}
61 
62  // deleted copy constructor and assignment operator
65 
68  ~BPHDecayToResResBuilder() override = default;
69 
70 protected:
71  BPHDecayToResResBuilder(const std::vector<res1_ptr>& res1Collection,
72  const std::string& res2Name,
73  const std::vector<res2_ptr>& res2Collection)
74  : BPHDecayToResResBuilderBase(res2Name),
75  BPHDecayConstrainedBuilder<ProdType, Res2Type>(res1Collection),
76  sCollection(&res2Collection) {}
77 
78  const std::vector<res2_ptr>* sCollection;
79 
80  void addRes2Collection(BPHRecoBuilder& brb) override {
81  const std::vector<res2_ptr>& sc = *this->sCollection;
82  if (res2Sel->getMassMax() > 0.0) {
83  sCollectSel.clear();
84  sCollectSel.reserve(sc.size());
85  for (const res2_ptr& s : sc) {
86  if (res2Sel->accept(*s))
87  sCollectSel.push_back(s);
88  }
89  brb.add(sName, sCollectSel);
90  } else
91  brb.add(sName, *this->sCollection);
92  }
93 
94 private:
95  std::vector<res2_ptr> sCollectSel;
96 };
97 
98 #endif
ProdType::const_pointer prod_ptr
Res1Type::const_pointer res1_ptr
const std::vector< res2_ptr > * sCollection
Res2Type::const_pointer res2_ptr
bool accept(const BPHDecayMomentum &cand) const override
select particle
Definition: BPHMassSelect.h:48
BPHDecayToResResBuilder & operator=(const BPHDecayToResResBuilder &x)=delete
std::vector< res2_ptr > sCollectSel
double getMassMax() const
Definition: BPHMassCuts.h:59
void addRes2Collection(BPHRecoBuilder &brb) override
void add(const std::string &name, const BPHGenericCollection *collection, double mass=-1.0, double msig=-1.0)
BPHDecayToResResBuilder(const BPHEventSetupWrapper &es, const std::string &res1Name, double res1Mass, double res1Width, const std::vector< res1_ptr > &res1Collection, const std::string &res2Name, const std::vector< res2_ptr > &res2Collection)
~BPHDecayToResResBuilder() override=default
BPHDecayToResResBuilder(const std::vector< res1_ptr > &res1Collection, const std::string &res2Name, const std::vector< res2_ptr > &res2Collection)