ATLAS Offline Software
Loading...
Searching...
No Matches
Trk::TrackingVolumeDisplayer Class Reference

The TrackingVolumeDisplayer writes a root .C file which can be executed and used the OpenGL root viewer. More...

#include <TrackingVolumeDisplayer.h>

Inheritance diagram for Trk::TrackingVolumeDisplayer:
Collaboration diagram for Trk::TrackingVolumeDisplayer:

Public Member Functions

StatusCode initialize ()
 AlgTool initialize method.
StatusCode finalize ()
 AlgTool finalize method.
 RecursiveGeometryProcessor (const std::string &, const std::string &, const IInterface *)
 Constructor.
virtual StatusCode process (TrackingGeometry &tgeo) const
 Processor Action to work on TrackingGeometry& tgeo.
virtual StatusCode process (TrackingVolume &tvol, size_t level=0) const
 Processor Action to work on TrackingVolumes - the level is for the hierachy tree.
virtual StatusCode process (Layer &lay, size_t level=0) const
 Processor Action to work on Layers.
virtual StatusCode process (Surface &surf, size_t level=0) const
 Processor Action to work on Surfaces.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
 DeclareInterfaceID (IGeometryProcessor, 1, 0)
 Creates the InterfaceID and interfaceID() method.

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

StatusCode processNode (const TrackingVolume &tvol, size_t level=0) const
 Current implementation: write root visualization to file stream.
StatusCode processNode (const Layer &lay, size_t level=0) const
 Current implementation: write root visualization to file stream.
StatusCode processNode (const Surface &, size_t level=0) const
 Current implementation: write root visualization to file stream.
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Static Private Member Functions

static void openFile (std::ofstream &output, const std::string &filename)
 File handling: open + write header.
static void closeFile (std::ofstream &output)
 File handling: write footer + close.
static int colorCodeFromMaterial (const Trk::MaterialProperties *prop, std::ofstream &output)
 calculate the color code from the Material

Private Attributes

int m_volumeCounter = 0
 volume counter
std::ofstream m_fileVolumeOutput
 file output for visualization action
Gaudi::Property< std::string > m_fileVolumeOutputName
Gaudi::Property< bool > m_fileVolumeOutputMode {this, "TrackingVolumeOutput", true, "steer writing"}
std::ofstream m_fileLayerOutput
 file output for visualization action
Gaudi::Property< std::string > m_fileLayerOutputName
Gaudi::Property< bool > m_fileLayerOutputMode {this, "LayerOutput", true, "steer writing"}
std::ofstream m_fileSurfaceOutput
 file output for visualization action
Gaudi::Property< std::string > m_fileSurfaceOutputName
Gaudi::Property< bool > m_fileSurfaceOutputMode {this, "SurfaceOutput", true, "steer writing"}
Gaudi::Property< bool > m_fileSurfaceOutputSplit {this, "SurfaceOutputSplit", false, "use one file for each layer"}
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Static Private Attributes

static int s_displaySurfaces = 0
 static surface counter

Detailed Description

The TrackingVolumeDisplayer writes a root .C file which can be executed and used the OpenGL root viewer.

Author
Andre.nosp@m.as.S.nosp@m.alzbu.nosp@m.rger.nosp@m.@cern.nosp@m..ch

Definition at line 34 of file TrackingVolumeDisplayer.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Member Function Documentation

◆ closeFile()

void Trk::TrackingVolumeDisplayer::closeFile ( std::ofstream & output)
staticprivate

File handling: write footer + close.

Definition at line 92 of file TrackingVolumeDisplayer.cxx.

93{
94 out << "worldnode->cd();" << '\n';
95 out << "worldnode->Draw(\"ogl\");" << '\n';
96 out << "tg->Update();" << '\n';
97 out << "}" << '\n';
98 out.close();
99}

◆ colorCodeFromMaterial()

int Trk::TrackingVolumeDisplayer::colorCodeFromMaterial ( const Trk::MaterialProperties * prop,
std::ofstream & output )
staticprivate

calculate the color code from the Material

Definition at line 346 of file TrackingVolumeDisplayer.cxx.

347{
348 if (!prop) return 6;
349 // start from 100 and reduce by radiation length
350 int color = 100;
351 double tInX0 = prop->thicknessInX0();
352 // write out a comment line
353 output << "// MaterialProperties : t/X0 = " << tInX0 << std::endl;
354 output << "// zOverAtimesRho : Z/A*rho = " << prop->zOverAtimesRho() << std::endl;
355 // 0 % : --> color code 100
356 // 4 % : --> color code 52
357 color -= int(tInX0 * 1200);
358 return color;
359}
output
Definition merge.py:16

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ DeclareInterfaceID()

