#include <CompositeCandidate.h>
Public Types | |
typedef CandidateCollection | daughters |
collection of daughters | |
typedef std::vector< std::string > | role_collection |
Public Member Functions | |
void | addDaughter (const Candidate &, const std::string &s="") |
add a clone of the passed candidate as daughter | |
void | addDaughter (std::auto_ptr< Candidate >, const std::string &s="") |
add a clone of the passed candidate as daughter | |
void | applyRoles () |
virtual const_iterator | begin () const |
first daughter const_iterator | |
virtual iterator | begin () |
first daughter iterator | |
void | clearDaughters () |
clear daughters | |
void | clearRoles () |
virtual CompositeCandidate * | clone () const |
returns a clone of the candidate | |
CompositeCandidate (std::string name="") | |
default constructor | |
CompositeCandidate (const Candidate &p, const std::string &name="") | |
constructor from values | |
CompositeCandidate (Charge q, const LorentzVector &p4, const Point &vtx=Point(0, 0, 0), int pdgId=0, int status=0, bool integerCharge=true, std::string name="") | |
constructor from values | |
CompositeCandidate (const Candidate &p, const std::string &name, role_collection const &roles) | |
constructor from values | |
CompositeCandidate (Charge q, const PolarLorentzVector &p4, const Point &vtx=Point(0, 0, 0), int pdgId=0, int status=0, bool integerCharge=true, std::string name="") | |
constructor from values | |
virtual const Candidate * | daughter (size_type) const |
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) | |
virtual Candidate * | daughter (size_type) |
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 | |
virtual const Candidate * | daughter (const std::string &s) const |
return daughter with a specified role name | |
virtual Candidate * | daughter (const std::string &s) |
return daughter with a specified role name | |
virtual const_iterator | end () const |
last daughter const_iterator | |
virtual iterator | end () |
last daughter const_iterator | |
virtual const Candidate * | mother (size_type i=0) const |
return pointer to mother | |
std::string | name () const |
get the name of the candidate | |
virtual size_type | numberOfDaughters () const |
number of daughters | |
virtual size_type | numberOfMothers () const |
number of mothers (zero or one in most of but not all the cases) | |
role_collection const & | roles () const |
get the roles | |
void | setName (std::string name) |
set the name of the candidate | |
void | setRoles (const role_collection &roles) |
set the roles | |
virtual | ~CompositeCandidate () |
destructor | |
Private Types | |
typedef candidate::const_iterator_imp_specific < daughters > | const_iterator_imp_specific |
typedef candidate::iterator_imp_specific < daughters > | iterator_imp_specific |
Private Member Functions | |
virtual bool | overlap (const Candidate &) const |
check overlap with another daughter | |
Private Attributes | |
daughters | dau |
collection of daughters | |
std::string | name_ |
candidate name | |
role_collection | roles_ |
candidate roles |
A Candidate composed of daughters. The daughters are owned by the composite candidate.
Definition at line 23 of file CompositeCandidate.h.
typedef candidate::const_iterator_imp_specific<daughters> reco::CompositeCandidate::const_iterator_imp_specific [private] |
Reimplemented from reco::LeafCandidate.
Definition at line 90 of file CompositeCandidate.h.
collection of daughters
Reimplemented from reco::LeafCandidate.
Definition at line 26 of file CompositeCandidate.h.
typedef candidate::iterator_imp_specific<daughters> reco::CompositeCandidate::iterator_imp_specific [private] |
Reimplemented from reco::LeafCandidate.
Definition at line 92 of file CompositeCandidate.h.
typedef std::vector<std::string> reco::CompositeCandidate::role_collection |
Reimplemented in reco::NamedCompositeCandidate.
Definition at line 27 of file CompositeCandidate.h.
reco::CompositeCandidate::CompositeCandidate | ( | std::string | name = "" | ) | [inline] |
default constructor
Definition at line 29 of file CompositeCandidate.h.
Referenced by clone().
: LeafCandidate(), name_(name) { }
reco::CompositeCandidate::CompositeCandidate | ( | Charge | q, |
const LorentzVector & | p4, | ||
const Point & | vtx = Point( 0, 0, 0 ) , |
||
int | pdgId = 0 , |
||
int | status = 0 , |
||
bool | integerCharge = true , |
||
std::string | name = "" |
||
) | [inline] |
constructor from values
Definition at line 31 of file CompositeCandidate.h.
reco::CompositeCandidate::CompositeCandidate | ( | Charge | q, |
const PolarLorentzVector & | p4, | ||
const Point & | vtx = Point( 0, 0, 0 ) , |
||
int | pdgId = 0 , |
||
int | status = 0 , |
||
bool | integerCharge = true , |
||
std::string | name = "" |
||
) | [inline] |
constructor from values
Definition at line 36 of file CompositeCandidate.h.
CompositeCandidate::CompositeCandidate | ( | const Candidate & | p, |
const std::string & | name = "" |
||
) | [explicit] |
constructor from values
Definition at line 7 of file CompositeCandidate.cc.
References addDaughter(), reco::Candidate::daughter(), i, n, and reco::Candidate::numberOfDaughters().
CompositeCandidate::CompositeCandidate | ( | const Candidate & | p, |
const std::string & | name, | ||
role_collection const & | roles | ||
) | [explicit] |
constructor from values
Definition at line 16 of file CompositeCandidate.cc.
References addDaughter(), reco::Candidate::daughter(), i, n, reco::Candidate::numberOfDaughters(), alignCSCRings::r, and roles_.
CompositeCandidate::~CompositeCandidate | ( | ) | [virtual] |
destructor
Reimplemented in pat::CompositeCandidate.
Definition at line 31 of file CompositeCandidate.cc.
{ }
void CompositeCandidate::addDaughter | ( | const Candidate & | cand, |
const std::string & | s = "" |
||
) |
add a clone of the passed candidate as daughter
Reimplemented in reco::NamedCompositeCandidate.
Definition at line 126 of file CompositeCandidate.cc.
References begin(), trackerHits::c, alignmentValidation::c1, reco::Candidate::clone(), dau, end(), Exception, spr::find(), edm::OwnVector< T, P >::push_back(), roles_, and setName().
Referenced by combiner::helpers::ShallowClonePtr::addDaughter(), combiner::helpers::NormalClone::addDaughter(), combiner::helpers::ShallowClone::addDaughter(), cloneDecayTree(), CompositeCandidate(), ZeeCandidateFilter::filter(), TtSemiLepHypothesis::hypo(), TtFullLepHypothesis::hypo(), TtFullHadHypothesis::hypo(), reco::PFTauDecayMode::PFTauDecayMode(), PFRecoTauDecayModeDeterminator::produce(), BoostedTopProducer::produce(), TruthTauDecayModeProducer::produce(), PatJPsiProducer::produce(), PFPhotonAlgo::RunPFPhoton(), PFElectronAlgo::SetCandidates(), TtSemiEvtSolution::setupHyp(), and reco::WMuNuCandidate::WMuNuCandidate().
{ Candidate * c = cand.clone(); if (s != "") { role_collection::iterator begin = roles_.begin(), end = roles_.end(); bool isFound = (find(begin, end, s) != end); if (isFound) { throw cms::Exception("InvalidReference") << "CompositeCandidate::addDaughter: Already have role with name \"" << s << "\", please clearDaughters, or use a new name\n"; } roles_.push_back(s); CompositeCandidate * c1 = dynamic_cast<CompositeCandidate*>(&*c); if (c1 != 0) { c1->setName(s); } } dau.push_back(c); }
void CompositeCandidate::addDaughter | ( | std::auto_ptr< Candidate > | cand, |
const std::string & | s = "" |
||
) |
add a clone of the passed candidate as daughter
Reimplemented in reco::NamedCompositeCandidate.
Definition at line 145 of file CompositeCandidate.cc.
References begin(), alignmentValidation::c1, dau, end(), Exception, spr::find(), edm::OwnVector< T, P >::push_back(), roles_, and setName().
{ if (s != "") { role_collection::iterator begin = roles_.begin(), end = roles_.end(); bool isFound = (find(begin, end, s) != end); if (isFound) { throw cms::Exception("InvalidReference") << "CompositeCandidate::addDaughter: Already have role with name \"" << s << "\", please clearDaughters, or use a new name\n"; } roles_.push_back(s); CompositeCandidate * c1 = dynamic_cast<CompositeCandidate*>(&*cand); if (c1 != 0) { c1->setName(s); } } dau.push_back(cand); }
void CompositeCandidate::applyRoles | ( | ) |
Reimplemented in reco::NamedCompositeCandidate.
Definition at line 64 of file CompositeCandidate.cc.
References trackerHits::c, alignmentValidation::c1, daughter(), Exception, i, numberOfDaughters(), roles_, and setName().
{ if (roles_.size() == 0) return; // Check if there are the same number of daughters and roles int N1 = roles_.size(); int N2 = numberOfDaughters(); if (N1 != N2) { throw cms::Exception("InvalidReference") << "CompositeCandidate::applyRoles : Number of roles and daughters differ, this is an error.\n"; } // Set up the daughter roles for (int i = 0 ; i < N1; ++i) { std::string role = roles_[i]; Candidate * c = CompositeCandidate::daughter(i); CompositeCandidate * c1 = dynamic_cast<CompositeCandidate *>(c); if (c1 != 0) { c1->setName(role); } } }
Candidate::iterator CompositeCandidate::begin | ( | void | ) | [virtual] |
first daughter iterator
Reimplemented from reco::LeafCandidate.
Definition at line 39 of file CompositeCandidate.cc.
References edm::OwnVector< T, P >::begin(), and dau.
{ return iterator(new iterator_imp_specific(dau.begin())); }
Candidate::const_iterator CompositeCandidate::begin | ( | void | ) | const [virtual] |
first daughter const_iterator
Reimplemented from reco::LeafCandidate.
Definition at line 35 of file CompositeCandidate.cc.
References edm::OwnVector< T, P >::begin(), and dau.
Referenced by addDaughter(), reco::NamedCompositeCandidate::addDaughter(), PFElectronTranslator::correspondingDaughterCandidate(), PFPhotonTranslator::correspondingDaughterCandidate(), and reco::tau::RecoTauPiZeroStripPlugin2::operator()().
{ return const_iterator(new const_iterator_imp_specific(dau.begin())); }
void reco::CompositeCandidate::clearDaughters | ( | ) | [inline] |
clear daughters
Reimplemented in reco::NamedCompositeCandidate.
Definition at line 78 of file CompositeCandidate.h.
References edm::OwnVector< T, P >::clear(), and dau.
Referenced by TtSemiEvtSolution::setupHyp().
void reco::CompositeCandidate::clearRoles | ( | ) | [inline] |
Reimplemented in reco::NamedCompositeCandidate.
Definition at line 80 of file CompositeCandidate.h.
References roles_.
Referenced by TtSemiEvtSolution::setupHyp().
{ roles_.clear(); }
CompositeCandidate * CompositeCandidate::clone | ( | void | ) | const [virtual] |
returns a clone of the candidate
Reimplemented from reco::LeafCandidate.
Reimplemented in reco::NamedCompositeCandidate, reco::VertexCompositeCandidate, reco::IsolatedPFCandidate, reco::PFCandidate, reco::PileUpPFCandidate, pat::CompositeCandidate, pat::PFParticle, and reco::PFTauDecayMode.
Definition at line 33 of file CompositeCandidate.cc.
References CompositeCandidate().
{ return new CompositeCandidate(* this); }
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode)
Reimplemented from reco::LeafCandidate.
Reimplemented in reco::NamedCompositeCandidate.
Definition at line 43 of file CompositeCandidate.cc.
References dau, i, and numberOfDaughters().
Referenced by reco::WMuNuCandidate::acop(), applyRoles(), reco::PFTauDecayMode::chargedPionCandidates(), daughter(), reco::PFTauDecayMode::filteredObjectCandidates(), reco::PFTauDecayMode::neutralPionCandidates(), reco::PFTauDecayMode::PFTauDecayMode(), PFRecoTauDecayModeDeterminator::produce(), ZMuMuUserData::produce(), and MuScleFitMuonSelector::selectMuons().
{ return (i < numberOfDaughters()) ? & dau[ i ] : 0; // i >= 0, since i is unsigned }
return daughter at a given position, i = 0, ... numberOfDaughters() - 1
Reimplemented from reco::LeafCandidate.
Reimplemented in reco::NamedCompositeCandidate.
Definition at line 47 of file CompositeCandidate.cc.
References dau, and numberOfDaughters().
{ Candidate * d = (i < numberOfDaughters()) ? & dau[ i ] : 0; // i >= 0, since i is unsigned return d; }
Candidate * CompositeCandidate::daughter | ( | const std::string & | s | ) | [virtual] |
return daughter with a specified role name
Reimplemented from reco::LeafCandidate.
Reimplemented in reco::NamedCompositeCandidate.
Definition at line 88 of file CompositeCandidate.cc.
References daughter(), Exception, newFWLiteAna::found, i, N, run_regression::ret, and roles_.
const Candidate * CompositeCandidate::daughter | ( | const std::string & | s | ) | const [virtual] |
return daughter with a specified role name
Reimplemented from reco::LeafCandidate.
Reimplemented in reco::NamedCompositeCandidate.
Definition at line 107 of file CompositeCandidate.cc.
References daughter(), Exception, newFWLiteAna::found, i, N, run_regression::ret, and roles_.
Candidate::iterator CompositeCandidate::end | ( | void | ) | [virtual] |
last daughter const_iterator
Reimplemented from reco::LeafCandidate.
Definition at line 41 of file CompositeCandidate.cc.
References dau, and edm::OwnVector< T, P >::end().
{ return iterator(new iterator_imp_specific(dau.end())); }
Candidate::const_iterator CompositeCandidate::end | ( | void | ) | const [virtual] |
last daughter const_iterator
Reimplemented from reco::LeafCandidate.
Definition at line 37 of file CompositeCandidate.cc.
References dau, and edm::OwnVector< T, P >::end().
Referenced by addDaughter(), reco::NamedCompositeCandidate::addDaughter(), PFElectronTranslator::correspondingDaughterCandidate(), PFPhotonTranslator::correspondingDaughterCandidate(), and reco::tau::RecoTauPiZeroStripPlugin2::operator()().
{ return const_iterator(new const_iterator_imp_specific(dau.end())); }
return pointer to mother
Reimplemented from reco::LeafCandidate.
Definition at line 52 of file CompositeCandidate.cc.
{
return 0;
}
std::string reco::CompositeCandidate::name | ( | ) | const [inline] |
get the name of the candidate
Reimplemented in reco::NamedCompositeCandidate.
Definition at line 47 of file CompositeCandidate.h.
References name_.
Referenced by setName().
{ return name_;}
size_t CompositeCandidate::numberOfDaughters | ( | ) | const [virtual] |
number of daughters
Reimplemented from reco::LeafCandidate.
Definition at line 56 of file CompositeCandidate.cc.
References dau, and edm::OwnVector< T, P >::size().
Referenced by TauMVATrainer::analyze(), applyRoles(), reco::NamedCompositeCandidate::applyRoles(), reco::PFTauDecayMode::chargedPionCandidates(), daughter(), reco::PFTauDecayMode::filteredObjectCandidates(), reco::NamedCompositeCandidate::NamedCompositeCandidate(), reco::PFTauDecayMode::neutralPionCandidates(), reco::PFTauDecayMode::pfMasterClones(), reco::PFTauDecayMode::PFTauDecayMode(), PFRecoTauDecayModeDeterminator::produce(), and BoostedTopProducer::produce().
size_t CompositeCandidate::numberOfMothers | ( | ) | const [virtual] |
number of mothers (zero or one in most of but not all the cases)
Reimplemented from reco::LeafCandidate.
Definition at line 58 of file CompositeCandidate.cc.
{ return 0; }
bool CompositeCandidate::overlap | ( | const Candidate & | c2 | ) | const [private, virtual] |
check overlap with another daughter
Reimplemented from reco::LeafCandidate.
Reimplemented in reco::PFCandidate.
Definition at line 60 of file CompositeCandidate.cc.
References Exception.
{ throw cms::Exception("Error") << "can't check overlap internally for CompositeCanddate"; }
role_collection const& reco::CompositeCandidate::roles | ( | ) | const [inline] |
get the roles
Reimplemented in reco::NamedCompositeCandidate.
Definition at line 51 of file CompositeCandidate.h.
References roles_.
Referenced by TtEvent::isHypoValid(), and setRoles().
{ return roles_; }
void reco::CompositeCandidate::setName | ( | std::string | name | ) | [inline] |
set the name of the candidate
Reimplemented in reco::NamedCompositeCandidate.
Definition at line 49 of file CompositeCandidate.h.
Referenced by addDaughter(), and applyRoles().
void reco::CompositeCandidate::setRoles | ( | const role_collection & | roles | ) | [inline] |
set the roles
Reimplemented in reco::NamedCompositeCandidate.
Definition at line 53 of file CompositeCandidate.h.
daughters reco::CompositeCandidate::dau [private] |
collection of daughters
Definition at line 94 of file CompositeCandidate.h.
Referenced by addDaughter(), begin(), clearDaughters(), daughter(), end(), and numberOfDaughters().
std::string reco::CompositeCandidate::name_ [private] |
candidate name
Reimplemented in reco::NamedCompositeCandidate.
Definition at line 98 of file CompositeCandidate.h.
candidate roles
Reimplemented in reco::NamedCompositeCandidate.
Definition at line 100 of file CompositeCandidate.h.
Referenced by addDaughter(), applyRoles(), clearRoles(), CompositeCandidate(), daughter(), roles(), and setRoles().