CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes
CandCombinerBase< OutputCollection, CandPtr > Class Template Referenceabstract

#include <CandCombinerBase.h>

Public Types

typedef std::vector< std::string > vstring
 

Public Member Functions

 CandCombinerBase (const std::string="")
 default construct More...
 
 CandCombinerBase (int, int, const std::string="")
 construct from two charge values More...
 
 CandCombinerBase (int, int, int, const std::string="")
 construct from three charge values More...
 
 CandCombinerBase (int, int, int, int, const std::string="")
 construct from four charge values More...
 
 CandCombinerBase (bool checkCharge, bool checkOverlap, const std::vector< int > &, const std::string="")
 constructor from a selector, specifying optionally to check for charge More...
 
std::unique_ptr< OutputCollection > combine (const std::vector< edm::Handle< reco::CandidateView > > &, const vstring &=vstring()) const
 return all selected candidate pairs More...
 
std::unique_ptr< OutputCollection > combine (const edm::Handle< reco::CandidateView > &, const vstring &=vstring()) const
 return all selected candidate pairs More...
 
std::unique_ptr< OutputCollection > combine (const edm::Handle< reco::CandidateView > &, const edm::Handle< reco::CandidateView > &, const vstring &=vstring()) const
 return all selected candidate pairs More...
 
std::unique_ptr< OutputCollection > combine (const edm::Handle< reco::CandidateView > &, const edm::Handle< reco::CandidateView > &, const edm::Handle< reco::CandidateView > &, const vstring &=vstring()) const
 return all selected candidate pairs More...
 
std::unique_ptr< OutputCollection > combine (const edm::Handle< reco::CandidateView > &, const edm::Handle< reco::CandidateView > &, const edm::Handle< reco::CandidateView > &, const edm::Handle< reco::CandidateView > &, const vstring &=vstring()) const
 return all selected candidate pairs More...
 
virtual ~CandCombinerBase ()
 destructor More...
 

Private Types

typedef std::vector< std::pair< std::pair< CandPtr, size_t >, std::vector< edm::Handle< reco::CandidateView > >::const_iterator > > CandStack
 temporary candidate stack More...
 
typedef std::vector< int > ChargeStack
 

Private Member Functions

virtual void addDaughter (typename OutputCollection::value_type &cmp, const CandPtr &c, const std::string="") const =0
 add candidate daughter More...
 
void combine (typename OutputCollection::value_type &, const CandPtr &, const CandPtr &, const std::string="", const std::string="") const
 returns a composite candidate combined from two daughters More...
 
void combine (size_t collectionIndex, CandStack &, ChargeStack &, std::vector< edm::Handle< reco::CandidateView > >::const_iterator begin, std::vector< edm::Handle< reco::CandidateView > >::const_iterator end, OutputCollection *comps, const vstring &name=vstring()) 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...
 
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 void setup (typename OutputCollection::value_type &) 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_
 composite name (if applies) More...
 
OverlapChecker overlap_
 utility to check candidate daughters overlap More...
 

Detailed Description

template<typename OutputCollection, typename CandPtr>
class CandCombinerBase< OutputCollection, CandPtr >

Author
Luca Lista, INFN

Definition at line 14 of file CandCombinerBase.h.

Member Typedef Documentation

template<typename OutputCollection, typename CandPtr>
typedef std::vector<std::pair<std::pair<CandPtr, size_t>, std::vector<edm::Handle<reco::CandidateView> >::const_iterator> > CandCombinerBase< OutputCollection, CandPtr >::CandStack
private

temporary candidate stack

Definition at line 60 of file CandCombinerBase.h.

template<typename OutputCollection, typename CandPtr>
typedef std::vector<int> CandCombinerBase< OutputCollection, CandPtr >::ChargeStack
private

Definition at line 61 of file CandCombinerBase.h.

template<typename OutputCollection, typename CandPtr>
typedef std::vector<std::string> CandCombinerBase< OutputCollection, CandPtr >::vstring

Definition at line 16 of file CandCombinerBase.h.

Constructor & Destructor Documentation

