ATLAS Offline Software
Loading...
Searching...
No Matches
HepMcWriterTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5// HepMcWriterTool.h
6// Header file for class HepMcWriterTool
7// Author: S.Binet<binet@cern.ch>
9#ifndef MCPARTICLETOOLS_HEPMCWRITERTOOL_H
10#define MCPARTICLETOOLS_HEPMCWRITERTOOL_H
11
12// STL includes
13#include <string>
14
15// FrameWork includes
16#include "GaudiKernel/ServiceHandle.h"
18
19// McParticleKernel includes
21
22// Forward declaration
25#ifdef HEPMC3
26#include "HepMC3/Writer.h"
27#include "HepMC3/WriterAsciiHepMC2.h"
28#endif
29class HepMcWriterTool : public extends<AthAlgTool, IIOHepMcTool>
30{
31
33 // Public methods:
35 public:
36
37 // Copy constructor:
38
40 HepMcWriterTool( const std::string& type, const std::string& name, const IInterface* parent );
41
43 virtual ~HepMcWriterTool();
44
45 // Athena algorithm's Hooks
46 StatusCode initialize();
47 StatusCode execute();
48 StatusCode finalize();
49
51 // Non-const methods:
53
56 StatusCode write( const HepMC::GenEvent* evt );
57
59 // Protected methods:
61 protected:
62
66
70 void setupBackend( Gaudi::Details::PropertyBase& ioBackendURL );
71
73 // Protected data:
75 protected:
76
82 StringProperty m_ioBackendURL;
83
88 StringProperty m_mcEventsName;
89
92#ifdef HEPMC3
93 HepMC3::Writer* m_ioBackend;
94#else
95 HepMC::IO_BaseClass* m_ioBackend;
96#endif
97
98};
99#endif //> MCPARTICLETOOLS_HEPMCWRITERTOOL_H
StatusCode finalize()
StringProperty m_ioBackendURL
URL of the I/O back-end (only "ASCII" for now...) glued with the name of the output file name.
HepMcWriterTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
StatusCode write(const HepMC::GenEvent *evt)
Process the HepMC::GenEvent through the I/O backend.
HepMcWriterTool()
Default constructor:
StatusCode execute()
HepMC::IO_BaseClass * m_ioBackend
Abstract base class for the back-end.
virtual ~HepMcWriterTool()
Destructor:
StringProperty m_mcEventsName
Location of the McEventCollection to be written out If there is more than 1 HepMC::GenEvent in the Mc...
void setupBackend(Gaudi::Details::PropertyBase &ioBackendURL)
Method to configure the back-end to write out the HepMC::GenEvent.
StatusCode initialize()
Athena Algorithm's Hooks.