42 if (Trk::RecursiveGeometryProcessor::initialize().isFailure()){
44 return StatusCode::FAILURE;
57 return StatusCode::SUCCESS;
75 return StatusCode::SUCCESS;
82 out.open(filename.c_str());
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';
94 out <<
"worldnode->cd();" <<
'\n';
95 out <<
"worldnode->Draw(\"ogl\");" <<
'\n';
96 out <<
"tg->Update();" <<
'\n';
123 const std::string& volumeName = tvol.
volumeName();
125 m_fileVolumeOutput <<
"// Processing TrackingVolume '" << volumeName <<
"'. " <<
'\n';
127 m_fileVolumeOutput << int(rMin)+1 <<
"," << int(rMax)-1 <<
"," << int(halfZ)-1 <<
");" <<
'\n';
129 double zPos = tvol.
center().z();
131 m_fileVolumeOutput << volumeName <<
"\"," << 0 <<
"," << 0 <<
"," << int(zPos) <<
");" <<
'\n';
136 return StatusCode::SUCCESS;
146 int layerIndexStr = (layerIndex < 0) ? (-layerIndex)+1 : layerIndex;
149 double layerPositionZ = layerPosition.z();
152 std::stringstream
ss;
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;
185 return StatusCode::FAILURE;
189 double radius = cylBo->
r();
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';
195 m_fileLayerOutput <<
"Cylinder" << layerIndexStr <<
"->SetLineColor(" << layerColor <<
");" <<
'\n';
197 m_fileLayerOutput <<
"Node" << layerIndexStr <<
" = new TNode(\"CylinderNode" << layerIndex;
198 m_fileLayerOutput <<
"\",\"CylinderNode" << layerIndexStr <<
"\",\"CylinderLayer";
199 m_fileLayerOutput << layerIndexStr <<
"\"," << 0 <<
"," << 0 <<
"," << int(layerPositionZ) <<
");" <<
'\n';
202 return StatusCode::SUCCESS;
209 return StatusCode::FAILURE;
214 double rMin = discBo->
rMin();
215 double rMax = discBo->
rMax();
217 m_fileLayerOutput <<
"Disc" << layerIndexStr <<
" = new TTUBE(\"DiscLayer" << layerIndexStr <<
"\",\"DiscLayer" << layerIndex <<
"\",\"void\",";
220 m_fileLayerOutput <<
"Disc" << layerIndexStr <<
"->SetLineColor(" << layerColor <<
");" <<
'\n';
222 m_fileLayerOutput <<
"DiscNode" << layerIndexStr <<
" = new TNode(\"DiscNode" << layerIndex;
224 m_fileLayerOutput << layerIndexStr <<
"\"," << 0 <<
"," << 0 <<
"," << int(layerPositionZ) <<
");" <<
'\n';
226 return StatusCode::SUCCESS;
229 return StatusCode::SUCCESS;
241 m_fileSurfaceOutput <<
"// ---------------------- Surface -------------------------------// " << std::endl;
244 double surfX = sf.center().x();
245 double surfY = sf.center().y();
246 double surfZ = sf.center().z();
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;
260 TString surfaceString =
"Surface_";
262 TString rotationString =
"Rotation_";
264 TString nodeString =
"Node";
275 m_fileSurfaceOutput << surfaceString <<
" = new TBRIK(\""<< surfaceString <<
"\",\"" << surfaceString<<
"\",\"void\",";
281 m_fileSurfaceOutput << rotationString <<
"= new TRotMatrix(\" "<< rotationString <<
" \",\" " << rotationString <<
" \", ";
282 m_fileSurfaceOutput << xTheta <<
"," << xPhi <<
"," << yTheta <<
"," << yPhi <<
", " << zTheta <<
"," << zPhi <<
");" << std::endl;
288 m_fileSurfaceOutput << surfaceString <<
" = new TTRD1(\""<< surfaceString <<
"\",\"" << surfaceString<<
"\",\"void\",";
294 m_fileSurfaceOutput << rotationString <<
"= new TRotMatrix(\" "<< rotationString <<
" \",\" " << rotationString <<
" \", ";
295 m_fileSurfaceOutput << xTheta <<
"," << xPhi <<
", " << zTheta <<
"," << zPhi <<
"," << yTheta <<
"," << yPhi <<
");" << std::endl;
296 }
else if (disctraBo) {
303 double stereo = disctraBo->
stereo();
304 double rMedium = disctraBo->
rCenter();
305 double avePhi = disctraBo->
averagePhi()+stereo;
307 surfX = rMedium*cos(avePhi);
308 surfY = rMedium*sin(avePhi);
309 surfZ = (sf.center()).z();
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;
327 m_fileSurfaceOutput << surfaceString <<
" = new TTRD1(\""<< surfaceString <<
"\",\"" << surfaceString<<
"\",\"void\",";
333 m_fileSurfaceOutput << rotationString <<
"= new TRotMatrix(\" "<< rotationString <<
" \",\" " << rotationString <<
" \", ";
334 m_fileSurfaceOutput << xTheta <<
"," << xPhi <<
", " << zTheta <<
"," << zPhi <<
"," << yTheta <<
"," << yPhi <<
");" << std::endl;
338 m_fileSurfaceOutput << nodeString <<
" = new TNode(\"" << nodeString <<
"\",\"" << nodeString <<
"\"," << surfaceString;
339 m_fileSurfaceOutput <<
"," << surfX <<
", " << surfY <<
"," << surfZ <<
", " << rotationString <<
");" << std::endl;
341 return StatusCode::SUCCESS;
351 double tInX0 = prop->thicknessInX0();
353 output <<
"// MaterialProperties : t/X0 = " << tInX0 << std::endl;
354 output <<
"// zOverAtimesRho : Z/A*rho = " << prop->zOverAtimesRho() << std::endl;
357 color -= int(tInX0 * 1200);
#define ATH_MSG_VERBOSE(x)
virtual std::span< T *const > arrayObjects()=0
Return all objects of the Array non-const we can still modify the T.
Bounds for a cylindrical Surface.
virtual double r() const override final
This method returns the radius.
double halflengthZ() const
This method returns the halflengthZ.
Bounds for a cylindrical Volume, the decomposeToSurfaces method creates a vector of up to 6 surfaces:
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.
Class to describe the bounds for a planar DiscSurface.
double rMax() const
This method returns outer radius.
double rMin() const
This method returns inner radius.
Class to describe the bounds for a planar DiscSurface.
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.
int value() const
layerIndex expressed in an integer
Base Class for a Detector Layer in the Tracking realm.
virtual const Surface & surfaceRepresentation() const =0
Transforms the layer into a Surface representation for extrapolation.
const SurfaceArray * surfaceArray() const
Return the entire SurfaceArray, returns nullptr if no SurfaceArray.
const LayerIndex & layerIndex() const
get the layerIndex
const TrackingVolume * enclosingTrackingVolume() const
get the confining TrackingVolume
Material with information about thickness of material.
Bounds for a rectangular, planar surface.
double halflengthX() const
for consistant naming
double halflengthY() const
for consitant naming
Abstract Base Class for tracking surfaces.
virtual constexpr SurfaceType type() const =0
Returns the Surface type to avoid dynamic casts.
virtual const SurfaceBounds & bounds() const =0
Surface Bounds method.
const Amg::Vector3D & center() const
Returns the center position of the Surface.
StatusCode processNode(const TrackingVolume &tvol, size_t level=0) const
Current implementation: write root visualization to file stream.
std::ofstream m_fileVolumeOutput
file output for visualization action
static int s_displaySurfaces
static surface counter
static void openFile(std::ofstream &output, const std::string &filename)
File handling: open + write header.
std::ofstream m_fileSurfaceOutput
file output for visualization action
Gaudi::Property< bool > m_fileVolumeOutputMode
StatusCode finalize()
AlgTool finalize method.
std::ofstream m_fileLayerOutput
file output for visualization action
Gaudi::Property< std::string > m_fileVolumeOutputName
Gaudi::Property< bool > m_fileSurfaceOutputMode
static int colorCodeFromMaterial(const Trk::MaterialProperties *prop, std::ofstream &output)
calculate the color code from the Material
Gaudi::Property< bool > m_fileLayerOutputMode
Gaudi::Property< bool > m_fileSurfaceOutputSplit
Gaudi::Property< std::string > m_fileLayerOutputName
int m_volumeCounter
volume counter
Gaudi::Property< std::string > m_fileSurfaceOutputName
static void closeFile(std::ofstream &output)
File handling: write footer + close.
StatusCode initialize()
AlgTool initialize method.
Full Volume description used in Tracking, it inherits from Volume to get the geometrical structure,...
const std::string & volumeName() const
Returns the VolumeName - for debug reason, might be depreciated later.
unsigned int colorCode() const
Get the color code.
Bounds for a trapezoidal, planar Surface.
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).
const Amg::Vector3D & center() const
returns the center of the volume
const VolumeBounds & volumeBounds() const
returns the volumeBounds()
Eigen::AngleAxisd AngleAxis3D
Eigen::Matrix< double, 3, 3 > RotationMatrix3D
Eigen::Matrix< double, 3, 1 > Vector3D
BinnedArray< Surface > SurfaceArray