CMS 3D CMS Logo

BPHDecayConstrainedBuilder.h
Go to the documentation of this file.
1 #ifndef HeavyFlavorAnalysis_SpecificDecay_BPHDecayConstrainedBuilder_h
2 #define HeavyFlavorAnalysis_SpecificDecay_BPHDecayConstrainedBuilder_h
3 
13 //----------------------
14 // Base Class Headers --
15 //----------------------
18 
19 //------------------------------------
20 // Collaborating Class Declarations --
21 //------------------------------------
24 
26 
28 
29 //---------------
30 // C++ Headers --
31 //---------------
32 #include <string>
33 #include <vector>
34 
35 // ---------------------
36 // -- Class Interface --
37 // ---------------------
38 
39 template <class ProdType, class ResType>
41  public virtual BPHDecayGenericBuilder<ProdType> {
42 public:
44  typedef typename ResType::const_pointer res_ptr;
45 
49  const std::string& resName,
50  double resMass,
51  double resWidth,
52  const std::vector<res_ptr>& resCollection)
54  BPHDecayConstrainedBuilderBase(resName, resMass, resWidth),
55  BPHDecayGenericBuilder<ProdType>(new BPHMassFitSelect(resName, resMass, resWidth, -2.0e+06, -1.0e+06)),
56  rCollection(&resCollection) {}
57 
58  // deleted copy constructor and assignment operator
61 
64  ~BPHDecayConstrainedBuilder() override = default;
65 
66 protected:
67  BPHDecayConstrainedBuilder(const std::vector<res_ptr>& resCollection) : rCollection(&resCollection) {}
68 
69  const std::vector<res_ptr>* rCollection;
70 
71  void addResCollection(BPHRecoBuilder& brb) override {
72  const std::vector<res_ptr>& rc = *this->rCollection;
73  if (resoSel->getMassMax() > 0.0) {
74  rCollectSel.clear();
75  rCollectSel.reserve(rc.size());
76  for (const res_ptr& r : rc) {
77  if (resoSel->accept(*r))
78  rCollectSel.push_back(r);
79  }
80  brb.add(rName, rCollectSel);
81  } else
82  brb.add(rName, *this->rCollection);
83  }
84 
85 private:
86  std::vector<res_ptr> rCollectSel;
87 };
88 
89 #endif
ProdType::const_pointer prod_ptr
BPHDecayConstrainedBuilder(const std::vector< res_ptr > &resCollection)
BPHDecayConstrainedBuilder & operator=(const BPHDecayConstrainedBuilder &x)=delete
bool accept(const BPHDecayMomentum &cand) const override
select particle
Definition: BPHMassSelect.h:48
~BPHDecayConstrainedBuilder() override=default
double getMassMax() const
Definition: BPHMassCuts.h:59
BPHDecayConstrainedBuilder(const BPHEventSetupWrapper &es, const std::string &resName, double resMass, double resWidth, const std::vector< res_ptr > &resCollection)
void add(const std::string &name, const BPHGenericCollection *collection, double mass=-1.0, double msig=-1.0)
const std::vector< res_ptr > * rCollection
void addResCollection(BPHRecoBuilder &brb) override