Imperial Analysis
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ic::CompositeCandidate Class Reference

A candidate built by adding the four-momenta of other candidates. More...

#include "UserCode/ICHiggsTauTau/interface/CompositeCandidate.hh"

+ Inheritance diagram for ic::CompositeCandidate:

Public Types

typedef std::vector< Candidate * >
::const_iterator 
const_iterator
 

Public Member Functions

 CompositeCandidate ()
 
virtual ~CompositeCandidate ()
 
virtual void Print () const
 
void AddCandidate (std::string name, Candidate *cand)
 Add a new Candidate. More...
 
Candidateat (std::size_t const &index) const
 Return a Candidate* using a vector index. Will throw if index is out of range. More...
 
Candidateat (std::string const &label) const
 Return a Candidate* using a label key. Will throw if a Candidate with label does not exist. More...
 
const_iterator begin () const
 Return a const_iterator to the start of the internal vector<Candidate*> More...
 
const_iterator end () const
 Return a const_iterator to the end of the internal vector<Candidate*> More...
 
std::vector< Candidate * > const & AsVector () const
 Return a copy of the internal vector<Candidate*> More...
 
CandidateGetCandidate (std::string name) const
 
CandidateAt (unsigned index) const
 
double PtOf (std::string name) const
 
double ScalarPtSum () const
 
double DeltaR (std::string name1, std::string name2) const
 
double DeltaPhi (std::string name1, std::string name2) const
 
- Public Member Functions inherited from ic::Candidate
 Candidate ()
 
virtual ~Candidate ()
 
 ClassDef (Candidate, 2)
 
Vector const & vector () const
 Four-momentum. More...
 
std::size_t id () const
 Unique identifier. More...
 
double pt () const
 Direct access to the \( p_{\text{T}} \). More...
 
double eta () const
 Direct access to \( \eta \). More...
 
double phi () const
 Direct access to \( \phi \). More...
 
double energy () const
 Direct access to the energy. More...
 
int charge () const
 Electric charge. More...
 
double M () const
 Calculates the candidate mass. More...
 
void set_vector (Vector const &vector)
 Four-momentum. More...
 
void set_id (std::size_t const &id)
 Unique identifier. More...
 
void set_pt (double const &pt)
 Direct access to the \( p_{\text{T}} \). More...
 
void set_eta (double const &eta)
 Direct access to \( \eta \). More...
 
void set_phi (double const &phi)
 Direct access to \( \phi \). More...
 
void set_energy (double const &energy)
 Direct access to the energy. More...
 
void set_charge (int const &charge)
 Electric charge. More...
 

Detailed Description

A candidate built by adding the four-momenta of other candidates.

Pointers to each consituent candidate are stored, and may be retrieved either by label or by index.

Due to the non-persistent nature of the pointers stored in this class it is not possible to write a CompositeCandidate into an ntuple. Instead it should be used as an "on-the-fly" tool to combine multiple candidates during an offline analysis sequence.

Warning
The internal four-momentum is updated as soon as a Candidate is added. If the four-momentum of this Candidate changes later, it will not be reflected in the four-momentum of the CompositeCandidate.

Definition at line 28 of file CompositeCandidate.hh.

Member Typedef Documentation

Definition at line 34 of file CompositeCandidate.hh.

Constructor & Destructor Documentation

ic::CompositeCandidate::CompositeCandidate ( )

Definition at line 9 of file CompositeCandidate.cc.

ic::CompositeCandidate::~CompositeCandidate ( )
virtual

Definition at line 11 of file CompositeCandidate.cc.

Member Function Documentation

void ic::CompositeCandidate::Print ( ) const
virtual

Reimplemented from ic::Candidate.

Definition at line 69 of file CompositeCandidate.cc.

void ic::CompositeCandidate::AddCandidate ( std::string  name,
Candidate cand 
)

Add a new Candidate.

Requires that a Candidate with label "name" has not already been defined

Parameters
nameLabel for the new Candidate
candPointer to the new Candidate

Definition at line 13 of file CompositeCandidate.cc.

Candidate* ic::CompositeCandidate::at ( std::size_t const &  index) const
inline

Return a Candidate* using a vector index. Will throw if index is out of range.

Definition at line 47 of file CompositeCandidate.hh.

Candidate* ic::CompositeCandidate::at ( std::string const &  label) const
inline

Return a Candidate* using a label key. Will throw if a Candidate with label does not exist.

Definition at line 53 of file CompositeCandidate.hh.

const_iterator ic::CompositeCandidate::begin ( ) const
inline

Return a const_iterator to the start of the internal vector<Candidate*>

Definition at line 58 of file CompositeCandidate.hh.

const_iterator ic::CompositeCandidate::end ( ) const
inline

Return a const_iterator to the end of the internal vector<Candidate*>

Definition at line 61 of file CompositeCandidate.hh.

std::vector<Candidate*> const& ic::CompositeCandidate::AsVector ( ) const
inline

Return a copy of the internal vector<Candidate*>

Definition at line 64 of file CompositeCandidate.hh.

Candidate * ic::CompositeCandidate::GetCandidate ( std::string  name) const
Deprecated:
Use at(std::string const&) instead

Definition at line 20 of file CompositeCandidate.cc.

Candidate * ic::CompositeCandidate::At ( unsigned  index) const
Deprecated:
Use at(std::size_t const&) instead

Definition at line 28 of file CompositeCandidate.cc.

double ic::CompositeCandidate::PtOf ( std::string  name) const
Deprecated:
Use a free function or at("name")->pt() instead

Definition at line 32 of file CompositeCandidate.cc.

double ic::CompositeCandidate::ScalarPtSum ( ) const
Deprecated:
Avoid methods that aren't simple getters/setters in the future. Can be replaced by a free function doing something like:
double pt_sum = std::accumulate(begin(), end(), 0.,
[](double x, Candidate* c) { return x + c->pt(); });

Definition at line 40 of file CompositeCandidate.cc.

double ic::CompositeCandidate::DeltaR ( std::string  name1,
std::string  name2 
) const
Deprecated:
Avoid methods that aren't simple getters/setters in the future. Use a free function instead.

Definition at line 48 of file CompositeCandidate.cc.

double ic::CompositeCandidate::DeltaPhi ( std::string  name1,
std::string  name2 
) const
Deprecated:
Avoid methods that aren't simple getters/setters in the future. Use a free function instead.

Definition at line 58 of file CompositeCandidate.cc.


The documentation for this class was generated from the following files: