ATLAS Offline Software
Loading...
Searching...
No Matches
ActsPropStepRootWriterSvc.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ACTSGEOMETRY_ACTSPROPSTEPROOTWRITERSVC_H
6#define ACTSGEOMETRY_ACTSPROPSTEPROOTWRITERSVC_H
7
9#include "GaudiKernel/IInterface.h"
10#include "Gaudi/Property.h" /*no forward decl: typedef*/
11
13
14
15#include <vector>
16#include <deque>
17#include <mutex>
18#include <thread>
19#include <atomic>
20
21template <typename T>
23
24
25namespace Acts {
26
27template <class>
29
30}
31
32class TFile;
33class TTree;
34
35
36class ActsPropStepRootWriterSvc : public extends<AthService, IActsPropStepRootWriterSvc> {
37public:
38
39 virtual StatusCode initialize() override;
40 virtual StatusCode finalize() override;
41
42 ActsPropStepRootWriterSvc( const std::string& name, ISvcLocator* svc );
43
44 using StepVector = std::vector<Acts::detail::Step>;
45
46 void
47 write(const StepVector& steps) override;
48
49private:
50 using queue_item_t = std::pair<size_t, StepVector>;
51
52 //std::shared_ptr<RootPropStepWriter<Acts::TrackParameters>> m_rootEccWriter;
53 std::deque<queue_item_t> m_queue;
54 std::mutex m_writeMutex;
55 std::thread m_writeThread;
56 std::atomic<bool> m_doEnd;
57
58 void writeThread();
59 void doWrite(const StepVector& steps, size_t evtNum);
60 void end();
61
62 // jobOptions properties
63 Gaudi::Property<std::string> m_filePath{this, "FilePath", "propsteps.root", "Output root file for charged particle"};
64 Gaudi::Property<std::string> m_treeName{this, "TreeName", "propsteps", ""};
65 //Gaudi::Property<bool> m_writeBoundary{this, "WriteBoundary", true, ""};
66 //Gaudi::Property<bool> m_writeMaterial{this, "WriteMaterial", true, ""};
67 //Gaudi::Property<bool> m_writeSensitive{this, "WriteSensitive", true, ""};
68 //Gaudi::Property<bool> m_writePassive{this, "WritePassive", true, ""};
69
70 // root branch storage
71 TFile* m_outputFile{};
72 TTree* m_outputTree{};
74 std::vector<float> m_s_pX;
75 std::vector<float> m_s_pY;
76 std::vector<float> m_s_pZ;
77 std::vector<float> m_s_pR;
78 std::vector<int> m_s_volumeID;
79 std::vector<int> m_s_boundaryID;
80 std::vector<int> m_s_layerID;
81 std::vector<int> m_s_approachID;
82 std::vector<int> m_s_sensitiveID;
83
84};
85
86
87#endif
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
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