ATLAS Offline Software
Loading...
Searching...
No Matches
ActsMaterialTrackWriterSvc.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_ACTSMATERIALTRACKWRITERSVC_H
6#define ACTSGEOMETRY_ACTSMATERIALTRACKWRITERSVC_H
7
10
12#include "GaudiKernel/IInterface.h"
13#include "Gaudi/Property.h" /*no forward decl: typedef*/
14
15#include <vector>
16#include <deque>
17#include <mutex>
18#include <thread>
19#include <atomic>
20
21#include "TTree.h"
22#include "TFile.h"
23
24class ActsMaterialTrackWriterSvc : public extends<AthService, IActsMaterialTrackWriterSvc> {
25public:
26
27 virtual StatusCode initialize() override;
28 virtual StatusCode finalize() override;
29
30 ActsMaterialTrackWriterSvc( const std::string& name, ISvcLocator* svc );
31
32 virtual void
33 write(const Acts::RecordedMaterialTrack& mTrack) override;
34
35private:
36
37 std::deque<Acts::RecordedMaterialTrack> m_mTracks;
38 std::mutex m_writeMutex;
39 std::thread m_writeThread;
40 std::atomic<bool> m_doEnd;
41 TFile* p_tFile{};
42 TTree* p_tree{};
43
44 float m_v_x{};
45 float m_v_y{};
46 float m_v_z{};
47 float m_v_px{};
48 float m_v_py{};
49 float m_v_pz{};
50 float m_v_phi{};
51 float m_v_eta{};
52 float m_tX0{};
53 float m_tL0{};
54
55 std::vector<float> m_step_sx;
56 std::vector<float> m_step_sy;
57 std::vector<float> m_step_sz;
58 std::vector<float> m_step_x;
59 std::vector<float> m_step_y;
60 std::vector<float> m_step_z;
61 std::vector<float> m_step_ex;
62 std::vector<float> m_step_ey;
63 std::vector<float> m_step_ez;
64 std::vector<float> m_step_dx;
65 std::vector<float> m_step_dy;
66 std::vector<float> m_step_dz;
67 std::vector<float> m_step_length;
68 std::vector<float> m_step_X0;
69 std::vector<float> m_step_L0;
70 std::vector<float> m_step_A;
71 std::vector<float> m_step_Z;
72 std::vector<float> m_step_rho;
73
74 std::vector<std::uint64_t>
76 std::vector<int32_t>
78 std::vector<float> m_sur_x;
80 std::vector<float> m_sur_y;
82 std::vector<float> m_sur_z;
84
85 std::vector<float>
87 std::vector<float>
89
90 std::vector<std::uint64_t>
92
93 void writerThread();
94 void doWrite(const Acts::RecordedMaterialTrack &mTrack);
95
97
98 // jobOptions properties
99 Gaudi::Property<std::string> m_filePath{this, "FilePath", "MaterialTracks.root", "Output root file for charged particle"};
100 Gaudi::Property<std::string> m_treeName{this, "TreeName", "material-tracks", ""};
101 Gaudi::Property<bool> m_storeSurface{this, "StoreSurface", true, "Store the surface info in the root file"};
102 Gaudi::Property<bool> m_storeVolume{this, "StoreVolume", true, "Store the volume info in the root file"};
103 Gaudi::Property<size_t> m_maxQueueSize{this, "MaxQueueSize", 5000, "Limit the write queue to this size"};
104
105};
106
107
108#endif
std::vector< float > m_step_length
step length
Gaudi::Property< std::string > m_treeName
ServiceHandle< ActsTrk::ITrackingGeometrySvc > m_trackingGeometrySvc
std::vector< float > m_step_X0
step material x0
ActsMaterialTrackWriterSvc(const std::string &name, ISvcLocator *svc)
std::vector< float > m_sur_y
y position of the center of the suface associated with the step
std::vector< float > m_step_sz
step z (start) position (optional)
std::vector< float > m_step_sy
step y (start) position (optional)
void doWrite(const Acts::RecordedMaterialTrack &mTrack)
std::vector< float > m_step_A
step material A
std::vector< float > m_step_ey
step y (end) position (optional)
virtual StatusCode finalize() override
std::vector< std::uint64_t > m_vol_id
ID of the volume associated with the step.
std::vector< float > m_step_L0
step material l0
virtual StatusCode initialize() override
std::vector< float > m_sur_z
z position of the center of the suface associated with the step
std::deque< Acts::RecordedMaterialTrack > m_mTracks
std::vector< float > m_step_dx
step x direction
std::vector< float > m_step_dz
step z direction
std::vector< float > m_step_ex
step x (end) position (optional)
float m_v_px
start global momentum x
std::vector< float > m_step_y
step y position
std::vector< float > m_step_Z
step material Z
std::vector< float > m_step_rho
step material rho
float m_v_py
start global momentum y
float m_v_pz
start global momentum z
Gaudi::Property< size_t > m_maxQueueSize
std::vector< float > m_step_z
step z position
std::vector< float > m_sur_x
x position of the center of the suface associated with the step
Gaudi::Property< std::string > m_filePath
std::vector< float > m_step_ez
step z (end) position (optional)
std::vector< float > m_step_x
step x position
std::vector< float > m_sur_range_max
Max range of the suface associated with the step.
std::vector< int32_t > m_sur_type
Type of the suface associated with the step.
std::vector< float > m_step_dy
step y direction
std::vector< std::uint64_t > m_sur_id
ID of the suface associated with the step.
std::vector< float > m_step_sx
step x (start) position (optional)
virtual void write(const Acts::RecordedMaterialTrack &mTrack) override
std::vector< float > m_sur_range_min
Min range of the suface associated with the step.
std::pair< std::pair< Acts::Vector3, Acts::Vector3 >, RecordedMaterial > RecordedMaterialTrack
Recorded material track.