 |
ATLAS Offline Software
|
Go to the documentation of this file.
12 #include "GaudiKernel/ITHistSvc.h"
13 #include "Gaudi/Property.h"
14 #include "GaudiKernel/GaudiException.h"
21 #include "CLHEP/Units/SystemOfUnits.h"
29 const std::string&
name,
30 const IInterface*
parent ) :
32 m_tupleSvc (
"THistSvc",
name ),
39 declareProperty(
"Output",
41 "Name of the output file which will contain the HepMC tuple"
45 declareProperty(
"OutputStream",
47 "Name of the stream which will contain the HepMC tuple"
50 declareProperty(
"McEvents",
52 "Input location of the McEventCollection to write out" );
69 if ( !evtStore().
retrieve().isSuccess() ) {
71 return StatusCode::FAILURE;
77 return StatusCode::FAILURE;
86 return StatusCode::SUCCESS;
92 return StatusCode::SUCCESS;
101 return StatusCode::FAILURE;
104 if ( mcEvts->
empty() ) {
106 return StatusCode::FAILURE;
109 const HepMC::GenEvent *
evt = mcEvts->
front();
111 ATH_MSG_ERROR(
"Retrieved NULL pointer to HepMC::GenEvent !!");
112 return StatusCode::FAILURE;
126 for (
const auto&
p: *
evt)
130 const HepMC::FourVector
mom =
p->momentum();
144 return StatusCode::SUCCESS;
156 throw GaudiException(
"Could not retrieve THistSvc",
name(), StatusCode::FAILURE );
161 const std::string
propName =
"Output";
165 updatedProp.push_back
173 throw GaudiException(
"Could not configure THistSvc output file !!",
name(), StatusCode::FAILURE );
181 TTree*
t =
new TTree(
"hepmc",
"HepMC validation tuple");
183 ATH_MSG_ERROR(
"Could not register HepMC validation tuple !!");
184 delete t;
t =
nullptr;
185 throw GaudiException(
"Could not register HepMC validation tuple !!",
name(), StatusCode::FAILURE );
def retrieve(aClass, aKey=None)
std::array< double, s_nMax > m_ene
std::array< int, s_nMax > m_pdgId
std::array< double, s_nMax > m_py
::StatusCode StatusCode
StatusCode definition for legacy code.
const T * front() const
Access the first element in the collection as an rvalue.
This defines the McEventCollection, which is really just an ObjectVector of McEvent objects.
std::array< double, s_nMax > m_m
#define ATH_MSG_WARNING(x)
std::array< double, s_nMax > m_pz
std::array< int, s_nMax > m_barcode
std::array< double, s_nMax > m_px
bool empty() const noexcept
Returns true if the collection is empty.
std::array< int, s_nMax > m_status