CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes
NamedCandCombinerBase Class Referenceabstract

#include <NamedCandCombinerBase.h>

Inheritance diagram for NamedCandCombinerBase:
NamedCandCombiner< Selector, PairSelector, Cloner, Setup > NamedCandCombiner< Selector, PairSelector, Cloner, Setup >

Public Types

typedef std::vector< std::string > string_coll
 
typedef std::vector< std::string > string_coll
 

Public Member Functions

std::auto_ptr< reco::NamedCompositeCandidateCollectioncombine (const std::vector< reco::CandidatePtrVector > &, string_coll const &) const
 return all selected candidate pairs More...
 
std::auto_ptr< reco::NamedCompositeCandidateCollectioncombine (const std::vector< reco::CandidatePtrVector > &, string_coll const &) const
 return all selected candidate pairs More...
 
std::auto_ptr< reco::NamedCompositeCandidateCollectioncombine (const reco::CandidatePtrVector &, string_coll const &) const
 return all selected candidate pairs More...
 
std::auto_ptr< reco::NamedCompositeCandidateCollectioncombine (const reco::CandidatePtrVector &, string_coll const &) const
 return all selected candidate pairs More...
 
std::auto_ptr< reco::NamedCompositeCandidateCollectioncombine (const reco::CandidatePtrVector &, const reco::CandidatePtrVector &, string_coll const &) const
 return all selected candidate pairs More...
 
std::auto_ptr< reco::NamedCompositeCandidateCollectioncombine (const reco::CandidatePtrVector &, const reco::CandidatePtrVector &, string_coll const &) const
 return all selected candidate pairs More...
 
std::auto_ptr< reco::NamedCompositeCandidateCollectioncombine (const reco::CandidatePtrVector &, const reco::CandidatePtrVector &, const reco::CandidatePtrVector &, string_coll const &) const
 return all selected candidate pairs More...
 
std::auto_ptr< reco::NamedCompositeCandidateCollectioncombine (const reco::CandidatePtrVector &, const reco::CandidatePtrVector &, const reco::CandidatePtrVector &, string_coll const &) const
 return all selected candidate pairs More...
 
std::auto_ptr< reco::NamedCompositeCandidateCollectioncombine (const reco::CandidatePtrVector &, const reco::CandidatePtrVector &, const reco::CandidatePtrVector &, const reco::CandidatePtrVector &, string_coll const &) const
 return all selected candidate pairs More...
 
std::auto_ptr< reco::NamedCompositeCandidateCollectioncombine (const reco::CandidatePtrVector &, const reco::CandidatePtrVector &, const reco::CandidatePtrVector &, const reco::CandidatePtrVector &, string_coll const &) const
 return all selected candidate pairs More...
 
 NamedCandCombinerBase (std::string name)
 default construct More...
 
 NamedCandCombinerBase (std::string name)
 default construct More...
 
 NamedCandCombinerBase (std::string name, int, int)
 construct from two charge values More...
 
 NamedCandCombinerBase (std::string name, int, int)
 construct from two charge values More...
 
 NamedCandCombinerBase (std::string name, int, int, int)
 construct from three charge values More...
 
 NamedCandCombinerBase (std::string name, int, int, int)
 construct from three charge values More...
 
 NamedCandCombinerBase (std::string name, int, int, int, int)
 construct from four charge values More...
 
 NamedCandCombinerBase (std::string name, int, int, int, int)
 construct from four charge values More...
 
 NamedCandCombinerBase (std::string name, bool checkCharge, const std::vector< int > &)
 constructor from a selector, specifying optionally to check for charge More...
 
 NamedCandCombinerBase (std::string name, bool checkCharge, bool checkOverlap, const std::vector< int > &)
 constructor from a selector, specifying optionally to check for charge More...
 
virtual ~NamedCandCombinerBase ()
 destructor More...
 
virtual ~NamedCandCombinerBase ()
 destructor More...
 

Private Types

typedef std::vector< std::pair< std::pair< reco::CandidatePtr, size_t >, std::vector< reco::CandidatePtrVector >::const_iterator > > CandStack
 temporary candidate stack More...
 
