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
33 public:
34
36 HepMcTupleWriterTool( const std::string& type, const std::string& name, const IInterface* parent );
37
39 virtual ~HepMcTupleWriterTool();
40
41 // Athena algorithm's Hooks
42 StatusCode initialize();
43 StatusCode execute();
44 StatusCode finalize();
45
46
49 StatusCode write( const HepMC::GenEvent* evt );
50
51 protected:
52
56
60 void setupBackend( Gaudi::Details::PropertyBase& outputFileName );
61
65 void bookTuple();
66
67 protected:
68
70 static const int s_nMax = 2000;
71
75 std::array<double, s_nMax> m_px;
76 std::array<double, s_nMax> m_py;
77 std::array<double, s_nMax> m_pz;
78 std::array<double, s_nMax> m_m;
79 std::array<double, s_nMax> m_ene;
80 std::array<int, s_nMax> m_pdgId;
81 std::array<int, s_nMax> m_status;
82 std::array<int, s_nMax> m_barcode;
83 };
84
86
89
94 StringProperty m_mcEventsName;
95
97 StringProperty m_outputFileName;
98
100 StringProperty m_outputStreamName;
101
103 TTree* m_tuple;
104};
105
106#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:
HepMC3::GenEvent GenEvent
Definition GenEvent.h:39
A simple representation of a HepMc particle.