ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
TrkDetDescr
TrkDetDescrTestTools
src
GeometryTTreeDumper.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
// GeometryTTreeDumper.cxx, (c) ATLAS Detector software
8
9
// Trk include
10
#include "
TrkDetDescrTestTools/GeometryTTreeDumper.h
"
11
#include "
TrkValidationUtils/SurfaceNtupleBranch.h
"
12
#include "
TrkGeometry/TrackingGeometry.h
"
13
#include "
TrkGeometry/Layer.h
"
14
#include "
TrkSurfaces/Surface.h
"
15
// Root
16
#include "TTree.h"
17
#include "TString.h"
18
#include <sstream>
19
20
// Gaudi
21
#include "GaudiKernel/ITHistSvc.h"
22
23
24
StatusCode
Trk::GeometryTTreeDumper::processNode
(
const
Trk::TrackingVolume
& tvol,
size_t
)
const
25
{
26
ATH_MSG_VERBOSE
(
"Dumping information for TrackingVolume."
);
27
// clean up from the previous event
28
if
(
m_currentTree
)
m_currentTree
->Fill();
29
30
// create the Tree for this TrackingVolume
31
m_currentTree
=
new
TTree(tvol.
volumeName
().c_str(),
"Geometrical information"
);
32
SmartIF<ITHistSvc> tHistSvc{service(
"THistSvc"
)};
33
if
(!tHistSvc) {
34
ATH_MSG_FATAL
(
"initialize() Could not find Hist Service! Aborting."
);
35
delete
m_currentTree
;
36
return
StatusCode::FAILURE;
37
}
38
// create the name under which the tree is registered
39
std::string fullTreeName =
m_treeFolder
+tvol.
volumeName
();
40
if
(tHistSvc->regTree(fullTreeName.c_str(),
m_currentTree
).isFailure()) {
41
ATH_MSG_ERROR
(
"initialize() Could not register the validation Tree!Aborting."
);
42
delete
m_currentTree
;
43
return
StatusCode::FAILURE;
44
}
45
46
// make the boundary surface branch
47
Trk::SurfaceNtupleBranch
boundarySurfaceBranch;
48
49
const
auto
& bSurfaces = tvol.
boundarySurfaces
();
50
for
(
size_t
ib = 0 ; ib < bSurfaces.size(); ++ib ){
51
TString bSurfId =
"bsurf_"
;
52
bSurfId += ib;
53
// initialize
54
boundarySurfaceBranch.
initForWrite
(*
m_currentTree
,bSurfId.Data());
55
boundarySurfaceBranch.
fill
(bSurfaces[ib]->surfaceRepresentation());
56
}
57
58
return
StatusCode::SUCCESS;
59
}
60
61
62
StatusCode
Trk::GeometryTTreeDumper::processNode
(
const
Trk::Layer
& lay,
size_t
)
const
63
{
64
65
ATH_MSG_VERBOSE
(
"Dumping information for Layer."
);
66
67
// make the layer branch
68
Trk::SurfaceNtupleBranch
layerBranch;
69
TString layerId =
"lay_"
;
70
layerId += lay.
layerIndex
().
value
();
71
// initialize
72
layerBranch.
initForWrite
(*
m_currentTree
,layerId.Data());
73
layerBranch.
fill
(lay.
surfaceRepresentation
());
74
75
return
StatusCode::SUCCESS;
76
}
77
78
79
StatusCode
Trk::GeometryTTreeDumper::processNode
(
const
Trk::Surface
& sf,
size_t
)
const
80
{
81
ATH_MSG_VERBOSE
(
"Dumping information for Surfaces."
);
82
83
// make the surface branch
84
Trk::SurfaceNtupleBranch
surfaceBranch;
85
TString surfaceId =
"surf"
;
86
// initialize
87
surfaceBranch.
initForWrite
(*
m_currentTree
,surfaceId.Data());
88
surfaceBranch.
fill
(sf);
89
90
return
StatusCode::SUCCESS;
91
}
92
93
94
95
96
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
GeometryTTreeDumper.h
Layer.h
SurfaceNtupleBranch.h
Surface.h
TrackingGeometry.h
Trk::GeometryTTreeDumper::processNode
StatusCode processNode(const TrackingVolume &tvol, size_t level=0) const
Current implementation: write root visualization to file stream.
Definition
GeometryTTreeDumper.cxx:24
Trk::GeometryTTreeDumper::m_currentTree
TTree * m_currentTree
the tree for the currently processed tracking Volume
Definition
GeometryTTreeDumper.h:56
Trk::GeometryTTreeDumper::m_treeFolder
std::string m_treeFolder
where the tree is written to
Definition
GeometryTTreeDumper.h:57
Trk::LayerIndex::value
int value() const
layerIndex expressed in an integer
Definition
LayerIndex.h:71
Trk::Layer
Base Class for a Detector Layer in the Tracking realm.
Definition
Layer.h:72
Trk::Layer::surfaceRepresentation
virtual const Surface & surfaceRepresentation() const =0
Transforms the layer into a Surface representation for extrapolation.
Trk::Layer::layerIndex
const LayerIndex & layerIndex() const
get the layerIndex
Trk::Surface
Abstract Base Class for tracking surfaces.
Definition
Surface.h:79
Trk::TrackingVolume
Full Volume description used in Tracking, it inherits from Volume to get the geometrical structure,...
Definition
TrackingVolume.h:119
Trk::TrackingVolume::boundarySurfaces
std::vector< std::shared_ptr< BoundarySurface< TrackingVolume > > > & boundarySurfaces()
Method to return the BoundarySurfaces.
Definition
TrackingVolume.cxx:809
Trk::TrackingVolume::volumeName
const std::string & volumeName() const
Returns the VolumeName - for debug reason, might be depreciated later.
Trk::SurfaceNtupleBranch
This class provides a simple interface to write Surfaces to a root tree.
Definition
SurfaceNtupleBranch.h:36
Trk::SurfaceNtupleBranch::initForWrite
void initForWrite(TTree &tree, std::string_view prefix="")
initialize class for writing
Definition
SurfaceNtupleBranch.cxx:11
Trk::SurfaceNtupleBranch::fill
void fill(const Trk::Surface &surface)
fill a vector
Definition
SurfaceNtupleBranch.cxx:30
Generated on
for ATLAS Offline Software by
1.17.0