ATLAS Offline Software
Loading...
Searching...
No Matches
TestHepMC Class Reference

Filtering algorithm to sanity check HepMC event features. More...

#include <TestHepMC.h>

Inheritance diagram for TestHepMC:
Collaboration diagram for TestHepMC:

Public Member Functions

 TestHepMC (const std::string &name, ISvcLocator *pSvcLocator)
StatusCode initialize ()
StatusCode execute (const EventContext &ctx)
 Execute method.
StatusCode finalize ()
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
bool filterPassed (const EventContext &ctx) const
void setFilterPassed (bool state, const EventContext &ctx) const
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
Event collection accessors (const and non-const)
HepMC::GenEvent *event ATLAS_NOT_CONST_THREAD_SAFE ()
 Access the current signal event (first in the McEventCollection).
McEventCollection *events ATLAS_NOT_CONST_THREAD_SAFE ()
 Access the current event's McEventCollection.
const HepMC::GenEventevent_const (const EventContext &ctx) const
 Access the current signal event (const).
const McEventCollectionevents_const (const EventContext &ctx) const
 Access the current event's McEventCollection (const).
Particle data accessors
const ServiceHandle< IPartPropSvc > partPropSvc () const
 Access the particle property service.
const HepPDT::ParticleDataTable & particleTable () const
 Get a particle data table.
const HepPDT::ParticleDataTable & pdt () const
 Shorter alias to get a particle data table.
const HepPDT::ParticleData * particleData (int pid) const
 Access an element in the particle data table.
const EventContext & getContext () const
 Deprecated methods (use the ones with EventContext).
bool filterPassed () const
void setFilterPassed (bool state) const

Protected Member Functions

virtual bool isReEntrant () const override final
 Legacy algorithms are not thread-safe.
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

int m_maxloops
int m_pdg
double m_cm_energy
double m_cme_diff
double m_energy_diff
double m_max_energy_diff
bool m_dumpEvent
bool m_allowMissingXSec
double m_min_dist_trans
double m_max_dist_trans
double m_max_dist
double m_min_tau
double m_nonG4_energy_threshold
double m_eff_warn_threshold
double m_eff_fail_threshold
double m_tau_eff_threshold
double m_accur_margin
bool m_doHist
bool m_beamEnergyTest
bool m_vtxNaNTest
bool m_vtxDisplacedTest
bool m_momNaNTest
bool m_lifeTimeTest
bool m_energyG4Test
bool m_energyImbalanceTest
bool m_momImbalanceTest
bool m_negativeEnergyTest
bool m_tachyonsTest
bool m_unstableNoVtxTest
bool m_pi0NoVtxTest
bool m_undisplacedDaughtersTest
bool m_unknownPDGIDTest
std::vector< int > m_vertexStatuses
int m_nPass
int m_nFail
int m_noXSECset
int m_TotalTaus
int m_FastDecayedTau
int m_invalidBeamParticlesCheckRate
int m_beamParticleswithStatusNotFourCheckRate
int m_beamEnergyCheckRate
int m_vtxNANandINFCheckRate
int m_vtxDisplacedstatuscode12CheckRate
int m_vtxDisplacedstatuscodenot12CheckRate
int m_vtxDisplacedMoreThan_1m_CheckRate
int m_partMomentumNANandINFCheckRate
int m_undecayedPi0statuscode12CheckRate
int m_unstableNoEndVtxCheckRate
int m_negativeEnergyTachyonicCheckRate
int m_decayCheckRate
int m_undisplacedLLHdaughtersCheckRate
int m_nonZeroPhotonMassCheckRate
int m_energyBalanceCheckRate
int m_momentumBalanceCheckRate
int m_negativeEnergyCheckRate
int m_tachyonCheckRate
int m_stableUnstableNoParentCheckRate
int m_unstablePartNoDecayVtxCheckRate
int m_undecayedPi0CheckRate
int m_Status1ShortLifetime
int m_undisplacedDecayDaughtersOfDisplacedVtxCheckRate
int m_nonG4_energyCheckRate
int m_unknownPDGIDCheckRate
std::string m_paramFile
std::string m_unknownPDGIDFile
std::vector< int > m_G4pdgID_tab
std::vector< int > m_SusyPdgID_tab
std::vector< int > m_uknownPDGID_tab
ServiceHandle< ITHistSvc > m_thistSvc
TH1F * m_h_energy_dispVtxCheck
TH1F * m_h_energy_dispVtxCheck_lt10
TH1F * m_h_pdgid_dispVtxCheck
TH1F * m_h_status_dispVtxCheck
TH1F * m_h_px_dispVtxCheck
TH1F * m_h_py_dispVtxCheck
TH1F * m_h_pz_dispVtxCheck
TH1F * m_h_vx_dispVtxCheck
TH1F * m_h_vy_dispVtxCheck
TH1F * m_h_vz_dispVtxCheck
TH1F * m_h_vxprod_dispVtxCheck
TH1F * m_h_vyprod_dispVtxCheck
TH1F * m_h_vzprod_dispVtxCheck
TH1F * m_h_vtxend_dispVtxCheck
TH1F * m_h_vtxprod_dispVtxCheck
TH1F * m_h_photon_mass
TH1F * m_h_photon_energy
TH1F * m_h_photon_e2_p2_e2
TH1F * m_h_energyImbalance
TH1F * m_h_momentumImbalance_px
TH1F * m_h_momentumImbalance_py
TH1F * m_h_momentumImbalance_pz
TH1F * m_h_beamparticle1_Energy
TH1F * m_h_beamparticle2_Energy
TH1F * m_h_cmEnergyDiff
MC::Loops< HepMC::GenEvent, HepMC::ConstGenParticlePtr, HepMC::ConstGenVertexPtrm_looper
 member to detect loops
DataObjIDColl m_extendedExtraObjects
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Properties

ServiceHandle< IPartPropSvc > m_ppSvc {this, "PartPropSvc", "PartPropSvc"}
 Handle on the particle property service.
SG::ReadHandleKey< McEventCollectionm_mcevents_const { this, "McEventKey", "GEN_EVENT", "StoreGate key of the MC event collection" }
 Const handle to the MC event collection.
std::string m_mcEventKey {}
 StoreGate key for the MC event collection (defaults to GEN_EVENT).
BooleanProperty m_mkMcEvent {this, "MakeMcEvent", false, "Create a new MC event collection if it doesn't exist"}
 Flag to determine if a new MC event collection should be made if it doesn't exist.

Detailed Description

Filtering algorithm to sanity check HepMC event features.

The TestHepMC algorithm is used in MC production to ensure that only events with valid final state particles, properly balanced initial-final state momentum and energy, etc. are accepted for further processing. A too-high failure rate results in a warning or algorithm failure to flag up to production that there is a fundamental problem and that the sanity check may be unphysically biasing the resulting events.

Todo
Inherit from GenFilter? It is a filter

Definition at line 33 of file TestHepMC.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ TestHepMC()

TestHepMC::TestHepMC ( const std::string & name,
ISvcLocator * pSvcLocator )

Definition at line 17 of file TestHepMC.cxx.

