7#include "GaudiKernel/IInterface.h"
33 return StatusCode::FAILURE;
38 new TTree(
m_treeName.value().c_str(),
"TTree from MaterialTrackWriter");
39 if (m_outputTree ==
nullptr) {
41 return StatusCode::FAILURE;
45 m_accessor.connectForWrite(*m_outputTree);
47 return StatusCode::SUCCESS;
56 m_outputTree->Write();
59 return StatusCode::SUCCESS;
67 if (!materialTracks.
isValid()) {
69 return StatusCode::FAILURE;
77 for (
const auto& materialTrack : *materialTracks) {
79 m_accessor.write(geoContext.
context(), ctx.evt(), materialTrack);
84 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
Acts::GeometryContext context() const
virtual StatusCode initialize() override
Gaudi::Property< std::string > m_treeName
The output file name.
Gaudi::Property< bool > m_recalculateTotals
Re-calculate total values from individual steps (for cross-checks)
TFile * m_outputFile
The output file and tree.
SG::ReadHandleKey< RecordedMaterialTrackCollection > m_materialTrackCollectionKey
The RecordedMaterialTrackCollection to read.
virtual ~MaterialTrackWriter()
Gaudi::Property< bool > m_storeVolume
Write the volume to which the material step correpond.
virtual StatusCode finalize() override
Gaudi::Property< bool > m_storeSurface
Write the surface to which the material step correpond.
std::mutex m_writeMutex
mutex used to protect multi-threaded writes
ServiceHandle< ActsTrk::ITrackingGeometrySvc > m_trackingGeometrySvc
The tracking geometry service to retrive the geometry context.
MaterialTrackWriter(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode execute(const EventContext &ctx) const override
Gaudi::Property< std::string > m_fileName
The output file name.
Gaudi::Property< bool > m_prePostStep
Write out pre and post step (for G4), otherwise central step position.
An algorithm that can be simultaneously executed in multiple threads.
virtual bool isValid() override final
Can the handle be successfully dereferenced?