ATLAS Offline Software
Loading...
Searching...
No Matches
xAOD::CompositeParticle_v1 Class Reference

Description of a composite particle, i.e. More...

#include <CompositeParticle_v1.h>

Inheritance diagram for xAOD::CompositeParticle_v1:
Collaboration diagram for xAOD::CompositeParticle_v1:

Classes

struct  MT
 Define the enumeration of calculation methods for the transverse mass. More...

Public Member Functions

 CompositeParticle_v1 ()
 Default constructor.
void toPersistent ()
 Function preparing the object to be persistified.
Functions implementing additional 4-momentum properties
double px () const
 Get the px momentum component of the particle.
double py () const
 Get the py momentum component of the particle.
double pz () const
 Get the pz momentum component of the particle.
double et () const
 The transverse energy ( \(e_T\)) of the particle.
void setP4 (const FourMom_t &vec)
 Set the 4-vec.
void setPxPyPzE (double px, double py, double pz, double e)
 Set the 4-vec.
void setPx (double px)
 Set the x-component of the momentum.
void setPy (double py)
 Set the y-component of the momentum.
void setPz (double pz)
 Set the z-component of the momentum.
void setE (double e)
 Set the energy.
Functions implementing other particly-type properties
bool hasCharge () const
 Check if this composite particle has its charge set.
float charge () const
 Return the electric charge.
void setCharge (float charge)
 Set the electric charge.
bool hasPdgId () const
 Check if this composite particle has its charge set.
int pdgId () const
 Return the PDG identifier.
void setPdgId (int pdgID)
 Set the PDG identifier.
Functions returning variables that are calculated from 4-momentum

information from constituents.

The 4-momentum is calculated as the sum of 4-momenta of all the constituent particles whos indices are given in the vector. If one of the indices is -1, then missingET will also be used with pz=0 and E=sqrt(mpx*mpx + mpy*mpy).

FourMom_t p4 (const std::vector< int > &partIndices) const
 The total 4-momentum.
FourMom_t p4 (int partIndexA, int partIndexB) const
 Get the four-momentum with two indices.
FourMom_t p4 (int partIndexA, int partIndexB, int partIndexC) const
 Get the four-momentum with three indices.
FourMom_t p4 (int partIndexA, int partIndexB, int partIndexC, int partIndexD) const
 Get the four-momentum with four indices.
double pt (const std::vector< int > &partIndices) const
 The transverse momentum ( \(p_T\)).
double eta (const std::vector< int > &partIndices) const
 The pseudorapidity ( \(\eta\)).
double phi (const std::vector< int > &partIndices) const
 The azimuthal angle ( \(\phi\)).
double m (const std::vector< int > &partIndices) const
 The invariant mass.
double p (const std::vector< int > &partIndices) const
 The total 3-momentum.
double e (const std::vector< int > &partIndices) const
 The total energy.
double rapidity (const std::vector< int > &partIndices) const
 The true rapidity (y).
double px (const std::vector< int > &partIndices) const
 Get the px momentum component.
double py (const std::vector< int > &partIndices) const
 Get the py momentum component.
double pz (const std::vector< int > &partIndices) const
 Get the pz momentum component.
double et (const std::vector< int > &partIndices) const
 The transverse energy ( \(e_T\)) Note that this differs from ( \(p_T\)) for massive particles.
double mt (const std::vector< int > &partIndices, MT::Method method=MT::DEFAULT) const
 Get the transverse mass.
double mt (int partIndexA, int partIndexB=-2, MT::Method method=MT::DEFAULT) const
 Get the transverse mass with only one constituent particle.
Functions implementing handling of constituents
void addPart (const xAOD::IParticle *part, bool updateFourMom=true)
 Add a particle as an additional constituent.
void addPart (const xAOD::IParticleLink &partLink, bool updateFourMom=true)
 Add a particle as an additional constituent.
void addParts (const xAOD::IParticleLinkContainer &partLinkCont, bool updateFourMom=true)
 Add many constituents at the same time Note that the 4-momentum of this CompositeParticle will be updated accordingly, if updateFourMom=true.
void removePart (const xAOD::IParticle *part, bool updateFourMom=true)
 Remove a particle as a constituent from this CompostiteParticle.
void removePart (const xAOD::IParticleLink &partLink, bool updateFourMom=true)
 Remove a particle as a constituent from this CompostiteParticle.
const xAOD::MissingETmissingET () const
 Get the MissingET object that is associated with this CompositeParticle.
void setMissingET (const xAOD::MissingET *met, bool updateFourMom=true)
 Set the MissingET for this CompositeParticle.
void removeMissingET (bool updateFourMom=true)
 Remove the existing MissingET object from this CompositeParticle.
bool contains (const xAOD::MissingET *met) const
 Check if a given xAOD::MissingET object is part of this CompositeParticle.
bool contains (const xAOD::IParticle *part) const
 Check if a given xAOD::IParticle is a constituent.
bool contains (const xAOD::IParticleLink &partLink) const
 Check if a given xAOD::IParticle is a constituent.
std::size_t nParts () const
 Number of constituent particles.
std::size_t nCompParts () const
 Number of constituent CompositeParticles.
std::size_t nPhotons () const
 Number of constituent photons.
std::size_t nTruthPhotons () const
 Number of constituent truth photons.
std::size_t nElectrons () const
 Number of constituent electrons.
std::size_t nTruthElectrons () const
 Number of constituent truth electrons.
std::size_t nMuons () const
 Number of constituent muons.
std::size_t nTruthMuons () const
 Number of constituent truth muons.
std::size_t nTaus () const
 Number of constituent taus.
std::size_t nTruthTaus () const
 Number of constituent truth taus.
std::size_t nLeptons () const
 Number of constituent leptons (electrons, muons, and taus).
std::size_t nTruthLeptons () const
 Number of constituent truth leptons (truth electrons, truth muons, and truth taus).
std::size_t nJets () const
 Number of constituent jets.
std::size_t nTruthParts () const
 Number of constituent xAOD::TruthParticles.
const xAOD::IParticlepart (std::size_t index=0) const
 Get the constituent IParticle number i.
const xAOD::IParticleLinkpartLink (std::size_t index=0) const
 Get the constituent IParticle number i as an ElementLink.
const xAOD::IParticleLinkContainerpartLinks () const
 Get all constituents in one go.
template<typename CONTTYPE>
ConstDataVector< CONTTYPE > * parts () const
 Method to return a DataVector<T>, e.g., a MuonContainer, for all the constituent particles, e.g., of type xAOD::Muon, that this CompositeParticle has.
xAOD::CompositeParticle_v1compPart (const std::vector< int > &partIndices, const std::vector< int > &otherPartIndices=std::vector< int >{}, bool updateFourMom=true) const
 Get a CompositeParticle that is build on the fly from the constituent particles associated to the indices given (missingET is at index=-1).
xAOD::CompositeParticle_v1compPart (int partIndexA, int partIndexB, int partIndexC=-2, bool updateFourMom=true) const
 Get a CompositeParticle that is build on the fly from the constituent particles associated to the indices given (missingET is at index=-1).
const xAOD::CompositeParticle_v1compPart (std::size_t index=0) const
 Get the constituent number i as a CompositeParticle.
const xAOD::Photonphoton (std::size_t index=0) const
 Get the constituent number i as a Photon.
const xAOD::Electronelectron (std::size_t index=0) const
 Get the constituent number i as an Electron.
const xAOD::Muonmuon (std::size_t index=0) const
 Get the constituent number i as an Muon.
const xAOD::TauJettau (std::size_t index=0) const
 Get the constituent number i as a tau.
const xAOD::Jetjet (std::size_t index=0) const
 Get the constituent number i as a Jet.
const xAOD::TruthParticletruthPart (std::size_t index=0) const
 Get the constituent number i as a TruthParticle.
Functions implementing handling of other constituents. These

The constituent iterators are missing for the moment

other particles are stored separetely from the main constituent particles. They will NOT be used to determine the four-momentum of this CompositeParticle. And they will NOT be used for determining the weight (and other properties) of this CompositeParticle. The main idea is that these other particles can be used for keeping track of, e.g., a third lepton to veto on, or sub-threshold jets.

void addOtherPart (const xAOD::IParticle *part)
 Add a particle as an additional other constituent.
void addOtherPart (const xAOD::IParticleLink &partLink)
 Add a particle as an additional other constituent.
void addOtherParts (const xAOD::IParticleLinkContainer &partLinkCont)
 Add many other constituents at the same time.
void removeOtherPart (const xAOD::IParticle *part)
 Remove a particle as an other constituent from this CompostiteParticle.
void removeOtherPart (const xAOD::IParticleLink &partLink)
 Remove a particle as an other constituent from this CompostiteParticle.
bool containsOther (const xAOD::IParticle *part) const
 Check if a given xAOD::IParticle is an other constituent.
bool containsOther (const xAOD::IParticleLink &partLink) const
 Check if a given xAOD::IParticle is an other constituent.
std::size_t nOtherParts () const
 Number of other constituent particles.
std::size_t nOtherCompParts () const
 Number of other constituent CompositeParticles.
std::size_t nOtherPhotons () const
 Number of other constituent photons.
std::size_t nOtherTruthPhotons () const
 Number of other constituent truth photons.
std::size_t nOtherElectrons () const
 Number of other constituent electrons.