18 : GenBase(name, pSvcLocator),
19 m_thistSvc("THistSvc", name)
20{
21 declareProperty("MaxLoops", m_maxloops = -1); //< Maximal number of particles allowed in the loops. -1 == any number
22 declareProperty("PdgToSearch", m_pdg = 15); //< @todo This test is a bit weirdly specific to taus
23 declareProperty("CmEnergy", m_cm_energy = -1); // in MeV, -1 = get from event
24 declareProperty("MinTransVtxDisp", m_min_dist_trans = 0.); // mm
25 declareProperty("MaxTransVtxDisp", m_max_dist_trans = 100.); // mm
26 declareProperty("MaxVtxDisp", m_max_dist = 1000.); // mm;
27 declareProperty("EnergyDifference", m_energy_diff = 1000.); // MeV
28 declareProperty("EnergyDifferenceError", m_max_energy_diff = 100000.); // MeV
29 declareProperty("CmeDifference", m_cme_diff = 1.); // MeV
30 declareProperty("DumpEvent", m_dumpEvent = false);
31 declareProperty("MinTau", m_min_tau = 1/300.); // ns; corresponds to 1mm
32 declareProperty("MaxNonG4Energy", m_nonG4_energy_threshold = 100.); //MeV
33 declareProperty("TauEffThreshold", m_tau_eff_threshold = 0.1); // fraction
34 declareProperty("EffWarnThreshold", m_eff_warn_threshold=0.99); // fraction
35 declareProperty("EffFailThreshold", m_eff_fail_threshold=0.98); // fraction
36 declareProperty("AccuracyMargin", m_accur_margin=0.); //MeV
37
38 declareProperty("G4ExtraWhiteFile", m_paramFile = "g4_extrawhite.param" );
39 // a list of allowed pdgid which however might not follow the official rules
40 declareProperty("UnknownPDGIDFile", m_unknownPDGIDFile = "pdgid_extras.txt" );
41
42 declareProperty("NoDecayVertexStatuses", m_vertexStatuses );
43
44 declareProperty("BeamEnergyTest", m_beamEnergyTest = true); //switching off inactive
45 declareProperty("VtxNaNTest", m_vtxNaNTest = true);
46 declareProperty("VtxDisplacedTest", m_vtxDisplacedTest = true);
47 declareProperty("MomNaNTest", m_momNaNTest = true);
48 declareProperty("LifeTimeTest", m_lifeTimeTest = true);
49 declareProperty("EnergyG4Test", m_energyG4Test = true);
50 declareProperty("EnergyImbalanceTest", m_energyImbalanceTest = true);
51 declareProperty("MomImbalanceTest", m_momImbalanceTest = true);
52 declareProperty("NegativeEnergyTest", m_negativeEnergyTest = true);
53 declareProperty("TachyonsTest", m_tachyonsTest = true);
54 declareProperty("UnstableNoVtxTest", m_unstableNoVtxTest = true);
55 declareProperty("Pi0NoVtxTest", m_pi0NoVtxTest = true);
56 declareProperty("UndisplacedDaughtersTest", m_undisplacedDaughtersTest = true);
57 declareProperty("UknownPDGIDTest", m_unknownPDGIDTest = true);
58 declareProperty("AllowMissingCrossSection", m_allowMissingXSec = false);
59
60 m_vertexStatuses.push_back( 1 );
61 m_vertexStatuses.push_back( 3 );
62 m_vertexStatuses.push_back( 4 );
63
64
65 declareProperty("THistSvc", m_thistSvc);
66
67 declareProperty("DoHist", m_doHist=false); //histograming yes/no true/false
68
69 m_nPass = 0;
70 m_nFail = 0;
71
72 m_TotalTaus = 0;
74
75 // Check counters
101 m_noXSECset = 0;
102
118 m_h_photon_mass = 0;
128}
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
GenBase(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition GenBase.cxx:11
int m_momentumBalanceCheckRate
Definition TestHepMC.h:80
int m_tachyonCheckRate
Definition TestHepMC.h:82
bool m_energyImbalanceTest
Definition TestHepMC.h:53
double m_cm_energy
Definition TestHepMC.h:45
TH1F * m_h_py_dispVtxCheck
Definition TestHepMC.h:106
int m_nFail
Definition TestHepMC.h:59
int m_stableUnstableNoParentCheckRate
Definition TestHepMC.h:83
int m_nonZeroPhotonMassCheckRate
Definition TestHepMC.h:78
TH1F * m_h_vyprod_dispVtxCheck
Definition TestHepMC.h:112
TH1F * m_h_energyImbalance
Definition TestHepMC.h:121
int m_vtxDisplacedMoreThan_1m_CheckRate
Definition TestHepMC.h:71
ServiceHandle< ITHistSvc > m_thistSvc
Definition TestHepMC.h:99
TH1F * m_h_vz_dispVtxCheck
Definition TestHepMC.h:110
int m_unknownPDGIDCheckRate
Definition TestHepMC.h:89
double m_nonG4_energy_threshold
Definition TestHepMC.h:48
int m_vtxDisplacedstatuscodenot12CheckRate
Definition TestHepMC.h:70
int m_beamParticleswithStatusNotFourCheckRate
Definition TestHepMC.h:66
bool m_dumpEvent
Definition TestHepMC.h:47
TH1F * m_h_beamparticle1_Energy
Definition TestHepMC.h:126
int m_nPass
Definition TestHepMC.h:58
double m_eff_fail_threshold
Definition TestHepMC.h:49
TH1F * m_h_momentumImbalance_py
Definition TestHepMC.h:123
TH1F * m_h_vxprod_dispVtxCheck
Definition TestHepMC.h:111
int m_unstablePartNoDecayVtxCheckRate
Definition TestHepMC.h:84
std::string m_unknownPDGIDFile
Definition TestHepMC.h:92
double m_min_dist_trans
Definition TestHepMC.h:48
int m_vtxDisplacedstatuscode12CheckRate
Definition TestHepMC.h:69
TH1F * m_h_vx_dispVtxCheck
Definition TestHepMC.h:108
TH1F * m_h_pz_dispVtxCheck
Definition TestHepMC.h:107
double m_max_dist_trans
Definition TestHepMC.h:48
TH1F * m_h_pdgid_dispVtxCheck
Definition TestHepMC.h:103
bool m_doHist
Definition TestHepMC.h:51
int m_maxloops
Definition TestHepMC.h:43
int m_undisplacedLLHdaughtersCheckRate
Definition TestHepMC.h:77
bool m_tachyonsTest
Definition TestHepMC.h:53
std::vector< int > m_vertexStatuses
Definition TestHepMC.h:56
TH1F * m_h_vy_dispVtxCheck
Definition TestHepMC.h:109
bool m_momImbalanceTest
Definition TestHepMC.h:53
int m_beamEnergyCheckRate
Definition TestHepMC.h:67
TH1F * m_h_photon_mass
Definition TestHepMC.h:117
int m_Status1ShortLifetime
Definition TestHepMC.h:86
double m_eff_warn_threshold
Definition TestHepMC.h:49
int m_noXSECset
Definition TestHepMC.h:60
bool m_allowMissingXSec
Definition TestHepMC.h:47
double m_tau_eff_threshold
Definition TestHepMC.h:49
int m_undecayedPi0statuscode12CheckRate
Definition TestHepMC.h:73
bool m_undisplacedDaughtersTest
Definition TestHepMC.h:54
bool m_vtxNaNTest
Definition TestHepMC.h:52
int m_unstableNoEndVtxCheckRate
Definition TestHepMC.h:74
double m_energy_diff
Definition TestHepMC.h:46
double m_accur_margin
Definition TestHepMC.h:50
bool m_lifeTimeTest
Definition TestHepMC.h:52
TH1F * m_h_energy_dispVtxCheck_lt10
Definition TestHepMC.h:102
TH1F * m_h_momentumImbalance_pz
Definition TestHepMC.h:124
bool m_negativeEnergyTest
Definition TestHepMC.h:53
TH1F * m_h_vtxprod_dispVtxCheck
Definition TestHepMC.h:115
int m_pdg
Definition TestHepMC.h:44
TH1F * m_h_vzprod_dispVtxCheck
Definition TestHepMC.h:113
int m_partMomentumNANandINFCheckRate
Definition TestHepMC.h:72
bool m_momNaNTest
Definition TestHepMC.h:52
int m_negativeEnergyCheckRate
Definition TestHepMC.h:81
TH1F * m_h_photon_energy
Definition TestHepMC.h:118
int m_undecayedPi0CheckRate
Definition TestHepMC.h:85
TH1F * m_h_energy_dispVtxCheck
Definition TestHepMC.h:101
TH1F * m_h_momentumImbalance_px
Definition TestHepMC.h:122
int m_energyBalanceCheckRate
Definition TestHepMC.h:79
bool m_unknownPDGIDTest
Definition TestHepMC.h:54
int m_TotalTaus
Definition TestHepMC.h:62
bool m_energyG4Test
Definition TestHepMC.h:52
TH1F * m_h_vtxend_dispVtxCheck
Definition TestHepMC.h:114
int m_FastDecayedTau
Definition TestHepMC.h:63
TH1F * m_h_beamparticle2_Energy
Definition TestHepMC.h:127
int m_decayCheckRate
Definition TestHepMC.h:76
double m_max_dist
Definition TestHepMC.h:48
double m_min_tau
Definition TestHepMC.h:48
int m_vtxNANandINFCheckRate
Definition TestHepMC.h:68
bool m_vtxDisplacedTest
Definition TestHepMC.h:52
int m_invalidBeamParticlesCheckRate
Definition TestHepMC.h:65
TH1F * m_h_status_dispVtxCheck
Definition TestHepMC.h:104
bool m_pi0NoVtxTest
Definition TestHepMC.h:54
double m_cme_diff
Definition TestHepMC.h:45
TH1F * m_h_px_dispVtxCheck
Definition TestHepMC.h:105
TH1F * m_h_cmEnergyDiff
Definition TestHepMC.h:128
TH1F * m_h_photon_e2_p2_e2
Definition TestHepMC.h:119
double m_max_energy_diff
Definition TestHepMC.h:46
int m_undisplacedDecayDaughtersOfDisplacedVtxCheckRate
Definition TestHepMC.h:87
bool m_unstableNoVtxTest
Definition TestHepMC.h:53
int m_negativeEnergyTachyonicCheckRate
Definition TestHepMC.h:75
int m_nonG4_energyCheckRate
Definition TestHepMC.h:88
std::string m_paramFile
Definition TestHepMC.h:91
bool m_beamEnergyTest
Definition TestHepMC.h:52

Member Function Documentation

◆ ATLAS_NOT_CONST_THREAD_SAFE() [1/2]

McEventCollection *events GenBase::ATLAS_NOT_CONST_THREAD_SAFE ( )
inherited

Access the current event's McEventCollection.

Note
This function will make a new McEventCollection if there is not already a valid one and MakeMcEvent=True.

◆ ATLAS_NOT_CONST_THREAD_SAFE() [2/2]

HepMC::GenEvent *event GenBase::ATLAS_NOT_CONST_THREAD_SAFE ( )
inlineinherited

Access the current signal event (first in the McEventCollection).

Note
This function will make a new McEventCollection if there is not already a valid one and MakeMcEvent=True.

Definition at line 76 of file GenBase.h.

76 {
77 if (events()->empty())
78 ATH_MSG_ERROR("McEventCollection is empty during first event access");
79 return *(events()->begin());
80 }
#define ATH_MSG_ERROR(x)
static const Attributes_t empty

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ event_const()

const HepMC::GenEvent * GenBase::event_const ( const EventContext & ctx) const
inlineinherited

Access the current signal event (const).

Definition at line 83 of file GenBase.h.

83 {
84 const McEventCollection* coll = events_const(ctx);
85 if (coll->empty())
86 ATH_MSG_ERROR("Const McEventCollection is empty during first event access");
87 return *(coll->begin());
88 }
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
bool empty() const noexcept
Returns true if the collection is empty.
const McEventCollection * events_const(const EventContext &ctx) const
Access the current event's McEventCollection (const).
Definition GenBase.h:97

◆ events_const()

const McEventCollection * GenBase::events_const ( const EventContext & ctx) const
inlineinherited

Access the current event's McEventCollection (const).

Definition at line 97 of file GenBase.h.

97 {
98 SG::ReadHandle<McEventCollection> ret = SG::makeHandle(m_mcevents_const, ctx);
99 if (!ret.isValid())
100 ATH_MSG_ERROR("No McEventCollection found in StoreGate with key " << m_mcevents_const.key());
101 return ret.cptr();
102 }
SG::ReadHandleKey< McEventCollection > m_mcevents_const
Const handle to the MC event collection.
Definition GenBase.h:145
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode TestHepMC::execute ( const EventContext & ctx)
virtual

Execute method.

Provides access to the EventContext if needed but is non-const as opposed to AthReentrantAlgorithm.

Uncomment for full debug HepMC3::Print::content(*evt);

Todo
Clean up / improve / apply to all decaying species
Todo
Persuade generator authors to set proper generated masses in HepMC, then really require mass = 0

Reimplemented from GenBase.

Definition at line 270 of file TestHepMC.cxx.

270 {
271
272 // Holder for filter outcome; allows us to check all filters on each event and diagnose multiple problems at once
273 bool filter_pass = true;
274
275 // Loop over all events in McEventCollection
276 for(const HepMC::GenEvent* evt : *events_const(ctx)) {
277 double totalPx = 0;
278 double totalPy = 0;
279 double totalPz = 0;
280 double totalE = 0;
281 double nonG4_energy = 0;
282 std::vector<HepMC::ConstGenParticlePtr> negEnPart;
283 std::vector<HepMC::ConstGenParticlePtr> tachyons;
284 std::vector<HepMC::ConstGenParticlePtr> unstNoEnd;
285 std::vector<HepMC::ConstGenParticlePtr> unDecPi0;
286 std::vector<HepMC::ConstGenParticlePtr> undisplaceds;
287
288 m_looper.findLoops(evt,true);
289 if (!m_looper.loop_particles().empty() || !m_looper.loop_vertices().empty()) {
290 ATH_MSG_DEBUG("Found " << m_looper.loop_vertices().size() << " vertices in loops");
291 ATH_MSG_DEBUG("Found " << m_looper.loop_particles().size() << " particles in loops");
292 ATH_MSG_DEBUG("Please use MC::Loops::findLoops for this event to obtain all particles and vertices in the loops");
293 if (m_maxloops > 0 && m_looper.loop_particles().size() > static_cast<std::size_t>(m_maxloops) ) filter_pass = false;
294 }
295
296 const auto xsec = evt->cross_section();
297 if (!xsec) {
298 ATH_MSG_WARNING("WATCH OUT: event is missing the generator cross-section!");
299 ++m_noXSECset;
300 if (m_allowMissingXSec) {
301 ATH_MSG_WARNING("-> Adding a dummy cross-section for debugging purposes.");
302 // for debugging purposes only -> set a dummy cross-section to make TestHepMC happy
303 std::shared_ptr<HepMC3::GenCrossSection> dummy_xsec = std::make_shared<HepMC3::GenCrossSection>();
304 dummy_xsec->set_cross_section(1.0,0.0);
305 HepMC::GenEvent* evt_nonconst = const_cast<HepMC::GenEvent*>(evt);
306 evt_nonconst->set_cross_section(std::move(dummy_xsec));
307 }
308 else {
309 ATH_MSG_WARNING("-> Will report this as failure.");
310 }
311 }
312
313 // Check beams and work out per-event beam energy
314 std::vector<std::shared_ptr<const HepMC3::GenParticle>> beams_t;
315 for (auto p : evt->beams()) { if (p->status() == 4) beams_t.push_back(std::move(p)); }
316 std::pair<std::shared_ptr<const HepMC3::GenParticle>,std::shared_ptr<const HepMC3::GenParticle>> beams;
317 if (beams_t.size() == 2) {
318 beams.first=beams_t.at(0);
319 beams.second=beams_t.at(1);
320 } else {
321 ATH_MSG_WARNING("Invalid number of beam particles " << beams_t.size() << " this generator interface should be fixed");
323 for (const auto& part: beams_t) HepMC3::Print::line(part);
324 }
325 double cmenergy = m_cm_energy;
326 if (!HepMC::valid_beam_particles(evt)) {
327 ATH_MSG_WARNING("Invalid beam particle pointers -- this generator interface should be fixed");
328 if (cmenergy < 0) ATH_MSG_WARNING("Invalid expected beam energy: " << cmenergy << " MeV");
330 } else {
331 if (!MC::isBeam(beams.first) || !MC::isBeam(beams.second)) {
332 ATH_MSG_WARNING("Beam particles have incorrectly set status -- this generator interface should be fixed");
334 }
335 const double sumE = beams.first->momentum().e() + beams.second->momentum().e();
336 const double sumP = beams.first->momentum().pz() + beams.second->momentum().pz();
337 cmenergy = std::sqrt(sumE*sumE - sumP*sumP);
338
339 if(beams.first->pdg_id() == MC::OXYGEN && beams.second->pdg_id() == MC::OXYGEN){//OO collisions
340 cmenergy /= MC::baryonNumber(MC::OXYGEN); // divided by the total number of nucleons per nucleus
341 }
342 if(beams.first->pdg_id() == MC::LEAD && beams.second->pdg_id() == MC::LEAD){//PbPb collisions
343 cmenergy /= MC::baryonNumber(MC::LEAD); // divided by the total number of nucleons per nucleus
344 }
345 if(beams.first->pdg_id() == MC::OXYGEN && beams.second->pdg_id() == MC::PROTON){//Op collisions
346 cmenergy = -2.0*beams.second->momentum().pz()*std::sqrt(static_cast<double>(MC::numberOfProtons(MC::OXYGEN))/MC::baryonNumber(MC::OXYGEN));
347 }
348 if(beams.first->pdg_id() == MC::PROTON && beams.second->pdg_id() == MC::OXYGEN){//pO collisions
349 cmenergy = 2.0*beams.first->momentum().pz()*std::sqrt(static_cast<double>(MC::numberOfProtons(MC::OXYGEN))/MC::baryonNumber(MC::OXYGEN));
350 }
351 if(beams.first->pdg_id() == MC::LEAD && beams.second->pdg_id() == MC::PROTON){//Pbp collisions
352 cmenergy = -2.0*beams.second->momentum().pz()*std::sqrt(static_cast<double>(MC::numberOfProtons(MC::LEAD))/MC::baryonNumber(MC::LEAD));
353 }
354 if(beams.first->pdg_id() == MC::PROTON && beams.second->pdg_id() == MC::LEAD){//pPb collisions
355 cmenergy = 2.0*beams.first->momentum().pz()*std::sqrt(static_cast<double>(MC::numberOfProtons(MC::LEAD))/MC::baryonNumber(MC::LEAD));
356 }
357 if(beams.first->pdg_id() == MC::OXYGEN && beams.second->pdg_id() == MC::HELIUM){//OHe collisions
358 cmenergy /= std::sqrt(static_cast<double>(MC::baryonNumber(MC::OXYGEN)*MC::baryonNumber(MC::HELIUM)));
359 }
360 if(beams.first->pdg_id() == MC::HELIUM && beams.second->pdg_id() == MC::OXYGEN){//HeO collisions
361 cmenergy /= std::sqrt(static_cast<double>(MC::baryonNumber(MC::OXYGEN)*MC::baryonNumber(MC::HELIUM)));
362 }
363
364 if (m_cm_energy > 0 && std::abs(cmenergy - m_cm_energy) > m_cme_diff) {
365 ATH_MSG_FATAL("Beam particles have incorrect energy: " << m_cm_energy/Gaudi::Units::GeV << " GeV expected, vs. " << cmenergy/Gaudi::Units::GeV << " GeV found");
366 setFilterPassed(false, ctx);
367 if (m_doHist){
368 m_h_beamparticle1_Energy->Fill(beams.first->momentum().e()/Gaudi::Units::GeV);
369 m_h_beamparticle2_Energy->Fill(beams.second->momentum().e()/Gaudi::Units::GeV);
370 m_h_cmEnergyDiff->Fill((cmenergy-m_cm_energy)/Gaudi::Units::GeV);
371 }
373 // Special case: this is so bad that we immediately fail out
374 return StatusCode::FAILURE;
375 }
376 }
377
378 // Check vertices
379 int vtxDisplacedstatuscode12CheckRateCnt=0;
380 int vtxDisplacedstatuscodenot12CheckRateCnt=0;
381 int vtxDisplacedMoreThan_1m_CheckRateCnt=0;
382 for (const auto& vtx: evt->vertices()) {
383 const HepMC::FourVector pos = vtx->position();
384
385 // Check for NaNs and infs in vertex position components
386 if ( std::isnan(pos.x()) || std::isinf(pos.x()) ||
387 std::isnan(pos.y()) || std::isinf(pos.y()) ||
388 std::isnan(pos.z()) || std::isinf(pos.z()) ) {
389 ATH_MSG_WARNING("NaN (Not A Number) or inf found in the event record vertex positions");
390
392 if (m_dumpEvent) HepMC::Print::content(std::cout,*evt);
393 if (m_vtxNaNTest) {
394 filter_pass = false;
395 }
396 } // Done of checking for nans and infinities
397
398 // Check for too-far-displaced vertices
399 // Anything which propagates macroscopically should be set stable in evgen for G4 to handle
400 const double dist_trans2 = pos.x()*pos.x() + pos.y()*pos.y(); // in mm2
401 const double dist2 = dist_trans2 + pos.z()*pos.z(); // in mm2
402 const double dist_trans = std::sqrt(dist_trans2); // in mm
403 const double dist = std::sqrt(dist2); // in mm
404 if (dist2 > m_max_dist*m_max_dist) {
405 ATH_MSG_WARNING("Found vertex position displaced by more than " << m_max_dist << "mm: " << dist << "mm");
406 ++vtxDisplacedMoreThan_1m_CheckRateCnt;
407
408 if (m_vtxDisplacedTest) {
409 filter_pass = false;
410 }
411 }
412 if (dist_trans2 < m_min_dist_trans*m_min_dist_trans) {
413 ATH_MSG_WARNING("Found vertex position displaced by less than " << m_min_dist_trans
414 << "mm in transverse distance: " << dist_trans << "mm");
415
416 for (const auto& part: vtx->particles_in()) {
417 if (m_dumpEvent){
418 ATH_MSG_WARNING("Incoming particle : ");
419 HepMC::Print::line(msg( MSG::WARNING ).stream(), part);
420 }
421 }
422
423 if (m_vtxDisplacedTest) {
424 filter_pass = false;
425 }
426 }
427
428 if (dist_trans2 > m_max_dist_trans*m_max_dist_trans) {
429 ATH_MSG_WARNING("Found vertex position displaced by more than " << m_max_dist_trans << "mm in transverse distance: " << dist_trans << "mm");
430
431 for (const auto& part: vtx->particles_in()) {
432 if (m_dumpEvent){
433 ATH_MSG_WARNING("Outgoing particle : ");
434 HepMC::Print::line(msg( MSG::WARNING ).stream(),part);
435 }
436 ATH_MSG_WARNING("production vertex = " << part->production_vertex()->position().x() << ", " << part->production_vertex()->position().y() << ", " << part->production_vertex()->position().z());
437 ATH_MSG_WARNING("end vertex = " << part->end_vertex()->position().x() << ", " << part->end_vertex()->position().y() << ", " << part->end_vertex()->position().z());
438 if (m_dumpEvent) ATH_MSG_WARNING("parents info: ");
439 if (part->production_vertex()) {
440 for(const auto& p_parents: part->production_vertex()->particles_in()) {
441 if (m_dumpEvent){
442 msg(MSG::WARNING) << "\t";
443 HepMC::Print::line( msg( MSG::WARNING ).stream() , p_parents );
444 }
445 }
446 } // Done with fancy print
447
448 if (part->status() == 1 || part->status() == 2){
449 vtxDisplacedstatuscode12CheckRateCnt += 1;
450 } else {
451 vtxDisplacedstatuscodenot12CheckRateCnt += 1;
452 }
453
454 if (m_doHist){
455 m_h_energy_dispVtxCheck->Fill(part->momentum().e()/Gaudi::Units::GeV);
456 if (part->momentum().e()/Gaudi::Units::GeV < 10.) {
457 m_h_energy_dispVtxCheck_lt10->Fill(part->momentum().e()/Gaudi::Units::GeV);
458 }
459 m_h_pdgid_dispVtxCheck->Fill(part->pdg_id());
460 m_h_status_dispVtxCheck->Fill(part->status());
461 m_h_px_dispVtxCheck->Fill(part->momentum().px()/Gaudi::Units::GeV);
462 m_h_py_dispVtxCheck->Fill(part->momentum().py()/Gaudi::Units::GeV);
463 m_h_pz_dispVtxCheck->Fill(part->momentum().pz()/Gaudi::Units::GeV);
464 m_h_vx_dispVtxCheck->Fill(part->end_vertex()->position().x());
465 m_h_vy_dispVtxCheck->Fill(part->end_vertex()->position().y());
466 m_h_vz_dispVtxCheck->Fill(part->end_vertex()->position().z());
467 m_h_vxprod_dispVtxCheck->Fill(part->production_vertex()->position().x());
468 m_h_vyprod_dispVtxCheck->Fill(part->production_vertex()->position().y());
469 m_h_vzprod_dispVtxCheck->Fill(part->production_vertex()->position().z());
470 double endvx = part->end_vertex()->position().x();
471 double endvy = part->end_vertex()->position().y();
472 double endvz = part->end_vertex()->position().z();
473 double prodvx = part->production_vertex()->position().x();
474 double prodvy = part->production_vertex()->position().y();
475 double prodvz = part->production_vertex()->position().z();
476 double enddis = std::sqrt(endvx*endvx + endvy*endvy + endvz*endvz);
477 double proddis = std::sqrt(prodvx*prodvx + prodvy*prodvy + prodvz*prodvz);
478 m_h_vtxend_dispVtxCheck->Fill(enddis);
479 m_h_vtxprod_dispVtxCheck->Fill(proddis);
480 } // End of the filling of histograms for bad vertices
481 } // End of a loop over theparents of the bad vertex
482 } // Found a bad vertex
483 } // Loop over all vertices
484 if (vtxDisplacedstatuscode12CheckRateCnt>0) ++m_vtxDisplacedstatuscode12CheckRate;
485 if (vtxDisplacedstatuscodenot12CheckRateCnt>0) ++m_vtxDisplacedstatuscodenot12CheckRate;
486 if (vtxDisplacedMoreThan_1m_CheckRateCnt>0) ++m_vtxDisplacedMoreThan_1m_CheckRate;
487
488 // Check particles
489 for (auto pitr: *evt) {
490
491 // Local loop variables to clean up the check code
492 const HepMC::FourVector pmom = pitr->momentum();
493 const int pstatus = pitr->status();
494 const int ppdgid = pitr->pdg_id();
495 // Check for NaNs and infs in momentum components
496 if ( std::isnan(pmom.px()) || std::isinf(pmom.px()) ||
497 std::isnan(pmom.py()) || std::isinf(pmom.py()) ||
498 std::isnan(pmom.pz()) || std::isinf(pmom.pz()) ||
499 std::isnan(pmom.e()) || std::isinf(pmom.e()) ) {
500 ATH_MSG_WARNING("NaN (Not A Number) or inf found in the event record momenta");
502
503 if (m_dumpEvent) HepMC::Print::line(std::cout,pitr);
504 if (m_momNaNTest) {
505 filter_pass = false;
506 }
507 } // End of check for NaNs and infinities
508
509 // Check for undecayed pi0s
510 if (MC::isStable(pstatus) || MC::isDecayed(pstatus)) {
511 if (ppdgid == 111 && !pitr->end_vertex() ) {
512 unDecPi0.push_back( pitr);
514 }
515 } // End of check for undecayed pi0s
516
517 //check stable particle lifetimes
518 if (MC::isStable(pstatus)) {
519 const HepPDT::ParticleData* pd = particleData(ppdgid);
520 if (pd != NULL) {
521 double plifetime = pd->lifetime()*1e+12; // why lifetime doesn't come in common units???
522 if (plifetime != 0 && plifetime < m_min_tau) { // particles with infinite lifetime get a 0 in the PDT
523 ATH_MSG_WARNING("Stable particle found with lifetime = " << plifetime << "~ns!!");
524 if (m_dumpEvent) HepMC::Print::line(std::cout,pitr);
525
527
528 if (m_lifeTimeTest) {
529 filter_pass = false;
530 }
531 } // Particle did not have infinite lifetime
532 } // The particle has a data table (so a lifetime)
533 else{
534 int susyPart = 0;
535 std::vector<int>::size_type count = 0;
536 while (susyPart==0 && (count < m_SusyPdgID_tab.size() )){
537 // no warning for SUSY particles from the list susyParticlePdgid.txt
538 if (m_SusyPdgID_tab[count] == std::abs(ppdgid)) {
539 susyPart=1;
540 }
541 count++;
542 } // Look through the SUSY table to see if this one should be counted
543 if (susyPart==0){
544 ATH_MSG_WARNING("Stable particle not found in PDT, no lifetime check done");
545 if (m_dumpEvent) HepMC::Print::line(std::cout,pitr);
546 } // It's a SUSY particle -- skip the lifetime check
547 } // The particle has no data table
548 } // Test if the particle is stable
549
550 //Check that stable particles are known by G4 or they are non-interacting
551 const MC::DecodedPID decodedPID(ppdgid);
552 const int first_dig = decodedPID(0);
553
554 if (MC::isStable(pstatus) && (!pitr->end_vertex()) && (MC::isSimInteracting(pitr)) && (!MC::isNucleus(ppdgid)) && (first_dig != 9) ) {
555
556 int known_byG4 = 0;
557 std::vector<int>::size_type count =0;
558
559 while (known_byG4==0 && count < m_G4pdgID_tab.size()){
560 if(ppdgid == m_G4pdgID_tab[count]) known_byG4=1;
561 count++;
562 }
563 if(known_byG4==0){
564 nonG4_energy += pmom.e();
565 ATH_MSG_WARNING("Interacting particle not known by Geant4 with ID " << ppdgid);
566 }
567 } // End of check that stable particles are known to G4 or are non-interacting
568
569 // Check for bad PDG IDs
570 if (!MC::isValid(ppdgid)){
571 ATH_MSG_DEBUG("Invalid PDG ID found: " << ppdgid);
572 if (m_unknownPDGIDTest && std::find(m_uknownPDGID_tab.begin(),m_uknownPDGID_tab.end(),ppdgid)==m_uknownPDGID_tab.end()){
573 ATH_MSG_WARNING("Invalid and unmasked PDG ID found: " << ppdgid);
574 filter_pass = false;
576 }
577 } // End of check for invalid PDG IDs
578
579 // Check for unstables with no end vertex,
580 if (!pitr->end_vertex() && MC::isDecayed(pstatus)) {
581 unstNoEnd.push_back(pitr);
583 } // End of check for unstable with no end vertex
584
585 // Sum final state mom/energy, and note negative energy / tachyonic particles
586 // std::cout << "status " << pstatus << " e " << pmom.e() << " pz " << pmom.pz()<< std::endl;
587 if ( MC::isStable(pstatus) && !pitr->end_vertex() ) {
588 totalPx += pmom.px();
589 totalPy += pmom.py();
590 totalPz += pmom.pz();
591 totalE += pmom.e();
592 if (pmom.e() < 0) {
593 negEnPart.push_back(pitr);
595 }
596 const double aener = std::abs(pmom.e());
597 if ( aener+m_accur_margin < std::abs(pmom.px()) || aener+m_accur_margin < std::abs(pmom.py()) || aener+m_accur_margin < std::abs(pmom.pz()) ) {
598 tachyons.push_back(pitr);
600 }
601 } // End of sums for momentum and energy conservation
602
603 // Decay checks (uses PdgToSearch attr value, for tau by default)
605 int tau_child = 0;
606 if (std::abs(ppdgid) == m_pdg && (MC::isStable(pstatus) || MC::isDecayed(pstatus))) {
607 ++m_TotalTaus;
608 auto vtx = pitr->end_vertex();
609 if (vtx) {
610 double p_energy = 0;
611 for (auto desc: HepMC::descendant_particles(vtx)) {
612 if (std::abs(desc->pdg_id()) == m_pdg) tau_child = 1;
613 if ( MC::isStable(desc) ) p_energy += desc->momentum().e();
614 }
615 if (std::abs( p_energy - pmom.e()) > m_energy_diff && !tau_child) {
616 ATH_MSG_WARNING("Energy sum (decay products): "
617 << "Energy (original particle) > " << m_energy_diff << " MeV, "
618 << "Event #" << evt->event_number() << ", "
619 << "The original particle = " << pitr);
621 if (m_dumpEvent) HepMC::Print::content(std::cout,*evt);
622 }
623 //most taus should not decay immediately
624 const HepMC::FourVector tau_decaypos = vtx->position();
625 const double tau_displacement = tau_decaypos.x()*tau_decaypos.x() + tau_decaypos.y()*tau_decaypos.y() + tau_decaypos.z()*tau_decaypos.z();
626 //tau_child != 1 exclude cases in which a tau is copied to another vertex or emits a photon
627 if ((tau_displacement < 1.e-6) && (tau_child!=1)) ++m_FastDecayedTau;
628 } else {
629 ATH_MSG_WARNING("UNDECAYED PARTICLE WITH PDG_ID = " << m_pdg);
631 if (m_dumpEvent) HepMC::Print::content(std::cout,*evt);
632 }
633 } // End of checks for specific particle (tau by default)
634
635 // Check for undisplaced decay daughters from long-lived hadrons
636 if (pitr->end_vertex()) {
637 auto decayvtx = pitr->end_vertex();
638 const HepMC::FourVector decaypos = decayvtx->position();
639 const double displacement = decaypos.x()*decaypos.x() + decaypos.y()*decaypos.y() + decaypos.z()*decaypos.z();
640 if (displacement > 1e-6) {
641 for (auto ip: *decayvtx) {
642 const HepMC::FourVector pos2 = ip->production_vertex()->position();
643 const double displacement2 = pos2.x()*pos2.x() + pos2.y()*pos2.y() + pos2.z()*pos2.z();
644 if (displacement2 < 1e-6) {
645 ATH_MSG_WARNING("Decay child " << ip << " from " << pitr
646 << " has undisplaced vertex (" << ip->production_vertex()
647 << " @ " << displacement2 << "mm) "
648 << " but parent vertex is displaced (" << decayvtx
649 << " @ " << displacement << "mm)");
650 undisplaceds.push_back(std::move(ip));
652 } // Check for displacement below 1 um
653 } // Loop over all particles coming from the decay vertex
654 } // Displacement of greater than 1 um
655 } // End of check for undisplaced decay daughters from long-lived hadrons
656
657 // Check for photons with non-zero masses
659 if (MC::isPhoton(ppdgid) && MC::isStable(pstatus)) {
660 const double mass = pitr->generated_mass();
661 if (std::abs(mass) > 1.0) { // in MeV
662 ATH_MSG_WARNING("Photon with non-zero mass found! Mass: " << mass << " MeV" << pitr);
664 }
665 } // End check for photons with too-large a mass
666
667 } // End of loop over particles in the event
668
669 // Energy of interacting particles not known by Geant4
670 if(nonG4_energy > m_nonG4_energy_threshold) {
671 ATH_MSG_WARNING("The energy of interacting particles not known by Geant4 is = " << nonG4_energy << " MeV");
672 if (m_energyG4Test) {
673 filter_pass = false;
674 }
676 } // End of check for interacting particles not known by G4
677
678 // Energy balance
679 double lostE = std::abs(totalE - cmenergy);
680 if (lostE > m_energy_diff) {
681 ATH_MSG_WARNING("ENERGY BALANCE FAILED : E-difference = " << lostE << " MeV");
682
683 ATH_MSG_WARNING("balance " << totalPx << " " << totalPy << " " << totalPz << " " << totalE);
684
685 if (m_doHist){
686 m_h_energyImbalance->Fill(lostE/Gaudi::Units::GeV);
687 }
688 if (m_dumpEvent) HepMC::Print::content(std::cout,*evt);
690 filter_pass = false;
691 }
693 } // End of energy balance check
694
695 // Momentum balance
696 if ( std::abs(totalPx) > m_energy_diff || std::abs(totalPy) > m_energy_diff || std::abs(totalPz) > m_energy_diff ) {
697 ATH_MSG_WARNING("MOMENTUM BALANCE FAILED : SumPx = " << totalPx << " SumPy = " << totalPy << " SumPz = " << totalPz << " MeV");
698 if (m_doHist){
699 m_h_momentumImbalance_px->Fill(std::abs(totalPx)/Gaudi::Units::GeV);
700 m_h_momentumImbalance_py->Fill(std::abs(totalPy)/Gaudi::Units::GeV);
701 m_h_momentumImbalance_pz->Fill(std::abs(totalPz)/Gaudi::Units::GeV);
702 }
703 if (m_dumpEvent) HepMC::Print::content(std::cout,*evt);
704 if (m_momImbalanceTest) {
705 filter_pass = false;
706 }
708 } // End of momentum balance check
709
710 // Negative energy particles
711 if (!negEnPart.empty()) {
712 std::stringstream ss;
713 ss << "NEGATIVE ENERGY PARTICLES FOUND :";
714 for (const auto &b: negEnPart){
715 ss << " " << b;
716 }
717 ATH_MSG_WARNING(ss.str());
718 if (m_dumpEvent) HepMC::Print::content(std::cout,*evt);
720 filter_pass = false;
721 }
723 } // End of negative energy particle chedk
724
725 // Tachyons
726 if (!tachyons.empty()) {
727 std::stringstream ss;
728 ss << "PARTICLES WITH |E| < |Pi| (i=x,y,z) FOUND :";
729 for (auto b: tachyons){
730 ss << " " << b;
731 }
732 ATH_MSG_WARNING(ss.str());
733 if (m_dumpEvent) HepMC::Print::content(std::cout,*evt);
734 if (m_tachyonsTest) {
735 filter_pass = false;
736 }
738 } // End of tachyon check
739
740 // Unstable particles with no decay vertex
741 if (!unstNoEnd.empty()) {
742 std::stringstream ss;
743 ss << "Unstable particle with no decay vertex found: ";
744 for (auto b: unstNoEnd){
745 ss << " " << b;
746 }
747 ATH_MSG_WARNING(ss.str());
748 if (m_dumpEvent) HepMC::Print::content(std::cout,*evt);
750 filter_pass = false;
751 }
753 } // End of unstable particle with no decay vertex check
754
755 // Undecayed pi0
756 if (!unDecPi0.empty()) {
757 std::stringstream ss;
758 ss << "pi0 with no decay vertex found:";
759 for (auto b: unDecPi0){
760 ss << " " << b;
761 }
762 ATH_MSG_WARNING(ss.str());
763 if (m_dumpEvent) HepMC::Print::content(std::cout,*evt);
764 if (m_pi0NoVtxTest) {
765 filter_pass = false;
766 }
768 } // End of undecayed pi0 check
769
770 // Undisplaced decay daughters of displaced vertices
771 if (!undisplaceds.empty()) {
772 std::stringstream ss{"Undisplaced decay vertices from displaced particle: "};
773 for (HepMC::ConstGenParticlePtr b: undisplaceds){
774 // coverity[COPY_INSTEAD_OF_MOVE]
775 ss << " " << b;
776 }
777 ATH_MSG_WARNING(ss.str());
778 if (m_dumpEvent) HepMC::Print::content(std::cout,*evt);
780 filter_pass = false;
781 }
783 } // End of undisplaced decay daughter of displaced vertices check
784
785 } // End of loop over MCEventCollection
786
787 // End of execution for each event - update filter value
788 if (!filter_pass){
789 setFilterPassed(false, ctx);
790 ++m_nFail;
791 } else {
792 ++m_nPass;
793 }
794
795 // If the efficiency after 100 events is below 10%, there is an important bug going on:
796 // we fail the job immediately so it doesn't run for ever
797 const double tmp_efficiency = double(m_nPass) / double(m_nPass + m_nFail);
798 if ((m_nPass + m_nFail) > 100 && tmp_efficiency < 0.1) {
799 ATH_MSG_FATAL("The efficiency after " << m_nPass + m_nFail << " events is " << tmp_efficiency*100. << "% !!!");
800 return StatusCode::FAILURE;
801 }
802
803 return StatusCode::SUCCESS;
804}
#define ATH_MSG_FATAL(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
static Double_t ss
void setFilterPassed(bool state) const
const HepPDT::ParticleData * particleData(int pid) const
Access an element in the particle data table.
Definition GenBase.h:124
std::vector< int > m_uknownPDGID_tab
Definition TestHepMC.h:96
MC::Loops< HepMC::GenEvent, HepMC::ConstGenParticlePtr, HepMC::ConstGenVertexPtr > m_looper
member to detect loops
Definition TestHepMC.h:130
std::vector< int > m_G4pdgID_tab
Definition TestHepMC.h:94
std::vector< int > m_SusyPdgID_tab
Definition TestHepMC.h:95
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:148
HepMC3::FourVector FourVector
HepMC3::ConstGenParticlePtr ConstGenParticlePtr
Definition GenParticle.h:20
bool valid_beam_particles(const GenEvent *e)
Definition GenEvent.h:599
HepMC3::GenEvent GenEvent
Definition GenEvent.h:39
int numberOfProtons(const T &p)
static const int HELIUM
static const int OXYGEN
bool isPhoton(const T &p)
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
bool isSimInteracting(const T &p)
Identify if the particle could interact with the detector during the simulation, e....
static const int LEAD
bool isDecayed(const T &p)
Identify if the particle decayed.
bool isBeam(const T &p)
Identify if the particle is beam particle.
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
bool isNucleus(const T &p)
PDG rule 16 Nuclear codes are given as 10-digit numbers ±10LZZZAAAI.
double baryonNumber(const T &p)
static const int PROTON
MsgStream & msg
Definition testRead.cxx:32

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 50 of file AthAlgorithm.cxx.