Trk::IGeometryProcessor::DeclareInterfaceID ( IGeometryProcessor ,
1 ,
0  )
inherited

Creates the InterfaceID and interfaceID() method.

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ finalize()

StatusCode Trk::TrackingVolumeDisplayer::finalize ( )

AlgTool finalize method.

Definition at line 61 of file TrackingVolumeDisplayer.cxx.

62{
63 ATH_MSG_INFO( "finalize() successful" );
64
65 // open the file for writing
68 // open the file for writing
71 // open the file for writing
74
75 return StatusCode::SUCCESS;
76}
#define ATH_MSG_INFO(x)
std::ofstream m_fileVolumeOutput
file output for visualization action
std::ofstream m_fileSurfaceOutput
file output for visualization action
Gaudi::Property< bool > m_fileVolumeOutputMode
std::ofstream m_fileLayerOutput
file output for visualization action
Gaudi::Property< bool > m_fileSurfaceOutputMode
Gaudi::Property< bool > m_fileLayerOutputMode
Gaudi::Property< bool > m_fileSurfaceOutputSplit
static void closeFile(std::ofstream &output)
File handling: write footer + close.

◆ initialize()

StatusCode Trk::TrackingVolumeDisplayer::initialize ( )

AlgTool initialize method.

Definition at line 37 of file TrackingVolumeDisplayer.cxx.

38{
39
40 ATH_MSG_INFO( "initialize()" );
41
42 if (Trk::RecursiveGeometryProcessor::initialize().isFailure()){
43 ATH_MSG_FATAL("Could not initialize base tool. Aborting.");
44 return StatusCode::FAILURE;
45 }
46
47 // open the file for writing
50 // open the file for writing
53 // open the file for writing
56
57 return StatusCode::SUCCESS;
58
59}
#define ATH_MSG_FATAL(x)
static void openFile(std::ofstream &output, const std::string &filename)
File handling: open + write header.
Gaudi::Property< std::string > m_fileVolumeOutputName
Gaudi::Property< std::string > m_fileLayerOutputName
Gaudi::Property< std::string > m_fileSurfaceOutputName

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ openFile()

void Trk::TrackingVolumeDisplayer::openFile ( std::ofstream & output,
const std::string & filename )
staticprivate

File handling: open + write header.

Definition at line 79 of file TrackingVolumeDisplayer.cxx.

80{
81 // open the file
82 out.open(filename.c_str());
83 // write the header
84 out << "{" << '\n';
85 out << "tg = new TCanvas(\"tg\",\"Geometry Shapes\",200,10,700,500);" <<'\n';
86 out << " world = new TBRIK(\"BRIK\",\"BRIK\",\"void\",2,2,2);" << '\n';
87 out << " worldnode = new TNode(\"NODE1\",\"NODE1\",\"BRIK\");" << '\n';
88 out << " worldnode->cd();" << '\n';
89}

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ process() [1/4]

StatusCode Trk::RecursiveGeometryProcessor::process ( Trk::Layer & lay,
size_t level = 0 ) const
virtualinherited

Processor Action to work on Layers.

Implements Trk::IGeometryProcessor.

Definition at line 109 of file RecursiveGeometryProcessor.cxx.

109 {
110
111 std::stringstream displayBuffer;
112 for (size_t il = 0; il < level; ++il) displayBuffer << " ";
113 ATH_MSG_VERBOSE(displayBuffer.str() << " processing Layer with Index: " << lay.layerIndex() );
114
115 // process the node itself
116 if (processNode(lay, level).isFailure()){
117 ATH_MSG_FATAL("Failed to call processNode(const Layer&). Aborting.");
118 return StatusCode::FAILURE;
119 }
120 // get the subsurface array
121 Trk::SurfaceArray* surfArray = lay.surfaceArray();
122 if (surfArray) {
123 std::span<Trk::Surface * const > layerSurfaces = surfArray->arrayObjects();
124 ATH_MSG_VERBOSE(displayBuffer.str() << " ---> has " << layerSurfaces.size() << " surfaces on the layer.");
125
126 auto laySurfIter = layerSurfaces.begin();
127 auto laySurfIterEnd = layerSurfaces.end();
128 // loop over the surfaces and draw them
129 for ( ; laySurfIter != laySurfIterEnd; ++laySurfIter) {
130 if (!(*laySurfIter))
131 ATH_MSG_WARNING("Zero-pointer found in SurfaceArray - indicates problem !");
132 if ((*laySurfIter) && process(**laySurfIter, level).isFailure()){
133 ATH_MSG_FATAL("Failed to call process(const Surface&) on confined layer surfaces. Aborting.");
134 return StatusCode::FAILURE;
135 }
136 }
137 }
138 // return SUCCESS
139 return StatusCode::SUCCESS;
140}
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
virtual std::span< T *const > arrayObjects()=0
Return all objects of the Array non-const we can still modify the T.
const SurfaceArray * surfaceArray() const
Return the entire SurfaceArray, returns nullptr if no SurfaceArray.
const LayerIndex & layerIndex() const
get the layerIndex
virtual StatusCode processNode(const TrackingVolume &tvol, size_t level=0) const
Dedicated action for the different processors.
const std::string process
BinnedArray< Surface > SurfaceArray
Definition Layer.h:40