std::size_t nOtherTruthElectrons () const
 Number of other constituent truth electrons.
std::size_t nOtherMuons () const
 Number of other constituent muons.
std::size_t nOtherTruthMuons () const
 Number of other constituent truth muons.
std::size_t nOtherTaus () const
 Number of other constituent taus.
std::size_t nOtherTruthTaus () const
 Number of other constituent truth taus.
std::size_t nOtherLeptons () const
 Number of other constituent leptons (electrons, muons, and taus).
std::size_t nOtherTruthLeptons () const
 Number of other constituent truth leptons (truth electrons, truth muons, and truth taus).
std::size_t nOtherJets () const
 Number of other constituent jets.
std::size_t nOtherTruthParts () const
 Number of other constituent xAOD::TruthParticles.
const xAOD::IParticleotherPart (std::size_t index=0) const
 Get the other constituent IParticle number i.
const xAOD::IParticleLinkotherPartLink (std::size_t index=0) const
 Get the other constituent IParticle number i as an ElementLink.
const xAOD::IParticleLinkContainerotherPartLinks () const
 Get all other constituents in one go.
const xAOD::CompositeParticle_v1otherCompPart (std::size_t index=0) const
 Get the other constituent number i as a CompositeParticle.
const xAOD::PhotonotherPhoton (std::size_t index=0) const
 Get the other constituent number i as a Photon.
const xAOD::ElectronotherElectron (std::size_t index=0) const
 Get the other constituent number i as an Electron.
const xAOD::MuonotherMuon (std::size_t index=0) const
 Get the other constituent number i as an Muon.
const xAOD::TauJetotherTau (std::size_t index=0) const
 Get the other constituent number i as a tau.
const xAOD::JetotherJet (std::size_t index=0) const
 Get the other constituent number i as a Jet.
const xAOD::TruthParticleotherTruthPart (std::size_t index=0) const
 Get the other constituent number i as a TruthParticle.
Functions implementing read-only access to auxdata (for python).

The constituent iterators are missing for the moment

This specialization is needed since ROOT 6.02 doesn't yet support C++11 in the TFormula stuff with JIT compilation, see: https://sft.its.cern.ch/jira/browse/ROOT-5083

bool getBool (const std::string &varName) const
 Access to get a variable of type bool (actually, it is stored using type char).
int getInt (const std::string &varName) const
 Access to get a variable of type int.
unsigned int getUInt (const std::string &varName) const
 Access to get a variable of type unsigned int.
float getFloat (const std::string &varName) const
 Access to get a variable of type float.
double getDouble (const std::string &varName) const
 Access to get a variable of type double.
Functions for getting and setting user properties
template<class T>
XAOD_AUXDATA_DEPRECATED T & auxdata (const std::string &name, const std::string &clsname="")
 Fetch an aux data variable, as a non-const reference.
template<class T>
XAOD_AUXDATA_DEPRECATED const T & auxdata (const std::string &name, const std::string &clsname="") const
 Fetch an aux data variable, as a const reference.
template<class T>
XAOD_AUXDATA_DEPRECATED bool isAvailable (const std::string &name, const std::string &clsname="") const
 Check if a user property is available for reading or not.
template<class T>
XAOD_AUXDATA_DEPRECATED bool isAvailableWritable (const std::string &name, const std::string &clsname="") const
 Check if a user property is available for writing or not.

Protected Member Functions

void setPartLinks (const xAOD::IParticleLinkContainer &constitLinks)
 Set all constituents in one go.
void setOtherPartLinks (const xAOD::IParticleLinkContainer &otherPartLinks)
 Set all other constituents in one go.

Functions implementing the xAOD::IParticle interface

typedef IParticle::FourMom_t FourMom_t
 Definition of the 4-momentum type.
typedef ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > GenVecFourMom_t
 Base 4 Momentum type (GenVector).
virtual double pt () const
 The transverse momentum ( \(p_T\)) of the particle.
virtual double eta () const
 The pseudorapidity ( \(\eta\)) of the particle.
virtual double phi () const
 The azimuthal angle ( \(\phi\)) of the particle.
virtual double m () const
 The invariant mass of the particle.
virtual double e () const
 The total energy of the particle.
virtual double rapidity () const
 The true rapidity (y) of the particle.
virtual FourMom_t p4 () const
 The full 4-momentum of the particle.
GenVecFourMom_t genvecP4 () const
 The full 4-momentum of the particle : GenVector form Note: can be slower than just p4 for this class; added for consistency.
virtual Type::ObjectType type () const
 The type of the object as a simple enumeration.

Functions returning variables that are calculated from

information from constituents (not only using their 4-momenta).

float weight (const std::vector< std::string > &varNames, const std::vector< int > &partIndices={}) const
 Get the weight for this xAOD::CompositeParticle by providing a vector of variable names that will be looked for.
float weight (const std::string &varNameA) const
 Get the weight for this xAOD::CompositeParticle.
float weight (const std::string &varNameA, const std::string &varNameB) const
float weight (const std::string &varNameA, const std::string &varNameB, const std::string &varNameC) const
float weight (const std::string &varNameA, const std::string &varNameB, const std::string &varNameC, const std::string &varNameD) const
float weight (const std::string &varNameA, const std::string &varNameB, const std::string &varNameC, const std::string &varNameD, const std::string &varNameE) const
float weightHelper (const xAOD::IParticle *part, const xAOD::IParticle::ConstAccessor< float > &varAcc) const
 This is a private helper method to calculate the weight.

Detailed Description

Description of a composite particle, i.e.

a particle that is composed out of several other particles/objects, e.g., a Z boson that consists out of two muons.

Author
Karsten Koeneke karst.nosp@m.en.k.nosp@m.oenek.nosp@m.e@ce.nosp@m.rn.ch
Revision
696023
Date
2015-09-21 19:09:08 +0200 (Mon, 21 Sep 2015)

Definition at line 45 of file CompositeParticle_v1.h.

Member Typedef Documentation

◆ FourMom_t

Definition of the 4-momentum type.

Definition at line 68 of file CompositeParticle_v1.h.

◆ GenVecFourMom_t

typedef ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > xAOD::CompositeParticle_v1::GenVecFourMom_t

Base 4 Momentum type (GenVector).

Definition at line 74 of file CompositeParticle_v1.h.

Constructor & Destructor Documentation

◆ CompositeParticle_v1()

xAOD::CompositeParticle_v1::CompositeParticle_v1 ( )

Default constructor.

Definition at line 27 of file CompositeParticle_v1.cxx.

28 : IParticle() {
29 }
IParticle()=default

Member Function Documentation

◆ addOtherPart() [1/2]

void xAOD::CompositeParticle_v1::addOtherPart ( const xAOD::IParticle * part)

Add a particle as an additional other constituent.

◆ addOtherPart() [2/2]

void xAOD::CompositeParticle_v1::addOtherPart ( const xAOD::IParticleLink & partLink)

Add a particle as an additional other constituent.

Definition at line 901 of file CompositeParticle_v1.cxx.

901 {
902 // Check if we have a valid ElementLink
903 if ( ! partLink.isValid() ) {
904 // This should not be... throw an error.
905 throw std::runtime_error("Got an invalid ElementLink when adding constituent!");
906 }
907 xAOD::IParticleLinkContainer& otherPartLinks = otherPartLinksAcc( *this );
908
909 // Add the given ElementLink as a constituent of this composite particle
910 otherPartLinks.push_back( partLink );
911 return;
912 }
const xAOD::IParticleLink & partLink(std::size_t index=0) const
Get the constituent IParticle number i as an ElementLink.
const xAOD::IParticleLinkContainer & otherPartLinks() const
Get all other constituents in one go.
IParticleLinkContainer_v1 IParticleLinkContainer
Define the latest version of the IParticleLinkContainer class.

◆ addOtherParts()

void xAOD::CompositeParticle_v1::addOtherParts ( const xAOD::IParticleLinkContainer & partLinkCont)

Add many other constituents at the same time.

Definition at line 916 of file CompositeParticle_v1.cxx.

916 {
917 for ( xAOD::IParticleLinkContainer::const_iterator
918 constitItr = partLinkCont.begin(),
919 constitItrEnd = partLinkCont.end();
920 constitItr != constitItrEnd;
921 ++constitItr ) {
922 const xAOD::IParticleLink& currentLink = *constitItr;
923 this->addOtherPart( currentLink );
924 }
925 return;
926 }
void addOtherPart(const xAOD::IParticle *part)
Add a particle as an additional other constituent.
IParticleLink_v1 IParticleLink
Define the latest version of the IParticleLink class.

◆ addPart() [1/2]

void xAOD::CompositeParticle_v1::addPart ( const xAOD::IParticle * part,
bool updateFourMom = true )

Add a particle as an additional constituent.

Note that the 4-momentum of this CompositeParticle will be updated accordingly, if updateFourMom=true.

◆ addPart() [2/2]

void xAOD::CompositeParticle_v1::addPart ( const xAOD::IParticleLink & partLink,
bool updateFourMom = true )

Add a particle as an additional constituent.

Note that the 4-momentum of this CompositeParticle will be updated accordingly, if updateFourMom=true.

Definition at line 499 of file CompositeParticle_v1.cxx.