51{
52 // If we didn't find any symlinks to add, just return the collection
53 // from the base class. Otherwise, return the extended collection.
54 if (!m_extendedExtraObjects.empty()) {
56 }
57 return Algorithm::extraOutputDeps();
58}
DataObjIDColl m_extendedExtraObjects

◆ filterPassed() [1/2]

bool AthAlgorithm::filterPassed ( ) const
inherited

Definition at line 94 of file AthAlgorithm.cxx.

94 {
95 return filterPassed( Gaudi::Hive::currentContext() );
96}
bool filterPassed() const

◆ filterPassed() [2/2]

bool AthAlgorithm::filterPassed ( const EventContext & ctx) const
inherited

Definition at line 98 of file AthAlgorithm.cxx.

98 {
99 return execState( ctx ).filterPassed();
100}

◆ finalize()

StatusCode TestHepMC::finalize ( )

Definition at line 807 of file TestHepMC.cxx.

807 {
808
809 ATH_MSG_INFO("Events passed = " << m_nPass << ", Events Failed = " << m_nFail);
810 // Keep a denominator for all the fractions, to ensure we don't get a bunch of nans.
811 // If nothing passed or failed, all the other counters should be zero; this is just avoiding FPEs etc.
812 double denom = m_nPass + m_nFail > 0. ? m_nPass + m_nFail : 1.;
813
814 ATH_MSG_INFO(" Event rate with invalid Beam Particles = " << m_invalidBeamParticlesCheckRate*100.0/denom << "% (not included in test efficiency)");
815 ATH_MSG_INFO(" Event rate with beam particles and status not equal to 4 = " << m_beamParticleswithStatusNotFourCheckRate*100.0/double(m_nPass + m_nFail) << "% (not included in test efficiency)");
816 ATH_MSG_INFO(" Event rate with incorrect beam particle energies = " << m_beamEnergyCheckRate*100.0/denom << "% (not included in test efficiency)");
817 ATH_MSG_INFO(" Configured minimum transverse vertex displacement = " << m_min_dist_trans << "~mm");
818 ATH_MSG_INFO(" Event rate with NaN (Not A Number) or inf found in the event record vertex positions = " << m_vtxNANandINFCheckRate*100.0/denom << "%");
819 if (!m_vtxNaNTest) ATH_MSG_INFO(" The check for NaN or inf in vtx. record is switched off, so is not included in the final TestHepMC efficiency ");
820 ATH_MSG_INFO(" Event rate with vertices displaced more than " << m_max_dist_trans << "~mm in transverse direction for particles with status code other than 1 and 2 = " << m_vtxDisplacedstatuscodenot12CheckRate*100.0/denom << "% (not included in test efficiency)");
821 ATH_MSG_INFO(" Event rate with vertices displaced more than " << m_max_dist << "~mm = " << m_vtxDisplacedMoreThan_1m_CheckRate*100.0/denom << "%");
822 if (!m_vtxDisplacedTest) ATH_MSG_INFO(" The check for displaced vertices is switched off, so is not included in the final TestHepMC efficiency ");
823 ATH_MSG_INFO(" Event rate with NAN (Not A Number) or inf found in particle momentum values = " << m_partMomentumNANandINFCheckRate*100.0/denom << "%");
824 if (!m_momNaNTest) ATH_MSG_INFO(" The check for NaN/inf in momentum record is switched off, so is not included in the final TestHepMC efficiency ");
825 ATH_MSG_INFO(" Event rate with undecayed pi0's with status 1 or 2 = " << m_undecayedPi0statuscode12CheckRate*100.0/denom << "% (not included in test efficiency)");
826 ATH_MSG_INFO(" Event rate with unstable particles with no end vertex = " << m_unstableNoEndVtxCheckRate*100.0/denom << "% (not included in test efficiency)");
827 ATH_MSG_INFO(" Event rate with negative total energy like for tachyonic particles = " << m_negativeEnergyTachyonicCheckRate*100.0/denom << "% (not included in test efficiency)");
828 ATH_MSG_INFO(" Event rate with particles with improper decay properties = " << m_decayCheckRate*100.0/denom << "% (not included in test efficiency)");
829 ATH_MSG_INFO(" Event rate with undisplaced daughters of long lived hadrons = " << m_undisplacedLLHdaughtersCheckRate*100.0/denom << "% (not included in test efficiency)");
830 ATH_MSG_INFO(" Event rate with non zero photon mass = " << m_nonZeroPhotonMassCheckRate*100.0/denom << "% (not included in test efficiency)");
831 ATH_MSG_INFO(" Event rate with no energy balance = " << m_energyBalanceCheckRate*100.0/denom << "%");
832 if (!m_energyImbalanceTest) ATH_MSG_INFO(" The check for energy imbalance is switched off, so is not included in the final TestHepMC efficiency ");
833 ATH_MSG_INFO(" Event rate with no momentum balance = " << m_momentumBalanceCheckRate*100.0/denom << "%");
834 if (!m_momImbalanceTest) ATH_MSG_INFO(" The check for momentum imbalance is switched off, so is not included in the final TestHepMC efficiency ");
835 ATH_MSG_INFO(" Event rate with negative energy particles = " << m_negativeEnergyCheckRate*100.0/denom << "%");
836 if (!m_negativeEnergyTest) ATH_MSG_INFO(" The check for particles with negative energy is switched off, so is not included in the final TestHepMC efficiency ");
837 ATH_MSG_INFO(" Event rate with tachyons = " << m_tachyonCheckRate*100.0/denom << "%");
838 if (!m_tachyonsTest) ATH_MSG_INFO(" The check for tachyons is switched off, so is not included in the final TestHepMC efficiency ");
839 ATH_MSG_INFO(" Event rate with stable or unstable particles with no parents = " << m_stableUnstableNoParentCheckRate*100.0/denom << "%");
840 ATH_MSG_INFO(" Event rate with unstable particle with no decay vertex = " << m_unstablePartNoDecayVtxCheckRate*100.0/denom << "%");
841 if (!m_unstableNoVtxTest) ATH_MSG_INFO(" The check for unstable part. without end vertex is switched off, so is not included in the final TestHepMC efficiency ");
842 ATH_MSG_INFO(" Event rate with undecayed Pi0's = " << m_undecayedPi0CheckRate*100.0/denom << "%");
843 if (!m_pi0NoVtxTest) ATH_MSG_INFO(" The check for undecayed pi0's is switched off, so is not included in the final TestHepMC efficiency ");
844 ATH_MSG_INFO(" Event rate with undisplaced decay daughters of displaced vertices = " << m_undisplacedDecayDaughtersOfDisplacedVtxCheckRate*100.0/denom << "%");
845 if (!m_undisplacedDaughtersTest) ATH_MSG_INFO(" The check for undisplaced daughters is switched off, so is not included in the final TestHepMC efficiency ");
846 ATH_MSG_INFO(" Event rate with particles with status 1 but lifetime < " << m_min_tau << "~ns = " << m_Status1ShortLifetime*100.0/denom << "%");
847 if (!m_lifeTimeTest) ATH_MSG_INFO(" The check for status 1 particles with too short lifetime is switched off, so is not included in the final TestHepMC efficiency ");
848 ATH_MSG_INFO(" Event rate with energy sum of interacting particles non known by Geant4 above " << m_nonG4_energy_threshold << " MeV = " << m_nonG4_energyCheckRate*100.0/denom << "%");
849 if (!m_energyG4Test) ATH_MSG_INFO(" The check for energy not known by G4 is switched off, so is not included in the final TestHepMC efficiency ");
850 ATH_MSG_INFO(" Event rate with unknown PDG IDs = " << m_unknownPDGIDCheckRate*100.0/denom << "%");
851 if (!m_unknownPDGIDTest) ATH_MSG_INFO(" The check for unknown PDG IDs is sitched off, so it is not included in the final TestHepMC efficiency ");
852
853 const double tau_fastDrate = double(m_FastDecayedTau) / double(m_TotalTaus);
854 if(tau_fastDrate > m_tau_eff_threshold){
855 ATH_MSG_FATAL("MORE THAN " << 100.*m_tau_eff_threshold << "% OF TAUS DECAYING IMMEDIATELY! " << m_FastDecayedTau << " found, out of: " << m_TotalTaus);
856 return StatusCode::FAILURE;
857 }
858
859 if (m_noXSECset) {
860 if (m_allowMissingXSec) {
861 ATH_MSG_WARNING(m_noXSECset << " EVENTS WITHOUT CROSS-SECTION!!! Added dummy cross-section instead.");
862 }
863 else {
864 ATH_MSG_FATAL(m_noXSECset << " EVENTS WITHOUT CROSS-SECTION!! Check the setup before production!");
865 return StatusCode::FAILURE;
866 }
867 }
868
869 const double efficiency = double(m_nPass) / double(m_nPass + m_nFail);
870 ATH_MSG_INFO("Efficiency = " << efficiency * 100 << "%");
871
872 // Check efficiency, and fail (to kill production jobs) if the pass rate is too low
874 ATH_MSG_FATAL("EFFICIENCY ABOVE ERROR THRESHOLD! " << 100*efficiency << "% found, but at least: " << 100*m_eff_fail_threshold << "% required");
875 return StatusCode::FAILURE;
876 } else if (efficiency <= m_eff_warn_threshold) {
877 ATH_MSG_WARNING("EFFICIENCY ABOVE WARNING THRESHOLD! " << 100*efficiency << "% found, but at least: " << 100*m_eff_warn_threshold << "% expected");
878 }
879
880 return StatusCode::SUCCESS;
881}
#define ATH_MSG_INFO(x)
void efficiency(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")

◆ getContext()

const EventContext & AthAlgorithm::getContext ( ) const
inherited

Deprecated methods (use the ones with EventContext).

Definition at line 90 of file AthAlgorithm.cxx.

90 {
91 return Gaudi::Hive::currentContext();
92}

◆ initialize()

StatusCode TestHepMC::initialize ( )
virtual

Reimplemented from GenBase.

Definition at line 131 of file TestHepMC.cxx.

131 {
133
134 if (m_doHist){
135 CHECK(m_thistSvc.retrieve());
136
137 m_h_energy_dispVtxCheck = new TH1F("h_energy_dispVtxCheck", "h_energy_dispVtxCheck", 2000, 0., 2000.);
138 m_h_energy_dispVtxCheck_lt10 = new TH1F("h_energy_dispVtxCheck_lt10", "h_energy_dispVtxCheck_lt10", 1000, 0., 10.);
139 m_h_pdgid_dispVtxCheck = new TH1F("h_pdgid_dispVtxCheck", "h_pdgid_dispVtxCheck", 10000, 0., 10000.);
140 m_h_status_dispVtxCheck = new TH1F("h_status_dispVtxCheck", "h_status_dispVtxCheck", 10000, 0., 10000.);
141 m_h_px_dispVtxCheck = new TH1F("h_px_dispVtxCheck", "h_px_dispVtxCheck", 4000, -2000., 2000.);
142 m_h_py_dispVtxCheck = new TH1F("h_py_dispVtxCheck", "h_py_dispVtxCheck", 4000, -2000., 2000.);
143 m_h_pz_dispVtxCheck = new TH1F("h_pz_dispVtxCheck", "h_pz_dispVtxCheck", 4000, -2000., 2000.);
144 m_h_vx_dispVtxCheck = new TH1F("h_vx_dispVtxCheck", "h_vx_dispVtxCheck", 40000, -200., 200);
145 m_h_vy_dispVtxCheck = new TH1F("h_vy_dispVtxCheck", "h_vy_dispVtxCheck", 40000, -200., 200);
146 m_h_vz_dispVtxCheck = new TH1F("h_vz_dispVtxCheck", "h_vz_dispVtxCheck", 40000, -200., 200);
147 m_h_vxprod_dispVtxCheck = new TH1F("h_vxprod_dispVtxCheck", "h_vxprod_dispVtxCheck", 40000, -200., 200.);
148 m_h_vyprod_dispVtxCheck = new TH1F("h_vyprod_dispVtxCheck", "h_vyprod_dispVtxCheck", 40000, -200., 200.);
149 m_h_vzprod_dispVtxCheck = new TH1F("h_vzprod_dispVtxCheck", "h_vzprod_dispVtxCheck", 40000, -200., 200.);
150 m_h_vtxprod_dispVtxCheck = new TH1F("h_vtxprod_dispVtxCheck", "h_vtxprod_dispVtxCheck", 20000, 0., 200.);
151 m_h_vtxend_dispVtxCheck = new TH1F("h_vtxend_dispVtxCheck", "h_vtxend_dispVtxCheck", 20000, 0., 200.);
152 m_h_photon_mass = new TH1F("h_photon_mass", "h_photon_mass", 20000, -10000., 10000);
153 m_h_photon_energy = new TH1F("h_photon_energy", "h_photon_energy", 20000, -10000., 10000);
154 m_h_photon_e2_p2_e2 = new TH1F("h_photon_e2_p2_e2", "h_photon_e2_p2_e2", 20000, -10., 10);
155 m_h_energyImbalance = new TH1F("h_energyImbalance", "h_energyImbalance", 2000, 0., 2000.);
156 m_h_momentumImbalance_px = new TH1F("h_momentumImbalance_px", "h_momentumImbalance_px", 2000,0., 2000.);
157 m_h_momentumImbalance_py = new TH1F("h_momentumImbalance_py", "h_momentumImbalance_py", 2000,0., 2000.);
158 m_h_momentumImbalance_pz = new TH1F("h_momentumImbalance_pz", "h_momentumImbalance_pz", 2000,0., 2000.);
159 m_h_beamparticle1_Energy = new TH1F("h_beamparticle1_Energy", "h_beamparticle1_Energy", 14000,0., 14000.);
160 m_h_beamparticle2_Energy = new TH1F("h_beamparticle2_Energy", "h_beamparticle2_Energy", 14000,0., 14000.);
161 m_h_cmEnergyDiff = new TH1F("h_cmEnergyDiff", "h_cmEnergyDiff", 8000, -4000., 4000.);
162
163 CHECK(m_thistSvc->regHist("/TestHepMCname/h_energy_dispVtxCheck", m_h_energy_dispVtxCheck));
164 CHECK(m_thistSvc->regHist("/TestHepMCname/h_energy_dispVtxCheck_lt10", m_h_energy_dispVtxCheck_lt10));
165 CHECK(m_thistSvc->regHist("/TestHepMCname/h_pdgid_dispVtxCheck", m_h_pdgid_dispVtxCheck));
166 CHECK(m_thistSvc->regHist("/TestHepMCname/h_status_dispVtxCheck", m_h_status_dispVtxCheck));
167 CHECK(m_thistSvc->regHist("/TestHepMCname/h_px_dispVtxCheck", m_h_px_dispVtxCheck));
168 CHECK(m_thistSvc->regHist("/TestHepMCname/h_py_dispVtxCheck", m_h_py_dispVtxCheck));
169 CHECK(m_thistSvc->regHist("/TestHepMCname/h_pz_dispVtxCheck", m_h_pz_dispVtxCheck));
170 CHECK(m_thistSvc->regHist("/TestHepMCname/h_vx_dispVtxCheck", m_h_vx_dispVtxCheck));
171 CHECK(m_thistSvc->regHist("/TestHepMCname/h_vy_dispVtxCheck", m_h_vy_dispVtxCheck));
172 CHECK(m_thistSvc->regHist("/TestHepMCname/h_vz_dispVtxCheck", m_h_vz_dispVtxCheck));
173 CHECK(m_thistSvc->regHist("/TestHepMCname/h_vxprod_dispVtxCheck", m_h_vxprod_dispVtxCheck));
174 CHECK(m_thistSvc->regHist("/TestHepMCname/h_vyprod_dispVtxCheck", m_h_vyprod_dispVtxCheck));
175 CHECK(m_thistSvc->regHist("/TestHepMCname/h_vzprod_dispVtxCheck", m_h_vzprod_dispVtxCheck));
176 CHECK(m_thistSvc->regHist("/TestHepMCname/h_vtxprod_dispVtxCheck", m_h_vtxprod_dispVtxCheck));
177 CHECK(m_thistSvc->regHist("/TestHepMCname/h_vtxend_dispVtxCheck", m_h_vtxend_dispVtxCheck));
178 CHECK(m_thistSvc->regHist("/TestHepMCname/h_photon_mass", m_h_photon_mass));
179 CHECK(m_thistSvc->regHist("/TestHepMCname/h_photon_energy", m_h_photon_energy));
180 CHECK(m_thistSvc->regHist("/TestHepMCname/h_photon_e2_p2_e2", m_h_photon_e2_p2_e2));
181 CHECK(m_thistSvc->regHist("/TestHepMCname/h_energyImbalance", m_h_energyImbalance));
182 CHECK(m_thistSvc->regHist("/TestHepMCname/h_momentumImbalance_px", m_h_momentumImbalance_px));
183 CHECK(m_thistSvc->regHist("/TestHepMCname/h_momentumImbalance_py", m_h_momentumImbalance_py));
184 CHECK(m_thistSvc->regHist("/TestHepMCname/h_momentumImbalance_pz", m_h_momentumImbalance_pz));
185 CHECK(m_thistSvc->regHist("/TestHepMCname/h_beamparticle1_Energy", m_h_beamparticle1_Energy));
186 CHECK(m_thistSvc->regHist("/TestHepMCname/h_beamparticle2_Energy", m_h_beamparticle2_Energy));
187 CHECK(m_thistSvc->regHist("/TestHepMCname/h_cmEnergyDiff", m_h_cmEnergyDiff));
188
189 ATH_MSG_INFO("No decay vertex - is ignored for particles with status (list):" );
190 for ( unsigned int i = 0; i < m_vertexStatuses.size(); i++ ) ATH_MSG_INFO(" : " << m_vertexStatuses.at(i) );
191 ATH_MSG_INFO("Vertex statuses finished");
192
193 } // End of histogramming setup
194
195 // open the files and read G4particle_acceptlist.txt
196
197 const std::string& fileLocation = PathResolverFindDataFile ( "G4particle_acceptlist.txt" );
198 std::ifstream G4file;
199 G4file.open(fileLocation);
200 std::string line;
201 int G4pdgID;
202 if (!G4file.fail()){
203 while(std::getline(G4file,line)){
204 std::stringstream ss(line);
205 ss >> G4pdgID;
206 m_G4pdgID_tab.push_back(G4pdgID);
207 }
208 G4file.close();
209 }
210 else {
211 ATH_MSG_WARNING("Failed to open G4particle_acceptlist.txt, checking that all particles are known by Genat4 cannot be performed");
212 }
213
214 // Open the param file (G4 accept list)
215 G4file.open(m_paramFile.c_str());
216 if (!G4file.fail()){
217 ATH_MSG_INFO("extra accept list for G4 found " << m_paramFile.c_str());
218 while(std::getline(G4file,line)){
219 std::stringstream ss(line);
220 ss >> G4pdgID;
221 m_G4pdgID_tab.push_back(G4pdgID);
222 }
223 G4file.close();
224 }
225 else {
226 ATH_MSG_INFO("extra accept list for G4 not provided ");
227 }
228
229 // Open the files and read susyParticlePdgid.txt
230 std::ifstream susyFile;
231 susyFile.open("susyParticlePdgid.txt");
232 int susyPdgID;
233 if (!susyFile.fail()){
234 while(getline(susyFile,line)){
235 std::stringstream ss1(line);
236 ss1 >> susyPdgID;
237 m_SusyPdgID_tab.push_back(susyPdgID);
238 }
239 susyFile.close();
240 }
241 else{
242 ATH_MSG_WARNING("Failed to open susyParticlePdgid.txt, listing particles not present in PDTTable");
243 }
244
245 // Open the file of extra PDG IDs that don't need to obey the rules
246 std::ifstream pdgFile;
247 pdgFile.open(m_unknownPDGIDFile.c_str());
248 int pdgID;
249 if (!pdgFile.fail()){
250 ATH_MSG_INFO("extra accept list for PDG IDs found " << m_unknownPDGIDFile.c_str());
251 while(std::getline(pdgFile,line)){
252 std::stringstream ss(line);
253 ss >> pdgID;
254 m_uknownPDGID_tab.push_back(pdgID);
255 }
256 pdgFile.close();
257 }
258 else {
259 ATH_MSG_INFO("extra accept list for PDG IDs not provided");
260 }
261
262 // Print Efficiency warning and error thresholds
263 ATH_MSG_INFO("EffWarnThreshold = " << m_eff_warn_threshold * 100 << " %");
264 ATH_MSG_INFO("EffFailThreshold = " << m_eff_fail_threshold * 100 << " %");
265
266 return StatusCode::SUCCESS;
267}
#define CHECK(...)
Evaluate an expression and check for errors.
std::string PathResolverFindDataFile(const std::string &logical_file_name)
virtual StatusCode initialize() override
Definition GenBase.cxx:17
TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isReEntrant()

virtual bool AthAlgorithm::isReEntrant ( ) const
inlinefinaloverrideprotectedvirtualinherited

Legacy algorithms are not thread-safe.

Definition at line 111 of file AthAlgorithm.h.

111{ return false; }

◆ msg()

MsgStream & AthCommonMsg< Gaudi::Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Gaudi::Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ particleData()

const HepPDT::ParticleData * GenBase::particleData ( int pid) const
inlineinherited

Access an element in the particle data table.

Definition at line 124 of file GenBase.h.

124 {
125 return pdt().particle(HepPDT::ParticleID(std::abs(pid)));
126 }
const HepPDT::ParticleDataTable & pdt() const
Shorter alias to get a particle data table.
Definition GenBase.h:121

◆ particleTable()

const HepPDT::ParticleDataTable & GenBase::particleTable ( ) const
inlineinherited

Get a particle data table.

Definition at line 116 of file GenBase.h.

116 {
117 return *(m_ppSvc->PDT());
118 }
ServiceHandle< IPartPropSvc > m_ppSvc
Handle on the particle property service.
Definition GenBase.h:142

◆ partPropSvc()

const ServiceHandle< IPartPropSvc > GenBase::partPropSvc ( ) const
inlineinherited

Access the particle property service.

Definition at line 111 of file GenBase.h.

111 {
112 return m_ppSvc;
113 }

◆ pdt()

const HepPDT::ParticleDataTable & GenBase::pdt ( ) const
inlineinherited

Shorter alias to get a particle data table.

Definition at line 121 of file GenBase.h.

121{ return particleTable(); }
const HepPDT::ParticleDataTable & particleTable() const
Get a particle data table.
Definition GenBase.h:116

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setFilterPassed() [1/2]

void AthAlgorithm::setFilterPassed ( bool state) const
inherited

Definition at line 102 of file AthAlgorithm.cxx.

102 {
103 setFilterPassed( state, Gaudi::Hive::currentContext() );
104}

◆ setFilterPassed() [2/2]

void AthAlgorithm::setFilterPassed ( bool state,
const EventContext & ctx ) const
inherited

Definition at line 106 of file AthAlgorithm.cxx.

106 {
107 execState( ctx ).setFilterPassed(state);
108}

◆ sysInitialize()

StatusCode AthAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc.

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, and PyAthena::Alg.

Definition at line 66 of file AthAlgorithm.cxx.

66 {
68
69 if (sc.isFailure()) {
70 return sc;
71 }
72 ServiceHandle<ICondSvc> cs("CondSvc",name());
73 for (auto h : outputHandles()) {
74 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75 // do this inside the loop so we don't create the CondSvc until needed
76 if ( cs.retrieve().isFailure() ) {
77 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78 return StatusCode::SUCCESS;
79 }
80 if (cs->regHandle(this,*h).isFailure()) {
81 sc = StatusCode::FAILURE;
82 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83 << " with CondSvc");
84 }
85 }
86 }
87 return sc;
88}
static Double_t sc
virtual StatusCode sysInitialize() override
Override sysInitialize.
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }

Member Data Documentation

◆ m_accur_margin

double TestHepMC::m_accur_margin
private

Definition at line 50 of file TestHepMC.h.

◆ m_allowMissingXSec

bool TestHepMC::m_allowMissingXSec
private

Definition at line 47 of file TestHepMC.h.

◆ m_beamEnergyCheckRate

int TestHepMC::m_beamEnergyCheckRate
private

Definition at line 67 of file TestHepMC.h.

◆ m_beamEnergyTest

bool TestHepMC::m_beamEnergyTest
private

Definition at line 52 of file TestHepMC.h.

◆ m_beamParticleswithStatusNotFourCheckRate

int TestHepMC::m_beamParticleswithStatusNotFourCheckRate
private

Definition at line 66 of file TestHepMC.h.

◆ m_cm_energy

double TestHepMC::m_cm_energy
private

Definition at line 45 of file TestHepMC.h.

◆ m_cme_diff

double TestHepMC::m_cme_diff
private

Definition at line 45 of file TestHepMC.h.

◆ m_decayCheckRate

int TestHepMC::m_decayCheckRate
private

Definition at line 76 of file TestHepMC.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 393 of file AthCommonDataStore.h.

◆ m_doHist

bool TestHepMC::m_doHist
private

Definition at line 51 of file TestHepMC.h.

