ATLAS Offline Software
Loading...
Searching...
No Matches
HepMcTupleWriterTool.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// HepMcTupleWriterTool.h
6// Header file for class HepMcTupleWriterTool
7// Author: S.Binet<binet@cern.ch>
9#ifndef MCPARTICLETOOLS_HEPMCTUPLEWRITERTOOL_H
10#define MCPARTICLETOOLS_HEPMCTUPLEWRITERTOOL_H
11
12// STL includes
13#include <string>
14
15
16#include <array>
17
18// FrameWork includes
19#include "GaudiKernel/ServiceHandle.h"
21
22// McParticleKernel includes
24
25// Forward declaration
26class ITHistSvc;
27class TTree;
29
30class HepMcTupleWriterTool : public extends<AthAlgTool, IIOHepMcTool>
31{
32
34 // Public methods:
36 public:
37
38 // Copy constructor:
39
41 HepMcTupleWriterTool( const std::string& type, const std::string& name, const IInterface* parent );
42
44 virtual ~HepMcTupleWriterTool();
45
46 // Athena algorithm's Hooks
47 StatusCode initialize();
48 StatusCode execute();
49 StatusCode finalize();
50
52 // Non-const methods:
54
57 StatusCode write( const HepMC::GenEvent* evt );
58
60 // Protected methods:
62 protected:
63
67
71 void setupBackend( Gaudi::Details::PropertyBase& outputFileName );
72
76 void bookTuple();
77
79 // Protected data:
81 protected:
82
84 static const int s_nMax = 2000;
85
89 std::array<double, s_nMax> m_px;
90 std::array<double, s_nMax> m_py;
91 std::array<double, s_nMax> m_pz;
92 std::array<double, s_nMax> m_m;
93 std::array<double, s_nMax> m_ene;
94 std::array<int, s_nMax> m_pdgId;
95 std::array<int, s_nMax> m_status;
96 std::array<int, s_nMax> m_barcode;
97 };
98
100
103
108 StringProperty m_mcEventsName;
109
111 StringProperty m_outputFileName;
112
114 StringProperty m_outputStreamName;
115
117 TTree* m_tuple;
118};
119
120#endif //> MCPARTICLETOOLS_HEPMCTUPLEWRITERTOOL_H
static const std::string outputFileName
StatusCode write(const HepMC::GenEvent *evt)
Process the HepMC::GenEvent through the I/O backend.
TTree * m_tuple
cached pointer to the tuple
StringProperty m_outputStreamName
Name of the output tuple stream.
StringProperty m_mcEventsName
Location of the McEventCollection to be written out If there is more than 1 HepMC::GenEvent in the Mc...
StringProperty m_outputFileName
Name of the output tuple file.
static const int s_nMax
maximum number of particles per event
void setupBackend(Gaudi::Details::PropertyBase &outputFileName)
Method to configure the back-end to write out the HepMC::GenEvent.
void bookTuple()
book the tuple
ServiceHandle< ITHistSvc > m_tupleSvc
Pointer to @ ITHistSvc.
HepMcParticles m_particles
our cached particles
HepMcTupleWriterTool()
Default constructor:
HepMcTupleWriterTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
StatusCode initialize()
Athena Algorithm's Hooks.
virtual ~HepMcTupleWriterTool()
Destructor:
A simple representation of a HepMc particle.