ATLAS Offline Software
RootExCellWriter.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // This file was largely imported from the Acts testing framework
6 
7 #pragma once
8 
9 #include <TFile.h>
10 #include <TTree.h>
11 #include <mutex>
12 #include "Acts/Extrapolation/ExtrapolationCell.hpp"
13 #include "Acts/Utilities/Logger.hpp"
14 
15 class TFile;
16 
17 #ifndef MAXSTEPS
18 #define MAXSTEPS 100
19 #endif
20 
27  template <class T>
28  class RootExCellWriter
29  {
30  public:
31 
35  {
36  float x{}, y{}, z{};
37  float px{}, py{}, pz{};
38  float type{};
39  };
40 
41  // @struct Config
42  //
43  // The nested config class
44  struct Config
45  {
46  public:
47  std::string filePath;
48  std::string fileMode = "RECREATE";
49  std::string treeName
50  = "extrapolation_cells";
52  bool writeMaterial{};
53  bool writePassive{};
54  bool writeBoundary{};
55  };
56 
60  //Acts::Logging::Level level = Acts::Logging::INFO
61  );
62 
63  RootExCellWriter() = delete;
64 
66 
68 
71 
73  void
74  endRun();
75 
78  void
80  const Acts::ExtrapolationCell<T>& ecell, int eventNum);
81 
82  protected:
83 
86  TFile* m_outputFile{};
87  TTree* m_outputTree{};
88  float m_eta{};
89  float m_phi{};
90  float m_materialX0{};
91  float m_materialL0{};
92  int m_eventNum{};
93  std::vector<float> m_s_positionX;
94  std::vector<float> m_s_positionY;
95  std::vector<float> m_s_positionZ;
96  std::vector<float> m_s_positionR;
97  std::vector<float> m_s_materialX0;
98  std::vector<float> m_s_materialL0;
99  std::vector<int> m_s_material;
100  std::vector<int> m_s_boundary;
101  std::vector<int> m_s_sensitive;
102  std::vector<int> m_s_volumeID;
103  std::vector<int> m_s_layerID;
104  std::vector<int> m_s_surfaceID;
105  std::vector<float>
107  std::vector<float>
109  int m_hits{};
110  };
111 
112 
113 #include "RootExCellWriter.icc"
114 
RootExCellWriter::m_materialL0
float m_materialL0
material in L0
Definition: RootExCellWriter.h:91
RootExCellWriter::Config::writeSensitive
bool writeSensitive
Definition: RootExCellWriter.h:51
RootExCellWriter::ExtrapolationStep::type
float type
type of the step
Definition: RootExCellWriter.h:38
RootExCellWriter.icc
RootExCellWriter::m_s_material
std::vector< int > m_s_material
type of the step: material
Definition: RootExCellWriter.h:99
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
RootExCellWriter::m_s_positionY
std::vector< float > m_s_positionY
global position y of the step
Definition: RootExCellWriter.h:94
RootExCellWriter::ExtrapolationStep::px
float px
Definition: RootExCellWriter.h:37
RootExCellWriter::m_outputFile
TFile * m_outputFile
the output file
Definition: RootExCellWriter.h:86
RootExCellWriter::Config::fileMode
std::string fileMode
file access mode
Definition: RootExCellWriter.h:48
RootExCellWriter::m_phi
float m_phi
global phi start
Definition: RootExCellWriter.h:89
RootExCellWriter::m_s_localposition0
std::vector< float > m_s_localposition0
local position - first coordinate
Definition: RootExCellWriter.h:106
RootExCellWriter::m_outputTree
TTree * m_outputTree
the output tree
Definition: RootExCellWriter.h:87
RootExCellWriter::m_s_boundary
std::vector< int > m_s_boundary
type of the step: boundary
Definition: RootExCellWriter.h:100
RootExCellWriter::Config::writeMaterial
bool writeMaterial
Definition: RootExCellWriter.h:52
Acts::ExtrapolationCell
Definition: ActsExCellWriterSvc.h:29
RootExCellWriter::ExtrapolationStep::y
float y
Definition: RootExCellWriter.h:36
RootExCellWriter::m_eta
float m_eta
global eta start
Definition: RootExCellWriter.h:88
RootExCellWriter::m_materialX0
float m_materialX0
material in X0
Definition: RootExCellWriter.h:90
RootExCellWriter::m_s_localposition1
std::vector< float > m_s_localposition1
local position - second coordinate
Definition: RootExCellWriter.h:108
RootExCellWriter::RootExCellWriter
RootExCellWriter(const &RootExCellWriter)=delete
RootExCellWriter::~RootExCellWriter
~RootExCellWriter()
Destructor; so now you need the rule of three (or five)
RootExCellWriter::m_writeMutex
std::mutex m_writeMutex
protect multi-threaded writes
Definition: RootExCellWriter.h:85
RootExCellWriter::m_s_layerID
std::vector< int > m_s_layerID
layer identification
Definition: RootExCellWriter.h:103
RootExCellWriter::m_s_volumeID
std::vector< int > m_s_volumeID
volume identification
Definition: RootExCellWriter.h:102
RootExCellWriter::Config::writeBoundary
bool writeBoundary
Definition: RootExCellWriter.h:54
RootExCellWriter::m_s_surfaceID
std::vector< int > m_s_surfaceID
surface identification
Definition: RootExCellWriter.h:104
Config
Definition: dumpNPs.cxx:47
RootExCellWriter::ExtrapolationStep::pz
float pz
momentum
Definition: RootExCellWriter.h:37
RootExCellWriter::m_s_sensitive
std::vector< int > m_s_sensitive
type of the step: sensitive
Definition: RootExCellWriter.h:101
WriteCaloSwCorrections.cfg
cfg
Definition: WriteCaloSwCorrections.py:23
RootExCellWriter::ExtrapolationStep::x
float x
Definition: RootExCellWriter.h:36
RootExCellWriter::ExtrapolationStep::z
float z
position (global)
Definition: RootExCellWriter.h:36
RootExCellWriter::m_s_positionR
std::vector< float > m_s_positionR
global position z of the step
Definition: RootExCellWriter.h:96
RootExCellWriter::m_s_materialL0
std::vector< float > m_s_materialL0
step material L0
Definition: RootExCellWriter.h:98
RootExCellWriter::ExtrapolationStep::py
float py
Definition: RootExCellWriter.h:37
RootExCellWriter::Config::filePath
std::string filePath
path of the output file
Definition: RootExCellWriter.h:47
RootExCellWriter::m_cfg
Config m_cfg
the config class
Definition: RootExCellWriter.h:84
RootExCellWriter::write
void write(const Acts::ExtrapolationCell< T > &ecell, int eventNum)
The protected writeT method, called by the WriterT base.
RootExCellWriter::RootExCellWriter
RootExCellWriter(const Config &cfg)
Constructor.
RootExCellWriter::m_eventNum
int m_eventNum
Definition: RootExCellWriter.h:92
RootExCellWriter::Config
Definition: RootExCellWriter.h:45
RootExCellWriter::m_hits
int m_hits
number of hits in sensitive material
Definition: RootExCellWriter.h:109
RootExCellWriter::m_s_materialX0
std::vector< float > m_s_materialX0
step material X0
Definition: RootExCellWriter.h:97
RootExCellWriter::Config::writePassive
bool writePassive
Definition: RootExCellWriter.h:53
RootExCellWriter::operator=
RootExCellWriter & operator=(const RootExCellWriter &)=delete
RootExCellWriter::Config::treeName
std::string treeName
name of the output tree
Definition: RootExCellWriter.h:50
RootExCellWriter::m_s_positionZ
std::vector< float > m_s_positionZ
global position z of the step
Definition: RootExCellWriter.h:95
RootExCellWriter::RootExCellWriter
RootExCellWriter()=delete
RootExCellWriter
Definition: ActsExCellWriterSvc.h:23
RootExCellWriter::m_s_positionX
std::vector< float > m_s_positionX
global position x of the step
Definition: RootExCellWriter.h:93
RootExCellWriter::ExtrapolationStep
Definition: RootExCellWriter.h:35
RootExCellWriter::endRun
void endRun()
End-of-run hook.