◆ m_dumpEvent

bool TestHepMC::m_dumpEvent
private

Definition at line 47 of file TestHepMC.h.

◆ m_eff_fail_threshold

double TestHepMC::m_eff_fail_threshold
private

Definition at line 49 of file TestHepMC.h.

◆ m_eff_warn_threshold

double TestHepMC::m_eff_warn_threshold
private

Definition at line 49 of file TestHepMC.h.

◆ m_energy_diff

double TestHepMC::m_energy_diff
private

Definition at line 46 of file TestHepMC.h.

◆ m_energyBalanceCheckRate

int TestHepMC::m_energyBalanceCheckRate
private

Definition at line 79 of file TestHepMC.h.

◆ m_energyG4Test

bool TestHepMC::m_energyG4Test
private

Definition at line 52 of file TestHepMC.h.

◆ m_energyImbalanceTest

bool TestHepMC::m_energyImbalanceTest
private

Definition at line 53 of file TestHepMC.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 114 of file AthAlgorithm.h.

◆ m_FastDecayedTau

int TestHepMC::m_FastDecayedTau
private

Definition at line 63 of file TestHepMC.h.

◆ m_G4pdgID_tab

std::vector<int> TestHepMC::m_G4pdgID_tab
private

Definition at line 94 of file TestHepMC.h.

