CMS 3D CMS Logo

BPHDecayToV0Builder.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * \author Paolo Ronchese INFN Padova
5  *
6  */
7 
8 //-----------------------
9 // This Class' Header --
10 //-----------------------
12 
13 //-------------------------------
14 // Collaborating Class Headers --
15 //-------------------------------
20 
22 
23 //---------------
24 // C++ Headers --
25 //---------------
26 #include <cmath>
27 using namespace std;
28 
29 //-------------------
30 // Initializations --
31 //-------------------
32 
33 //----------------
34 // Constructors --
35 //----------------
37  const string& d1Name,
38  const string& d2Name,
39  const BPHRecoBuilder::BPHGenericCollection* d1Collection,
40  const BPHRecoBuilder::BPHGenericCollection* d2Collection)
42  p1Name(d1Name),
43  p2Name(d2Name),
44  p1Collection(d1Collection),
45  p2Collection(d2Collection),
46  vCollection(nullptr),
47  rCollection(nullptr),
48  sList("") {}
49 
51  const string& d1Name,
52  const string& d2Name,
53  const vector<reco::VertexCompositeCandidate>* v0Collection,
54  const string& searchList)
56  p1Name(d1Name),
57  p2Name(d2Name),
58  p1Collection(nullptr),
59  p2Collection(nullptr),
60  vCollection(v0Collection),
61  rCollection(nullptr),
62  sList(searchList) {}
63 
65  const string& d1Name,
66  const string& d2Name,
67  const vector<reco::VertexCompositePtrCandidate>* vpCollection,
68  const string& searchList)
70  p1Name(d1Name),
71  p2Name(d2Name),
72  p1Collection(nullptr),
73  p2Collection(nullptr),
74  vCollection(nullptr),
75  rCollection(vpCollection),
76  sList(searchList) {}
77 
78 //--------------
79 // Destructor --
80 //--------------
82 
83 //--------------
84 // Operations --
85 //--------------
87  v0Clear();
88 
89  if ((p1Collection != nullptr) && (p2Collection != nullptr))
91  else if (vCollection != nullptr)
93  else if (rCollection != nullptr)
95 
96  return;
97 }
98 
99 template <class T>
100 void BPHDecayToV0Builder::buildFromV0(const T* v0Collection, v0Type type) {
101  int iv0;
102  int nv0 = v0Collection->size();
103  recList.reserve(nv0);
104 
105  // cycle over V0 collection
106  for (iv0 = 0; iv0 < nv0; ++iv0) {
107  const typename T::value_type& v0 = v0Collection->at(iv0);
108 
109  // every reco::VertexCompositeCandidate must have exactly two daughters
110  if (v0.numberOfDaughters() != 2)
111  continue;
112  const reco::Candidate* dr = v0.daughter(0);
113  const reco::Candidate* dl = v0.daughter(1);
114 
115  // filters
117  if (cand.get() == nullptr)
118  continue;
119  BPHPlusMinusCandidate* cptr = cand.get();
120  if (cand->daughters().size() != 2)
121  continue;
122  if (!massSel->accept(*cand))
123  continue;
124  if ((chi2Sel != nullptr) && (!chi2Sel->accept(*cand)))
125  continue;
126 
127  recList.push_back(cand);
128  V0Info* info = new V0Info;
129  info->type = type;
130  info->v0 = &v0;
131  v0Map[cptr] = info;
132  }
133 
134  return;
135 }
136 
138  map<const BPHRecoCandidate*, const V0Info*>::iterator iter = v0Map.begin();
139  map<const BPHRecoCandidate*, const V0Info*>::iterator iend = v0Map.end();
140  while (iter != iend)
141  delete iter++->second;
142  return;
143 }
static const TGPicture * info(bool iBackgroundIsBlack)
BPHDecayToV0Builder(const BPHEventSetupWrapper &es, const std::string &daug1Name, const std::string &daug2Name, const BPHRecoBuilder::BPHGenericCollection *daug1Collection, const BPHRecoBuilder::BPHGenericCollection *daug2Collection)
bool accept(const BPHDecayVertex &cand) const override
select vertex
Definition: BPHChi2Select.h:48
virtual void buildFromBPHGenericCollection()=0
build candidates and link to V0
bool accept(const BPHDecayMomentum &cand) const override
select particle
Definition: BPHMassSelect.h:48
const BPHRecoBuilder::BPHGenericCollection * p2Collection
BPHGenericPtr< BPHPlusMinusCandidate >::type BPHPlusMinusCandidatePtr
std::map< const BPHRecoCandidate *, const V0Info * > v0Map
const BPHRecoBuilder::BPHGenericCollection * p1Collection
const std::vector< reco::VertexCompositeCandidate > * vCollection
virtual BPHPlusMinusCandidatePtr buildCandidate(const reco::Candidate *c1, const reco::Candidate *c2, const void *v0, v0Type type)=0
void buildFromV0(const T *v0Collection, v0Type type)
common object to interface with edm collections
const std::vector< reco::VertexCompositePtrCandidate > * rCollection
void fillRecList() override
build candidates
long double T