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

 TrackingVolumeDisplayer (const std::string &, const std::string &, const IInterface *)
 Constructor.
virtual ~TrackingVolumeDisplayer ()
 Destructor.
StatusCode initialize ()
 AlgTool initialize method.
StatusCode finalize ()
 AlgTool finalize method.
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
 volume counter
std::ofstream m_fileVolumeOutput
 file output for visualization action
std::string m_fileVolumeOutputName
 file name for visualization action
bool m_fileVolumeOutputMode
 steer writing
std::ofstream m_fileLayerOutput
 file output for visualization action
std::string m_fileLayerOutputName
 file name for visualization action
bool m_fileLayerOutputMode
 steer writing
std::ofstream m_fileSurfaceOutput
 file output for visualization action
std::string m_fileSurfaceOutputName
 file name for visualization action
bool m_fileSurfaceOutputMode
 steer writing
bool m_fileSurfaceOutputSplit
 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.

Constructor & Destructor Documentation

◆ TrackingVolumeDisplayer()

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

Constructor.

Definition at line 36 of file TrackingVolumeDisplayer.cxx.

36 :
37 Trk::RecursiveGeometryProcessor(t,n,p),
39 m_fileVolumeOutputName("TrackingGeometryVolumeDisplay.C"),
41 m_fileLayerOutputName("TrackingGeometryLayerDisplay.C"),
43 m_fileSurfaceOutputName("TrackingGeometrySurfaceDisplay.C"),
46{
47 // set name and output type
48 declareProperty("TrackingVolumeOutputFile", m_fileVolumeOutputName);
49 declareProperty("TrackingVolumeOutput", m_fileVolumeOutputMode);
50 declareProperty("LayerOutputFile", m_fileLayerOutputName);
52 declareProperty("SurfaceOutputFile", m_fileSurfaceOutputName);
54 declareProperty("SurfaceOutputSplit", m_fileSurfaceOutputSplit);
55}
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
bool m_fileSurfaceOutputSplit
use one file for each layer
std::string m_fileSurfaceOutputName
file name for visualization action
std::string m_fileLayerOutputName
file name for visualization action
std::string m_fileVolumeOutputName
file name for visualization action

◆ ~TrackingVolumeDisplayer()

Trk::TrackingVolumeDisplayer::~TrackingVolumeDisplayer ( )
virtualdefault

Destructor.

Member Function Documentation

◆ closeFile()

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

File handling: write footer + close.

Definition at line 118 of file TrackingVolumeDisplayer.cxx.

119{
120 out << "worldnode->cd();" << '\n';
121 out << "worldnode->Draw(\"ogl\");" << '\n';
122 out << "tg->Update();" << '\n';
123 out << "}" << '\n';
124 out.close();
125}

◆ colorCodeFromMaterial()

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

calculate the color code from the Material

Definition at line 372 of file TrackingVolumeDisplayer.cxx.

373{
374 if (!prop) return 6;
375 // start from 100 and reduce by radiation length
376 int color = 100;
377 double tInX0 = prop->thicknessInX0();
378 // write out a comment line
379 output << "// MaterialProperties : t/X0 = " << tInX0 << std::endl;
380 output << "// zOverAtimesRho : Z/A*rho = " << prop->zOverAtimesRho() << std::endl;
381 // 0 % : --> color code 100
382 // 4 % : --> color code 52
383 color -= int(tInX0 * 1200);
384 return color;
385}
float thicknessInX0() const
Return the radiationlength fraction.
float zOverAtimesRho() const
Return the .
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 }

◆ 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 87 of file TrackingVolumeDisplayer.cxx.

88{
89 ATH_MSG_INFO( "finalize() successful" );
90
91 // open the file for writing
94 // open the file for writing
97 // open the file for writing
100
101 return StatusCode::SUCCESS;
102}
#define ATH_MSG_INFO(x)
std::ofstream m_fileVolumeOutput
file output for visualization action
std::ofstream m_fileSurfaceOutput
file output for visualization action
std::ofstream m_fileLayerOutput
file output for visualization action
static void closeFile(std::ofstream &output)
File handling: write footer + close.

◆ initialize()

StatusCode Trk::TrackingVolumeDisplayer::initialize ( )

AlgTool initialize method.

Definition at line 63 of file TrackingVolumeDisplayer.cxx.