◆ m_h_beamparticle1_Energy

TH1F* TestHepMC::m_h_beamparticle1_Energy
private

Definition at line 126 of file TestHepMC.h.

◆ m_h_beamparticle2_Energy

TH1F* TestHepMC::m_h_beamparticle2_Energy
private

Definition at line 127 of file TestHepMC.h.

◆ m_h_cmEnergyDiff

TH1F* TestHepMC::m_h_cmEnergyDiff
private

Definition at line 128 of file TestHepMC.h.

◆ m_h_energy_dispVtxCheck

TH1F* TestHepMC::m_h_energy_dispVtxCheck
private

Definition at line 101 of file TestHepMC.h.

◆ m_h_energy_dispVtxCheck_lt10

TH1F* TestHepMC::m_h_energy_dispVtxCheck_lt10
private

Definition at line 102 of file TestHepMC.h.

◆ m_h_energyImbalance

TH1F* TestHepMC::m_h_energyImbalance
private

Definition at line 121 of file TestHepMC.h.

◆ m_h_momentumImbalance_px

TH1F* TestHepMC::m_h_momentumImbalance_px
private

Definition at line 122 of file TestHepMC.h.

◆ m_h_momentumImbalance_py

TH1F* TestHepMC::m_h_momentumImbalance_py
private

