6#include "GaudiKernel/IInterface.h"
8#include "Acts/Propagator/detail/SteppingLogger.hpp"
9#include "Acts/Geometry/TrackingVolume.hpp"
10#include "Acts/Geometry/GeometryIdentifier.hpp"
22: base_class(name, svc) {
30 m_outputFile = TFile::Open(filePath.c_str(),
"RECREATE");
33 return StatusCode::FAILURE;
38 m_outputTree =
new TTree(treeName.c_str(),
"Acts Propagation Steps");
41 return StatusCode::FAILURE;
56 return StatusCode::SUCCESS;
64 return StatusCode::SUCCESS;
71 const auto& ctx = Gaudi::Hive::currentContext();
78 doWrite(steps, ctx.eventID().event_number());
84 using namespace std::chrono_literals;
87 std::this_thread::sleep_for(2s);
97 std::this_thread::sleep_for(0.5s);
100 ATH_MSG_INFO(
"Writer thread caught termination signal. Shutting down.");
111 size_t eventNum = queue_item.first;
112 StepVector steps = std::move(queue_item.second);
133 for(
const auto& step : steps) {
134 Acts::GeometryIdentifier::Value volumeID = 0;
135 Acts::GeometryIdentifier::Value boundaryID = 0;
136 Acts::GeometryIdentifier::Value layerID = 0;
137 Acts::GeometryIdentifier::Value approachID = 0;
138 Acts::GeometryIdentifier::Value sensitiveID = 0;
141 auto geoID = step.surface->geometryId();
142 sensitiveID = geoID.sensitive();
143 approachID = geoID.approach();
144 layerID = geoID.layer();
145 boundaryID = geoID.boundary();
146 volumeID = geoID.volume();
149 if (step.geoID != Acts::GeometryIdentifier()) {
150 volumeID = step.geoID.volume();
159 m_s_pX.push_back(step.position.x());
160 m_s_pY.push_back(step.position.y());
161 m_s_pZ.push_back(step.position.z());
162 m_s_pR.push_back(Acts::VectorHelpers::perp(step.position));
std::vector< int > m_s_boundaryID
boundary identification
ActsPropStepRootWriterSvc(const std::string &name, ISvcLocator *svc)
std::vector< float > m_s_pR
global position z of the step
TTree * m_outputTree
the output tree
Gaudi::Property< std::string > m_filePath
void doWrite(const StepVector &steps, size_t evtNum)
std::deque< queue_item_t > m_queue
std::vector< int > m_s_volumeID
volume identification
std::vector< float > m_s_pZ
global position z of the step
void write(const StepVector &steps) override
virtual StatusCode initialize() override
std::vector< Acts::detail::Step > StepVector
std::atomic< bool > m_doEnd
virtual StatusCode finalize() override
std::pair< size_t, StepVector > queue_item_t
Gaudi::Property< std::string > m_treeName
std::vector< int > m_s_approachID
approach identification
std::vector< float > m_s_pX
global position x of the step
std::vector< int > m_s_layerID
layer identification
std::vector< int > m_s_sensitiveID
sensitive identification
TFile * m_outputFile
the output file
std::vector< float > m_s_pY
global position y of the step