typedef std::vector< std::pair< std::pair< reco::CandidatePtr, size_t >, std::vector< reco::CandidatePtrVector >::const_iterator > > CandStack
 temporary candidate stack More...
 
typedef std::vector< int > ChargeStack
 
typedef std::vector< int > ChargeStack
 

Private Member Functions

virtual void addDaughter (reco::NamedCompositeCandidate &cmp, const reco::CandidatePtr &c, std::string name) const =0
 add candidate daughter More...
 
virtual void addDaughter (reco::NamedCompositeCandidate &cmp, const reco::CandidatePtr &c, std::string name) const =0
 add candidate daughter More...
 
void combine (reco::NamedCompositeCandidate &, const reco::CandidatePtr &, const reco::CandidatePtr &, std::string, std::string) const
 returns a composite candidate combined from two daughters More...
 
void combine (reco::NamedCompositeCandidate &, const reco::CandidatePtr &, const reco::CandidatePtr &, std::string, std::string) const
 returns a composite candidate combined from two daughters More...
 
void combine (size_t collectionIndex, CandStack &, ChargeStack &, string_coll const &names, std::vector< reco::CandidatePtrVector >::const_iterator begin, std::vector< reco::CandidatePtrVector >::const_iterator end, std::auto_ptr< reco::NamedCompositeCandidateCollection > &comps) const
 returns a composite candidate combined from two daughters More...
 
void combine (size_t collectionIndex, CandStack &, ChargeStack &, string_coll const &names, std::vector< reco::CandidatePtrVector >::const_iterator begin, std::vector< reco::CandidatePtrVector >::const_iterator end, std::auto_ptr< reco::NamedCompositeCandidateCollection > &comps) const
 returns a composite candidate combined from two daughters More...
 
bool preselect (const reco::Candidate &, const reco::Candidate &) const
 verify that the two candidate don't overlap and check charge More...
 
bool preselect (const reco::Candidate &, const reco::Candidate &) const
 verify that the two candidate don't overlap and check charge More...
 
virtual bool select (const reco::Candidate &) const =0
 select a candidate More...
 
virtual bool select (const reco::Candidate &) const =0
 select a candidate More...
 
virtual bool selectPair (const reco::Candidate &c1, const reco::Candidate &c2) const =0
 select a candidate pair More...
 
virtual bool selectPair (const reco::Candidate &c1, const reco::Candidate &c2) const =0
 select a candidate pair More...
 
virtual void setup (reco::NamedCompositeCandidate &) const =0
 set kinematics to reconstructed composite More...
 
virtual void setup (reco::NamedCompositeCandidate &) const =0
 set kinematics to reconstructed composite More...
 

Private Attributes

bool checkCharge_
 flag to specify the checking of electric charge More...
 
bool checkOverlap_
 flag to specify the checking of overlaps More...
 
std::vector< int > dauCharge_
 electric charges of the daughters More...
 
std::string name_
 Name. More...
 
OverlapChecker overlap_
 utility to check candidate daughters overlap More...
 

Detailed Description

Definition at line 13 of file NamedCandCombinerBase.h.

Member Typedef Documentation

typedef std::vector<std::pair<std::pair<reco::CandidatePtr, size_t>, std::vector<reco::CandidatePtrVector>::const_iterator> > NamedCandCombinerBase::CandStack
private

temporary candidate stack

Definition at line 65 of file NamedCandCombinerBase.h.

typedef std::vector<std::pair<std::pair<reco::CandidatePtr, size_t>, std::vector<reco::CandidatePtrVector>::const_iterator> > NamedCandCombinerBase::CandStack
private

temporary candidate stack

Definition at line 65 of file NamedCandCombinerBase.h.

typedef std::vector<int> NamedCandCombinerBase::ChargeStack
private

Definition at line 66 of file NamedCandCombinerBase.h.

typedef std::vector<int> NamedCandCombinerBase::ChargeStack
private

Definition at line 66 of file NamedCandCombinerBase.h.

typedef std::vector<std::string> NamedCandCombinerBase::string_coll

Definition at line 15 of file NamedCandCombinerBase.h.