Definition at line 123 of file TestHepMC.h.

◆ m_h_momentumImbalance_pz

TH1F* TestHepMC::m_h_momentumImbalance_pz
private

Definition at line 124 of file TestHepMC.h.

◆ m_h_pdgid_dispVtxCheck

TH1F* TestHepMC::m_h_pdgid_dispVtxCheck
private

Definition at line 103 of file TestHepMC.h.

◆ m_h_photon_e2_p2_e2

TH1F* TestHepMC::m_h_photon_e2_p2_e2
private

Definition at line 119 of file TestHepMC.h.

◆ m_h_photon_energy

TH1F* TestHepMC::m_h_photon_energy
private

Definition at line 118 of file TestHepMC.h.

◆ m_h_photon_mass

TH1F* TestHepMC::m_h_photon_mass
private

Definition at line 117 of file TestHepMC.h.

◆ m_h_px_dispVtxCheck

TH1F* TestHepMC::m_h_px_dispVtxCheck
private

Definition at line 105 of file TestHepMC.h.

◆ m_h_py_dispVtxCheck

TH1F* TestHepMC::m_h_py_dispVtxCheck
private

Definition at line 106 of file TestHepMC.h.

◆ m_h_pz_dispVtxCheck

TH1F* TestHepMC::m_h_pz_dispVtxCheck
private