64{
65
66 ATH_MSG_INFO( "initialize()" );
67
69 ATH_MSG_FATAL("Could not initialize base tool. Aborting.");
70 return StatusCode::FAILURE;
71 }
72
73 // open the file for writing
76 // open the file for writing
79 // open the file for writing
82
83 return StatusCode::SUCCESS;
84
85}
#define ATH_MSG_FATAL(x)
StatusCode initialize()
AlgTool initialize method.
static void openFile(std::ofstream &output, const std::string &filename)
File handling: open + write header.

◆ 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 105 of file TrackingVolumeDisplayer.cxx.

106{
107 // open the file
108 out.open(filename.c_str());
109 // write the header
110 out << "{" << '\n';
111 out << "tg = new TCanvas(\"tg\",\"Geometry Shapes\",200,10,700,500);" <<'\n';
112 out << " world = new TBRIK(\"BRIK\",\"BRIK\",\"void\",2,2,2);" << '\n';
113 out << " worldnode = new TNode(\"NODE1\",\"NODE1\",\"BRIK\");" << '\n';
114 out << " worldnode->cd();" << '\n';
115}

◆ 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 128 of file RecursiveGeometryProcessor.cxx.

128 {
129
130 std::stringstream displayBuffer;
131 for (size_t il = 0; il < level; ++il) displayBuffer << " ";
132 ATH_MSG_VERBOSE(displayBuffer.str() << " processing Layer with Index: " << lay.layerIndex() );
133
134 // process the node itself
135 if (processNode(lay, level).isFailure()){
136 ATH_MSG_FATAL("Failed to call processNode(const Layer&). Aborting.");
137 return StatusCode::FAILURE;
138 }
139 // get the subsurface array
140 Trk::SurfaceArray* surfArray = lay.surfaceArray();
141 if (surfArray) {
142 std::span<Trk::Surface * const > layerSurfaces = surfArray->arrayObjects();
143 ATH_MSG_VERBOSE(displayBuffer.str() << " ---> has " << layerSurfaces.size() << " surfaces on the layer.");
144
145 auto laySurfIter = layerSurfaces.begin();
146 auto laySurfIterEnd = layerSurfaces.end();
147 // loop over the surfaces and draw them
148 for ( ; laySurfIter != laySurfIterEnd; ++laySurfIter) {
149 if (!(*laySurfIter))
150 ATH_MSG_WARNING("Zero-pointer found in SurfaceArray - indicates problem !");
151 if ((*laySurfIter) && process(**laySurfIter, level).isFailure()){
152 ATH_MSG_FATAL("Failed to call process(const Surface&) on confined layer surfaces. Aborting.");
153 return StatusCode::FAILURE;
154 }
155 }
156 }
157 // return SUCCESS
158 return StatusCode::SUCCESS;
159}
#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 162 of file RecursiveGeometryProcessor.cxx.

162 {
163 return processNode(surf, level);
164}

◆ 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 46 of file RecursiveGeometryProcessor.cxx.

46 {
47
48 ATH_MSG_VERBOSE("Start processing the TrackingGeometry recursively");
49 // retrieve the highest tracking volume
50 Trk::TrackingVolume* worldVolume = tgeo.highestTrackingVolume();
51 if (worldVolume){
52 ATH_MSG_VERBOSE("TrackingVolume '" << worldVolume->volumeName() << "' retrieved as highest level node.");
53 return process(*worldVolume, 0);
54 }
55 // abort job
56 ATH_MSG_FATAL("No highest level TrackingVolume found. Stopping recursive parsing, abort job.");
57 return StatusCode::FAILURE;
58}
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 61 of file RecursiveGeometryProcessor.cxx.

61 {
62
63 std::stringstream displayBuffer;
64 for (size_t il = 0; il < level; ++il) displayBuffer << " ";
65 // formatted screen output
66 ATH_MSG_VERBOSE(displayBuffer.str() << "TrackingVolume '" << tvol.volumeName() << "'");
67
68 // create the action on the volume part of the TrackingVolume
69 if (processNode(tvol, level).isFailure() ){
70 ATH_MSG_FATAL("Failed to call processNode(const TrackingVolume&). Aborting.");
71 return StatusCode::FAILURE;
72 }
73
74 // Process the contained layers if they exist
75 Trk::LayerArray* layerArray = tvol.confinedLayers();
76 if (layerArray) {
77 // display output
78 auto layers = layerArray->arrayObjects();
79 ATH_MSG_VERBOSE(displayBuffer.str() << "--> has " << layers.size() << " confined layers." );
80 for (const auto & layIter : layers){
81 if (!layIter)
82 ATH_MSG_WARNING("Zero-pointer found in LayerArray - indicates problem !");
83 if ((layIter) && process(*layIter, level).isFailure()){
84 ATH_MSG_FATAL("Failed to call process(const Layer&) on confined layers. Aborting.");
85 return StatusCode::FAILURE;
86 }
87 }
88 }
89
90 // Process the boundary surface layers
91 auto bSurfaces = tvol.boundarySurfaces();
92 for (auto & bSurface : bSurfaces){
93 if (bSurface->surfaceRepresentation().associatedLayer()){
94 ATH_MSG_VERBOSE(displayBuffer.str() << "--> has a boundary layer." );
95 if (process(
96 const_cast<Trk::Layer&>(
97 *bSurface->surfaceRepresentation().associatedLayer()),level)
98 .isFailure()) {
99 ATH_MSG_FATAL("Failed to call process(const Layer&) on boundary "
100 "layer. Aborting.");
101 return StatusCode::FAILURE;
102 }
103 }
104 }
105
106
107 // Process the contained TrackingVolumes (recursively) if they exist
108 Trk::BinnedArray< Trk::TrackingVolume >* confinedVolumes = tvol.confinedVolumes();
109 // register the next round
110 if (confinedVolumes) {
111 auto volumes = confinedVolumes->arrayObjects();
112 for (const auto & volumesIter : volumes){
113 if (!volumesIter)
114 ATH_MSG_WARNING("Zero-pointer found in VolumeArray - indicates problem !");
115 if (volumesIter && process(*volumesIter, ++level).isFailure() ){
116 ATH_MSG_FATAL("Failed to call process(const TrackingVolume&) on confined volumes. Aborting.");
117 return StatusCode::FAILURE;
118 }
119 }
120 }
121
122 // return
123 return StatusCode::SUCCESS;
124
125}
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 166 of file TrackingVolumeDisplayer.cxx.

167{
168
169 ATH_MSG_VERBOSE("Writing display information for Layer.");
170 // get the identifier
171 int layerIndex = lay.layerIndex().value();
172 int layerIndexStr = (layerIndex < 0) ? (-layerIndex)+1 : layerIndex;
173 // the layer position
174 const Amg::Vector3D& layerPosition = lay.surfaceRepresentation().center();
175 double layerPositionZ = layerPosition.z();
176 // output mode
178 std::stringstream ss;
179 std::string str;
180 ss << "Layer" << layerIndexStr << "_" << m_fileSurfaceOutputName;
181 ss >> str;
183 m_fileSurfaceOutput<<"// Enclosing Volume: "<<lay.enclosingTrackingVolume()->volumeName()<<std::endl;
184 }
185
187 const Trk::SurfaceArray* surfArray = lay.surfaceArray();
188 if (surfArray) {
189 const auto & layerSurfaces = surfArray->arrayObjects();
190 // loop over the surfaces and draw them
191 for (const auto & laySurfIter : layerSurfaces) {
192 if ( laySurfIter && processNode(*laySurfIter).isFailure()){
193 ATH_MSG_FATAL("Failed to call processNode(const Surface& sf) on sub surface. Abort.");
194 return StatusCode::FAILURE;
195 }
196 }
197 }
198 }
201
202 const Trk::Surface& lSurface = lay.surfaceRepresentation();
203 int layerColor = lay.enclosingTrackingVolume() ? lay.enclosingTrackingVolume()->colorCode() : 22;
204
205 // CYLINDER SECTION
206 if (lSurface.type() == Trk::SurfaceType::Cylinder && layerIndex > 0) {
207 // get the Bounds
208 const Trk::CylinderBounds* cylBo = dynamic_cast<const Trk::CylinderBounds*>(&lSurface.bounds());
209 if (!cylBo) {
210 m_fileLayerOutput << "ERROR Cylinder surface without CylinderBounds\n";
211 return StatusCode::FAILURE;
212 }
213 else {
214 // set the boundaries
215 double radius = cylBo->r();
216 double halfZ = cylBo->halflengthZ();
217 m_fileLayerOutput << "Cylinder" << layerIndexStr << " = new TTUBE(\"CylinderLayer";
218 m_fileLayerOutput << layerIndexStr << "\",\"CylinderLayer" << layerIndex << "\",\"void\",";
219 m_fileLayerOutput << int(radius-5) << "," << int(radius+5) << "," << int(halfZ) << ");" << '\n';
220 // get the line color
221 m_fileLayerOutput << "Cylinder" << layerIndexStr << "->SetLineColor(" << layerColor << ");" << '\n';
222 // write the node
223 m_fileLayerOutput <<"Node" << layerIndexStr << " = new TNode(\"CylinderNode" << layerIndex;
224 m_fileLayerOutput << "\",\"CylinderNode" << layerIndexStr << "\",\"CylinderLayer";
225 m_fileLayerOutput << layerIndexStr << "\"," << 0 << "," << 0 << "," << int(layerPositionZ) << ");" << '\n';
226 m_fileLayerOutput <<'\n';
227
228 return StatusCode::SUCCESS;
229 }
230 } else if (lSurface.type() == Trk::SurfaceType::Disc && layerIndex > 0) {
231 // get the Bounds
232 const Trk::DiscBounds* discBo = dynamic_cast<const Trk::DiscBounds*>(&lSurface.bounds());
233 if (!discBo) {
234 m_fileLayerOutput << "ERROR Disc surface without DiscBounds\n";
235 return StatusCode::FAILURE;
236 }
237 else {
238
239 // set the boundaries
240 double rMin = discBo->rMin();
241 double rMax = discBo->rMax();
242
243 m_fileLayerOutput << "Disc" << layerIndexStr << " = new TTUBE(\"DiscLayer" << layerIndexStr << "\",\"DiscLayer" << layerIndex << "\",\"void\",";
244 m_fileLayerOutput << int(rMin+1.) << "," << int(rMax-1.) << ",10);" << '\n';
245 // get the line color
246 m_fileLayerOutput << "Disc" << layerIndexStr << "->SetLineColor(" << layerColor << ");" << '\n';
247 // write the node
248 m_fileLayerOutput << "DiscNode" << layerIndexStr << " = new TNode(\"DiscNode" << layerIndex;
249 m_fileLayerOutput << "\",\"DiscNode" << layerIndexStr << "\",\"DiscLayer";
250 m_fileLayerOutput << layerIndexStr << "\"," << 0 << "," << 0 << "," << int(layerPositionZ) << ");" << '\n';
251 m_fileLayerOutput <<'\n';
252 return StatusCode::SUCCESS;
253 }
254 }
255 return StatusCode::SUCCESS;
256}
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 259 of file TrackingVolumeDisplayer.cxx.

260{
261
263
264 ATH_MSG_VERBOSE("Writing display information for Surface.");
265
266
267 m_fileSurfaceOutput << "// ---------------------- Surface -------------------------------// " << std::endl;
268
269 // surface center
270 double surfX = sf.center().x();
271 double surfY = sf.center().y();
272 double surfZ = sf.center().z();
273 // rotation matrix
274 const Amg::RotationMatrix3D sfRot = sf.transform().rotation();
275
276 // ROOT wants the angles in degrees
277 const double convFac = 180./M_PI;
278 double xPhi = sfRot.col(0).phi()*convFac;
279 double xTheta = sfRot.col(0).theta()*convFac;
280 double yPhi = sfRot.col(1).phi()*convFac;
281 double yTheta = sfRot.col(1).theta()*convFac;
282 double zPhi = sfRot.col(2).phi()*convFac;
283 double zTheta = sfRot.col(2).theta()*convFac;
284
285 // surface
286 TString surfaceString = "Surface_";
287 surfaceString += s_displaySurfaces;
288 TString rotationString = "Rotation_";
289 rotationString += s_displaySurfaces;
290 TString nodeString = "Node";
291 nodeString += s_displaySurfaces;
292 // test version just with planar bounds
293 const Trk::RectangleBounds* recBo = dynamic_cast<const Trk::RectangleBounds*>(&(sf.bounds()));
294 const Trk::TrapezoidBounds* traBo = recBo ? nullptr : dynamic_cast<const Trk::TrapezoidBounds*>(&(sf.bounds()));
295 const Trk::DiscTrapezoidalBounds* disctraBo = (recBo || traBo) ? nullptr : dynamic_cast<const Trk::DiscTrapezoidalBounds*>(&(sf.bounds()));
296 if (recBo) {
297 // it is a rectangle surface
298 double halfX = recBo->halflengthX();
299 double halfY = recBo->halflengthY();
300 // prepare the surface
301 m_fileSurfaceOutput << surfaceString << " = new TBRIK(\""<< surfaceString << "\",\"" << surfaceString<< "\",\"void\",";
302 m_fileSurfaceOutput << halfX << ","<< halfY <<" ,2);" << '\n';
303
304 m_fileSurfaceOutput << surfaceString << "->SetLineColor(80);" << std::endl;
305
306 // the rotation
307 m_fileSurfaceOutput << rotationString << "= new TRotMatrix(\" "<< rotationString << " \",\" " << rotationString << " \", ";
308 m_fileSurfaceOutput << xTheta << "," << xPhi << "," << yTheta << "," << yPhi << ", " << zTheta << "," << zPhi << ");" << std::endl;
309
310 } else if (traBo) {
311 //example
312 //TGTRA gtra = new TGTRA("GTRA","GTRA","void",390,0,0,20,60,40,90,15120,80180,15);
313 // prepare the surface (swap Y and Z)
314 m_fileSurfaceOutput << surfaceString << " = new TTRD1(\""<< surfaceString << "\",\"" << surfaceString<< "\",\"void\",";
315 m_fileSurfaceOutput << traBo->minHalflengthX() << "," << traBo->maxHalflengthX() << ",2," << traBo->halflengthY() << ");" << '\n';
316
317 m_fileSurfaceOutput << surfaceString << "->SetLineColor(80);" << std::endl;
318
319 // the rotation (swap Y and Z)
320 m_fileSurfaceOutput << rotationString << "= new TRotMatrix(\" "<< rotationString << " \",\" " << rotationString << " \", ";
321 m_fileSurfaceOutput << xTheta << "," << xPhi << ", " << zTheta << "," << zPhi << "," << yTheta << "," << yPhi << ");" << std::endl;
322 } else if (disctraBo) {
323 //double rMedium = disctraBo->rCenter();
324 //double Rc = (sf.center()).perp();
325 //double side = (sf.normal()).z();
326 //double stereo = side*2.*asin(Rc/(2.*rMedium));
327 //double avePhi = (side>0) ? disctraBo->averagePhi()+stereo : -disctraBo->averagePhi()+M_PI+stereo;
328
329 double stereo = disctraBo->stereo();
330 double rMedium = disctraBo->rCenter();
331 double avePhi = disctraBo->averagePhi()+stereo;
332
333 surfX = rMedium*cos(avePhi);
334 surfY = rMedium*sin(avePhi);
335 surfZ = (sf.center()).z();
336
338 rotation = Amg::AngleAxis3D(0., Amg::Vector3D::UnitX())*
339 Amg::AngleAxis3D(0., Amg::Vector3D::UnitY())*
340 Amg::AngleAxis3D(-M_PI/2.+avePhi-surfZ/fabs(surfZ)*stereo, Amg::Vector3D::UnitZ());
341
342 // ROOT wants the angles in degrees
343 xPhi = rotation.col(0).phi()*convFac;
344 xTheta = rotation.col(0).theta()*convFac;
345 yPhi = rotation.col(1).phi()*convFac;
346 yTheta = rotation.col(1).theta()*convFac;
347 zPhi = rotation.col(2).phi()*convFac;
348 zTheta = rotation.col(2).theta()*convFac;
349
350 //example
351 //TGTRA gtra = new TGTRA("GTRA","GTRA","void",390,0,0,20,60,40,90,15120,80180,15);
352 // prepare the surface (swap Y and Z)
353 m_fileSurfaceOutput << surfaceString << " = new TTRD1(\""<< surfaceString << "\",\"" << surfaceString<< "\",\"void\",";
354 m_fileSurfaceOutput << disctraBo->minHalflengthX() << "," << disctraBo->maxHalflengthX() << ",2," << disctraBo->halflengthY() << ");" << '\n';
355
356 m_fileSurfaceOutput << surfaceString << "->SetLineColor(80);" << std::endl;
357
358 // the rotation (swap Y and Z)
359 m_fileSurfaceOutput << rotationString << "= new TRotMatrix(\" "<< rotationString << " \",\" " << rotationString << " \", ";
360 m_fileSurfaceOutput << xTheta << "," << xPhi << ", " << zTheta << "," << zPhi << "," << yTheta << "," << yPhi << ");" << std::endl;
361 }
362
363 // the node
364 m_fileSurfaceOutput << nodeString << " = new TNode(\"" << nodeString << "\",\"" << nodeString << "\"," << surfaceString;
365 m_fileSurfaceOutput << "," << surfX << ", " << surfY << "," << surfZ << ", " << rotationString << ");" << std::endl;
366
367 return StatusCode::SUCCESS;
368
369}
#define M_PI
bool const RAWDATA *ch2 const
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
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 128 of file TrackingVolumeDisplayer.cxx.