◆ process() [2/4]

StatusCode Trk::RecursiveGeometryProcessor::process ( Trk::Surface & surf,
size_t level = 0 ) const
virtualinherited

Processor Action to work on Surfaces.

Implements Trk::IGeometryProcessor.

Definition at line 143 of file RecursiveGeometryProcessor.cxx.

143 {
144 return processNode(surf, level);
145}

◆ process() [3/4]

StatusCode Trk::RecursiveGeometryProcessor::process ( Trk::TrackingGeometry & tgeo) const
virtualinherited

Processor Action to work on TrackingGeometry& tgeo.

Implements Trk::IGeometryProcessor.

Definition at line 27 of file RecursiveGeometryProcessor.cxx.

27 {
28
29 ATH_MSG_VERBOSE("Start processing the TrackingGeometry recursively");
30 // retrieve the highest tracking volume
31 Trk::TrackingVolume* worldVolume = tgeo.highestTrackingVolume();
32 if (worldVolume){
33 ATH_MSG_VERBOSE("TrackingVolume '" << worldVolume->volumeName() << "' retrieved as highest level node.");
34 return process(*worldVolume, 0);
35 }
36 // abort job
37 ATH_MSG_FATAL("No highest level TrackingVolume found. Stopping recursive parsing, abort job.");
38 return StatusCode::FAILURE;
39}
const TrackingVolume * highestTrackingVolume() const
return the world
const std::string & volumeName() const
Returns the VolumeName - for debug reason, might be depreciated later.

◆ process() [4/4]

StatusCode Trk::RecursiveGeometryProcessor::process ( Trk::TrackingVolume & tvol,
size_t level = 0 ) const
virtualinherited

Processor Action to work on TrackingVolumes - the level is for the hierachy tree.

Implements Trk::IGeometryProcessor.

Definition at line 42 of file RecursiveGeometryProcessor.cxx.

42 {
43
44 std::stringstream displayBuffer;
45 for (size_t il = 0; il < level; ++il) displayBuffer << " ";
46 // formatted screen output
47 ATH_MSG_VERBOSE(displayBuffer.str() << "TrackingVolume '" << tvol.volumeName() << "'");
48
49 // create the action on the volume part of the TrackingVolume
50 if (processNode(tvol, level).isFailure() ){
51 ATH_MSG_FATAL("Failed to call processNode(const TrackingVolume&). Aborting.");
52 return StatusCode::FAILURE;
53 }
54
55 // Process the contained layers if they exist
56 Trk::LayerArray* layerArray = tvol.confinedLayers();
57 if (layerArray) {
58 // display output
59 auto layers = layerArray->arrayObjects();
60 ATH_MSG_VERBOSE(displayBuffer.str() << "--> has " << layers.size() << " confined layers." );
61 for (const auto & layIter : layers){
62 if (!layIter)
63 ATH_MSG_WARNING("Zero-pointer found in LayerArray - indicates problem !");
64 if ((layIter) && process(*layIter, level).isFailure()){
65 ATH_MSG_FATAL("Failed to call process(const Layer&) on confined layers. Aborting.");
66 return StatusCode::FAILURE;
67 }
68 }
69 }
70
71 // Process the boundary surface layers
72 auto bSurfaces = tvol.boundarySurfaces();
73 for (auto & bSurface : bSurfaces){
74 if (bSurface->surfaceRepresentation().associatedLayer()){
75 ATH_MSG_VERBOSE(displayBuffer.str() << "--> has a boundary layer." );
76 if (process(
77 const_cast<Trk::Layer&>(
78 *bSurface->surfaceRepresentation().associatedLayer()),level)
79 .isFailure()) {
80 ATH_MSG_FATAL("Failed to call process(const Layer&) on boundary "
81 "layer. Aborting.");
82 return StatusCode::FAILURE;
83 }
84 }
85 }
86
87
88 // Process the contained TrackingVolumes (recursively) if they exist
89 Trk::BinnedArray< Trk::TrackingVolume >* confinedVolumes = tvol.confinedVolumes();
90 // register the next round
91 if (confinedVolumes) {
92 auto volumes = confinedVolumes->arrayObjects();
93 for (const auto & volumesIter : volumes){
94 if (!volumesIter)
95 ATH_MSG_WARNING("Zero-pointer found in VolumeArray - indicates problem !");
96 if (volumesIter && process(*volumesIter, ++level).isFailure() ){
97 ATH_MSG_FATAL("Failed to call process(const TrackingVolume&) on confined volumes. Aborting.");
98 return StatusCode::FAILURE;
99 }
100 }
101 }
102
103 // return
104 return StatusCode::SUCCESS;
105
106}
const LayerArray * confinedLayers() const
Return the subLayer array.
const TrackingVolumeArray * confinedVolumes() const
Return the subLayer array.
std::vector< std::shared_ptr< BoundarySurface< TrackingVolume > > > & boundarySurfaces()
Method to return the BoundarySurfaces.
layers(flags, cells_name, *args, **kw)
Here we define wrapper functions to set up all of the standard corrections.
BinnedArray< Layer > LayerArray
simply for the eye