Definition at line 107 of file TestHepMC.h.

◆ m_h_status_dispVtxCheck

TH1F* TestHepMC::m_h_status_dispVtxCheck
private

Definition at line 104 of file TestHepMC.h.

◆ m_h_vtxend_dispVtxCheck

TH1F* TestHepMC::m_h_vtxend_dispVtxCheck
private

Definition at line 114 of file TestHepMC.h.

◆ m_h_vtxprod_dispVtxCheck

TH1F* TestHepMC::m_h_vtxprod_dispVtxCheck
private

Definition at line 115 of file TestHepMC.h.

◆ m_h_vx_dispVtxCheck

TH1F* TestHepMC::m_h_vx_dispVtxCheck
private

Definition at line 108 of file TestHepMC.h.

◆ m_h_vxprod_dispVtxCheck

TH1F* TestHepMC::m_h_vxprod_dispVtxCheck
private

Definition at line 111 of file TestHepMC.h.

◆ m_h_vy_dispVtxCheck

TH1F* TestHepMC::m_h_vy_dispVtxCheck
private

Definition at line 109 of file TestHepMC.h.

◆ m_h_vyprod_dispVtxCheck

TH1F* TestHepMC::m_h_vyprod_dispVtxCheck
private

Definition at line 112 of file TestHepMC.h.

◆ m_h_vz_dispVtxCheck

TH1F* TestHepMC::m_h_vz_dispVtxCheck
private

Definition at line 110 of file TestHepMC.h.

◆ m_h_vzprod_dispVtxCheck

TH1F* TestHepMC::m_h_vzprod_dispVtxCheck
private

Definition at line 113 of file TestHepMC.h.

◆ m_invalidBeamParticlesCheckRate

int TestHepMC::m_invalidBeamParticlesCheckRate
private

Definition at line 65 of file TestHepMC.h.

◆ m_lifeTimeTest

bool TestHepMC::m_lifeTimeTest
private

Definition at line 52 of file TestHepMC.h.

◆ m_looper

member to detect loops

Definition at line 130 of file TestHepMC.h.

◆ m_max_dist

double TestHepMC::m_max_dist
private

Definition at line 48 of file TestHepMC.h.

◆ m_max_dist_trans

double TestHepMC::m_max_dist_trans
private

Definition at line 48 of file TestHepMC.h.

◆ m_max_energy_diff

double TestHepMC::m_max_energy_diff
private

Definition at line 46 of file TestHepMC.h.

◆ m_maxloops

int TestHepMC::m_maxloops
private

Definition at line 43 of file TestHepMC.h.

◆ m_mcEventKey

std::string GenBase::m_mcEventKey {}
protectedinherited

StoreGate key for the MC event collection (defaults to GEN_EVENT).

Definition at line 134 of file GenBase.h.

134{};

◆ m_mcevents_const

SG::ReadHandleKey<McEventCollection> GenBase::m_mcevents_const { this, "McEventKey", "GEN_EVENT", "StoreGate key of the MC event collection" }
privateinherited

Const handle to the MC event collection.

Definition at line 145 of file GenBase.h.

145{ this, "McEventKey", "GEN_EVENT", "StoreGate key of the MC event collection" };

◆ m_min_dist_trans

double TestHepMC::m_min_dist_trans
private

Definition at line 48 of file TestHepMC.h.

◆ m_min_tau

double TestHepMC::m_min_tau
private

Definition at line 48 of file TestHepMC.h.

◆ m_mkMcEvent

BooleanProperty GenBase::m_mkMcEvent {this, "MakeMcEvent", false, "Create a new MC event collection if it doesn't exist"}
protectedinherited

Flag to determine if a new MC event collection should be made if it doesn't exist.

Definition at line 136 of file GenBase.h.

136{this, "MakeMcEvent", false, "Create a new MC event collection if it doesn't exist"};

◆ m_momentumBalanceCheckRate

int TestHepMC::m_momentumBalanceCheckRate
private

Definition at line 80 of file TestHepMC.h.

◆ m_momImbalanceTest

bool TestHepMC::m_momImbalanceTest
private

Definition at line 53 of file TestHepMC.h.

◆ m_momNaNTest

bool TestHepMC::m_momNaNTest
private

Definition at line 52 of file TestHepMC.h.

◆ m_negativeEnergyCheckRate

int TestHepMC::m_negativeEnergyCheckRate
private

Definition at line 81 of file TestHepMC.h.

◆ m_negativeEnergyTachyonicCheckRate

int TestHepMC::m_negativeEnergyTachyonicCheckRate
private

Definition at line 75 of file TestHepMC.h.

◆ m_negativeEnergyTest

bool TestHepMC::m_negativeEnergyTest
private

Definition at line 53 of file TestHepMC.h.

◆ m_nFail

int TestHepMC::m_nFail
private

Definition at line 59 of file TestHepMC.h.

◆ m_nonG4_energy_threshold

double TestHepMC::m_nonG4_energy_threshold
private

Definition at line 48 of file TestHepMC.h.

◆ m_nonG4_energyCheckRate

int TestHepMC::m_nonG4_energyCheckRate
private

Definition at line 88 of file TestHepMC.h.

◆ m_nonZeroPhotonMassCheckRate

int TestHepMC::m_nonZeroPhotonMassCheckRate
private

Definition at line 78 of file TestHepMC.h.

◆ m_noXSECset

int TestHepMC::m_noXSECset
private

Definition at line 60 of file TestHepMC.h.

◆ m_nPass

int TestHepMC::m_nPass
private

Definition at line 58 of file TestHepMC.h.

◆ m_paramFile

std::string TestHepMC::m_paramFile
private

Definition at line 91 of file TestHepMC.h.

◆ m_partMomentumNANandINFCheckRate

int TestHepMC::m_partMomentumNANandINFCheckRate
private

Definition at line 72 of file TestHepMC.h.

◆ m_pdg

int TestHepMC::m_pdg
private

Definition at line 44 of file TestHepMC.h.

◆ m_pi0NoVtxTest

bool TestHepMC::m_pi0NoVtxTest
private

Definition at line 54 of file TestHepMC.h.

◆ m_ppSvc

ServiceHandle<IPartPropSvc> GenBase::m_ppSvc {this, "PartPropSvc", "PartPropSvc"}
privateinherited

Handle on the particle property service.

Definition at line 142 of file GenBase.h.

142{this, "PartPropSvc", "PartPropSvc"};

◆ m_stableUnstableNoParentCheckRate

int TestHepMC::m_stableUnstableNoParentCheckRate
private

Definition at line 83 of file TestHepMC.h.

◆ m_Status1ShortLifetime

int TestHepMC::m_Status1ShortLifetime
private

Definition at line 86 of file TestHepMC.h.

◆ m_SusyPdgID_tab

std::vector<int> TestHepMC::m_SusyPdgID_tab
private

Definition at line 95 of file TestHepMC.h.

◆ m_tachyonCheckRate

int TestHepMC::m_tachyonCheckRate
private

Definition at line 82 of file TestHepMC.h.

◆ m_tachyonsTest

bool TestHepMC::m_tachyonsTest
private

Definition at line 53 of file TestHepMC.h.

◆ m_tau_eff_threshold

double TestHepMC::m_tau_eff_threshold
private

Definition at line 49 of file TestHepMC.h.

◆ m_thistSvc

ServiceHandle<ITHistSvc> TestHepMC::m_thistSvc
private
Todo
Can we use the GenAnalysis / AthHistoAlg methods for histo management?

Definition at line 99 of file TestHepMC.h.

◆ m_TotalTaus

int TestHepMC::m_TotalTaus
private

Definition at line 62 of file TestHepMC.h.

◆ m_uknownPDGID_tab

std::vector<int> TestHepMC::m_uknownPDGID_tab
private

Definition at line 96 of file TestHepMC.h.

◆ m_undecayedPi0CheckRate

int TestHepMC::m_undecayedPi0CheckRate
private

Definition at line 85 of file TestHepMC.h.

◆ m_undecayedPi0statuscode12CheckRate

int TestHepMC::m_undecayedPi0statuscode12CheckRate
private

Definition at line 73 of file TestHepMC.h.

◆ m_undisplacedDaughtersTest

bool TestHepMC::m_undisplacedDaughtersTest
private

Definition at line 54 of file TestHepMC.h.

◆ m_undisplacedDecayDaughtersOfDisplacedVtxCheckRate

int TestHepMC::m_undisplacedDecayDaughtersOfDisplacedVtxCheckRate
private

Definition at line 87 of file TestHepMC.h.

◆ m_undisplacedLLHdaughtersCheckRate

int TestHepMC::m_undisplacedLLHdaughtersCheckRate
private

Definition at line 77 of file TestHepMC.h.

◆ m_unknownPDGIDCheckRate

int TestHepMC::m_unknownPDGIDCheckRate
private

Definition at line 89 of file TestHepMC.h.

◆ m_unknownPDGIDFile

std::string TestHepMC::m_unknownPDGIDFile
private

Definition at line 92 of file TestHepMC.h.

◆ m_unknownPDGIDTest

bool TestHepMC::m_unknownPDGIDTest
private

Definition at line 54 of file TestHepMC.h.

◆ m_unstableNoEndVtxCheckRate

int TestHepMC::m_unstableNoEndVtxCheckRate
private

Definition at line 74 of file TestHepMC.h.

◆ m_unstableNoVtxTest

bool TestHepMC::m_unstableNoVtxTest
private

Definition at line 53 of file TestHepMC.h.

◆ m_unstablePartNoDecayVtxCheckRate

int TestHepMC::m_unstablePartNoDecayVtxCheckRate
private

Definition at line 84 of file TestHepMC.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vertexStatuses

std::vector<int> TestHepMC::m_vertexStatuses
private

Definition at line 56 of file TestHepMC.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.

◆ m_vtxDisplacedMoreThan_1m_CheckRate

int TestHepMC::m_vtxDisplacedMoreThan_1m_CheckRate
private

Definition at line 71 of file TestHepMC.h.

◆ m_vtxDisplacedstatuscode12CheckRate

int TestHepMC::m_vtxDisplacedstatuscode12CheckRate
private

Definition at line 69 of file TestHepMC.h.

◆ m_vtxDisplacedstatuscodenot12CheckRate

int TestHepMC::m_vtxDisplacedstatuscodenot12CheckRate
private

Definition at line 70 of file TestHepMC.h.

◆ m_vtxDisplacedTest

bool TestHepMC::m_vtxDisplacedTest
private

Definition at line 52 of file TestHepMC.h.

◆ m_vtxNANandINFCheckRate

int TestHepMC::m_vtxNANandINFCheckRate
private

Definition at line 68 of file TestHepMC.h.

◆ m_vtxNaNTest

bool TestHepMC::m_vtxNaNTest
private

Definition at line 52 of file TestHepMC.h.


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