typedef std::vector<std::string> NamedCandCombinerBase::string_coll

Definition at line 15 of file NamedCandCombinerBase.h.

Constructor & Destructor Documentation

NamedCandCombinerBase::NamedCandCombinerBase ( std::string  name)

default construct

Definition at line 6 of file NamedCandCombinerBase.cc.

6  :
8 }
std::vector< int > dauCharge_
electric charges of the daughters
OverlapChecker overlap_
utility to check candidate daughters overlap
bool checkCharge_
flag to specify the checking of electric charge
bool checkOverlap_
flag to specify the checking of overlaps
NamedCandCombinerBase::NamedCandCombinerBase ( std::string  name,
int  q1,
int  q2 
)

construct from two charge values

Definition at line 10 of file NamedCandCombinerBase.cc.

References dauCharge_, q1, and q2.

10  :
11  checkCharge_(true), checkOverlap_(true), dauCharge_(2), overlap_(), name_(name) {
12  dauCharge_[0] = q1;
13  dauCharge_[1] = q2;
14 }
std::vector< int > dauCharge_
electric charges of the daughters
double q2[4]
Definition: TauolaWrapper.h:88
OverlapChecker overlap_
utility to check candidate daughters overlap
double q1[4]
Definition: TauolaWrapper.h:87
bool checkCharge_
flag to specify the checking of electric charge
bool checkOverlap_
flag to specify the checking of overlaps
NamedCandCombinerBase::NamedCandCombinerBase ( std::string  name,
int  q1,
int  q2,
int  q3 
)

construct from three charge values

Definition at line 16 of file NamedCandCombinerBase.cc.

References dauCharge_, q1, and q2.

16  :
17  checkCharge_(true), checkOverlap_(true), dauCharge_(3), overlap_(), name_(name) {
18  dauCharge_[0] = q1;
19  dauCharge_[1] = q2;
20  dauCharge_[2] = q3;
21 }
std::vector< int > dauCharge_
electric charges of the daughters
double q2[4]
Definition: TauolaWrapper.h:88
OverlapChecker overlap_
utility to check candidate daughters overlap
double q1[4]
Definition: TauolaWrapper.h:87
bool checkCharge_
flag to specify the checking of electric charge
bool checkOverlap_
flag to specify the checking of overlaps
NamedCandCombinerBase::NamedCandCombinerBase ( std::string  name,
int  q1,
int  q2,
int  q3,
int  q4 
)

construct from four charge values

Definition at line 23 of file NamedCandCombinerBase.cc.

References dauCharge_, q1, and q2.

23  :
24  checkCharge_(true), checkOverlap_(true), dauCharge_(4), overlap_(), name_(name) {
25  dauCharge_[0] = q1;
26  dauCharge_[1] = q2;
27  dauCharge_[2] = q3;
28  dauCharge_[3] = q4;
29 }
std::vector< int > dauCharge_
electric charges of the daughters
double q2[4]
Definition: TauolaWrapper.h:88
OverlapChecker overlap_
utility to check candidate daughters overlap
double q1[4]
Definition: TauolaWrapper.h:87
bool checkCharge_
flag to specify the checking of electric charge
bool checkOverlap_
flag to specify the checking of overlaps
NamedCandCombinerBase::NamedCandCombinerBase ( std::string  name,
bool  checkCharge,
bool  checkOverlap,
const std::vector< int > &  dauCharge 
)

constructor from a selector, specifying optionally to check for charge

Definition at line 31 of file NamedCandCombinerBase.cc.

31  :
33 }
std::vector< int > dauCharge_
electric charges of the daughters
OverlapChecker overlap_
utility to check candidate daughters overlap
bool checkCharge_
flag to specify the checking of electric charge
bool checkOverlap_
flag to specify the checking of overlaps
def checkOverlap(process)
NamedCandCombinerBase::~NamedCandCombinerBase ( )
virtual

destructor

Definition at line 35 of file NamedCandCombinerBase.cc.

Referenced by NamedCandCombinerBase().

35  {
36 }
NamedCandCombinerBase::NamedCandCombinerBase ( std::string  name)

default construct

