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