499 {
500 // Check if we have a valid ElementLink
501 if ( ! partLink.isValid() ) {
502 // This should not be... throw an error.
503 throw std::runtime_error("Got an invalid ElementLink when adding constituent!");
504 }
505 xAOD::IParticleLinkContainer& constitLinks = partLinksAcc( *this );
506
507 // Update the four-momentum of this composite particle, if requested
508 if ( updateFourMom ) {
509 this->setP4( this->p4() + (*partLink)->p4() );
510 // Cannot add charge automatically as this is NOT part of the xAOD::IParticle interface
511 //this->setCharge( this->charge() + (*partLink)->charge() );
512 }
513
514 // Add the given ElementLink as a constituent of this composite particle
515 constitLinks.push_back( partLink );
516 return;
517 }
virtual FourMom_t p4() const
The full 4-momentum of the particle.
void setP4(const FourMom_t &vec)
Set the 4-vec.

◆ addParts()

void xAOD::CompositeParticle_v1::addParts ( const xAOD::IParticleLinkContainer & partLinkCont,
bool updateFourMom = true )

Add many constituents at the same time Note that the 4-momentum of this CompositeParticle will be updated accordingly, if updateFourMom=true.

Definition at line 521 of file CompositeParticle_v1.cxx.

522 {
523 for ( xAOD::IParticleLinkContainer::const_iterator
524 constitItr = partLinkCont.begin(),
525 constitItrEnd = partLinkCont.end();
526 constitItr != constitItrEnd;
527 ++constitItr ) {
528 const xAOD::IParticleLink& currentLink = *constitItr;
529 this->addPart( currentLink, updateFourMom );
530 }
531 return;
532 }
void addPart(const xAOD::IParticle *part, bool updateFourMom=true)
Add a particle as an additional constituent.

◆ auxdata() [1/2]

template<class T>
XAOD_AUXDATA_DEPRECATED T & xAOD::IParticle::auxdata ( const std::string & name,
const std::string & clsname = "" )
inlineinherited

Fetch an aux data variable, as a non-const reference.

This function provides an easy way for users to decorate objects with auxiliary data.

Take note that this function is slow. Should not be used inside time-critical code.

Parameters
nameName of the aux variable
clsnameThe name of the associated class. May be blank
Returns
A modifiable reference to the decoration

Definition at line 98 of file Event/xAOD/xAODBase/xAODBase/IParticle.h.

99 {
100
101 return SG::Accessor< T >(name, clsname)(*this);
102 }
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:573

◆ auxdata() [2/2]

template<class T>
XAOD_AUXDATA_DEPRECATED const T & xAOD::IParticle::auxdata ( const std::string & name,
const std::string & clsname = "" ) const
inlineinherited

Fetch an aux data variable, as a const reference.

This function provides an easy way for users to retrieve auxiliary decorations from an object.

Take note that this function is slow. Should not be used inside time-critical code.

Parameters
nameName of the aux variable
clsnameThe name of the associated class. May be blank
Returns
A constant reference to the decoration

Definition at line 118 of file Event/xAOD/xAODBase/xAODBase/IParticle.h.

119 {
120
121 return SG::ConstAccessor< T >( name, clsname )( *this );
122 }
SG::ConstAccessor< T, ALLOC > ConstAccessor
Definition AuxElement.h:570

◆ charge()

float xAOD::CompositeParticle_v1::charge ( ) const

Return the electric charge.

Definition at line 182 of file CompositeParticle_v1.cxx.

182 {
183 if ( chargeAcc.isAvailable(*this) ) {
184 // If we have stored the charge with this CompositeParticle, just use it.
185 return chargeAcc(*this);
186 }
187 else {
188 // Otherwise, try to re-calculate it from the constituents
189 float charge = 0.0;
190 // Sum up the charges of all constituents, if all have it
191 std::size_t nParts = this->nParts();
192 for ( std::size_t i=0; i<nParts; ++i ) {
193 const xAOD::IParticle* part = this->part(i);
194 if (!part) {
195 throw std::runtime_error("Got a zero pointer to an xAOD::IParticle!");
196 }
197 if ( chargeAcc.isAvailable(*part) ) {
198 charge += chargeAcc(*part);
199 }
200 else if ( part->type() != xAOD::Type::CompositeParticle ) {
201 // We have an electron
202 const xAOD::CompositeParticle_v1* compPart = static_cast<const xAOD::CompositeParticle_v1*>(part);
203 charge += compPart->charge();
204 }
205 } // End: loop over all constituent particles
206 return charge;
207 }
208 }
const xAOD::IParticle * part(std::size_t index=0) const
Get the constituent IParticle number i.
std::size_t nParts() const
Number of constituent particles.
float charge() const
Return the electric charge.
xAOD::CompositeParticle_v1 * compPart(const std::vector< int > &partIndices, const std::vector< int > &otherPartIndices=std::vector< int >{}, bool updateFourMom=true) const
Get a CompositeParticle that is build on the fly from the constituent particles associated to the ind...
@ CompositeParticle
Particle composed of other particles.
Definition ObjectType.h:95
static const SG::AuxElement::Accessor< float > chargeAcc("charge")

◆ compPart() [1/3]

xAOD::CompositeParticle_v1 * xAOD::CompositeParticle_v1::compPart ( const std::vector< int > & partIndices,
const std::vector< int > & otherPartIndices = std::vector< int >{},
bool updateFourMom = true ) const

Get a CompositeParticle that is build on the fly from the constituent particles associated to the indices given (missingET is at index=-1).

If the second list of idices is given, also the "other" particles will be used in building this CompositeParticle.

◆ compPart() [2/3]

xAOD::CompositeParticle_v1 * xAOD::CompositeParticle_v1::compPart ( int partIndexA,
int partIndexB,
int partIndexC = -2,
bool updateFourMom = true ) const
inline

Get a CompositeParticle that is build on the fly from the constituent particles associated to the indices given (missingET is at index=-1).

This specialization to the above method is needed since ROOT 6.02 doesn't yet support C++11 in the TFormula stuff with JIT compilation, see: https://sft.its.cern.ch/jira/browse/ROOT-5083

Definition at line 418 of file CompositeParticle_v1.h.

419 {
420 if ( partIndexC==-2 ) {
421 return this->compPart( std::vector<int>{partIndexA, partIndexB}, std::vector<int>{}, updateFourMom );
422 }
423 return this->compPart( std::vector<int>{partIndexA, partIndexB, partIndexC}, std::vector<int>{}, updateFourMom );
424 }

◆ compPart() [3/3]

const xAOD::CompositeParticle_v1 * xAOD::CompositeParticle_v1::compPart ( std::size_t index = 0) const
inline

Get the constituent number i as a CompositeParticle.

If the cast to CompositeParticle fails for a constituent, a null pointer is returned.

Definition at line 642 of file CompositeParticle_v1.h.

643{
644 const xAOD::IParticle* ipart = this->part(index);
645 if ( ipart->type() != xAOD::Type::CompositeParticle ){ return 0; }
646 return static_cast<const xAOD::CompositeParticle_v1*>(ipart);
647}
virtual Type::ObjectType type() const =0
The type of the object as a simple enumeration.

◆ contains() [1/3]

bool xAOD::CompositeParticle_v1::contains ( const xAOD::IParticle * part) const

Check if a given xAOD::IParticle is a constituent.

Definition at line 687 of file CompositeParticle_v1.cxx.

687 {
688 const xAOD::IParticleLinkContainer& constitLinks = this->partLinks();
689 for ( xAOD::IParticleLinkContainer::const_iterator
690 constitItr = constitLinks.begin(),
691 constitItrEnd = constitLinks.end();
692 constitItr != constitItrEnd;
693 ++constitItr ) {
694 const xAOD::IParticleLink& currentLink = *constitItr;
695 if ( ! currentLink.isValid() ) continue;
696 const xAOD::IParticle* currentPart = *currentLink;
697 if ( part == currentPart ) {
698 return true;
699 }
700 }
701 return false;
702 }
const xAOD::IParticleLinkContainer & partLinks() const
Get all constituents in one go.

◆ contains() [2/3]

bool xAOD::CompositeParticle_v1::contains ( const xAOD::IParticleLink & partLink) const

Check if a given xAOD::IParticle is a constituent.

Definition at line 706 of file CompositeParticle_v1.cxx.

706 {
707 const xAOD::IParticleLinkContainer& constitLinks = this->partLinks();
708 for ( xAOD::IParticleLinkContainer::const_iterator
709 constitItr = constitLinks.begin(),
710 constitItrEnd = constitLinks.end();
711 constitItr != constitItrEnd;
712 ++constitItr ) {
713 const xAOD::IParticleLink& currentLink = *constitItr;
714 if ( partLink == currentLink ) {
715 return true;
716 }
717 }
718 return false;
719 }

◆ contains() [3/3]

bool xAOD::CompositeParticle_v1::contains ( const xAOD::MissingET * met) const

Check if a given xAOD::MissingET object is part of this CompositeParticle.

Definition at line 660 of file CompositeParticle_v1.cxx.