129{
130
131 ATH_MSG_VERBOSE("Writing display information for TrackingVolume.");
132
133 // make a dynamic cast to the CylinderVolumeBounds
134 const Trk::CylinderVolumeBounds* cvol = dynamic_cast<const Trk::CylinderVolumeBounds*>(&tvol.volumeBounds());
135
136 double rMin = 0.;
137 double rMax = 0.;
138 double halfZ = 0.;
139
140 if (cvol) {
141 // from the color code one can determine if its a gap volume
142 // set the boundaries
143 rMin = cvol->innerRadius();
144 rMax = cvol->outerRadius();
145 halfZ = cvol->halflengthZ();
146 }
147
148 // get the name
149 const std::string& volumeName = tvol.volumeName();
150 // write a debug line
151 m_fileVolumeOutput << "// Processing TrackingVolume '" << volumeName << "'. " << '\n';
152 m_fileVolumeOutput << "CylinderVolume" << m_volumeCounter << " = new TTUBE(\"" << volumeName << "\",\"" << volumeName << "\",\"void\",";
153 m_fileVolumeOutput << int(rMin)+1 << "," << int(rMax)-1 << "," << int(halfZ)-1 << ");" << '\n';
154 m_fileVolumeOutput << "CylinderVolume" << m_volumeCounter << "->SetLineColor(" << tvol.colorCode() << ");" << '\n';
155 double zPos = tvol.center().z();
156 m_fileVolumeOutput << "CylinderNode" << m_volumeCounter << " = new TNode(\"" << volumeName << "Node\",\"" << volumeName << "Node\",\"";
157 m_fileVolumeOutput << volumeName << "\"," << 0 << "," << 0 << "," << int(zPos) << ");" << '\n';
158 m_fileVolumeOutput <<'\n';
160
161 // return successful
162 return StatusCode::SUCCESS;
163}
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.