NamedCandCombinerBase::NamedCandCombinerBase ( std::string  name,
int  ,
int   
)

construct from two charge values

NamedCandCombinerBase::NamedCandCombinerBase ( std::string  name,
int  ,
int  ,
int   
)

construct from three charge values

NamedCandCombinerBase::NamedCandCombinerBase ( std::string  name,
int  ,
int  ,
int  ,
int   
)

construct from four charge values

NamedCandCombinerBase::NamedCandCombinerBase ( std::string  name,
bool  checkCharge,
const std::vector< int > &  dauCharge 
)

constructor from a selector, specifying optionally to check for charge

Definition at line 31 of file NamedCandCombinerBase.cc.

References addDaughter(), EnergyCorrector::c, alignmentValidation::c1, reco::Candidate::charge(), checkCharge_, combine(), edm::errors::Configuration, dauCharge_, mps_fire::i, cuy::ii, gen::n, cscdqm::h::names, overlap_, preselect(), lumiQueryAPI::q, q1, q2, select(), selectPair(), setup(), edm::PtrVectorBase::size(), TrackRefitter_38T_cff::src, svgfig::stack, AlCaHLTBitMon_QueryRunRegistry::string, and ~NamedCandCombinerBase().

31  :
33 }
std::vector< int > dauCharge_
electric charges of the daughters
OverlapChecker overlap_
utility to check candidate daughters overlap
bool checkCharge_
flag to specify the checking of electric charge
virtual NamedCandCombinerBase::~NamedCandCombinerBase ( )
virtual

destructor

Member Function Documentation

virtual void NamedCandCombinerBase::addDaughter ( reco::NamedCompositeCandidate cmp,
const reco::CandidatePtr c,
std::string  name 
) const
privatepure virtual
virtual void NamedCandCombinerBase::addDaughter ( reco::NamedCompositeCandidate cmp,
const reco::CandidatePtr c,
std::string  name 
) const
privatepure virtual
auto_ptr< NamedCompositeCandidateCollection > NamedCandCombinerBase::combine ( const std::vector< reco::CandidatePtrVector > &  src,
string_coll const &  names 
) const

return all selected candidate pairs

Definition at line 56 of file NamedCandCombinerBase.cc.

References EnergyCorrector::c, alignmentValidation::c1, checkCharge_, edm::errors::Configuration, dauCharge_, gen::n, preselect(), select(), edm::PtrVectorBase::size(), and svgfig::stack.

Referenced by combine(), and NamedCandCombinerBase().

57  {
58  size_t srcSize = src.size();
59  if (checkCharge_ && dauCharge_.size() != srcSize)
61  << "NamedCandCombiner: trying to combine " << srcSize << " collections"
62  << " but configured to check against " << dauCharge_.size() << " charges.";
63 
64  if ( names.size() < 2 )
66  << "NamedCandCombiner: need to add 2 names, but size is " << names.size();
67 
68  auto_ptr<NamedCompositeCandidateCollection> comps(new NamedCompositeCandidateCollection);
69  if(srcSize == 2) {
70  CandidatePtrVector src1 = src[0], src2 = src[1];
71  if(src1 == src2) {
72  const int n = src1.size();
73  for(int i1 = 0; i1 < n; ++i1) {
74  const Candidate & c1 = *(src1[i1]);
75  for(int i2 = i1 + 1; i2 < n; ++i2) {
76  const Candidate & c2 = *(src1[i2]);
77  if (preselect(c1, c2)) {
79  combine(c, src1[i1], src1[i2], names[0], names[1]);
80  if(select(c))
81  comps->push_back(c);
82  }
83  }
84  }
85  } else {
86  const int n1 = src1.size(), n2 = src2.size();
87  for(int i1 = 0; i1 < n1; ++i1) {
88  const Candidate & c1 = *(src1[i1]);
89  for(int i2 = 0; i2 < n2; ++i2) {
90  const Candidate & c2 = *(src2[i2]);
91  if(preselect(c1, c2)) {
93  combine(c, src1[i1], src2[i2], names[0], names[1]);
94  if(select(c))
95  comps->push_back(c);
96  }
97  }
98  }
99  }
100  } else {
102  ChargeStack qStack;
103  combine(0, stack, qStack, names, src.begin(), src.end(), comps);
104  }
105 
106  return comps;
107 }
std::vector< int > dauCharge_
electric charges of the daughters
size_type size() const
Size of the RefVector.
Definition: PtrVectorBase.h:74
static const HistoName names[]
std::vector< NamedCompositeCandidate > NamedCompositeCandidateCollection
collection of Candidate objects
std::vector< int > ChargeStack
virtual bool select(const reco::Candidate &) const =0
select a candidate
std::vector< std::pair< std::pair< reco::CandidatePtr, size_t >, std::vector< reco::CandidatePtrVector >::const_iterator > > CandStack
temporary candidate stack
stack
Definition: svgfig.py:558
std::auto_ptr< reco::NamedCompositeCandidateCollection > combine(const std::vector< reco::CandidatePtrVector > &, string_coll const &) const
return all selected candidate pairs
bool preselect(const reco::Candidate &, const reco::Candidate &) const
verify that the two candidate don&#39;t overlap and check charge
bool checkCharge_
flag to specify the checking of electric charge
std::auto_ptr<reco::NamedCompositeCandidateCollection> NamedCandCombinerBase::combine ( const std::vector< reco::CandidatePtrVector > &  ,
string_coll const &   
) const

