ATLAS Offline Software
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
McEtIsolVisitor< TruthParticleContainer_pX > Class Template Reference

#include <McEtIsolVisitor.h>

Inheritance diagram for McEtIsolVisitor< TruthParticleContainer_pX >:
Collaboration diagram for McEtIsolVisitor< TruthParticleContainer_pX >:

Public Member Functions

 McEtIsolVisitor (const McEtIsolVisitor &rhs)
 Copy constructor: More...
 
 McEtIsolVisitor (const TruthParticleContainer_pX &persObj, TruthEtIsolations *etIsols, MsgStream &msg)
 Constructor with parameters: More...
 
virtual ~McEtIsolVisitor ()
 Destructor: More...
 
virtual void visit (TruthParticle *truthParticle) const
 The method to visit a TruthParticle to apply further modifications to the instance at hand. More...
 

Protected Member Functions

 McEtIsolVisitor ()
 Default constructor: More...
 
McEtIsolVisitoroperator= (const McEtIsolVisitor &rhs)
 Assignment operator: More...
 

Private Attributes

MsgStream * m_msg
 
const TruthParticleContainer_pX & m_persObj
 
TruthEtIsolationsm_etIsols
 

Detailed Description

template<class TruthParticleContainer_pX>
class McEtIsolVisitor< TruthParticleContainer_pX >

Definition at line 29 of file McEtIsolVisitor.h.

Constructor & Destructor Documentation

◆ McEtIsolVisitor() [1/3]

template<class TruthParticleContainer_pX >
McEtIsolVisitor< TruthParticleContainer_pX >::McEtIsolVisitor ( const McEtIsolVisitor< TruthParticleContainer_pX > &  rhs)
inline

Copy constructor:

Definition at line 39 of file McEtIsolVisitor.h.

39  :
41  m_msg ( rhs.m_msg ),
42  m_persObj( rhs.m_persObj ),
43  m_etIsols( rhs.m_etIsols )
44  {}

◆ McEtIsolVisitor() [2/3]

template<class TruthParticleContainer_pX >
McEtIsolVisitor< TruthParticleContainer_pX >::McEtIsolVisitor ( const TruthParticleContainer_pX &  persObj,
TruthEtIsolations etIsols,
MsgStream &  msg 
)
inline

Constructor with parameters:

Definition at line 48 of file McEtIsolVisitor.h.

50  :
52  m_msg ( &msg ),
53  m_persObj( persObj ),
54  m_etIsols( etIsols )
55  {}

◆ ~McEtIsolVisitor()

template<class TruthParticleContainer_pX >
McEtIsolVisitor< TruthParticleContainer_pX >::~McEtIsolVisitor
virtual

Destructor:

Definition at line 103 of file McEtIsolVisitor.h.

104 {}

◆ McEtIsolVisitor() [3/3]

template<class TruthParticleContainer_pX >
McEtIsolVisitor< TruthParticleContainer_pX >::McEtIsolVisitor ( )
protected

Default constructor:

Member Function Documentation

◆ operator=()

template<class TruthParticleContainer_pX >
McEtIsolVisitor& McEtIsolVisitor< TruthParticleContainer_pX >::operator= ( const McEtIsolVisitor< TruthParticleContainer_pX > &  rhs)
protected

Assignment operator:

◆ visit()

template<class TruthParticleContainer_pX >
void McEtIsolVisitor< TruthParticleContainer_pX >::visit ( TruthParticle truthParticle) const
virtual

The method to visit a TruthParticle to apply further modifications to the instance at hand.

Implements ITruthParticleVisitor.

Definition at line 108 of file McEtIsolVisitor.h.

109 {
110  if ( 0 == mc ) {
111  return;
112  }
113 
114  const int barcode = mc->barcode();
115  try {
116  const std::vector<float>& etIsolations = m_persObj.etIsol(barcode);
117  if ( etIsolations.empty() ) {
118  // do nothing: no particle will be registered in the TruthEtIsolations.
119  } else {
120  const HepMC::GenParticle* hepMcPart = mc->genParticle();
121  for ( std::size_t j = 0;
122  j != static_cast<std::size_t>(TruthParticleParameters::NbrOfCones);
123  ++j ) {
124  m_etIsols->setEtIsol( hepMcPart,
125  static_cast<TruthParticleParameters::ConeSize>(j),
126  etIsolations[j] );
127 
128  }
129  }
130  } catch (std::out_of_range& e) {
131  *m_msg << MSG::WARNING
132  << "Caught an out of range exception for this barcode: " << barcode
133  << endmsg
134  << e.what() << endmsg
135  << "This particle won't have any et isolation informations !!"
136  << endmsg;
137  // we don't want to have a buggy McTruth, do we ?
138  throw std::runtime_error("Reqested an UNKNOWN TruthParticle/barcode");
139  }
140 
141  return;
142 }

Member Data Documentation

◆ m_etIsols

template<class TruthParticleContainer_pX >
TruthEtIsolations* McEtIsolVisitor< TruthParticleContainer_pX >::m_etIsols
private

Definition at line 95 of file McEtIsolVisitor.h.

◆ m_msg

template<class TruthParticleContainer_pX >
MsgStream* McEtIsolVisitor< TruthParticleContainer_pX >::m_msg
private

Definition at line 92 of file McEtIsolVisitor.h.

◆ m_persObj

template<class TruthParticleContainer_pX >
const TruthParticleContainer_pX& McEtIsolVisitor< TruthParticleContainer_pX >::m_persObj
private

Definition at line 93 of file McEtIsolVisitor.h.


The documentation for this class was generated from the following file:
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
TruthParticleParameters::NbrOfCones
@ NbrOfCones
Definition: TruthParticleParamDefs.h:31
TruthEtIsolations::setEtIsol
void setEtIsol(const HepMC::ConstGenParticlePtr &genParticle, const TruthParticleParameters::ConeSize coneIdx, const double etIsol)
Set the transverse energy isolation of a HepMC::GenParticle for a given Cone size.
Definition: TruthEtIsolations.cxx:127
TruthParticleParameters::ConeSize
ConeSize
Enum for Cone size indexes (for isolation)
Definition: TruthParticleParamDefs.h:20
mc
Definition: mc.PG_single_nu_valid.py:1
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
HepMC::barcode
int barcode(const T *p)
Definition: Barcode.h:16
McEtIsolVisitor::m_msg
MsgStream * m_msg
Definition: McEtIsolVisitor.h:92
ITruthParticleVisitor::ITruthParticleVisitor
ITruthParticleVisitor()
Default constructor:
Definition: ITruthParticleVisitor.cxx:25
McEtIsolVisitor::m_persObj
const TruthParticleContainer_pX & m_persObj
Definition: McEtIsolVisitor.h:93
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
McEtIsolVisitor::m_etIsols
TruthEtIsolations * m_etIsols
Definition: McEtIsolVisitor.h:95
GenParticle
@ GenParticle
Definition: TruthClasses.h:30