CMS 3D CMS Logo

BPHDecayToResTrkTrkSameMassBuilder.h
Go to the documentation of this file.
1 #ifndef HeavyFlavorAnalysis_SpecificDecay_BPHDecayToResTrkTrkSameMassBuilder_h
2 #define HeavyFlavorAnalysis_SpecificDecay_BPHDecayToResTrkTrkSameMassBuilder_h
3 
14 //----------------------
15 // Base Class Headers --
16 //----------------------
19 
20 //------------------------------------
21 // Collaborating Class Declarations --
22 //------------------------------------
25 
29 
31 
34 
35 //---------------
36 // C++ Headers --
37 //---------------
38 #include <string>
39 #include <vector>
40 
41 // ---------------------
42 // -- Class Interface --
43 // ---------------------
44 
45 template <class ProdType, class ResType>
47  public BPHDecayConstrainedBuilder<ProdType, ResType> {
48 public:
51 
55  const std::string& resName,
56  double resMass,
57  double resWidth,
58  const std::vector<res_ptr>& resCollection,
59  const std::string& posName,
60  const std::string& negName,
61  double trkMass,
62  double trkSigma,
63  const BPHRecoBuilder::BPHGenericCollection* posCollection,
64  const BPHRecoBuilder::BPHGenericCollection* negCollection)
65  : BPHDecayGenericBuilderBase(es, nullptr),
66  BPHDecayConstrainedBuilderBase(resName, resMass, resWidth),
67  BPHDecayToResTrkTrkSameMassBuilderBase(posName, negName, trkMass, trkSigma, posCollection, negCollection),
68  BPHDecayConstrainedBuilder<ProdType, ResType>(resCollection) {}
69 
70  // deleted copy constructor and assignment operator
73 
76  ~BPHDecayToResTrkTrkSameMassBuilder() override = default;
77 
78 protected:
79  BPHDecayToResTrkTrkSameMassBuilder(const std::vector<res_ptr>& resCollection,
80  const std::string& posName,
81  const std::string& negName,
82  double trkMass,
83  double trkSigma,
84  const BPHRecoBuilder::BPHGenericCollection* posCollection,
85  const BPHRecoBuilder::BPHGenericCollection* negCollection)
86  : BPHDecayToResTrkTrkSameMassBuilderBase(posName, negName, trkMass, trkSigma, posCollection, negCollection),
87  BPHDecayConstrainedBuilder<ProdType, ResType>(resCollection) {}
88 
89  void fillRecList() override {
90  std::vector<res_ptr> resList;
91  int nRes = this->rCollection->size();
92  int iRes;
93  resList.reserve(nRes);
94  for (iRes = 0; iRes < nRes; ++iRes) {
95  const res_ptr& rCand = this->rCollection->at(iRes);
96  if (this->resoSel->accept(*rCand))
97  resList.push_back(rCand);
98  }
99  if (resList.empty())
100  return;
101  nRes = resList.size();
102 
103  fillTrkTrkList();
104  if (ttPairs.empty())
105  return;
106 
107  int nPair = ttPairs.size();
108  int iPair;
109  for (iPair = 0; iPair < nPair; ++iPair) {
110  const BPHPlusMinusConstCandPtr tt = ttPairs[iPair];
111  for (iRes = 0; iRes < nRes; ++iRes) {
112  ProdType* cand = new ProdType(evSetup);
113  prod_ptr cPtr(cand);
114  cand->add(rName, resList[iRes]);
115  cand->add(pName, tt->originalReco(tt->getDaug(pName)), tMass, tSigma);
116  cand->add(nName, tt->originalReco(tt->getDaug(nName)), tMass, tSigma);
117  if (!massSel->accept(*cand))
118  continue;
119  if ((chi2Sel != nullptr) && !chi2Sel->accept(*cand))
120  continue;
121  if (!mFitSel->accept(*cand))
122  continue;
123  this->recList.push_back(cPtr);
124  }
125  }
126  ttPairs.clear();
127 
128  return;
129  }
130 };
131 
132 #endif
ProdType::const_pointer prod_ptr
~BPHDecayToResTrkTrkSameMassBuilder() override=default
BPHDecayToResTrkTrkSameMassBuilder(const std::vector< res_ptr > &resCollection, const std::string &posName, const std::string &negName, double trkMass, double trkSigma, const BPHRecoBuilder::BPHGenericCollection *posCollection, const BPHRecoBuilder::BPHGenericCollection *negCollection)
bool accept(const BPHDecayVertex &cand) const override
select vertex
Definition: BPHChi2Select.h:48
bool accept(const BPHDecayMomentum &cand) const override
select particle
Definition: BPHMassSelect.h:48
const BPHEventSetupWrapper * evSetup
BPHGenericPtr< const BPHPlusMinusCandidate >::type BPHPlusMinusConstCandPtr
BPHDecayToResTrkTrkSameMassBuilder(const BPHEventSetupWrapper &es, const std::string &resName, double resMass, double resWidth, const std::vector< res_ptr > &resCollection, const std::string &posName, const std::string &negName, double trkMass, double trkSigma, const BPHRecoBuilder::BPHGenericCollection *posCollection, const BPHRecoBuilder::BPHGenericCollection *negCollection)
common object to interface with edm collections
BPHDecayToResTrkTrkSameMassBuilder & operator=(const BPHDecayToResTrkTrkSameMassBuilder &x)=delete
const std::vector< res_ptr > * rCollection
std::vector< prod_ptr > recList
bool accept(const BPHKinematicFit &cand) const override
select particle