660 {
661 const ElementLink<xAOD::MissingETContainer>& metLink = metLinkAcc(*this);
662 // Check if we have a valid ElementLink. If not, return false. This is
663 // because the given met that we check against obviously exists, meaning
664 // that if it would be the same, the ElementLink should have been valid.
665 if ( ! metLink.isValid() ) {
666 return false;
667 }
668 const xAOD::MissingET* thisMet = *metLink;
669
670 // Check if the pointers are equal
671 if ( thisMet == met ) {
672 return true;
673 }
674
675 // Use the MissingET == operator
676 if ( (*thisMet) == (*met) ) {
677 return true;
678 }
679
680 // Otherwise, return false
681 return false;
682 }
MissingET_v1 MissingET
Version control by type defintion.
static const SG::AuxElement::Accessor< ElementLink< xAOD::MissingETContainer > > metLinkAcc("missingETLink")

◆ containsOther() [1/2]

bool xAOD::CompositeParticle_v1::containsOther ( const xAOD::IParticle * part) const

Check if a given xAOD::IParticle is an other constituent.

Definition at line 975 of file CompositeParticle_v1.cxx.

975 {
977 for ( xAOD::IParticleLinkContainer::const_iterator
978 constitItr = otherPartLinks.begin(),
979 constitItrEnd = otherPartLinks.end();
980 constitItr != constitItrEnd;
981 ++constitItr ) {
982 const xAOD::IParticleLink& currentLink = *constitItr;
983 if ( ! currentLink.isValid() ) continue;
984 const xAOD::IParticle* currentPart = *currentLink;
985 if ( part == currentPart ) {
986 return true;
987 }
988 }
989 return false;
990 }

◆ containsOther() [2/2]

bool xAOD::CompositeParticle_v1::containsOther ( const xAOD::IParticleLink & partLink) const

Check if a given xAOD::IParticle is an other constituent.

Definition at line 994 of file CompositeParticle_v1.cxx.

994 {
996 for ( xAOD::IParticleLinkContainer::const_iterator
997 constitItr = otherPartLinks.begin(),
998 constitItrEnd = otherPartLinks.end();
999 constitItr != constitItrEnd;
1000 ++constitItr ) {
1001 const xAOD::IParticleLink& currentLink = *constitItr;
1002 if ( partLink == currentLink ) {
1003 return true;
1004 }
1005 }
1006 return false;
1007 }

◆ e() [1/2]

double xAOD::CompositeParticle_v1::e ( ) const
virtual

The total energy of the particle.

Implements xAOD::IParticle.

Definition at line 107 of file CompositeParticle_v1.cxx.

107 {
108 return p4().E();
109 }

◆ e() [2/2]

double xAOD::CompositeParticle_v1::e ( const std::vector< int > & partIndices) const

The total energy.

◆ electron()

const xAOD::Electron * xAOD::CompositeParticle_v1::electron ( std::size_t index = 0) const
inline

Get the constituent number i as an Electron.

If the cast to Electron fails for a constituent, a null pointer is returned.

Definition at line 662 of file CompositeParticle_v1.h.

663{
664 const xAOD::IParticle* ipart = this->part(index);
665 if ( ipart->type() != xAOD::Type::Electron ){ return 0; }
666 return static_cast<const xAOD::Electron*>(ipart);
667}
@ Electron
The object is an electron.
Definition ObjectType.h:46
Electron_v1 Electron
Definition of the current "egamma version".

◆ et() [1/2]

double xAOD::CompositeParticle_v1::et ( ) const

The transverse energy ( \(e_T\)) of the particle.

Note that this differs from ( \(p_T\)) for massive particles.

Definition at line 127 of file CompositeParticle_v1.cxx.

127 {
128 return p4().Et();
129 }

◆ et() [2/2]

double xAOD::CompositeParticle_v1::et ( const std::vector< int > & partIndices) const

The transverse energy ( \(e_T\)) Note that this differs from ( \(p_T\)) for massive particles.

◆ eta() [1/2]

double xAOD::CompositeParticle_v1::eta ( ) const
virtual

The pseudorapidity ( \(\eta\)) of the particle.

Implements xAOD::IParticle.

Definition at line 48 of file CompositeParticle_v1.cxx.

48 {
49 return p4().Eta();
50 }

◆ eta() [2/2]

double xAOD::CompositeParticle_v1::eta ( const std::vector< int > & partIndices) const

The pseudorapidity ( \(\eta\)).

◆ genvecP4()

CompositeParticle_v1::GenVecFourMom_t xAOD::CompositeParticle_v1::genvecP4 ( ) const

The full 4-momentum of the particle : GenVector form Note: can be slower than just p4 for this class; added for consistency.

Definition at line 83 of file CompositeParticle_v1.cxx.

83 {
84 if ( accPx.isAvailable(*this) && accPy.isAvailable(*this)
85 && accPz.isAvailable(*this) && accE.isAvailable(*this) ) {
86 // We have everything stored with this CompositeParticle. Just use it.
87 const double px = static_cast<double>(accPx(*this));
88 const double py = static_cast<double>(accPy(*this));
89 const double pz = static_cast<double>(accPz(*this));
90 const double e = static_cast<double>(accE(*this));
91 return GenVecFourMom_t( px, py, pz, e );
92 }
93 else {
94 // Not everything is stored, we need to re-calculate the p4 based on the constituents.
95 // Create an empty vector such that the subsequent call will use all constituents.
96 const std::vector<int> partIndices;
97 FourMom_t fourmom = p4(partIndices);
98 return GenVecFourMom_t(fourmom.Px(), fourmom.Py(), fourmom.Pz(), fourmom.E());
99 }
100 }
double pz() const
Get the pz momentum component of the particle.
double py() const
Get the py momentum component of the particle.
IParticle::FourMom_t FourMom_t
Definition of the 4-momentum type.
double px() const
Get the px momentum component of the particle.
virtual double e() const
The total energy of the particle.
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > GenVecFourMom_t
Base 4 Momentum type (GenVector).
static const SG::AuxElement::Accessor< float > accE("e")
static const SG::AuxElement::Accessor< float > accPy("py")
static const SG::AuxElement::Accessor< float > accPx("px")
static const SG::AuxElement::Accessor< float > accPz("pz")

◆ getBool()

bool xAOD::CompositeParticle_v1::getBool ( const std::string & varName) const
inline

Access to get a variable of type bool (actually, it is stored using type char).

Definition at line 589 of file CompositeParticle_v1.h.

589 {
590 return SG::ConstAccessor<bool>(varName)(*this);
591 }

◆ getDouble()

double xAOD::CompositeParticle_v1::getDouble ( const std::string & varName) const
inline

Access to get a variable of type double.

Definition at line 609 of file CompositeParticle_v1.h.

609 {
610 return SG::ConstAccessor<double>(varName)(*this);
611 }

◆ getFloat()

float xAOD::CompositeParticle_v1::getFloat ( const std::string & varName) const
inline

Access to get a variable of type float.

Definition at line 604 of file CompositeParticle_v1.h.

604 {
605 return SG::ConstAccessor<float>(varName)(*this);
606 }

◆ getInt()

int xAOD::CompositeParticle_v1::getInt ( const std::string & varName) const
inline

Access to get a variable of type int.

Definition at line 594 of file CompositeParticle_v1.h.

594 {
595 return SG::ConstAccessor<int>(varName)(*this);
596 }

◆ getUInt()

unsigned int xAOD::CompositeParticle_v1::getUInt ( const std::string & varName) const
inline

Access to get a variable of type unsigned int.

Definition at line 599 of file CompositeParticle_v1.h.

599 {
600 return SG::ConstAccessor<unsigned int>(varName)(*this);
601 }

◆ hasCharge()

setPy setE bool xAOD::CompositeParticle_v1::hasCharge ( ) const

Check if this composite particle has its charge set.

Definition at line 177 of file CompositeParticle_v1.cxx.

177 {
178 return chargeAcc.isAvailable( *this );
179 }

◆ hasPdgId()

bool xAOD::CompositeParticle_v1::hasPdgId ( ) const

Check if this composite particle has its charge set.

Definition at line 217 of file CompositeParticle_v1.cxx.

217 {
218 return pdgAcc.isAvailable( *this );
219 }
static const SG::AuxElement::Accessor< int > pdgAcc("pdgId")

◆ isAvailable()

template<class T>
XAOD_AUXDATA_DEPRECATED bool xAOD::IParticle::isAvailable ( const std::string & name,
const std::string & clsname = "" ) const
inlineinherited

Check if a user property is available for reading or not.

This function should be used to check if a user property which may or may not exist, is set on the object.

Parameters
nameName of the auxiliary variable
clsnameThe name of the associated class. May be blank
Returns
Whether the decoration exists or not

Definition at line 135 of file Event/xAOD/xAODBase/xAODBase/IParticle.h.

136 {
137
138 return SG::ConstAccessor< T >(name, clsname).isAvailable(*this);
139 }
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.

◆ isAvailableWritable()

template<class T>
XAOD_AUXDATA_DEPRECATED bool xAOD::IParticle::isAvailableWritable ( const std::string & name,
const std::string & clsname = "" ) const
inlineinherited

Check if a user property is available for writing or not.

This function can be used to check whether it will be possible to set a user property on the object.

Parameters
nameName of the auxiliary variable
clsnameThe name of the associated class. May be blank
Returns
Whether the decoration is possible to set

Definition at line 152 of file Event/xAOD/xAODBase/xAODBase/IParticle.h.

153 {
154
155 return SG::Accessor< T >(name, clsname).isAvailableWritable(*this);
156 }
bool isAvailableWritable(ELT &e) const
Test to see if this variable exists in the store and is writable.

