|
ATLAS Offline Software
|
Go to the documentation of this file.
39 m_fileVolumeOutputName(
"TrackingGeometryVolumeDisplay.C"),
40 m_fileVolumeOutputMode(true),
41 m_fileLayerOutputName(
"TrackingGeometryLayerDisplay.C"),
42 m_fileLayerOutputMode(true),
43 m_fileSurfaceOutputName(
"TrackingGeometrySurfaceDisplay.C"),
44 m_fileSurfaceOutputMode(true),
45 m_fileSurfaceOutputSplit(false)
70 return StatusCode::FAILURE;
74 if (m_fileVolumeOutputMode)
75 openFile(m_fileVolumeOutput, m_fileVolumeOutputName);
77 if (m_fileLayerOutputMode)
78 openFile(m_fileLayerOutput, m_fileLayerOutputName);
80 if (m_fileSurfaceOutputMode && !m_fileSurfaceOutputSplit)
81 openFile(m_fileSurfaceOutput, m_fileSurfaceOutputName);
83 return StatusCode::SUCCESS;
92 if (m_fileVolumeOutputMode)
93 closeFile(m_fileVolumeOutput);
95 if (m_fileLayerOutputMode)
96 closeFile(m_fileLayerOutput);
98 if (m_fileSurfaceOutputMode && !m_fileSurfaceOutputSplit)
99 closeFile(m_fileSurfaceOutput);
101 return StatusCode::SUCCESS;
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';
120 out <<
"worldnode->cd();" <<
'\n';
121 out <<
"worldnode->Draw(\"ogl\");" <<
'\n';
122 out <<
"tg->Update();" <<
'\n';
149 const std::string& volumeName = tvol.
volumeName();
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';
162 return StatusCode::SUCCESS;
172 int layerIndexStr = (layerIndex < 0) ? (-layerIndex)+1 : layerIndex;
175 double layerPositionZ = layerPosition.z();
177 if (m_fileSurfaceOutputMode && m_fileSurfaceOutputSplit) {
178 std::stringstream
ss;
180 ss <<
"Layer" << layerIndexStr <<
"_" << m_fileSurfaceOutputName;
186 if (m_fileSurfaceOutputMode) {
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;
199 if (m_fileSurfaceOutputMode && m_fileSurfaceOutputSplit)
200 closeFile(m_fileSurfaceOutput);
210 m_fileLayerOutput <<
"ERROR Cylinder surface without CylinderBounds\n";
211 return StatusCode::FAILURE;
217 m_fileLayerOutput <<
"Cylinder" << layerIndexStr <<
" = new TTUBE(\"CylinderLayer";
218 m_fileLayerOutput << layerIndexStr <<
"\",\"CylinderLayer" << layerIndex <<
"\",\"void\",";
221 m_fileLayerOutput <<
"Cylinder" << layerIndexStr <<
"->SetLineColor(" << layerColor <<
");" <<
'\n';
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';
228 return StatusCode::SUCCESS;
234 m_fileLayerOutput <<
"ERROR Disc surface without DiscBounds\n";
235 return StatusCode::FAILURE;
240 double rMin = discBo->
rMin();
241 double rMax = discBo->
rMax();
243 m_fileLayerOutput <<
"Disc" << layerIndexStr <<
" = new TTUBE(\"DiscLayer" << layerIndexStr <<
"\",\"DiscLayer" << layerIndex <<
"\",\"void\",";
244 m_fileLayerOutput <<
int(rMin+1.) <<
"," <<
int(rMax-1.) <<
",10);" <<
'\n';
246 m_fileLayerOutput <<
"Disc" << layerIndexStr <<
"->SetLineColor(" << layerColor <<
");" <<
'\n';
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;
255 return StatusCode::SUCCESS;
267 m_fileSurfaceOutput <<
"// ---------------------- Surface -------------------------------// " << std::endl;
270 double surfX =
sf.center().x();
271 double surfY =
sf.center().y();
272 double surfZ =
sf.center().z();
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;
286 TString surfaceString =
"Surface_";
287 surfaceString += s_displaySurfaces;
288 TString rotationString =
"Rotation_";
289 rotationString += s_displaySurfaces;
290 TString nodeString =
"Node";
291 nodeString += s_displaySurfaces;
301 m_fileSurfaceOutput << surfaceString <<
" = new TBRIK(\""<< surfaceString <<
"\",\"" << surfaceString<<
"\",\"void\",";
302 m_fileSurfaceOutput << halfX <<
","<< halfY <<
" ,2);" <<
'\n';
304 m_fileSurfaceOutput << surfaceString <<
"->SetLineColor(80);" << std::endl;
307 m_fileSurfaceOutput << rotationString <<
"= new TRotMatrix(\" "<< rotationString <<
" \",\" " << rotationString <<
" \", ";
308 m_fileSurfaceOutput << xTheta <<
"," << xPhi <<
"," << yTheta <<
"," << yPhi <<
", " << zTheta <<
"," << zPhi <<
");" << std::endl;
314 m_fileSurfaceOutput << surfaceString <<
" = new TTRD1(\""<< surfaceString <<
"\",\"" << surfaceString<<
"\",\"void\",";
317 m_fileSurfaceOutput << surfaceString <<
"->SetLineColor(80);" << std::endl;
320 m_fileSurfaceOutput << rotationString <<
"= new TRotMatrix(\" "<< rotationString <<
" \",\" " << rotationString <<
" \", ";
321 m_fileSurfaceOutput << xTheta <<
"," << xPhi <<
", " << zTheta <<
"," << zPhi <<
"," << yTheta <<
"," << yPhi <<
");" << std::endl;
322 }
else if (disctraBo) {
329 double stereo = disctraBo->
stereo();
330 double rMedium = disctraBo->
rCenter();
331 double avePhi = disctraBo->
averagePhi()+stereo;
333 surfX = rMedium*
cos(avePhi);
334 surfY = rMedium*
sin(avePhi);
335 surfZ = (
sf.center()).
z();
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;
353 m_fileSurfaceOutput << surfaceString <<
" = new TTRD1(\""<< surfaceString <<
"\",\"" << surfaceString<<
"\",\"void\",";
356 m_fileSurfaceOutput << surfaceString <<
"->SetLineColor(80);" << std::endl;
359 m_fileSurfaceOutput << rotationString <<
"= new TRotMatrix(\" "<< rotationString <<
" \",\" " << rotationString <<
" \", ";
360 m_fileSurfaceOutput << xTheta <<
"," << xPhi <<
", " << zTheta <<
"," << zPhi <<
"," << yTheta <<
"," << yPhi <<
");" << std::endl;
364 m_fileSurfaceOutput << nodeString <<
" = new TNode(\"" << nodeString <<
"\",\"" << nodeString <<
"\"," << surfaceString;
365 m_fileSurfaceOutput <<
"," << surfX <<
", " << surfY <<
"," << surfZ <<
", " << rotationString <<
");" << std::endl;
367 return StatusCode::SUCCESS;
379 output <<
"// MaterialProperties : t/X0 = " << tInX0 << std::endl;
static int colorCodeFromMaterial(const Trk::MaterialProperties *prop, std::ofstream &output)
calculate the color code from the Material
double maxHalflengthX() const
This method returns the maximal halflength in X (first coordinate of local surface frame)
bool m_fileLayerOutputMode
steer writing
TrackingVolumeDisplayer(const std::string &, const std::string &, const IInterface *)
Constructor.
std::string m_fileVolumeOutputName
file name for visualization action
@ z
global position (cartesian)
StatusCode initialize()
AlgTool initialize method.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
double halflengthY() const
This method returns the halflength in Y (second coordinate of local surface frame)
float thicknessInX0() const
Return the radiationlength fraction.
double minHalflengthX() const
This method returns the minimal halflength in X (first coordinate of local surface frame)
#define ATH_MSG_VERBOSE(x)
bool m_fileSurfaceOutputMode
steer writing
const Amg::Vector3D & center() const
Returns the center position of the Surface.
double rMax() const
This method returns outer radius.
std::string m_fileLayerOutputName
file name for visualization action
const SurfaceArray * surfaceArray() const
Return the entire SurfaceArray, returns nullptr if no SurfaceArray.
void openFile(const std::string &fname, streamptr &strm)
double rMin() const
This method returns inner radius.
unsigned int colorCode() const
Get the color code.
virtual const Surface & surfaceRepresentation() const =0
Transforms the layer into a Surface representation for extrapolation.
double halflengthX() const
for consistant naming
::StatusCode StatusCode
StatusCode definition for legacy code.
StatusCode initialize()
AlgTool initialize method.
double averagePhi() const
This method returns the average phi.
double halflengthZ() const
This method returns the halflengthZ.
const Amg::Vector3D & center() const
returns the center of the volume
double rCenter() const
This method returns the center radius.
int value() const
layerIndex expressed in an integer
double halflengthY() const
This method returns the halflength in Y (this is Rmax -Rmin)
Ensure that the ATLAS eigen extensions are properly loaded.
const std::string & volumeName() const
Returns the VolumeName - for debug reason, might be depreciated later.
virtual const SurfaceBounds & bounds() const =0
Surface Bounds method.
static void openFile(std::ofstream &output, const std::string &filename)
File handling: open + write header.
double outerRadius() const
This method returns the outer radius.
virtual BinnedArraySpan< T *const > arrayObjects()=0
Return all objects of the Array non-const we can still modify the T.
double halflengthY() const
for consitant naming
Eigen::Matrix< double, 3, 1 > Vector3D
static void closeFile(std::ofstream &output)
File handling: write footer + close.
static int s_displaySurfaces
static surface counter
bool m_fileSurfaceOutputSplit
use one file for each layer
StatusCode finalize()
AlgTool finalize method.
double innerRadius() const
This method returns the inner radius.
Eigen::Matrix< double, 3, 3 > RotationMatrix3D
virtual ~TrackingVolumeDisplayer()
Destructor.
bool m_fileVolumeOutputMode
steer writing
const VolumeBounds & volumeBounds() const
returns the volumeBounds()
StatusCode processNode(const TrackingVolume &tvol, size_t level=0) const
Current implementation: write root visualization to file stream.
const TrackingVolume * enclosingTrackingVolume() const
get the confining TrackingVolume
Eigen::AngleAxisd AngleAxis3D
float zOverAtimesRho() const
Return the .
double minHalflengthX() const
This method returns the minimal halflength in X.
double stereo() const
This method returns the stereo angle.
double maxHalflengthX() const
This method returns the maximal halflength in X.
constexpr virtual SurfaceType type() const =0
Returns the Surface type to avoid dynamic casts.
double halflengthZ() const
This method returns the halflengthZ.
virtual double r() const override final
This method returns the radius.
const LayerIndex & layerIndex() const
get the layerIndex
std::string m_fileSurfaceOutputName
file name for visualization action