template<typename OutputCollection , typename CandPtr >
CandCombinerBase< OutputCollection, CandPtr >::CandCombinerBase ( const std::string  name = "")
explicit

default construct

Definition at line 89 of file CandCombinerBase.h.

89  :
90  checkCharge_(false), checkOverlap_(true), dauCharge_(), overlap_(), name_(name) {
91 }
bool checkOverlap_
flag to specify the checking of overlaps
bool checkCharge_
flag to specify the checking of electric charge
OverlapChecker overlap_
utility to check candidate daughters overlap
std::vector< int > dauCharge_
electric charges of the daughters
std::string name_
composite name (if applies)
template<typename OutputCollection , typename CandPtr >
CandCombinerBase< OutputCollection, CandPtr >::CandCombinerBase ( int  q1,
int  q2,
const std::string  name = "" 
)

construct from two charge values

Definition at line 94 of file CandCombinerBase.h.

References CandCombinerBase< OutputCollection, CandPtr >::dauCharge_, q1, and q2.

94  :
95  checkCharge_(true), checkOverlap_(true), dauCharge_(2), overlap_(), name_(name) {
96  dauCharge_[0] = q1;
97  dauCharge_[1] = q2;
98 }
bool checkOverlap_
flag to specify the checking of overlaps
bool checkCharge_
flag to specify the checking of electric charge
OverlapChecker overlap_
utility to check candidate daughters overlap
double q2[4]
Definition: TauolaWrapper.h:88
double q1[4]
Definition: TauolaWrapper.h:87
std::vector< int > dauCharge_
electric charges of the daughters
std::string name_
composite name (if applies)
template<typename OutputCollection , typename CandPtr >
CandCombinerBase< OutputCollection, CandPtr >::CandCombinerBase ( int  q1,
int  q2,
int  q3,
const std::string  name = "" 
)

construct from three charge values

Definition at line 101 of file CandCombinerBase.h.

References CandCombinerBase< OutputCollection, CandPtr >::dauCharge_, q1, and q2.

101  :
102  checkCharge_(true), checkOverlap_(true), dauCharge_(3), overlap_(), name_(name) {
103  dauCharge_[0] = q1;
104  dauCharge_[1] = q2;
105  dauCharge_[2] = q3;
106 }
bool checkOverlap_
flag to specify the checking of overlaps
bool checkCharge_
flag to specify the checking of electric charge
OverlapChecker overlap_
utility to check candidate daughters overlap
double q2[4]
Definition: TauolaWrapper.h:88
double q1[4]
Definition: TauolaWrapper.h:87
std::vector< int > dauCharge_
electric charges of the daughters
std::string name_
composite name (if applies)
template<typename OutputCollection , typename CandPtr >
CandCombinerBase< OutputCollection, CandPtr >::CandCombinerBase ( int  q1,
int  q2,
int  q3,
int  q4,
const std::string  name = "" 
)

construct from four charge values

Definition at line 109 of file CandCombinerBase.h.

References CandCombinerBase< OutputCollection, CandPtr >::dauCharge_, q1, and q2.

109  :
110  checkCharge_(true), checkOverlap_(true), dauCharge_(4), overlap_(), name_(name) {
111  dauCharge_[0] = q1;
112  dauCharge_[1] = q2;
113  dauCharge_[2] = q3;
114  dauCharge_[3] = q4;
115 }
bool checkOverlap_
flag to specify the checking of overlaps
bool checkCharge_
flag to specify the checking of electric charge
OverlapChecker overlap_
utility to check candidate daughters overlap
double q2[4]
Definition: TauolaWrapper.h:88
double q1[4]
Definition: TauolaWrapper.h:87
std::vector< int > dauCharge_
electric charges of the daughters
std::string name_
composite name (if applies)
template<typename OutputCollection , typename CandPtr >
CandCombinerBase< OutputCollection, CandPtr >::CandCombinerBase ( bool  checkCharge,
bool  checkOverlap,
const std::vector< int > &  dauCharge,
const std::string  name = "" 
)

constructor from a selector, specifying optionally to check for charge