◆ processNode() [1/3]

StatusCode Trk::TrackingVolumeDisplayer::processNode ( const Layer & lay,
size_t level = 0 ) const
privatevirtual

Current implementation: write root visualization to file stream.

Reimplemented from Trk::RecursiveGeometryProcessor.

Definition at line 140 of file TrackingVolumeDisplayer.cxx.

141{
142
143 ATH_MSG_VERBOSE("Writing display information for Layer.");
144 // get the identifier
145 int layerIndex = lay.layerIndex().value();
146 int layerIndexStr = (layerIndex < 0) ? (-layerIndex)+1 : layerIndex;
147 // the layer position
148 const Amg::Vector3D& layerPosition = lay.surfaceRepresentation().center();
149 double layerPositionZ = layerPosition.z();
150 // output mode
152 std::stringstream ss;
153 std::string str;
154 ss << "Layer" << layerIndexStr << "_" << m_fileSurfaceOutputName;
155 ss >> str;
157 m_fileSurfaceOutput<<"// Enclosing Volume: "<<lay.enclosingTrackingVolume()->volumeName()<<std::endl;
158 }
159
161 const Trk::SurfaceArray* surfArray = lay.surfaceArray();
162 if (surfArray) {
163 const auto & layerSurfaces = surfArray->arrayObjects();
164 // loop over the surfaces and draw them
165 for (const auto & laySurfIter : layerSurfaces) {
166 if ( laySurfIter && processNode(*laySurfIter).isFailure()){
167 ATH_MSG_FATAL("Failed to call processNode(const Surface& sf) on sub surface. Abort.");
168 return StatusCode::FAILURE;
169 }
170 }
171 }
172 }
175
176 const Trk::Surface& lSurface = lay.surfaceRepresentation();
177 int layerColor = lay.enclosingTrackingVolume() ? lay.enclosingTrackingVolume()->colorCode() : 22;
178
179 // CYLINDER SECTION
180 if (lSurface.type() == Trk::SurfaceType::Cylinder && layerIndex > 0) {
181 // get the Bounds
182 const Trk::CylinderBounds* cylBo = dynamic_cast<const Trk::CylinderBounds*>(&lSurface.bounds());
183 if (!cylBo) {
184 m_fileLayerOutput << "ERROR Cylinder surface without CylinderBounds\n";
185 return StatusCode::FAILURE;
186 }
187 else {
188 // set the boundaries
189 double radius = cylBo->r();
190 double halfZ = cylBo->halflengthZ();
191 m_fileLayerOutput << "Cylinder" << layerIndexStr << " = new TTUBE(\"CylinderLayer";
192 m_fileLayerOutput << layerIndexStr << "\",\"CylinderLayer" << layerIndex << "\",\"void\",";
193 m_fileLayerOutput << int(radius-5) << "," << int(radius+5) << "," << int(halfZ) << ");" << '\n';
194 // get the line color
195 m_fileLayerOutput << "Cylinder" << layerIndexStr << "->SetLineColor(" << layerColor << ");" << '\n';
196 // write the node
197 m_fileLayerOutput <<"Node" << layerIndexStr << " = new TNode(\"CylinderNode" << layerIndex;
198 m_fileLayerOutput << "\",\"CylinderNode" << layerIndexStr << "\",\"CylinderLayer";
199 m_fileLayerOutput << layerIndexStr << "\"," << 0 << "," << 0 << "," << int(layerPositionZ) << ");" << '\n';
200 m_fileLayerOutput <<'\n';
201
202 return StatusCode::SUCCESS;
203 }
204 } else if (lSurface.type() == Trk::SurfaceType::Disc && layerIndex > 0) {
205 // get the Bounds
206 const Trk::DiscBounds* discBo = dynamic_cast<const Trk::DiscBounds*>(&lSurface.bounds());
207 if (!discBo) {
208 m_fileLayerOutput << "ERROR Disc surface without DiscBounds\n";
209 return StatusCode::FAILURE;
210 }
211 else {
212
213 // set the boundaries
214 double rMin = discBo->rMin();
215 double rMax = discBo->rMax();
216
217 m_fileLayerOutput << "Disc" << layerIndexStr << " = new TTUBE(\"DiscLayer" << layerIndexStr << "\",\"DiscLayer" << layerIndex << "\",\"void\",";
218 m_fileLayerOutput << int(rMin+1.) << "," << int(rMax-1.) << ",10);" << '\n';
219 // get the line color
220 m_fileLayerOutput << "Disc" << layerIndexStr << "->SetLineColor(" << layerColor << ");" << '\n';
221 // write the node
222 m_fileLayerOutput << "DiscNode" << layerIndexStr << " = new TNode(\"DiscNode" << layerIndex;
223 m_fileLayerOutput << "\",\"DiscNode" << layerIndexStr << "\",\"DiscLayer";
224 m_fileLayerOutput << layerIndexStr << "\"," << 0 << "," << 0 << "," << int(layerPositionZ) << ");" << '\n';
225 m_fileLayerOutput <<'\n';
226 return StatusCode::SUCCESS;
227 }
228 }
229 return StatusCode::SUCCESS;
230}
static Double_t ss
virtual double r() const override final
This method returns the radius.
double halflengthZ() const
This method returns the halflengthZ.
double rMax() const
This method returns outer radius.
double rMin() const
This method returns inner radius.
virtual constexpr SurfaceType type() const =0
Returns the Surface type to avoid dynamic casts.
virtual const SurfaceBounds & bounds() const =0
Surface Bounds method.
StatusCode processNode(const TrackingVolume &tvol, size_t level=0) const
Current implementation: write root visualization to file stream.
Eigen::Matrix< double, 3, 1 > Vector3D
double halfZ(const Acts::VolumeBounds &bounds)
Returns the half-Z length for the parsed volume bounds (Trapezoid/ Cuboid).