◆ jet()

const xAOD::Jet * xAOD::CompositeParticle_v1::jet ( std::size_t index = 0) const
inline

Get the constituent number i as a Jet.

If the cast to Jet fails for a constituent, a null pointer is returned.

Definition at line 692 of file CompositeParticle_v1.h.

693{
694 const xAOD::IParticle* ipart = this->part(index);
695 if ( ipart->type() != xAOD::Type::Jet ){ return 0; }
696 return static_cast<const xAOD::Jet*>(ipart);
697}
@ Jet
The object is a jet.
Definition ObjectType.h:40
Jet_v1 Jet
Definition of the current "jet version".

◆ m() [1/2]

double xAOD::CompositeParticle_v1::m ( ) const
virtual

The invariant mass of the particle.

Implements xAOD::IParticle.

Definition at line 56 of file CompositeParticle_v1.cxx.

56 {
57 return p4().M();
58 }

◆ m() [2/2]

double xAOD::CompositeParticle_v1::m ( const std::vector< int > & partIndices) const

The invariant mass.

◆ missingET()

const xAOD::MissingET * xAOD::CompositeParticle_v1::missingET ( ) const

Get the MissingET object that is associated with this CompositeParticle.

If no (valid) MissingET object is associated with this CompositeParticle, a null pointer will be returned

Definition at line 593 of file CompositeParticle_v1.cxx.

593 {
594 if ( !(metLinkAcc.isAvailable(*this)) ) {
595 return nullptr;
596 }
597 const ElementLink<xAOD::MissingETContainer>& metLink = metLinkAcc(*this);
598 // Check if we have a valid ElementLink
599 if ( ! metLink.isValid() ) {
600 return nullptr;
601 }
602 return *metLink;
603 }

◆ mt() [1/2]

double xAOD::CompositeParticle_v1::mt ( const std::vector< int > & partIndices,
MT::Method method = MT::DEFAULT ) const

Get the transverse mass.

Specify which calculation method to use as an optional additional argument.

◆ mt() [2/2]

double xAOD::CompositeParticle_v1::mt ( int partIndexA,
int partIndexB = -2,
MT::Method method = MT::DEFAULT ) const
inline

Get the transverse mass with only one constituent particle.

Specify which calculation method to use as an optional additional argument. This specialization to the above method is needed since ROOT 6.02 doesn't yet support C++11 in the TFormula stuff with JIT compilation, see: https://sft.its.cern.ch/jira/browse/ROOT-5083

Definition at line 205 of file CompositeParticle_v1.h.

205 {
206 if ( partIndexB==-2 ) {
207 return this->mt( std::vector<int>{partIndexA}, method );
208 }
209 return this->mt( std::vector<int>{partIndexA, partIndexB}, method );
210 }
double mt(const std::vector< int > &partIndices, MT::Method method=MT::DEFAULT) const
Get the transverse mass.

◆ muon()

const xAOD::Muon * xAOD::CompositeParticle_v1::muon ( std::size_t index = 0) const
inline

Get the constituent number i as an Muon.

If the cast to Muon fails for a constituent, a null pointer is returned.

Definition at line 672 of file CompositeParticle_v1.h.

673{
674 const xAOD::IParticle* ipart = this->part(index);
675 if ( ipart->type() != xAOD::Type::Muon ){ return 0; }
676 return static_cast<const xAOD::Muon*>(ipart);
677}
@ Muon
The object is a muon.
Definition ObjectType.h:48
Muon_v1 Muon
Reference the current persistent version:

◆ nCompParts()

std::size_t xAOD::CompositeParticle_v1::nCompParts ( ) const

Number of constituent CompositeParticles.

◆ nElectrons()

std::size_t xAOD::CompositeParticle_v1::nElectrons ( ) const

Number of constituent electrons.

◆ nJets()

std::size_t xAOD::CompositeParticle_v1::nJets ( ) const

Number of constituent jets.

◆ nLeptons()

std::size_t xAOD::CompositeParticle_v1::nLeptons ( ) const

Number of constituent leptons (electrons, muons, and taus).

Definition at line 750 of file CompositeParticle_v1.cxx.

750 {
751 return this->nElectrons() + this->nMuons() + this->nTaus();
752 }
std::size_t nElectrons() const
Number of constituent electrons.
std::size_t nMuons() const
Number of constituent muons.
std::size_t nTaus() const
Number of constituent taus.

◆ nMuons()

std::size_t xAOD::CompositeParticle_v1::nMuons ( ) const

Number of constituent muons.

◆ nOtherCompParts()

std::size_t xAOD::CompositeParticle_v1::nOtherCompParts ( ) const

Number of other constituent CompositeParticles.

◆ nOtherElectrons()

std::size_t xAOD::CompositeParticle_v1::nOtherElectrons ( ) const

Number of other constituent electrons.

◆ nOtherJets()

std::size_t xAOD::CompositeParticle_v1::nOtherJets ( ) const

Number of other constituent jets.

◆ nOtherLeptons()

std::size_t xAOD::CompositeParticle_v1::nOtherLeptons ( ) const

Number of other constituent leptons (electrons, muons, and taus).

Definition at line 1038 of file CompositeParticle_v1.cxx.

1038 {
1039 return this->nOtherElectrons() + this->nOtherMuons() + this->nOtherTaus();
1040 }
std::size_t nOtherMuons() const
Number of other constituent muons.
std::size_t nOtherElectrons() const
Number of other constituent electrons.
std::size_t nOtherTaus() const
Number of other constituent taus.

◆ nOtherMuons()

std::size_t xAOD::CompositeParticle_v1::nOtherMuons ( ) const

Number of other constituent muons.

◆ nOtherParts()

std::size_t xAOD::CompositeParticle_v1::nOtherParts ( ) const

Number of other constituent particles.

Definition at line 1010 of file CompositeParticle_v1.cxx.

1010 {
1011 if( otherPartLinksAcc.isAvailable( *this ) ) {
1012 return otherPartLinksAcc( *this ).size();
1013 }
1014 return 0;
1015 }

◆ nOtherPhotons()

std::size_t xAOD::CompositeParticle_v1::nOtherPhotons ( ) const

Number of other constituent photons.

◆ nOtherTaus()

std::size_t xAOD::CompositeParticle_v1::nOtherTaus ( ) const

Number of other constituent taus.

◆ nOtherTruthElectrons()

std::size_t xAOD::CompositeParticle_v1::nOtherTruthElectrons ( ) const

Number of other constituent truth electrons.

◆ nOtherTruthLeptons()

std::size_t xAOD::CompositeParticle_v1::nOtherTruthLeptons ( ) const

Number of other constituent truth leptons (truth electrons, truth muons, and truth taus).

Definition at line 1065 of file CompositeParticle_v1.cxx.

1065 {
1066 return this->nOtherTruthElectrons() + this->nOtherTruthMuons() + this->nOtherTruthTaus();
1067 }
std::size_t nOtherTruthTaus() const
Number of other constituent truth taus.
std::size_t nOtherTruthMuons() const
Number of other constituent truth muons.
std::size_t nOtherTruthElectrons() const
Number of other constituent truth electrons.

◆ nOtherTruthMuons()

std::size_t xAOD::CompositeParticle_v1::nOtherTruthMuons ( ) const

Number of other constituent truth muons.

◆ nOtherTruthParts()

std::size_t xAOD::CompositeParticle_v1::nOtherTruthParts ( ) const

Number of other constituent xAOD::TruthParticles.

◆ nOtherTruthPhotons()

std::size_t xAOD::CompositeParticle_v1::nOtherTruthPhotons ( ) const

Number of other constituent truth photons.

◆ nOtherTruthTaus()

std::size_t xAOD::CompositeParticle_v1::nOtherTruthTaus ( ) const

Number of other constituent truth taus.

◆ nParts()

std::size_t xAOD::CompositeParticle_v1::nParts ( ) const

Number of constituent particles.

Note that MissingET is NOT counted as a constituent in this context

Definition at line 722 of file CompositeParticle_v1.cxx.

722 {
723 if( partLinksAcc.isAvailable( *this ) ) {
724 return partLinksAcc( *this ).size();
725 }
726 return 0;
727 }

◆ nPhotons()

std::size_t xAOD::CompositeParticle_v1::nPhotons ( ) const

Number of constituent photons.

◆ nTaus()

std::size_t xAOD::CompositeParticle_v1::nTaus ( ) const

Number of constituent taus.

◆ nTruthElectrons()

std::size_t xAOD::CompositeParticle_v1::nTruthElectrons ( ) const

Number of constituent truth electrons.

◆ nTruthLeptons()

std::size_t xAOD::CompositeParticle_v1::nTruthLeptons ( ) const

Number of constituent truth leptons (truth electrons, truth muons, and truth taus).

Definition at line 777 of file CompositeParticle_v1.cxx.

777 {
778 return this->nTruthElectrons() + this->nTruthMuons() + this->nTruthTaus();
779 }
std::size_t nTruthElectrons() const
Number of constituent truth electrons.
std::size_t nTruthTaus() const
Number of constituent truth taus.
std::size_t nTruthMuons() const
Number of constituent truth muons.

◆ nTruthMuons()

std::size_t xAOD::CompositeParticle_v1::nTruthMuons ( ) const

Number of constituent truth muons.

◆ nTruthParts()

std::size_t xAOD::CompositeParticle_v1::nTruthParts ( ) const

Number of constituent xAOD::TruthParticles.

◆ nTruthPhotons()

std::size_t xAOD::CompositeParticle_v1::nTruthPhotons ( ) const

Number of constituent truth photons.

◆ nTruthTaus()

std::size_t xAOD::CompositeParticle_v1::nTruthTaus ( ) const

Number of constituent truth taus.

◆ otherCompPart()

const xAOD::CompositeParticle_v1 * xAOD::CompositeParticle_v1::otherCompPart ( std::size_t index = 0) const
inline

Get the other constituent number i as a CompositeParticle.

If the cast to CompositeParticle fails for a constituent, a null pointer is returned.

Definition at line 713 of file CompositeParticle_v1.h.

714{
715 const xAOD::IParticle* ipart = this->otherPart(index);
716 if ( ipart->type() != xAOD::Type::CompositeParticle ){ return 0; }
717 return static_cast<const xAOD::CompositeParticle_v1*>(ipart);
718}
const xAOD::IParticle * otherPart(std::size_t index=0) const
Get the other constituent IParticle number i.

◆ otherElectron()

const xAOD::Electron * xAOD::CompositeParticle_v1::otherElectron ( std::size_t index = 0) const
inline

Get the other constituent number i as an Electron.

If the cast to Electron fails for a constituent, a null pointer is returned.

Definition at line 733 of file CompositeParticle_v1.h.

734{
735 const xAOD::IParticle* ipart = this->otherPart(index);
736 if ( ipart->type() != xAOD::Type::Electron ){ return 0; }
737 return static_cast<const xAOD::Electron*>(ipart);
738}

◆ otherJet()

const xAOD::Jet * xAOD::CompositeParticle_v1::otherJet ( std::size_t index = 0) const
inline

Get the other constituent number i as a Jet.

If the cast to Jet fails for a constituent, a null pointer is returned.

Definition at line 763 of file CompositeParticle_v1.h.

764{
765 const xAOD::IParticle* ipart = this->otherPart(index);
766 if ( ipart->type() != xAOD::Type::Jet ){ return 0; }
767 return static_cast<const xAOD::Jet*>(ipart);
768}

◆ otherMuon()

const xAOD::Muon * xAOD::CompositeParticle_v1::otherMuon ( std::size_t index = 0) const
inline

Get the other constituent number i as an Muon.

If the cast to Muon fails for a constituent, a null pointer is returned.

Definition at line 743 of file CompositeParticle_v1.h.

744{
745 const xAOD::IParticle* ipart = this->otherPart(index);
746 if ( ipart->type() != xAOD::Type::Muon ){ return 0; }
747 return static_cast<const xAOD::Muon*>(ipart);
748}

◆ otherPart()

const xAOD::IParticle * xAOD::CompositeParticle_v1::otherPart ( std::size_t index = 0) const

Get the other constituent IParticle number i.

Definition at line 1071 of file CompositeParticle_v1.cxx.

1071 {
1072 if ( index >= this->nOtherParts() ) {
1073 return nullptr;
1074 }
1075 const xAOD::IParticleLink & otherPartLink = this->otherPartLink( index );
1076 if ( ! otherPartLink.isValid() ) {
1077 return nullptr;
1078 }
1079 return *otherPartLink;
1080 }
std::size_t nOtherParts() const
Number of other constituent particles.
const xAOD::IParticleLink & otherPartLink(std::size_t index=0) const
Get the other constituent IParticle number i as an ElementLink.

◆ otherPartLink()

const xAOD::IParticleLink & xAOD::CompositeParticle_v1::otherPartLink ( std::size_t index = 0) const

Get the other constituent IParticle number i as an ElementLink.

Definition at line 1084 of file CompositeParticle_v1.cxx.

1084 {
1085 if ( index >= this->nOtherParts() ) {
1086 static const xAOD::IParticleLink dummy;
1087 return dummy;
1088 }
1089 return otherPartLinks()[ index ];
1090 }
str index
Definition DeMoScan.py:362

◆ otherPartLinks()

const xAOD::IParticleLinkContainer & xAOD::CompositeParticle_v1::otherPartLinks ( ) const

Get all other constituents in one go.

◆ otherPhoton()

const xAOD::Photon * xAOD::CompositeParticle_v1::otherPhoton ( std::size_t index = 0) const
inline

Get the other constituent number i as a Photon.

If the cast to Photon fails for a constituent, a null pointer is returned.

Definition at line 723 of file CompositeParticle_v1.h.

724{
725 const xAOD::IParticle* ipart = this->otherPart(index);
726 if ( ipart->type() != xAOD::Type::Photon ){ return 0; }
727 return static_cast<const xAOD::Photon*>(ipart);
728}
@ Photon
The object is a photon.
Definition ObjectType.h:47
Photon_v1 Photon
Definition of the current "egamma version".

◆ otherTau()

const xAOD::TauJet * xAOD::CompositeParticle_v1::otherTau ( std::size_t index = 0) const
inline

Get the other constituent number i as a tau.

If the cast to tau fails for a constituent, a null pointer is returned.

Definition at line 753 of file CompositeParticle_v1.h.

754{
755 const xAOD::IParticle* ipart = this->otherPart(index);
756 if ( ipart->type() != xAOD::Type::Tau ){ return 0; }
757 return static_cast<const xAOD::TauJet*>(ipart);
758}
@ Tau
The object is a tau (jet).
Definition ObjectType.h:49
TauJet_v3 TauJet
Definition of the current "tau version".

◆ otherTruthPart()

const xAOD::TruthParticle * xAOD::CompositeParticle_v1::otherTruthPart ( std::size_t index = 0) const
inline

Get the other constituent number i as a TruthParticle.

If the cast to TruthParticle fails for a constituent, a null pointer is returned.

Definition at line 773 of file CompositeParticle_v1.h.

774{
775 const xAOD::IParticle* ipart = this->otherPart(index);
776 if ( ipart->type() != xAOD::Type::TruthParticle ){ return 0; }
777 return static_cast<const xAOD::TruthParticle*>(ipart);
778}
@ TruthParticle
The object is a truth particle.
Definition ObjectType.h:67
TruthParticle_v1 TruthParticle
Typedef to implementation.

◆ p()

double xAOD::CompositeParticle_v1::p ( const std::vector< int > & partIndices) const

The total 3-momentum.

◆ p4() [1/5]

CompositeParticle_v1::FourMom_t xAOD::CompositeParticle_v1::p4 ( ) const
virtual

The full 4-momentum of the particle.

Implements xAOD::IParticle.

Definition at line 64 of file CompositeParticle_v1.cxx.

64 {
65 if ( accPx.isAvailable(*this) && accPy.isAvailable(*this)
66 && accPz.isAvailable(*this) && accE.isAvailable(*this) ) {
67 // We have everything stored with this CompositeParticle. Just use it.
68 const double px = static_cast<double>(accPx(*this));
69 const double py = static_cast<double>(accPy(*this));
70 const double pz = static_cast<double>(accPz(*this));
71 const double e = static_cast<double>(accE(*this));
72 return FourMom_t( px, py, pz, e );
73 }
74 else {
75 // Not everything is stored, we need to re-calculate the p4 based on the constituents.
76 // Create an empty vector such that the subsequent call will use all constituents.
77 const std::vector<int> partIndices;
78 return p4( partIndices );
79 }
80 }

◆ p4() [2/5]

FourMom_t xAOD::CompositeParticle_v1::p4 ( const std::vector< int > & partIndices) const

The total 4-momentum.

◆ p4() [3/5]

FourMom_t xAOD::CompositeParticle_v1::p4 ( int partIndexA,
int partIndexB ) const
inline

Get the four-momentum with two indices.

This specialization to the above method is needed since ROOT 6.02 doesn't yet support C++11 in the TFormula stuff with JIT compilation, see: https://sft.its.cern.ch/jira/browse/ROOT-5083

Definition at line 149 of file CompositeParticle_v1.h.

149 {
150 return this->p4( std::vector<int>{partIndexA, partIndexB} );
151 }

◆ p4() [4/5]

FourMom_t xAOD::CompositeParticle_v1::p4 ( int partIndexA,
int partIndexB,
int partIndexC ) const
inline

Get the four-momentum with three indices.

Definition at line 153 of file CompositeParticle_v1.h.

153 {
154 return this->p4( std::vector<int>{partIndexA, partIndexB, partIndexC} );
155 }

◆ p4() [5/5]

FourMom_t xAOD::CompositeParticle_v1::p4 ( int partIndexA,
int partIndexB,
int partIndexC,
int partIndexD ) const
inline

Get the four-momentum with four indices.

Definition at line 157 of file CompositeParticle_v1.h.

157 {
158 return this->p4( std::vector<int>{partIndexA, partIndexB, partIndexC, partIndexD} );
159 }

◆ part()

const xAOD::IParticle * xAOD::CompositeParticle_v1::part ( std::size_t index = 0) const

Get the constituent IParticle number i.

Definition at line 782 of file CompositeParticle_v1.cxx.

782 {
783 if ( index >= this->nParts() ) {
784 return nullptr;
785 }
786 const xAOD::IParticleLink & constitLink = partLink( index );
787 if ( ! constitLink.isValid() ) {
788 return nullptr;
789 }
790 return *constitLink;
791 }

◆ partLink()

const xAOD::IParticleLink & xAOD::CompositeParticle_v1::partLink ( std::size_t index = 0) const

Get the constituent IParticle number i as an ElementLink.

Definition at line 795 of file CompositeParticle_v1.cxx.

795 {
796 if ( index >= this->nParts() ) {
797 static const xAOD::IParticleLink dummy;
798 return dummy;
799 }
800 return partLinks()[ index ];
801 }

◆ partLinks()

const xAOD::IParticleLinkContainer & xAOD::CompositeParticle_v1::partLinks ( ) const

Get all constituents in one go.

◆ parts()

template<typename CONTTYPE>
ConstDataVector< CONTTYPE > * xAOD::CompositeParticle_v1::parts ( ) const

Method to return a DataVector<T>, e.g., a MuonContainer, for all the constituent particles, e.g., of type xAOD::Muon, that this CompositeParticle has.

This DataVector be a simple SG::VIEW_ELEMENTS container, i.e., it does NOT own the elements, e.g., muons, but has simple pointers to them. However, the user is still required to take care of its memory management by either recording it to StoreGate (and thus transfering ownership), or by deleting this view-container when done with it.

◆ pdgId()

int xAOD::CompositeParticle_v1::pdgId ( ) const

Return the PDG identifier.

◆ phi() [1/2]

double xAOD::CompositeParticle_v1::phi ( ) const
virtual

The azimuthal angle ( \(\phi\)) of the particle.

Implements xAOD::IParticle.

Definition at line 52 of file CompositeParticle_v1.cxx.

52 {
53 return p4().Phi();
54 }

◆ phi() [2/2]

double xAOD::CompositeParticle_v1::phi ( const std::vector< int > & partIndices) const

The azimuthal angle ( \(\phi\)).

◆ photon()

const xAOD::Photon * xAOD::CompositeParticle_v1::photon ( std::size_t index = 0) const
inline

Get the constituent number i as a Photon.

If the cast to Photon fails for a constituent, a null pointer is returned.

Definition at line 652 of file CompositeParticle_v1.h.

653{
654 const xAOD::IParticle* ipart = this->part(index);
655 if ( ipart->type() != xAOD::Type::Photon ){ return 0; }
656 return static_cast<const xAOD::Photon*>(ipart);
657}

◆ pt() [1/2]

double xAOD::CompositeParticle_v1::pt ( ) const
virtual

The transverse momentum ( \(p_T\)) of the particle.

Implements xAOD::IParticle.

Definition at line 44 of file CompositeParticle_v1.cxx.

44 {
45 return std::hypot( px(), py() );
46 }

◆ pt() [2/2]

double xAOD::CompositeParticle_v1::pt ( const std::vector< int > & partIndices) const

The transverse momentum ( \(p_T\)).

◆ px() [1/2]

double xAOD::CompositeParticle_v1::px ( ) const

Get the px momentum component of the particle.

Definition at line 112 of file CompositeParticle_v1.cxx.

112 {
113 return p4().Px();
114 }

◆ px() [2/2]

double xAOD::CompositeParticle_v1::px ( const std::vector< int > & partIndices) const

Get the px momentum component.

◆ py() [1/2]

double xAOD::CompositeParticle_v1::py ( ) const

Get the py momentum component of the particle.

Definition at line 117 of file CompositeParticle_v1.cxx.

117 {
118 return p4().Py();
119 }

◆ py() [2/2]

double xAOD::CompositeParticle_v1::py ( const std::vector< int > & partIndices) const

Get the py momentum component.

◆ pz() [1/2]

double xAOD::CompositeParticle_v1::pz ( ) const

Get the pz momentum component of the particle.

Definition at line 122 of file CompositeParticle_v1.cxx.

122 {
123 return p4().Pz();
124 }

◆ pz() [2/2]

double xAOD::CompositeParticle_v1::pz ( const std::vector< int > & partIndices) const

Get the pz momentum component.

◆ rapidity() [1/2]

double xAOD::CompositeParticle_v1::rapidity ( ) const
virtual

The true rapidity (y) of the particle.

Implements xAOD::IParticle.

Definition at line 60 of file CompositeParticle_v1.cxx.

60 {
61 return p4().Rapidity();
62 }

◆ rapidity() [2/2]

double xAOD::CompositeParticle_v1::rapidity ( const std::vector< int > & partIndices) const

The true rapidity (y).

◆ removeMissingET()

void xAOD::CompositeParticle_v1::removeMissingET ( bool updateFourMom = true)

Remove the existing MissingET object from this CompositeParticle.

Note that the 4-momentum of this CompositeParticle will be updated accordingly, if updateFourMom=true.

Definition at line 636 of file CompositeParticle_v1.cxx.

636 {
637 const xAOD::MissingET* met = this->missingET();
638 if ( !met ) {
639 // There is no valid MissingET object assigned... nothing can done
640 return;
641 }
642
643 // Update the four-momentum of this composite particle, if requested
644 if ( updateFourMom ) {
646 double metpx = met->mpx();
647 double metpy = met->mpy();
648 metP4.SetPxPyPzE( metpx, metpy, 0.0, std::sqrt(metpx*metpx + metpy*metpy) );
649 this->setP4( this->p4() - metP4 );
650 }
651 // Assign an invalid ElementLink here
652 metLinkAcc(*this) = ElementLink<xAOD::MissingETContainer>();
653 return;
654 }
const xAOD::MissingET * missingET() const
Get the MissingET object that is associated with this CompositeParticle.
TLorentzVector FourMom_t
Definition of the 4-momentum type.
float mpx() const
Returns .
float mpy() const
Returns .

◆ removeOtherPart() [1/2]

void xAOD::CompositeParticle_v1::removeOtherPart ( const xAOD::IParticle * part)

Remove a particle as an other constituent from this CompostiteParticle.

Definition at line 930 of file CompositeParticle_v1.cxx.

930 {
931 // Check if we have a valid pointer
932 if ( !part ) {
933 // This should not be... throw an error.
934 throw std::runtime_error("Got a zero pointer to an xAOD::IParticle when adding constituent!");
935 }
936
937 // Add the ElementLink of the given particle and pass it on
938 const std::size_t partIdx = part->index();
939 const xAOD::IParticleContainer* partCont =
940 static_cast<const xAOD::IParticleContainer*>(part->container());
941 this->removeOtherPart( IParticleLink( *partCont, partIdx ) );
942 return;
943 }
void removeOtherPart(const xAOD::IParticle *part)
Remove a particle as an other constituent from this CompostiteParticle.
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.

◆ removeOtherPart() [2/2]

void xAOD::CompositeParticle_v1::removeOtherPart ( const xAOD::IParticleLink & partLink)

Remove a particle as an other constituent from this CompostiteParticle.

Definition at line 948 of file CompositeParticle_v1.cxx.

948 {
949 // Check if we have a valid ElementLink
950 if ( ! partLink.isValid() ) {
951 // This should not be... throw an error.
952 throw std::runtime_error("Got an invalid ElementLink when adding constituent!");
953 }
954 xAOD::IParticleLinkContainer& otherPartLinks = otherPartLinksAcc( *this );
955
956 // Find the constituent particle that should be removed
957 for ( xAOD::IParticleLinkContainer::iterator
958 constitItr = otherPartLinks.begin(),
959 constitItrEnd = otherPartLinks.end();
960 constitItr != constitItrEnd;
961 ++constitItr ) {
962 const xAOD::IParticleLink& currentLink = *constitItr;
963 if ( partLink == currentLink ) {
964 // Remove the found link
965 otherPartLinks.erase( constitItr );
966 return;
967 }
968 }
969 return;
970 }

◆ removePart() [1/2]

void xAOD::CompositeParticle_v1::removePart ( const xAOD::IParticle * part,
bool updateFourMom = true )

Remove a particle as a constituent from this CompostiteParticle.

Note that the 4-momentum of this CompositeParticle will be updated accordingly, if updateFourMom=true. If the given IParticle is not already a constituent of this CompositeParticle, nothing happens

Definition at line 536 of file CompositeParticle_v1.cxx.

537 {
538 // Check if we have a valid pointer
539 if ( !part ) {
540 // This should not be... throw an error.
541 throw std::runtime_error("Got a zero pointer to an xAOD::IParticle when adding constituent!");
542 }
543
544 // Add the ElementLink of the given particle and pass it on
545 const std::size_t partIdx = part->index();
546 const xAOD::IParticleContainer* partCont =
547 static_cast<const xAOD::IParticleContainer*>(part->container());
548 this->removePart( IParticleLink( *partCont, partIdx ), updateFourMom );
549 return;
550 }
void removePart(const xAOD::IParticle *part, bool updateFourMom=true)
Remove a particle as a constituent from this CompostiteParticle.

◆ removePart() [2/2]

void xAOD::CompositeParticle_v1::removePart ( const xAOD::IParticleLink & partLink,
bool updateFourMom = true )

Remove a particle as a constituent from this CompostiteParticle.

Note that the 4-momentum of this CompositeParticle will be updated accordingly, if updateFourMom=true. If the given IParticle is not already a constituent of this CompositeParticle, nothing happens

Definition at line 555 of file CompositeParticle_v1.cxx.