Definition at line 118 of file CandCombinerBase.h.

118  :
120 }
bool checkOverlap_
flag to specify the checking of overlaps
bool checkCharge_
flag to specify the checking of electric charge
OverlapChecker overlap_
utility to check candidate daughters overlap
std::vector< int > dauCharge_
electric charges of the daughters
def checkOverlap(process)
std::string name_
composite name (if applies)
template<typename OutputCollection , typename CandPtr >
CandCombinerBase< OutputCollection, CandPtr >::~CandCombinerBase ( )
virtual

destructor

Definition at line 123 of file CandCombinerBase.h.

123  {
124 }

Member Function Documentation

template<typename OutputCollection, typename CandPtr>
virtual void CandCombinerBase< OutputCollection, CandPtr >::addDaughter ( typename OutputCollection::value_type &  cmp,
const CandPtr &  c,
const std::string  = "" 
) const
privatepure virtual
template<typename OutputCollection , typename CandPtr >
std::unique_ptr< OutputCollection > CandCombinerBase< OutputCollection, CandPtr >::combine ( const std::vector< edm::Handle< reco::CandidateView > > &  src,
const vstring names = vstring() 
) const

return all selected candidate pairs

Definition at line 148 of file CandCombinerBase.h.

References EnergyCorrector::c, alignmentValidation::c1, CandCombinerBase< OutputCollection, CandPtr >::checkCharge_, edm::errors::Configuration, CandCombinerBase< OutputCollection, CandPtr >::dauCharge_, Exception, edm::ProductID::id(), edm::HandleBase::id(), gen::n, cscdqm::h::names, cscdqm::h::namesSize, CandCombinerBase< OutputCollection, CandPtr >::preselect(), CandCombinerBase< OutputCollection, CandPtr >::select(), edm::View< T >::size(), TrackRefitter_38T_cff::src, svgfig::stack, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by CandCombinerBase< OutputCollection, CandPtr >::combine().

149  {
150  size_t srcSize = src.size();
151  if (checkCharge_ && dauCharge_.size() != srcSize)
153  << "CandCombiner: trying to combine " << srcSize << " collections"
154  << " but configured to check against " << dauCharge_.size() << " charges.";
155  std::unique_ptr<OutputCollection> comps(new OutputCollection);
156  size_t namesSize = names.size();
157  if(srcSize == 2) {
158  std::string name1="", name2="";
159  if(namesSize > 0) {
160  if(namesSize != 2)
162  << "CandCombiner: should specify exactly two "
163  << " names in configuration (" << namesSize << " specified).\n";
164  name1 = names[0];
165  name2 = names[1];
166  }
167  edm::Handle<reco::CandidateView> src1 = src[0], src2 = src[1];
168  if(src1.id() == src2.id()) {
169  const reco::CandidateView & cands = * src1;
170  const size_t n = cands.size();
171  for(size_t i1 = 0; i1 < n; ++i1) {
172  const reco::Candidate & c1 = cands[i1];
173  CandPtr cr1(src1, i1);
174  for(size_t i2 = i1 + 1; i2 < n; ++i2) {
175  const reco::Candidate & c2 = cands[i2];
176  if(preselect(c1, c2)) {
177  CandPtr cr2(src2, i2);
179  combine(c, cr1, cr2, name1, name2);
180  if(select(c))
181  comps->push_back(c);
182  }
183  }
184  }
185  } else {
186  const reco::CandidateView & cands1 = * src1, & cands2 = * src2;
187  const size_t n1 = cands1.size(), n2 = cands2.size();
188  for(size_t i1 = 0; i1 < n1; ++i1) {
189  const reco::Candidate & c1 = cands1[i1];
190  CandPtr cr1(src1, i1);
191  for(size_t i2 = 0; i2 < n2; ++i2) {
192  const reco::Candidate & c2 = cands2[i2];
193  if(preselect(c1, c2)) {
194  CandPtr cr2(src2, i2);
196  combine(c, cr1, cr2, name1, name2);
197  if(select(c))
198  comps->push_back(c);
199  }
200  }
201  }
202  }
203  } else {
205  ChargeStack qStack;
206  combine(0, stack, qStack, src.begin(), src.end(), comps.get(), names);
207  }
208 
209  return comps;
210 }
static const HistoName names[]
ProductID id() const
Definition: HandleBase.cc:15
bool checkCharge_
flag to specify the checking of electric charge
bool preselect(const reco::Candidate &, const reco::Candidate &) const
verify that the two candidate don&#39;t overlap and check charge
size_type size() const
static const unsigned int namesSize
stack
Definition: svgfig.py:558
std::unique_ptr< OutputCollection > combine(const std::vector< edm::Handle< reco::CandidateView > > &, const vstring &=vstring()) const
return all selected candidate pairs
std::vector< std::pair< std::pair< CandPtr, size_t >, std::vector< edm::Handle< reco::CandidateView > >::const_iterator > > CandStack
temporary candidate stack
std::vector< int > dauCharge_
electric charges of the daughters
virtual bool select(const reco::Candidate &) const =0
select a candidate
ProductIndex id() const
Definition: ProductID.h:38
std::vector< int > ChargeStack
template<typename OutputCollection , typename CandPtr >
std::unique_ptr< OutputCollection > CandCombinerBase< OutputCollection, CandPtr >::combine ( const edm::Handle< reco::CandidateView > &  src,
const vstring names = vstring() 
) const

return all selected candidate pairs

Definition at line 214 of file CandCombinerBase.h.

References EnergyCorrector::c, alignmentValidation::c1, CandCombinerBase< OutputCollection, CandPtr >::checkCharge_, CandCombinerBase< OutputCollection, CandPtr >::combine(), edm::errors::Configuration, CandCombinerBase< OutputCollection, CandPtr >::dauCharge_, Exception, gen::n, cscdqm::h::namesSize, CandCombinerBase< OutputCollection, CandPtr >::preselect(), CandCombinerBase< OutputCollection, CandPtr >::select(), edm::View< T >::size(), TrackRefitter_38T_cff::src, and AlCaHLTBitMon_QueryRunRegistry::string.

215  {
216  if(checkCharge_ && dauCharge_.size() != 2)
218  << "CandCombiner: trying to combine 2 collections"
219  << " but configured to check against " << dauCharge_.size() << " charges.";
220 
221  std::unique_ptr<OutputCollection> comps(new OutputCollection);
222  size_t namesSize = names.size();
223  std::string name1, name2;
224  if(namesSize > 0) {
225  if(namesSize != 2)
227  << "CandCombiner: should specify exactly two "
228  << " names in configuration (" << namesSize << " specified).\n";
229  name1 = names[0];
230  name2 = names[1];
231  }
232  const reco::CandidateView & cands = * src;
233  const size_t n = cands.size();
234  for(size_t i1 = 0; i1 < n; ++i1) {
235  const reco::Candidate & c1 = cands[i1];
236  CandPtr cr1(src, i1);
237  for(size_t i2 = i1 + 1; i2 < n; ++i2) {
238  const reco::Candidate & c2 = cands[i2];
239  if(preselect(c1, c2)) {
240  CandPtr cr2(src, i2);
242  combine(c, cr1, cr2, name1, name2);
243  if(select(c))
244  comps->push_back(c);
245  }
246  }
247  }
248 
249  return comps;
250 }
static const HistoName names[]
bool checkCharge_
flag to specify the checking of electric charge
bool preselect(const reco::Candidate &, const reco::Candidate &) const
verify that the two candidate don&#39;t overlap and check charge
size_type size() const
static const unsigned int namesSize
std::unique_ptr< OutputCollection > combine(const std::vector< edm::Handle< reco::CandidateView > > &, const vstring &=vstring()) const
return all selected candidate pairs
std::vector< int > dauCharge_
electric charges of the daughters
virtual bool select(const reco::Candidate &) const =0
select a candidate
template<typename OutputCollection , typename CandPtr >
std::unique_ptr< OutputCollection > CandCombinerBase< OutputCollection, CandPtr >::combine ( const edm::Handle< reco::CandidateView > &  src1,
const edm::Handle< reco::CandidateView > &  src2,
const vstring names = vstring() 
) const