◆ 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 >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ 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 73 of file TrackingVolumeDisplayer.h.

◆ m_fileLayerOutputMode

bool Trk::TrackingVolumeDisplayer::m_fileLayerOutputMode
mutableprivate

steer writing

Definition at line 75 of file TrackingVolumeDisplayer.h.

◆ m_fileLayerOutputName

std::string Trk::TrackingVolumeDisplayer::m_fileLayerOutputName
mutableprivate

file name for visualization action

Definition at line 74 of file TrackingVolumeDisplayer.h.

◆ m_fileSurfaceOutput

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

file output for visualization action

Definition at line 77 of file TrackingVolumeDisplayer.h.

◆ m_fileSurfaceOutputMode

bool Trk::TrackingVolumeDisplayer::m_fileSurfaceOutputMode
mutableprivate

steer writing

Definition at line 79 of file TrackingVolumeDisplayer.h.

◆ m_fileSurfaceOutputName

std::string Trk::TrackingVolumeDisplayer::m_fileSurfaceOutputName
mutableprivate

file name for visualization action

Definition at line 78 of file TrackingVolumeDisplayer.h.

◆ m_fileSurfaceOutputSplit

bool Trk::TrackingVolumeDisplayer::m_fileSurfaceOutputSplit
mutableprivate

use one file for each layer

Definition at line 80 of file TrackingVolumeDisplayer.h.

◆ m_fileVolumeOutput

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

file output for visualization action

Definition at line 69 of file TrackingVolumeDisplayer.h.

◆ m_fileVolumeOutputMode

bool Trk::TrackingVolumeDisplayer::m_fileVolumeOutputMode
mutableprivate

steer writing

Definition at line 71 of file TrackingVolumeDisplayer.h.

◆ m_fileVolumeOutputName

std::string Trk::TrackingVolumeDisplayer::m_fileVolumeOutputName
mutableprivate

file name for visualization action

Definition at line 70 of file TrackingVolumeDisplayer.h.

◆ 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
mutableprivate

volume counter

Definition at line 67 of file TrackingVolumeDisplayer.h.

◆ s_displaySurfaces

int Trk::TrackingVolumeDisplayer::s_displaySurfaces = 0
staticprivate

static surface counter

Definition at line 82 of file TrackingVolumeDisplayer.h.


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