return all selected candidate pairs

auto_ptr< NamedCompositeCandidateCollection > NamedCandCombinerBase::combine ( const reco::CandidatePtrVector src,
string_coll const &  names 
) const

return all selected candidate pairs

Definition at line 110 of file NamedCandCombinerBase.cc.

References EnergyCorrector::c, alignmentValidation::c1, checkCharge_, combine(), edm::errors::Configuration, dauCharge_, gen::n, preselect(), select(), and edm::PtrVectorBase::size().

110  {
111  if(checkCharge_ && dauCharge_.size() != 2)
113  << "NamedCandCombiner: trying to combine 2 collections"
114  << " but configured to check against " << dauCharge_.size() << " charges.";
115 
116  if ( names.size() < 2 )
118  << "NamedCandCombiner: need to add 2 names, but size is " << names.size();
119 
120  auto_ptr<NamedCompositeCandidateCollection> comps(new NamedCompositeCandidateCollection);
121  const int n = src.size();
122  for(int i1 = 0; i1 < n; ++i1) {
123  const Candidate & c1 = *(src[i1]);
124  for(int i2 = i1 + 1; i2 < n; ++i2) {
125  const Candidate & c2 = *(src[i2]);
126  if(preselect(c1, c2)) {
128  combine(c, src[i1], src[i2], names[0], names[1]);
129  if(select(c))
130  comps->push_back(c);
131  }
132  }
133  }
134 
135  return comps;
136 }
std::vector< int > dauCharge_
electric charges of the daughters
size_type size() const
Size of the RefVector.
Definition: PtrVectorBase.h:74
static const HistoName names[]
std::vector< NamedCompositeCandidate > NamedCompositeCandidateCollection
collection of Candidate objects
virtual bool select(const reco::Candidate &) const =0
select a candidate
std::auto_ptr< reco::NamedCompositeCandidateCollection > combine(const std::vector< reco::CandidatePtrVector > &, string_coll const &) const
return all selected candidate pairs
bool preselect(const reco::Candidate &, const reco::Candidate &) const
verify that the two candidate don&#39;t overlap and check charge
bool checkCharge_
flag to specify the checking of electric charge
std::auto_ptr<reco::NamedCompositeCandidateCollection> NamedCandCombinerBase::combine ( const reco::CandidatePtrVector ,
string_coll const &   
) const

return all selected candidate pairs

auto_ptr< NamedCompositeCandidateCollection > NamedCandCombinerBase::combine ( const reco::CandidatePtrVector src1,
const reco::CandidatePtrVector src2,
string_coll const &  names 
) const

return all selected candidate pairs

Definition at line 139 of file NamedCandCombinerBase.cc.

References combine(), and TrackRefitter_38T_cff::src.