return all selected candidate pairs

Definition at line 254 of file CandCombinerBase.h.

References CandCombinerBase< OutputCollection, CandPtr >::combine(), and TrackRefitter_38T_cff::src.

256  {
257  std::vector<edm::Handle<reco::CandidateView> > src;
258  src.push_back(src1);
259  src.push_back(src2);
260  return combine(src, names);
261 }
static const HistoName names[]
std::unique_ptr< OutputCollection > combine(const std::vector< edm::Handle< reco::CandidateView > > &, const vstring &=vstring()) const
return all selected candidate pairs
template<typename OutputCollection , typename CandPtr >
std::unique_ptr< OutputCollection > CandCombinerBase< OutputCollection, CandPtr >::combine ( const edm::Handle< reco::CandidateView > &  src1,
const edm::Handle< reco::CandidateView > &  src2,
const edm::Handle< reco::CandidateView > &  src3,
const vstring names = vstring() 
) const

return all selected candidate pairs

Definition at line 265 of file CandCombinerBase.h.

References CandCombinerBase< OutputCollection, CandPtr >::combine(), and TrackRefitter_38T_cff::src.

268  {
269  std::vector<edm::Handle<reco::CandidateView> > src;
270  src.push_back(src1);
271  src.push_back(src2);
272  src.push_back(src3);
273  return combine(src, names);
274 }
static const HistoName names[]
std::unique_ptr< OutputCollection > combine(const std::vector< edm::Handle< reco::CandidateView > > &, const vstring &=vstring()) const
return all selected candidate pairs
template<typename OutputCollection , typename CandPtr >
std::unique_ptr< OutputCollection > CandCombinerBase< OutputCollection, CandPtr >::combine ( const edm::Handle< reco::CandidateView > &  src1,
const edm::Handle< reco::CandidateView > &  src2,
const edm::Handle< reco::CandidateView > &  src3,
const edm::Handle< reco::CandidateView > &  src4,
const vstring names = vstring() 
) const

return all selected candidate pairs

Definition at line 278 of file CandCombinerBase.h.

References CandCombinerBase< OutputCollection, CandPtr >::combine(), and TrackRefitter_38T_cff::src.

282  {
283  std::vector<edm::Handle<reco::CandidateView> > src;
284  src.push_back(src1);
285  src.push_back(src2);
286  src.push_back(src3);
287  src.push_back(src4);
288  return combine(src, names);
289 }
static const HistoName names[]
std::unique_ptr< OutputCollection > combine(const std::vector< edm::Handle< reco::CandidateView > > &, const vstring &=vstring()) const
return all selected candidate pairs
template<typename OutputCollection, typename CandPtr>
void CandCombinerBase< OutputCollection, CandPtr >::combine ( typename OutputCollection::value_type &  cmp,
const CandPtr &  c1,
const CandPtr &  c2,
const std::string  name1 = "",
const std::string  name2 = "" 
) const
private

returns a composite candidate combined from two daughters

Definition at line 138 of file CandCombinerBase.h.

References CandCombinerBase< OutputCollection, CandPtr >::addDaughter(), and CandCombinerBase< OutputCollection, CandPtr >::setup().

140  {
141  addDaughter(cmp, c1, name1);
142  addDaughter(cmp, c2, name2);
143  setup(cmp);
144 }
virtual void setup(typename OutputCollection::value_type &) const =0
set kinematics to reconstructed composite
virtual void addDaughter(typename OutputCollection::value_type &cmp, const CandPtr &c, const std::string="") const =0
add candidate daughter
template<typename OutputCollection, typename CandPtr>
void CandCombinerBase< OutputCollection, CandPtr >::combine ( size_t  collectionIndex,
CandStack stack,
ChargeStack qStack,
std::vector< edm::Handle< reco::CandidateView > >::const_iterator  begin,
std::vector< edm::Handle< reco::CandidateView > >::const_iterator  end,
OutputCollection *  comps,
const vstring name = vstring() 
) const
private