◆ processNode() [2/3]

StatusCode Trk::TrackingVolumeDisplayer::processNode ( const Surface & sf,
size_t level = 0 ) const
privatevirtual

Current implementation: write root visualization to file stream.

Reimplemented from Trk::RecursiveGeometryProcessor.

Definition at line 233 of file TrackingVolumeDisplayer.cxx.

234{
235
237
238 ATH_MSG_VERBOSE("Writing display information for Surface.");
239
240
241 m_fileSurfaceOutput << "// ---------------------- Surface -------------------------------// " << std::endl;
242
243 // surface center
244 double surfX = sf.center().x();
245 double surfY = sf.center().y();
246 double surfZ = sf.center().z();
247 // rotation matrix
248 const Amg::RotationMatrix3D sfRot = sf.transform().rotation();
249
250 // ROOT wants the angles in degrees
251 const double convFac = 180./M_PI;
252 double xPhi = sfRot.col(0).phi()*convFac;
253 double xTheta = sfRot.col(0).theta()*convFac;
254 double yPhi = sfRot.col(1).phi()*convFac;
255 double yTheta = sfRot.col(1).theta()*convFac;
256 double zPhi = sfRot.col(2).phi()*convFac;
257 double zTheta = sfRot.col(2).theta()*convFac;
258
259 // surface
260 TString surfaceString = "Surface_";
261 surfaceString += s_displaySurfaces;
262 TString rotationString = "Rotation_";
263 rotationString += s_displaySurfaces;
264 TString nodeString = "Node";
265 nodeString += s_displaySurfaces;
266 // test version just with planar bounds
267 const Trk::RectangleBounds* recBo = dynamic_cast<const Trk::RectangleBounds*>(&(sf.bounds()));
268 const Trk::TrapezoidBounds* traBo = recBo ? nullptr : dynamic_cast<const Trk::TrapezoidBounds*>(&(sf.bounds()));
269 const Trk::DiscTrapezoidalBounds* disctraBo = (recBo || traBo) ? nullptr : dynamic_cast<const Trk::DiscTrapezoidalBounds*>(&(sf.bounds()));
270 if (recBo) {
271 // it is a rectangle surface
272 double halfX = recBo->halflengthX();
273 double halfY = recBo->halflengthY();
274 // prepare the surface
275 m_fileSurfaceOutput << surfaceString << " = new TBRIK(\""<< surfaceString << "\",\"" << surfaceString<< "\",\"void\",";
276 m_fileSurfaceOutput << halfX << ","<< halfY <<" ,2);" << '\n';
277
278 m_fileSurfaceOutput << surfaceString << "->SetLineColor(80);" << std::endl;
279
280 // the rotation
281 m_fileSurfaceOutput << rotationString << "= new TRotMatrix(\" "<< rotationString << " \",\" " << rotationString << " \", ";
282 m_fileSurfaceOutput << xTheta << "," << xPhi << "," << yTheta << "," << yPhi << ", " << zTheta << "," << zPhi << ");" << std::endl;
283
284 } else if (traBo) {
285 //example
286 //TGTRA gtra = new TGTRA("GTRA","GTRA","void",390,0,0,20,60,40,90,15120,80180,15);
287 // prepare the surface (swap Y and Z)
288 m_fileSurfaceOutput << surfaceString << " = new TTRD1(\""<< surfaceString << "\",\"" << surfaceString<< "\",\"void\",";
289 m_fileSurfaceOutput << traBo->minHalflengthX() << "," << traBo->maxHalflengthX() << ",2," << traBo->halflengthY() << ");" << '\n';
290
291 m_fileSurfaceOutput << surfaceString << "->SetLineColor(80);" << std::endl;
292
293 // the rotation (swap Y and Z)
294 m_fileSurfaceOutput << rotationString << "= new TRotMatrix(\" "<< rotationString << " \",\" " << rotationString << " \", ";
295 m_fileSurfaceOutput << xTheta << "," << xPhi << ", " << zTheta << "," << zPhi << "," << yTheta << "," << yPhi << ");" << std::endl;
296 } else if (disctraBo) {
297 //double rMedium = disctraBo->rCenter();
298 //double Rc = (sf.center()).perp();
299 //double side = (sf.normal()).z();
300 //double stereo = side*2.*asin(Rc/(2.*rMedium));
301 //double avePhi = (side>0) ? disctraBo->averagePhi()+stereo : -disctraBo->averagePhi()+M_PI+stereo;
302
303 double stereo = disctraBo->stereo();
304 double rMedium = disctraBo->rCenter();
305 double avePhi = disctraBo->averagePhi()+stereo;
306
307 surfX = rMedium*cos(avePhi);
308 surfY = rMedium*sin(avePhi);
309 surfZ = (sf.center()).z();
310
312 rotation = Amg::AngleAxis3D(0., Amg::Vector3D::UnitX())*
313 Amg::AngleAxis3D(0., Amg::Vector3D::UnitY())*
314 Amg::AngleAxis3D(-M_PI/2.+avePhi-surfZ/fabs(surfZ)*stereo, Amg::Vector3D::UnitZ());
315
316 // ROOT wants the angles in degrees
317 xPhi = rotation.col(0).phi()*convFac;
318 xTheta = rotation.col(0).theta()*convFac;
319 yPhi = rotation.col(1).phi()*convFac;
320 yTheta = rotation.col(1).theta()*convFac;
321 zPhi = rotation.col(2).phi()*convFac;
322 zTheta = rotation.col(2).theta()*convFac;
323
324 //example
325 //TGTRA gtra = new TGTRA("GTRA","GTRA","void",390,0,0,20,60,40,90,15120,80180,15);
326 // prepare the surface (swap Y and Z)
327 m_fileSurfaceOutput << surfaceString << " = new TTRD1(\""<< surfaceString << "\",\"" << surfaceString<< "\",\"void\",";
328 m_fileSurfaceOutput << disctraBo->minHalflengthX() << "," << disctraBo->maxHalflengthX() << ",2," << disctraBo->halflengthY() << ");" << '\n';
329
330 m_fileSurfaceOutput << surfaceString << "->SetLineColor(80);" << std::endl;
331
332 // the rotation (swap Y and Z)
333 m_fileSurfaceOutput << rotationString << "= new TRotMatrix(\" "<< rotationString << " \",\" " << rotationString << " \", ";
334 m_fileSurfaceOutput << xTheta << "," << xPhi << ", " << zTheta << "," << zPhi << "," << yTheta << "," << yPhi << ");" << std::endl;
335 }
336
337 // the node
338 m_fileSurfaceOutput << nodeString << " = new TNode(\"" << nodeString << "\",\"" << nodeString << "\"," << surfaceString;
339 m_fileSurfaceOutput << "," << surfX << ", " << surfY << "," << surfZ << ", " << rotationString << ");" << std::endl;
340
341 return StatusCode::SUCCESS;
342
343}
#define M_PI
double halflengthY() const
This method returns the halflength in Y (this is Rmax -Rmin).
double averagePhi() const
This method returns the average phi.
double maxHalflengthX() const
This method returns the maximal halflength in X.
double minHalflengthX() const
This method returns the minimal halflength in X.
double stereo() const
This method returns the stereo angle.
double rCenter() const
This method returns the center radius.
double halflengthX() const
for consistant naming
double halflengthY() const
for consitant naming
static int s_displaySurfaces
static surface counter
double halflengthY() const
This method returns the halflength in Y (second coordinate of local surface frame).
double minHalflengthX() const
This method returns the minimal halflength in X (first coordinate of local surface frame).
double maxHalflengthX() const
This method returns the maximal halflength in X (first coordinate of local surface frame).
Eigen::AngleAxisd AngleAxis3D
Eigen::Matrix< double, 3, 3 > RotationMatrix3D
const
helper method to get the collection index (into m_inputCollectionsName) and tuple index (into m_tuple...
double halfY(const Acts::VolumeBounds &bounds)
Returns the half-Y length for the parsed volume bounds (Trapezoid/ Cuboid).

◆ processNode() [3/3]

StatusCode Trk::TrackingVolumeDisplayer::processNode ( const TrackingVolume & tvol,
size_t level = 0 ) const
privatevirtual

Current implementation: write root visualization to file stream.

Reimplemented from Trk::RecursiveGeometryProcessor.

Definition at line 102 of file TrackingVolumeDisplayer.cxx.

103{
104
105 ATH_MSG_VERBOSE("Writing display information for TrackingVolume.");
106
107 // make a dynamic cast to the CylinderVolumeBounds
108 const Trk::CylinderVolumeBounds* cvol = dynamic_cast<const Trk::CylinderVolumeBounds*>(&tvol.volumeBounds());
109
110 double rMin = 0.;
111 double rMax = 0.;
112 double halfZ = 0.;
113
114 if (cvol) {
115 // from the color code one can determine if its a gap volume
116 // set the boundaries
117 rMin = cvol->innerRadius();
118 rMax = cvol->outerRadius();
119 halfZ = cvol->halflengthZ();
120 }
121
122 // get the name
123 const std::string& volumeName = tvol.volumeName();
124 // write a debug line
125 m_fileVolumeOutput << "// Processing TrackingVolume '" << volumeName << "'. " << '\n';
126 m_fileVolumeOutput << "CylinderVolume" << m_volumeCounter << " = new TTUBE(\"" << volumeName << "\",\"" << volumeName << "\",\"void\",";
127 m_fileVolumeOutput << int(rMin)+1 << "," << int(rMax)-1 << "," << int(halfZ)-1 << ");" << '\n';
128 m_fileVolumeOutput << "CylinderVolume" << m_volumeCounter << "->SetLineColor(" << tvol.colorCode() << ");" << '\n';
129 double zPos = tvol.center().z();
130 m_fileVolumeOutput << "CylinderNode" << m_volumeCounter << " = new TNode(\"" << volumeName << "Node\",\"" << volumeName << "Node\",\"";
131 m_fileVolumeOutput << volumeName << "\"," << 0 << "," << 0 << "," << int(zPos) << ");" << '\n';
132 m_fileVolumeOutput <<'\n';
134
135 // return successful
136 return StatusCode::SUCCESS;
137}
double innerRadius() const
This method returns the inner radius.
double halflengthZ() const
This method returns the halflengthZ.
double outerRadius() const
This method returns the outer radius.

◆ RecursiveGeometryProcessor()

Trk::RecursiveGeometryProcessor::RecursiveGeometryProcessor ( const std::string & t,
const std::string & n,
const IInterface * p )

Constructor.

Definition at line 43 of file RecursiveGeometryProcessor.cxx.

21: AthAlgTool(t,n,p)
22{
23 declareInterface<Trk::IGeometryProcessor>(this);
24}
AthAlgTool()
Default constructor:

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, and AthCheckedComponent<::AthAlgTool >.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 390 of file AthCommonDataStore.h.

◆ m_fileLayerOutput

std::ofstream Trk::TrackingVolumeDisplayer::m_fileLayerOutput
mutableprivate

file output for visualization action

Definition at line 74 of file TrackingVolumeDisplayer.h.

◆ m_fileLayerOutputMode

Gaudi::Property<bool> Trk::TrackingVolumeDisplayer::m_fileLayerOutputMode {this, "LayerOutput", true, "steer writing"}
private

Definition at line 78 of file TrackingVolumeDisplayer.h.

79{this, "LayerOutput", true, "steer writing"};

◆ m_fileLayerOutputName

Gaudi::Property<std::string> Trk::TrackingVolumeDisplayer::m_fileLayerOutputName
private
Initial value:
{this, "LayerOutputFile", "TrackingGeometryLayerDisplay.C",
"file name for visualization action"}

Definition at line 75 of file TrackingVolumeDisplayer.h.

76 {this, "LayerOutputFile", "TrackingGeometryLayerDisplay.C",
77 "file name for visualization action"};

◆ m_fileSurfaceOutput

std::ofstream Trk::TrackingVolumeDisplayer::m_fileSurfaceOutput
mutableprivate

file output for visualization action

Definition at line 81 of file TrackingVolumeDisplayer.h.

◆ m_fileSurfaceOutputMode

Gaudi::Property<bool> Trk::TrackingVolumeDisplayer::m_fileSurfaceOutputMode {this, "SurfaceOutput", true, "steer writing"}
private

Definition at line 85 of file TrackingVolumeDisplayer.h.

86{this, "SurfaceOutput", true, "steer writing"};

◆ m_fileSurfaceOutputName

Gaudi::Property<std::string> Trk::TrackingVolumeDisplayer::m_fileSurfaceOutputName
private
Initial value:
{this, "SurfaceOutputFile", "TrackingGeometrySurfaceDisplay.C",
"file name for visualization action"}

Definition at line 82 of file TrackingVolumeDisplayer.h.

83 {this, "SurfaceOutputFile", "TrackingGeometrySurfaceDisplay.C",
84 "file name for visualization action"};

◆ m_fileSurfaceOutputSplit

Gaudi::Property<bool> Trk::TrackingVolumeDisplayer::m_fileSurfaceOutputSplit {this, "SurfaceOutputSplit", false, "use one file for each layer"}
private

Definition at line 87 of file TrackingVolumeDisplayer.h.

88{this, "SurfaceOutputSplit", false, "use one file for each layer"};

◆ m_fileVolumeOutput

std::ofstream Trk::TrackingVolumeDisplayer::m_fileVolumeOutput
mutableprivate

file output for visualization action

Definition at line 67 of file TrackingVolumeDisplayer.h.

◆ m_fileVolumeOutputMode

Gaudi::Property<bool> Trk::TrackingVolumeDisplayer::m_fileVolumeOutputMode {this, "TrackingVolumeOutput", true, "steer writing"}
private

Definition at line 71 of file TrackingVolumeDisplayer.h.

72{this, "TrackingVolumeOutput", true, "steer writing"};

◆ m_fileVolumeOutputName

Gaudi::Property<std::string> Trk::TrackingVolumeDisplayer::m_fileVolumeOutputName
private
Initial value:
{this, "TrackingVolumeOutputFile", "TrackingGeometryVolumeDisplay.C",
"file name for visualization action"}

Definition at line 68 of file TrackingVolumeDisplayer.h.

69 {this, "TrackingVolumeOutputFile", "TrackingGeometryVolumeDisplay.C",
70 "file name for visualization action"};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.

◆ m_volumeCounter

int Trk::TrackingVolumeDisplayer::m_volumeCounter = 0
mutableprivate

volume counter

Definition at line 65 of file TrackingVolumeDisplayer.h.

◆ s_displaySurfaces

int Trk::TrackingVolumeDisplayer::s_displaySurfaces = 0
staticprivate

static surface counter

Definition at line 90 of file TrackingVolumeDisplayer.h.


The documentation for this class was generated from the following files: