ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
Simulation::GenEventValidityChecker Class Reference

#include <GenEventValidityChecker.h>

Inheritance diagram for Simulation::GenEventValidityChecker:
Collaboration diagram for Simulation::GenEventValidityChecker:

Public Member Functions

 GenEventValidityChecker (const std::string &t, const std::string &n, const IInterface *p)
 Constructor with parameters. More...
 
StatusCode initialize () override final
 Athena algtool's Hooks. More...
 
StatusCode finalize () override final
 Athena algtool's Hooks. More...
 
StatusCode manipulate (HepMC::GenEvent &ge, const EventContext &ctx) const override final
 checks the the validity of the given GenEvent More...
 

Private Attributes

Gaudi::Property< bool > m_checkTime {this, "CheckTime", true}
 check the time dimension value for validity More...
 

Detailed Description

Use the manipulate() method of this AthenaTool, to check a given GenEven for its validity.

Author
Elmar.Ritsch -at- cern.ch

Definition at line 20 of file GenEventValidityChecker.h.

Constructor & Destructor Documentation

◆ GenEventValidityChecker()

Simulation::GenEventValidityChecker::GenEventValidityChecker ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

Constructor with parameters.

Constructor.

Definition at line 17 of file GenEventValidityChecker.cxx.

20  : base_class(t,n,p)
21  {
22  }

Member Function Documentation

◆ finalize()

StatusCode Simulation::GenEventValidityChecker::finalize ( )
finaloverride

Athena algtool's Hooks.

Definition at line 33 of file GenEventValidityChecker.cxx.

34  {
35  ATH_MSG_VERBOSE("Finalizing ...");
36  ATH_MSG_VERBOSE("Finalize successful");
37  return StatusCode::SUCCESS;
38  }

◆ initialize()

StatusCode Simulation::GenEventValidityChecker::initialize ( )
finaloverride

Athena algtool's Hooks.

Definition at line 25 of file GenEventValidityChecker.cxx.

26  {
27  ATH_MSG_VERBOSE("Initializing ...");
28  ATH_MSG_VERBOSE("Initialize successful");
29  return StatusCode::SUCCESS;
30  }

◆ manipulate()

StatusCode Simulation::GenEventValidityChecker::manipulate ( HepMC::GenEvent &  ge,
const EventContext &  ctx 
) const
finaloverride

checks the the validity of the given GenEvent

checks the given GenEvent

Returns
StatusCode::SUCCESS in case of a valid GenEvent, StatusCode::FAILURE otherwise

Definition at line 41 of file GenEventValidityChecker.cxx.

42  {
43  bool allOK = true;
44 
45  // loop over the vertices in the GenEvent
46 #ifdef HEPMC3
47  auto vtxIt = ge.vertices().begin();
48  auto vtxEnd = ge.vertices().end();
49 #else
50  auto vtxIt = ge.vertices_begin();
51  auto vtxEnd = ge.vertices_end();
52 #endif
53  for( ; vtxIt != vtxEnd; ++vtxIt) {
54  // for quick access:
55  const HepMC::FourVector &curPos = (*vtxIt)->position();
56 
57  // check if all position values are in range
58  allOK &= std::isfinite( curPos.x() );
59  allOK &= std::isfinite( curPos.y() );
60  allOK &= std::isfinite( curPos.z() );
61  // in case m_checkTime==false --> always return true here:
62  allOK &= std::isfinite( curPos.t() ) || !m_checkTime;
63  }
64 
65  if (allOK) {
66  ATH_MSG_DEBUG("All vertices in the given GenEvent are valid.");
67  return StatusCode::SUCCESS;
68  }
69 
70  ATH_MSG_ERROR("At least one vertex in the given GenEvent has an invalid position value (NaN or inf).");
71  return StatusCode::FAILURE;
72  }

Member Data Documentation

◆ m_checkTime

Gaudi::Property<bool> Simulation::GenEventValidityChecker::m_checkTime {this, "CheckTime", true}
private

check the time dimension value for validity

Definition at line 35 of file GenEventValidityChecker.h.


The documentation for this class was generated from the following files:
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
Simulation::GenEventValidityChecker::m_checkTime
Gaudi::Property< bool > m_checkTime
check the time dimension value for validity
Definition: GenEventValidityChecker.h:35
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
beamspotman.n
n
Definition: beamspotman.py:731
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29