139  {
140  vector<CandidatePtrVector> src;
141  src.push_back(src1);
142  src.push_back(src2);
143  return combine(src, names);
144 }
static const HistoName names[]
std::auto_ptr< reco::NamedCompositeCandidateCollection > combine(const std::vector< reco::CandidatePtrVector > &, string_coll const &) const
return all selected candidate pairs
std::auto_ptr<reco::NamedCompositeCandidateCollection> NamedCandCombinerBase::combine ( const reco::CandidatePtrVector ,
const reco::CandidatePtrVector ,
string_coll const &   
) const

return all selected candidate pairs

auto_ptr< NamedCompositeCandidateCollection > NamedCandCombinerBase::combine ( const reco::CandidatePtrVector src1,
const reco::CandidatePtrVector src2,
const reco::CandidatePtrVector src3,
string_coll const &  names 
) const

return all selected candidate pairs

Definition at line 147 of file NamedCandCombinerBase.cc.

References combine(), and TrackRefitter_38T_cff::src.

148  {
149  vector<CandidatePtrVector> src;
150  src.push_back(src1);
151  src.push_back(src2);
152  src.push_back(src3);
153  return combine(src, names);
154 }
static const HistoName names[]
std::auto_ptr< reco::NamedCompositeCandidateCollection > combine(const std::vector< reco::CandidatePtrVector > &, string_coll const &) const
return all selected candidate pairs
std::auto_ptr<reco::NamedCompositeCandidateCollection> NamedCandCombinerBase::combine ( const reco::CandidatePtrVector ,
const reco::CandidatePtrVector ,
const reco::CandidatePtrVector ,
string_coll const &   
) const

return all selected candidate pairs

std::auto_ptr<reco::NamedCompositeCandidateCollection> NamedCandCombinerBase::combine ( const reco::CandidatePtrVector ,
const reco::CandidatePtrVector ,
const reco::CandidatePtrVector ,
const reco::CandidatePtrVector ,
string_coll const &   
) const

return all selected candidate pairs

auto_ptr< NamedCompositeCandidateCollection > NamedCandCombinerBase::combine ( const reco::CandidatePtrVector src1,
const reco::CandidatePtrVector src2,
const reco::CandidatePtrVector src3,
const reco::CandidatePtrVector src4,
string_coll const &  names 
) const

return all selected candidate pairs

Definition at line 157 of file NamedCandCombinerBase.cc.

References addDaughter(), EnergyCorrector::c, reco::Candidate::charge(), checkCharge_, checkOverlap_, combine(), dauCharge_, mps_fire::i, cuy::ii, cscdqm::h::names, overlap_, lumiQueryAPI::q, select(), setup(), edm::PtrVectorBase::size(), TrackRefitter_38T_cff::src, and svgfig::stack.

159  {
160  vector<CandidatePtrVector> src;
161  src.push_back(src1);
162  src.push_back(src2);
163  src.push_back(src3);
164  src.push_back(src4);
165  return combine(src, names);
166 }
static const HistoName names[]
std::auto_ptr< reco::NamedCompositeCandidateCollection > combine(const std::vector< reco::CandidatePtrVector > &, string_coll const &) const
return all selected candidate pairs
void NamedCandCombinerBase::combine ( reco::NamedCompositeCandidate ,
const reco::CandidatePtr ,
const reco::CandidatePtr ,
std::string  ,
std::string   
) const
private

returns a composite candidate combined from two daughters

void NamedCandCombinerBase::combine ( reco::NamedCompositeCandidate cmp,
const reco::CandidatePtr c1,
const reco::CandidatePtr c2,
std::string  n1,
std::string  n2 
) const
private

returns a composite candidate combined from two daughters

Definition at line 48 of file NamedCandCombinerBase.cc.

References addDaughter(), and setup().

49  {
50  addDaughter(cmp, c1, n1);
51  addDaughter(cmp, c2, n2);
52  setup(cmp);
53 }
virtual void setup(reco::NamedCompositeCandidate &) const =0
set kinematics to reconstructed composite
virtual void addDaughter(reco::NamedCompositeCandidate &cmp, const reco::CandidatePtr &c, std::string name) const =0
add candidate daughter
void NamedCandCombinerBase::combine ( size_t  collectionIndex,
CandStack ,
ChargeStack ,
string_coll const &  names,
std::vector< reco::CandidatePtrVector >::const_iterator  begin,
std::vector< reco::CandidatePtrVector >::const_iterator  end,
std::auto_ptr< reco::NamedCompositeCandidateCollection > &  comps 
) const
private

returns a composite candidate combined from two daughters

void NamedCandCombinerBase::combine ( size_t  collectionIndex,
CandStack ,
ChargeStack ,
string_coll const &  names,
std::vector< reco::CandidatePtrVector >::const_iterator  begin,
std::vector< reco::CandidatePtrVector >::const_iterator  end,
std::auto_ptr< reco::NamedCompositeCandidateCollection > &  comps 
) const
private

returns a composite candidate combined from two daughters

bool NamedCandCombinerBase::preselect ( const reco::Candidate c1,
const reco::Candidate c2 
) const
private

verify that the two candidate don't overlap and check charge

Definition at line 38 of file NamedCandCombinerBase.cc.

References reco::Candidate::charge(), checkCharge_, checkOverlap_, dauCharge_, overlap_, q1, q2, and selectPair().

Referenced by combine(), and NamedCandCombinerBase().

38  {
39  if (checkCharge_) {
40  int dq1 = dauCharge_[0], dq2 = dauCharge_[1], q1 = c1.charge(), q2 = c2.charge();
41  bool matchCharge = (q1 == dq1 && q2 == dq2) || (q1 == -dq1 && q2 == -dq2);
42  if (!matchCharge) return false;
43  }
44  if (checkOverlap_ && overlap_(c1, c2)) return false;
45  return selectPair(c1, c2);
46 }
std::vector< int > dauCharge_
electric charges of the daughters
double q2[4]
Definition: TauolaWrapper.h:88
OverlapChecker overlap_
utility to check candidate daughters overlap
virtual bool selectPair(const reco::Candidate &c1, const reco::Candidate &c2) const =0
select a candidate pair
double q1[4]
Definition: TauolaWrapper.h:87
bool checkCharge_
flag to specify the checking of electric charge
bool checkOverlap_
flag to specify the checking of overlaps
virtual int charge() const =0
electric charge
bool NamedCandCombinerBase::preselect ( const reco::Candidate ,
const reco::Candidate  
) const
private

verify that the two candidate don't overlap and check charge

virtual bool NamedCandCombinerBase::select ( const reco::Candidate ) const
privatepure virtual
virtual bool NamedCandCombinerBase::select ( const reco::Candidate ) const
privatepure virtual
virtual bool NamedCandCombinerBase::selectPair ( const reco::Candidate c1,
const reco::Candidate c2 
) const
privatepure virtual
virtual bool NamedCandCombinerBase::selectPair ( const reco::Candidate c1,
const reco::Candidate c2 
) const
privatepure virtual
virtual void NamedCandCombinerBase::setup ( reco::NamedCompositeCandidate ) const
privatepure virtual
virtual void NamedCandCombinerBase::setup ( reco::NamedCompositeCandidate ) const
privatepure virtual

Member Data Documentation

bool NamedCandCombinerBase::checkCharge_
private

flag to specify the checking of electric charge

Definition at line 83 of file NamedCandCombinerBase.h.

Referenced by combine(), NamedCandCombinerBase(), and preselect().

bool NamedCandCombinerBase::checkOverlap_
private

flag to specify the checking of overlaps

Definition at line 85 of file NamedCandCombinerBase.h.

Referenced by combine(), and preselect().

std::vector< int > NamedCandCombinerBase::dauCharge_
private

electric charges of the daughters

Definition at line 87 of file NamedCandCombinerBase.h.

Referenced by combine(), NamedCandCombinerBase(), and preselect().

std::string NamedCandCombinerBase::name_
private

Name.

Definition at line 91 of file NamedCandCombinerBase.h.

OverlapChecker NamedCandCombinerBase::overlap_
private

utility to check candidate daughters overlap

Definition at line 89 of file NamedCandCombinerBase.h.

Referenced by combine(), NamedCandCombinerBase(), and preselect().