returns a composite candidate combined from two daughters

Definition at line 292 of file CandCombinerBase.h.

References CandCombinerBase< OutputCollection, CandPtr >::addDaughter(), EnergyCorrector::c, reco::Candidate::charge(), CandCombinerBase< OutputCollection, CandPtr >::checkCharge_, CandCombinerBase< OutputCollection, CandPtr >::checkOverlap_, CandCombinerBase< OutputCollection, CandPtr >::combine(), CandCombinerBase< OutputCollection, CandPtr >::dauCharge_, mps_fire::i, edm::HandleBase::id(), CandCombinerBase< OutputCollection, CandPtr >::overlap_, lumiQueryAPI::q, CandCombinerBase< OutputCollection, CandPtr >::select(), CandCombinerBase< OutputCollection, CandPtr >::setup(), edm::View< T >::size(), and TrackRefitter_38T_cff::src.

296  {
297  if(collBegin == collEnd) {
298  static const int undetermined = 0, sameDecay = 1, conjDecay = -1, wrongDecay = 2;
299  int decayType = undetermined;
300  if(checkCharge_) {
301  assert(qStack.size() == stack.size());
302  for(size_t i = 0; i < qStack.size(); ++i) {
303  int q = qStack[i], dq = dauCharge_[i];
304  if(decayType == undetermined) {
305  if(q != 0 && dq != 0) {
306  if(q == dq) decayType = sameDecay;
307  else if(q == -dq) decayType = conjDecay;
308  else decayType = wrongDecay;
309  }
310  } else if((decayType == sameDecay && q != dq) ||
311  (decayType == conjDecay && q != -dq)) {
312  decayType = wrongDecay;
313  }
314  if(decayType == wrongDecay) break;
315  }
316  }
317  if(decayType != wrongDecay) {
319  size_t nameIndex = 0;
320  for(typename CandStack::const_iterator i = stack.begin(); i != stack.end(); ++i, ++ nameIndex) {
321  if ( names.size() > 0 )
322  addDaughter(c, i->first.first, names[nameIndex]);
323  else
324  addDaughter(c, i->first.first);
325  }
326  setup(c);
327  if(select(c))
328  comps->push_back(c);
329  }
330  } else {
331  const edm::Handle<reco::CandidateView> & srcRef = * collBegin;
332  const reco::CandidateView & src = * srcRef;
333  size_t candBegin = 0, candEnd = src.size();
334  for(typename CandStack::const_iterator i = stack.begin(); i != stack.end(); ++i)
335  if(srcRef.id() == i->second->id())
336  candBegin = i->first.second + 1;
337  for(size_t candIndex = candBegin; candIndex != candEnd; ++ candIndex) {
338  CandPtr candRef(srcRef, candIndex);
339  bool noOverlap = true;
340  const reco::Candidate & cand = * candRef;
341  for(typename CandStack::const_iterator i = stack.begin(); i != stack.end(); ++i)
342  if(checkOverlap_ && overlap_(cand, *(i->first.first))) {
343  noOverlap = false;
344  break;
345  }
346  if(noOverlap) {
347  stack.push_back(std::make_pair(std::make_pair(candRef, candIndex), collBegin));
348  if(checkCharge_) qStack.push_back(cand.charge());
349  combine(collectionIndex + 1, stack, qStack, collBegin + 1, collEnd, comps, names);
350  stack.pop_back();
351  qStack.pop_back();
352  }
353  }
354  }
355 }
static const HistoName names[]
ProductID id() const
Definition: HandleBase.cc:15
bool checkOverlap_
flag to specify the checking of overlaps
bool checkCharge_
flag to specify the checking of electric charge
virtual void setup(typename OutputCollection::value_type &) const =0
set kinematics to reconstructed composite
OverlapChecker overlap_
utility to check candidate daughters overlap
size_type size() const
stack
Definition: svgfig.py:558
virtual void addDaughter(typename OutputCollection::value_type &cmp, const CandPtr &c, const std::string="") const =0
add candidate daughter
std::unique_ptr< OutputCollection > combine(const std::vector< edm::Handle< reco::CandidateView > > &, const vstring &=vstring()) const
return all selected candidate pairs
std::vector< int > dauCharge_
electric charges of the daughters
virtual int charge() const =0
electric charge
virtual bool select(const reco::Candidate &) const =0
select a candidate
template<typename OutputCollection , typename CandPtr >
bool CandCombinerBase< OutputCollection, CandPtr >::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 127 of file CandCombinerBase.h.

