7 : checkCharge_(
false), checkOverlap_(
true), dauCharge_(), overlap_(), name_(
name) {}
10 : checkCharge_(
true), checkOverlap_(
true), dauCharge_(2), overlap_(), name_(
name) {
16 : checkCharge_(
true), checkOverlap_(
true), dauCharge_(3), overlap_(), name_(
name) {
23 : checkCharge_(
true), checkOverlap_(
true), dauCharge_(4), overlap_(), name_(
name) {
33 const vector<int>& dauCharge)
41 bool matchCharge = (q1 == dq1 && q2 == dq2) || (q1 == -dq1 && q2 == -dq2);
62 size_t srcSize =
src.size();
65 <<
"NamedCandCombiner: trying to combine " << srcSize <<
" collections" 66 <<
" but configured to check against " <<
dauCharge_.size() <<
" charges.";
70 <<
"NamedCandCombiner: need to add 2 names, but size is " <<
names.size();
76 const int n =
src1.size();
77 for (
int i1 = 0;
i1 <
n; ++
i1) {
90 const int n1 =
src1.size(), n2 =
src2.size();
91 for (
int i1 = 0;
i1 < n1; ++
i1) {
93 for (
int i2 = 0;
i2 < n2; ++
i2) {
117 <<
"NamedCandCombiner: trying to combine 2 collections" 118 <<
" but configured to check against " <<
dauCharge_.size() <<
" charges.";
120 if (
names.size() < 2)
122 <<
"NamedCandCombiner: need to add 2 names, but size is " <<
names.size();
125 const int n =
src.size();
126 for (
int i1 = 0;
i1 <
n; ++
i1) {
145 vector<CandidatePtrVector>
src;
155 vector<CandidatePtrVector>
src;
167 vector<CandidatePtrVector>
src;
178 string_coll
const&
names,
179 vector<CandidatePtrVector>::const_iterator collBegin,
180 vector<CandidatePtrVector>::const_iterator collEnd,
181 unique_ptr<NamedCompositeCandidateCollection>& comps)
const {
182 if (collBegin == collEnd) {
183 static const int undetermined = 0, sameDecay = 1, conjDecay = -1, wrongDecay = 2;
184 int decayType = undetermined;
187 for (
size_t i = 0;
i < qStack.size(); ++
i) {
189 if (decayType == undetermined) {
190 if (
q != 0 && dq != 0) {
192 decayType = sameDecay;
194 decayType = conjDecay;
196 decayType = wrongDecay;
198 }
else if ((decayType == sameDecay &&
q != dq) || (decayType == conjDecay &&
q != -dq)) {
199 decayType = wrongDecay;
201 if (decayType == wrongDecay)
205 if (decayType != wrongDecay) {
208 for (CandStack::const_iterator
i =
stack.begin();
i !=
stack.end(); ++
i, ++
ii) {
217 size_t candBegin = 0, candEnd =
src.size();
218 for (CandStack::const_iterator
i =
stack.begin();
i !=
stack.end(); ++
i)
219 if (
src == *
i->second)
220 candBegin =
i->first.second + 1;
221 for (
size_t candIndex = candBegin; candIndex != candEnd; ++candIndex) {
224 bool noOverlap =
true;
226 for (CandStack::const_iterator
i =
stack.begin();
i !=
stack.end(); ++
i)
232 stack.push_back(make_pair(make_pair(candPtr, candIndex), collBegin));
234 qStack.push_back(
cand.charge());
235 combine(collectionIndex + 1,
stack, qStack,
names, collBegin + 1, collEnd, comps);
NamedCandCombinerBase(std::string name)
default construct
virtual void setup(reco::NamedCompositeCandidate &) const =0
set kinematics to reconstructed composite
std::vector< NamedCompositeCandidate > NamedCompositeCandidateCollection
collection of Candidate objects
const std::string names[nVars_]
std::vector< int > ChargeStack
virtual int charge() const =0
electric charge
OverlapChecker overlap_
utility to check candidate daughters overlap
virtual void addDaughter(reco::NamedCompositeCandidate &cmp, const reco::CandidatePtr &c, std::string name) const =0
add candidate daughter
bool preselect(const reco::Candidate &, const reco::Candidate &) const
verify that the two candidate don't overlap and check charge
bool checkCharge_
flag to specify the checking of electric charge
bool checkOverlap_
flag to specify the checking of overlaps
std::vector< int > dauCharge_
electric charges of the daughters
std::vector< std::pair< std::pair< reco::CandidatePtr, size_t >, std::vector< reco::CandidatePtrVector >::const_iterator > > CandStack
temporary candidate stack
virtual bool select(const reco::Candidate &) const =0
select a candidate
def checkOverlap(process)
virtual bool selectPair(const reco::Candidate &c1, const reco::Candidate &c2) const =0
select a candidate pair
std::vector< std::string > string_coll
std::unique_ptr< reco::NamedCompositeCandidateCollection > combine(const std::vector< reco::CandidatePtrVector > &, string_coll const &) const
return all selected candidate pairs
virtual ~NamedCandCombinerBase()
destructor