ATLAS Offline Software
Loading...
Searching...
No Matches
xAODtoHepMCTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5/*
6 * dual-use tool for converting xAOD truth events back to HepMC
7 * Principal Authors (responsible for the core conversion algorithm): Josh McFayden and James Catmore
8 * Tool Author: Jim Lacey (Carleton University)
9 * ... updated tool interface to be dual-use
10 * ... added missing PDF information and requirements to allow running on full sim (remove Geant4 secondaries)
11 * <james.lacey@cern.ch,jlacey@physics.carleton.ca>
12 * <dag.gillberg@cern.ch>
13 */
14
15#ifndef TRUTHCONVERTERS_XAODTOHEPMCTOOL_H
16#define TRUTHCONVERTERS_XAODTOHEPMCTOOL_H 1
17
18#include "AsgTools/AsgTool.h"
20
21
22class xAODtoHepMCTool: public asg::AsgTool, public virtual IxAODtoHepMCTool {
23public:
25 xAODtoHepMCTool( const std::string& name );
26 virtual ~xAODtoHepMCTool () { };
27
28 virtual StatusCode initialize() override;
29 StatusCode finalize () override;
30
31public:
32 std::vector<HepMC::GenEvent> getHepMCEvents(const xAOD::TruthEventContainer* xTruthEventContainer, const xAOD::EventInfo* eventInfo) const override;
33
34private:
35 HepMC::GenEvent createHepMCEvent(const xAOD::TruthEvent* xEvt, const xAOD::EventInfo* eventInfo) const;
36 HepMC::GenVertexPtr vertexHelper(const xAOD::TruthVertex*,std::map<const xAOD::TruthVertex*,HepMC::GenVertexPtr>&,bool&) const;
39 void printxAODEvent(const xAOD::TruthEvent* event, const xAOD::EventInfo* eventInfo) const;
40
41private:
43 Gaudi::Property<float> m_momFac {
44 this, "MomentFactor", 0.001,
45 "Scale factor to be applied to truth energy and momenta to convert from MeV, e.g. 0.001 to go to GeV"};
46 Gaudi::Property<float> m_lenFac {
47 this, "LengthFactor", 1.0,
48 "Scale factor to be applied to truth lengths to convert from mm, e.g. 0.01 to go to cm"};
49 Gaudi::Property<bool> m_signalOnly {
50 this, "SignalOnly", true,
51 "Convert only the signal event (true), or all events found"};
52 Gaudi::Property<int> m_maxCount {
53 this, "PrintNevents", 0,
54 "Maximum number of events to print out"};
55
56 //not sure if these need to be atomic but just in case this will run in MT
57 mutable std::atomic<int> m_evtCount{};
58 mutable std::atomic<int> m_badSuggest{};
61
62};
63
64#endif //> !XAODTOHEPMC_XAODTOHEPMCTOOL_H
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Base class for the dual-use tool implementation classes.
Definition AsgTool.h:47
std::atomic< int > m_evtCount
Counters.
StatusCode finalize() override
HepMC::GenEvent createHepMCEvent(const xAOD::TruthEvent *xEvt, const xAOD::EventInfo *eventInfo) const
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
std::atomic< int > m_badSuggest
xAODtoHepMCTool(const std::string &name)
HepMC::GenVertexPtr vertexHelper(const xAOD::TruthVertex *, std::map< const xAOD::TruthVertex *, HepMC::GenVertexPtr > &, bool &) const
HepMC::GenVertexPtr createHepMCVertex(const xAOD::TruthVertex *) const
virtual ~xAODtoHepMCTool()
Gaudi::Property< bool > m_signalOnly
Gaudi::Property< float > m_momFac
Input container key (job property)
HepMC::GenParticlePtr createHepMCParticle(const xAOD::TruthParticle *) const
void printxAODEvent(const xAOD::TruthEvent *event, const xAOD::EventInfo *eventInfo) const
Gaudi::Property< float > m_lenFac
Gaudi::Property< int > m_maxCount
std::vector< HepMC::GenEvent > getHepMCEvents(const xAOD::TruthEventContainer *xTruthEventContainer, const xAOD::EventInfo *eventInfo) const override
HepMC::GenVertex * GenVertexPtr
Definition GenVertex.h:59
GenParticle * GenParticlePtr
Definition GenParticle.h:37
TruthEventContainer_v1 TruthEventContainer
Declare the latest version of the truth event container.
EventInfo_v1 EventInfo
Definition of the latest event info version.
TruthVertex_v1 TruthVertex
Typedef to implementation.
Definition TruthVertex.h:15
TruthEvent_v1 TruthEvent
Typedef to implementation.
Definition TruthEvent.h:17
TruthParticle_v1 TruthParticle
Typedef to implementation.