ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
BeamEffects
src
GenEventValidityChecker.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// class header include
6
#include "
GenEventValidityChecker.h
"
7
8
// HepMC includes
9
#include "
AtlasHepMC/GenEvent.h
"
10
11
// CLHEP includes
12
#include "CLHEP/Geometry/Point3D.h"
13
14
namespace
Simulation
15
{
17
GenEventValidityChecker::GenEventValidityChecker
(
const
std::string& t,
18
const
std::string& n,
19
const
IInterface* p )
20
: base_class(t,n,p)
21
{
22
}
23
25
StatusCode
GenEventValidityChecker::initialize
()
26
{
27
ATH_MSG_VERBOSE
(
"Initializing ..."
);
28
ATH_MSG_VERBOSE
(
"Initialize successful"
);
29
return
StatusCode::SUCCESS;
30
}
31
33
StatusCode
GenEventValidityChecker::finalize
()
34
{
35
ATH_MSG_VERBOSE
(
"Finalizing ..."
);
36
ATH_MSG_VERBOSE
(
"Finalize successful"
);
37
return
StatusCode::SUCCESS;
38
}
39
41
StatusCode
GenEventValidityChecker::manipulate
(
HepMC::GenEvent
& ge,
const
EventContext&)
const
42
{
43
bool
allOK =
true
;
44
45
// loop over the vertices in the GenEvent
46
auto
vtxIt = ge.vertices().begin();
47
auto
vtxEnd = ge.vertices().end();
48
for
( ; vtxIt != vtxEnd; ++vtxIt) {
49
// for quick access:
50
const
HepMC::FourVector
&curPos = (*vtxIt)->position();
51
52
// check if all position values are in range
53
allOK &= std::isfinite( curPos.x() );
54
allOK &= std::isfinite( curPos.y() );
55
allOK &= std::isfinite( curPos.z() );
56
// in case m_checkTime==false --> always return true here:
57
allOK &= std::isfinite( curPos.t() ) || !
m_checkTime
;
58
}
59
60
if
(allOK) {
61
ATH_MSG_DEBUG
(
"All vertices in the given GenEvent are valid."
);
62
return
StatusCode::SUCCESS;
63
}
64
65
ATH_MSG_ERROR
(
"At least one vertex in the given GenEvent has an invalid position value (NaN or inf)."
);
66
return
StatusCode::FAILURE;
67
}
68
69
}
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
GenEventValidityChecker.h
GenEvent.h
Simulation::GenEventValidityChecker::m_checkTime
Gaudi::Property< bool > m_checkTime
check the time dimension value for validity
Definition
GenEventValidityChecker.h:35
Simulation::GenEventValidityChecker::initialize
StatusCode initialize() override final
Athena algtool's Hooks.
Definition
GenEventValidityChecker.cxx:25
Simulation::GenEventValidityChecker::GenEventValidityChecker
GenEventValidityChecker(const std::string &t, const std::string &n, const IInterface *p)
Constructor with parameters.
Definition
GenEventValidityChecker.cxx:17
Simulation::GenEventValidityChecker::finalize
StatusCode finalize() override final
Athena algtool's Hooks.
Definition
GenEventValidityChecker.cxx:33
Simulation::GenEventValidityChecker::manipulate
StatusCode manipulate(HepMC::GenEvent &ge, const EventContext &ctx) const override final
checks the the validity of the given GenEvent
Definition
GenEventValidityChecker.cxx:41
HepMC::FourVector
HepMC3::FourVector FourVector
Definition
SimpleVector.h:11
HepMC::GenEvent
HepMC3::GenEvent GenEvent
Definition
GenEvent.h:39
Simulation
Definition
BeamEffectsAlg.cxx:21
Generated on
for ATLAS Offline Software by
1.17.0