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