556 {
557 // Check if we have a valid ElementLink
558 if ( ! partLink.isValid() ) {
559 // This should not be... throw an error.
560 throw std::runtime_error("Got an invalid ElementLink when adding constituent!");
561 }
562 xAOD::IParticleLinkContainer& constitLinks = partLinksAcc( *this );
563
564 // Find the constituent particle that should be removed
565 for ( xAOD::IParticleLinkContainer::iterator
566 constitItr = constitLinks.begin(),
567 constitItrEnd = constitLinks.end();
568 constitItr != constitItrEnd;
569 ++constitItr ) {
570 const xAOD::IParticleLink& currentLink = *constitItr;
571 if ( partLink == currentLink ) {
572 // Update the four-momentum of this composite particle, if requested
573 if ( updateFourMom ) {
574 this->setP4( this->p4() - (*partLink)->p4() );
575 // Cannot add charge automatically as this is NOT part of the xAOD::IParticle interface
576 //this->setCharge( this->charge() - (*partLink)->charge() );
577 }
578
579 // Remove the found link
580 constitLinks.erase( constitItr );
581 return;
582 }
583 }
584 return;
585 }

◆ setCharge()

void xAOD::CompositeParticle_v1::setCharge ( float charge)

Set the electric charge.

Definition at line 211 of file CompositeParticle_v1.cxx.

211 {
212 chargeAcc(*this) = charge;
213 return;
214 }

◆ setE()

void xAOD::CompositeParticle_v1::setE ( double e)

Set the energy.

◆ setMissingET()

void xAOD::CompositeParticle_v1::setMissingET ( const xAOD::MissingET * met,
bool updateFourMom = true )

Set the MissingET for this CompositeParticle.

Note that the 4-momentum of this CompositeParticle will be updated accordingly, if updateFourMom=true.

Definition at line 608 of file CompositeParticle_v1.cxx.

609 {
610 // Check if we have a valid pointer
611 if ( !met ) {
612 // This should not be... throw an error.
613 throw std::runtime_error("Got a zero pointer to xAOD::MissingET when adding it!");
614 }
615
616 // Update the four-momentum of this composite particle, if requested
617 if ( updateFourMom ) {
619 double metpx = met->mpx();
620 double metpy = met->mpy();
621 metP4.SetPxPyPzE( metpx, metpy, 0.0, std::sqrt(metpx*metpx + metpy*metpy) );
622 this->setP4( this->p4() + metP4 );
623 }
624
625 // Add the given ElementLink as a constituent of this composite particle
626 const std::size_t metIdx = met->index();
627 const xAOD::MissingETContainer* metCont =
628 static_cast<const xAOD::MissingETContainer*>(met->container());
629 metLinkAcc(*this) = ElementLink<xAOD::MissingETContainer>( *metCont, metIdx );
630 return;
631 }

◆ setOtherPartLinks()

void xAOD::CompositeParticle_v1::setOtherPartLinks ( const xAOD::IParticleLinkContainer & otherPartLinks)
protected

Set all other constituents in one go.

◆ setP4()

void xAOD::CompositeParticle_v1::setP4 ( const FourMom_t & vec)

Set the 4-vec.

Definition at line 132 of file CompositeParticle_v1.cxx.

132 {
133 accPx( *this ) = static_cast<float>(vec.Px());
134 accPy( *this ) = static_cast<float>(vec.Py());
135 accPz( *this ) = static_cast<float>(vec.Pz());
136 accE( *this ) = static_cast<float>(vec.E());
137 }
std::vector< size_t > vec

◆ setPartLinks()

void xAOD::CompositeParticle_v1::setPartLinks ( const xAOD::IParticleLinkContainer & constitLinks)
protected

Set all constituents in one go.

Warning: This is meant for usage internal to this class only because no addition of the constituent properties will be done!

◆ setPdgId()

void xAOD::CompositeParticle_v1::setPdgId ( int pdgID)

Set the PDG identifier.

◆ setPx()

void xAOD::CompositeParticle_v1::setPx ( double px)

Set the x-component of the momentum.

◆ setPxPyPzE()

void xAOD::CompositeParticle_v1::setPxPyPzE ( double px,
double py,
double pz,
double e )

Set the 4-vec.

Definition at line 140 of file CompositeParticle_v1.cxx.

143 {
144 static const Accessor< float > acc1( "px" );
145 acc1( *this ) = (float)px;
146 static const Accessor< float > acc2( "py" );
147 acc2( *this ) = (float)py;
148 static const Accessor< float > acc3( "pz" );
149 acc3( *this ) = (float)pz;
150 static const Accessor< float > acc4( "e" );
151 acc4( *this ) = (float)e;
152 }

◆ setPy()

void xAOD::CompositeParticle_v1::setPy ( double py)

Set the y-component of the momentum.

◆ setPz()

void xAOD::CompositeParticle_v1::setPz ( double pz)

Set the z-component of the momentum.

◆ tau()

const xAOD::TauJet * xAOD::CompositeParticle_v1::tau ( std::size_t index = 0) const
inline

Get the constituent number i as a tau.

If the cast to tau fails for a constituent, a null pointer is returned.

Definition at line 682 of file CompositeParticle_v1.h.

683{
684 const xAOD::IParticle* ipart = this->part(index);
685 if ( ipart->type() != xAOD::Type::Tau ){ return 0; }
686 return static_cast<const xAOD::TauJet*>(ipart);
687}

◆ toPersistent()

void xAOD::CompositeParticle_v1::toPersistent ( )

Function preparing the object to be persistified.

◆ truthPart()

const xAOD::TruthParticle * xAOD::CompositeParticle_v1::truthPart ( std::size_t index = 0) const
inline

Get the constituent number i as a TruthParticle.

If the cast to TruthParticle fails for a constituent, a null pointer is returned.

Definition at line 702 of file CompositeParticle_v1.h.

703{
704 const xAOD::IParticle* ipart = this->part(index);
705 if ( ipart->type() != xAOD::Type::TruthParticle ){ return 0; }
706 return static_cast<const xAOD::TruthParticle*>(ipart);
707}

◆ type()

Type::ObjectType xAOD::CompositeParticle_v1::type ( ) const
virtual

The type of the object as a simple enumeration.

Implements xAOD::IParticle.

Definition at line 102 of file CompositeParticle_v1.cxx.

102 {
103 return Type::CompositeParticle;
104 }

◆ weight() [1/6]

float xAOD::CompositeParticle_v1::weight ( const std::string & varNameA) const
inline

Get the weight for this xAOD::CompositeParticle.

This specialization to the above method is needed since ROOT 6.02 doesn't yet support C++11 in the TFormula stuff with JIT compilation, see: https://sft.its.cern.ch/jira/browse/ROOT-5083

Definition at line 239 of file CompositeParticle_v1.h.

239 {
240 return this->weight( std::vector<std::string>{varNameA} );
241 }
float weight(const std::vector< std::string > &varNames, const std::vector< int > &partIndices={}) const
Get the weight for this xAOD::CompositeParticle by providing a vector of variable names that will be ...

◆ weight() [2/6]

float xAOD::CompositeParticle_v1::weight ( const std::string & varNameA,
const std::string & varNameB ) const
inline

Definition at line 242 of file CompositeParticle_v1.h.

243 {
244 return this->weight( std::vector<std::string>{varNameA,varNameB} );
245 }

◆ weight() [3/6]

float xAOD::CompositeParticle_v1::weight ( const std::string & varNameA,
const std::string & varNameB,
const std::string & varNameC ) const
inline

Definition at line 246 of file CompositeParticle_v1.h.

248 {
249 return this->weight( std::vector<std::string>{varNameA,varNameB,varNameC} );
250 }

◆ weight() [4/6]

float xAOD::CompositeParticle_v1::weight ( const std::string & varNameA,
const std::string & varNameB,
const std::string & varNameC,
const std::string & varNameD ) const
inline

Definition at line 251 of file CompositeParticle_v1.h.

254 {
255 return this->weight( std::vector<std::string>{varNameA,varNameB,varNameC,varNameD} );
256 }

◆ weight() [5/6]

float xAOD::CompositeParticle_v1::weight ( const std::string & varNameA,
const std::string & varNameB,
const std::string & varNameC,
const std::string & varNameD,
const std::string & varNameE ) const
inline

Definition at line 257 of file CompositeParticle_v1.h.

261 {
262 return this->weight( std::vector<std::string>{varNameA,varNameB,varNameC,varNameD,varNameE} );
263 }

◆ weight() [6/6]

float xAOD::CompositeParticle_v1::weight ( const std::vector< std::string > & varNames,
const std::vector< int > & partIndices = {} ) const

Get the weight for this xAOD::CompositeParticle by providing a vector of variable names that will be looked for.

These variables, if found, are assumed to be of type float and to hold a multiplicative weight variable. If a given variable name is not found for this xAOD::CompositeParticle, then, the whole constituent tree will be searched for iteratively. The same variable name can be found and used for several constituents. But if a xAOD::CompositeParticle has that variable, the iterative search will not look into the constituents of that xAOD::CompositeParticle. The second, optional, argument is a list of indices such that one can restrict the variable name search to only the given constituent particles.

◆ weightHelper()

float xAOD::CompositeParticle_v1::weightHelper ( const xAOD::IParticle * part,
const xAOD::IParticle::ConstAccessor< float > & varAcc ) const
private

This is a private helper method to calculate the weight.


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