References reco::Candidate::charge(), CandCombinerBase< OutputCollection, CandPtr >::checkCharge_, CandCombinerBase< OutputCollection, CandPtr >::checkOverlap_, CandCombinerBase< OutputCollection, CandPtr >::dauCharge_, CandCombinerBase< OutputCollection, CandPtr >::overlap_, q1, q2, and CandCombinerBase< OutputCollection, CandPtr >::selectPair().

Referenced by CandCombinerBase< OutputCollection, CandPtr >::combine().

127  {
128  if (checkCharge_) {
129  int dq1 = dauCharge_[0], dq2 = dauCharge_[1], q1 = c1.charge(), q2 = c2.charge();
130  bool matchCharge = (q1 == dq1 && q2 == dq2) || (q1 == -dq1 && q2 == -dq2);
131  if (!matchCharge) return false;
132  }
133  if (checkOverlap_ && overlap_(c1, c2)) return false;
134  return selectPair(c1, c2);
135 }
bool checkOverlap_
flag to specify the checking of overlaps
bool checkCharge_
flag to specify the checking of electric charge
OverlapChecker overlap_
utility to check candidate daughters overlap
double q2[4]
Definition: TauolaWrapper.h:88
virtual bool selectPair(const reco::Candidate &c1, const reco::Candidate &c2) const =0
select a candidate pair
double q1[4]
Definition: TauolaWrapper.h:87
std::vector< int > dauCharge_
electric charges of the daughters
virtual int charge() const =0
electric charge
template<typename OutputCollection, typename CandPtr>
virtual bool CandCombinerBase< OutputCollection, CandPtr >::select ( const reco::Candidate ) const
privatepure virtual
template<typename OutputCollection, typename CandPtr>
virtual bool CandCombinerBase< OutputCollection, CandPtr >::selectPair ( const reco::Candidate c1,
const reco::Candidate c2 
) const
privatepure virtual
template<typename OutputCollection, typename CandPtr>
virtual void CandCombinerBase< OutputCollection, CandPtr >::setup ( typename OutputCollection::value_type &  ) const
privatepure virtual

Member Data Documentation

template<typename OutputCollection, typename CandPtr>
bool CandCombinerBase< OutputCollection, CandPtr >::checkCharge_
private

flag to specify the checking of electric charge

Definition at line 77 of file CandCombinerBase.h.

Referenced by CandCombinerBase< OutputCollection, CandPtr >::combine(), and CandCombinerBase< OutputCollection, CandPtr >::preselect().

template<typename OutputCollection, typename CandPtr>
bool CandCombinerBase< OutputCollection, CandPtr >::checkOverlap_
private

flag to specify the checking of overlaps

Definition at line 79 of file CandCombinerBase.h.

Referenced by CandCombinerBase< OutputCollection, CandPtr >::combine(), and CandCombinerBase< OutputCollection, CandPtr >::preselect().

template<typename OutputCollection, typename CandPtr>
std::vector<int> CandCombinerBase< OutputCollection, CandPtr >::dauCharge_
private
template<typename OutputCollection, typename CandPtr>
std::string CandCombinerBase< OutputCollection, CandPtr >::name_
private

composite name (if applies)

Definition at line 85 of file CandCombinerBase.h.

template<typename OutputCollection, typename CandPtr>
OverlapChecker CandCombinerBase< OutputCollection, CandPtr >::overlap_
private

utility to check candidate daughters overlap

Definition at line 83 of file CandCombinerBase.h.

Referenced by CandCombinerBase< OutputCollection, CandPtr >::combine(), and CandCombinerBase< OutputCollection, CandPtr >::preselect().