ATLAS Offline Software
Loading...
Searching...
No Matches
TileVolumeBuilder.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6// TileVolumeBuilder.cxx, (c) ATLAS Detector software
8
9// Tile
11// Tile
13// Calo
17#include "CaloDetDescr/CaloDetDescrElement.h"
18// GeoModel
19#include "GeoModelKernel/GeoFullPhysVol.h"
20#include "GeoModelKernel/GeoLogVol.h"
21#include "GeoModelKernel/GeoShape.h"
22#include "GeoModelKernel/GeoTubs.h"
23#include "GeoModelKernel/GeoTube.h"
24#include "GeoModelKernel/GeoPcon.h"
25#include "GeoModelKernel/GeoTrd.h"
26#include "GeoModelKernel/GeoMaterial.h"
27#include "GeoModelKernel/GeoVPhysVol.h"
28#include "GeoModelKernel/GeoVolumeCursor.h"
29#include "GeoModelKernel/Units.h"
30// Trk
48// Gaudi
49#include "GaudiKernel/MsgStream.h"
50#include "GaudiKernel/SystemOfUnits.h"
51// StoreGate
53
54using Gaudi::Units::mm;
55using std::make_unique;
56
57// constructor
58Tile::TileVolumeBuilder::TileVolumeBuilder(const std::string& t, const std::string& n, const IInterface* p) :
59 AthAlgTool(t,n,p),
60 m_tileMgr(nullptr),
61 m_tileMgrLocation("Tile"),
62 m_trackingVolumeCreator("Trk::CylinderVolumeCreator/TrackingVolumeCreator"),
66 m_surfBuilder("CaloSurfaceBuilder"),
67 m_forceSymmetry(true)
68
69{
70 declareInterface<Trk::ICaloTrackingVolumeBuilder>(this);
71 // declare the properties via Python
72 declareProperty("TileDetManagerLocation", m_tileMgrLocation);
73 // layers and general setup
74 declareProperty("BarrelEnvelopeCover", m_tileBarrelEnvelope);
75 declareProperty("ForceVolumeSymmetry", m_forceSymmetry);
76 // helper tools
77 declareProperty("TrackingVolumeCreator", m_trackingVolumeCreator);
78 declareProperty("UseCaloSurfBuilder", m_useCaloSurfBuilder);
79 declareProperty("BarrelLayersPerSampling", m_tileBarrelLayersPerSampling);
80 declareProperty("CaloSurfaceBuilder", m_surfBuilder);
81}
82
83// destructor
84Tile::TileVolumeBuilder::~ TileVolumeBuilder()
85= default;
86
87
88// Athena standard methods
89// initialize
91{
92 // get Tile Detector Description Manager
94
95 // Retrieve the second volume creator
97 ATH_MSG_INFO( "Retrieved tool " << m_trackingVolumeCreator );
98
99 ATH_CHECK(m_surfBuilder.retrieve());
100 ATH_MSG_INFO( "Retrieved tool " << m_surfBuilder );
101
102 ATH_MSG_INFO( " initialize() successful" );
103 return StatusCode::SUCCESS;
104}
105
106std::vector<Trk::TrackingVolume*> Tile::TileVolumeBuilder::trackingVolumes(
107 const CaloDetDescrManager& caloDDM,
108 const GeoAlignmentStore* /*geoAlign*/) const {
109 // the return vector
110 auto tileTrackingVolumes = std::vector<Trk::TrackingVolume*>();
111 // the converter helpers
112 //Trk::GeoShapeConverter geoShapeToVolumeBounds;
113 //Trk::GeoMaterialConverter geoMaterialToMaterialProperties;
114 // dummy material
115 Trk::Material tileMaterial;
116
117 // dimensions
118 double tileZ = 0.;
119 double gapZ = 0.;
120 // ITC hardcoded : simple shortcut (needs resizing anyway )
121 double plug1Z = 3405.;
122 double plug2Z = 3512.075;
123 double plug1R = 3440.;
124 double plug2R = 2959.;
125 double plug1hZ = 154.5;
126 double plug2hZ = 47.425;
127
128 // The Volumes To be Created ( by parsing geoModel ) ===========
129 Trk::TrackingVolume* tileBarrel = nullptr;
130 Trk::TrackingVolume* tileGirder = nullptr;
131
132 Trk::TrackingVolume* tilePositiveExtendedBarrel = nullptr;
133 Trk::TrackingVolume* tileNegativeExtendedBarrel = nullptr;
134
135 // The Volumes To be Created ( Gap Volumes ) ====================
136 Trk::TrackingVolume* tileBarrelPositiveFingerGap = nullptr;
137 Trk::TrackingVolume* tileBarrelNegativeFingerGap = nullptr;
138 Trk::TrackingVolume* tilePositiveFingerGap = nullptr;
139 Trk::TrackingVolume* tileNegativeFingerGap = nullptr;
140
141 // The Bounds To be Assigned (for resizing) ====================
142 std::shared_ptr<Trk::CylinderVolumeBounds> tileBarrelBounds;
143 std::unique_ptr<Trk::CylinderVolumeBounds> tileBarrelGirderBounds;
144
145 Trk::CylinderVolumeBounds tilePositiveExtendedBarrelBounds;
146 std::shared_ptr<Trk::CylinderVolumeBounds> itcPlug1Bounds;
147 std::shared_ptr<Trk::CylinderVolumeBounds> itcPlug2Bounds;
148 std::shared_ptr<Trk::CylinderVolumeBounds> gapBounds;
149
150 std::vector<std::pair<const Trk::Surface*, const Trk::Surface*>> entrySurf =
151 m_surfBuilder->entrySurfaces(&caloDDM);
152 std::vector<std::pair<const Trk::Surface*, const Trk::Surface*>> exitSurf =
153 m_surfBuilder->exitSurfaces(&caloDDM);
154
155 // averaged material properties
156 auto barrelProperties = std::make_shared<Trk::Material>(22.7, 212., 45.8, 21.4, 0.0062);
157 auto extendedBarrelProperties = std::make_shared<Trk::Material>(22.7, 210., 45.8, 21.4, 0.0062);
158 // material properties with layer encoding - to be defined later
159 Trk::BinnedMaterial barrelMaterialBinned{};
160 Trk::BinnedMaterial extendedMaterialBinned{};
161
162 Trk::Material girderProperties = Trk::Material(28.6, 272.5, 40.4, 19., 0.0049);
163 Trk::Material extendedGirderProperties = Trk::Material(27.9, 266.4, 41., 19.2, 0.005);
164 Trk::Material fingerProperties = Trk::Material(46., 426.6, 34.2, 16.2, 0.0032);
165
166 unsigned int numTreeTops = m_tileMgr->getNumTreeTops();
167 ATH_MSG_DEBUG( "Retrieved " << numTreeTops << " tree tops from the TileDetDescrManager. " );
168
169 // layer material can be adjusted here
170 std::vector<Trk::IdentifiedMaterial> matTB;
171 int baseID = Trk::GeometrySignature(Trk::Calo)*1000 + 12;
172 matTB.emplace_back(barrelProperties,0);
173 matTB.emplace_back(barrelProperties,baseID);
174 matTB.emplace_back(barrelProperties,baseID+1);
175 matTB.emplace_back(barrelProperties,baseID+2);
176
177 // material index
178 std::vector<size_t> ltb{0,1,2,3};
179
180 // layer material can be adjusted here
181 std::vector<Trk::IdentifiedMaterial> matETB;
182 baseID = Trk::GeometrySignature(Trk::Calo)*1000 + 18;
183 matETB.emplace_back(extendedBarrelProperties,0);
184 matETB.emplace_back(extendedBarrelProperties,baseID);
185 matETB.emplace_back(extendedBarrelProperties,baseID+1);
186 matETB.emplace_back(extendedBarrelProperties,baseID+2);
187
188 // layer material can be adjusted here
189 //Trk::MaterialProperties barrelFingerGapProperties = Trk::MaterialProperties(1., 130./0.35, 0.003*pow(0.35,3),30.);
190 Trk::Material barrelFingerGapProperties(353., 2254., 20.7, 10., 0.00057);
191
192 //Trk::MaterialProperties fingerGapProperties = Trk::MaterialProperties(1., 88./0.1, 0.003*pow(0.1,3),30.);
193 Trk::Material fingerGapProperties(552., 3925., 16.4, 8.1, 0.00034);
194
195 for (unsigned int itreetop = 0; itreetop<numTreeTops; ++itreetop){
196 PVConstLink currentVPhysVolLink = m_tileMgr->getTreeTop(itreetop);
197
198 // const GeoVPhysVol* top = &(*(m_tileMgr->getTreeTop(itreetop)));
199 //GeoVolumeCursor vol (top);
200 //while (!vol.atEnd()) {
201 // const GeoVPhysVol* cv = &(*(vol.getVolume()));
202 // printInfo(cv);
203 //}
204
205 const GeoLogVol* currentLogVol = currentVPhysVolLink->getLogVol();
206
207 unsigned int currentChilds = currentVPhysVolLink->getNChildVols();
208
209 ATH_MSG_DEBUG( "Processing " << currentLogVol->getName() << "... has "
210 << currentChilds << " childs." );
211 const GeoShape* currentShape = currentLogVol->getShape();
212 ATH_MSG_VERBOSE( " -> the shape is " << currentShape->type() );
213 std::vector<double> zboundaries;
214
215 ATH_MSG_DEBUG( "Start looping over childs. " );
216 // the loop over the childs
217 for (unsigned int ichild = 0; ichild < currentChilds; ++ichild){
218
219 PVConstLink currentChildLink = currentVPhysVolLink->getChildVol(ichild);
220 //printInfo(currentChildLink);
221 const GeoLogVol* childLogVol = currentChildLink->getLogVol();
222 const GeoShape* childShape = childLogVol->getShape();
223 ATH_MSG_VERBOSE( " Child: " << childLogVol->getName() << " has shape " << childShape->type() );
224
225 const GeoTubs* currentTubs = dynamic_cast<const GeoTubs*>(childShape);
226 std::shared_ptr<Trk::CylinderVolumeBounds> childCylVolBounds = currentTubs ? Trk::GeoShapeConverter::convert(currentTubs) : nullptr;
227 // get the transform
228 GeoTrf::Transform3D childTransform = currentVPhysVolLink->getXToChildVol(ichild);
229 double childZposition = childTransform.translation().z();
230
231 if (childCylVolBounds){
232 // screen output
233 ATH_MSG_VERBOSE( " ---> CylinderVolumeBounds created as: " );
234 ATH_MSG_VERBOSE( " ---> Position in z: " << childTransform.translation().z() );
235 ATH_MSG_VERBOSE( *childCylVolBounds );
236
237 // retrieve split radius from the TileBar2 exit surface
238 double depth = exitSurf[CaloCell_ID::TileBar2].first->bounds().r();
239
240 switch (itreetop){
241
242 case 0 : { // Tile Barrel case ==================================================================
243
244 // the centered one is the TileBarrel
245 if ( fabs(childZposition)< 100.*mm ){
246 //depth is where we split childCylVolBounds
247 tileBarrelBounds = std::make_shared<Trk::CylinderVolumeBounds>(childCylVolBounds->innerRadius(),depth,childCylVolBounds->halflengthZ());
248
249 // assign Bounds
250 tileBarrelGirderBounds = make_unique<Trk::CylinderVolumeBounds>(depth,childCylVolBounds->outerRadius(),childCylVolBounds->halflengthZ());
251
252 // construct bin utilities
253 std::vector<float> steps;
254 steps.push_back(childCylVolBounds->innerRadius());
255 steps.push_back(entrySurf[CaloCell_ID::TileBar0].first->bounds().r());
256 steps.push_back(entrySurf[CaloCell_ID::TileBar1].first->bounds().r());
257 steps.push_back(entrySurf[CaloCell_ID::TileBar2].first->bounds().r());
258 steps.push_back(depth);
259 auto rBU = Trk::BinUtility(steps, Trk::open, Trk::binR);
260
261 barrelMaterialBinned = Trk::BinnedMaterial(*barrelProperties,rBU,ltb,matTB);
262
263 tileBarrel = new Trk::AlignableTrackingVolume(
264 nullptr, tileBarrelBounds, barrelMaterialBinned, 12,
265 "Calo::Detectors::Tile::Barrel");
266 }
267 } break;
268
269 default : { // Tile Extended Barrel ==================================================================
270
271 std::string volumeName;
272 std::string girderName;
273 std::vector<double> girderLayerRadius;
274 std::vector<double> layerRadius;
275 std::vector<double> layerEnvelope;
276 std::shared_ptr<Trk::CylinderVolumeBounds> tileExtendedBounds = nullptr;
277 std::unique_ptr<Trk::CylinderVolumeBounds> gapVolBounds;
278
279 // prepare for the Extended Barrel
280 if (childCylVolBounds->halflengthZ() > 1000.){
281 volumeName = childZposition > 0. ?
282 "Calo::Detectors::Tile::PositiveExtendedBarrel" : "Calo::Detectors::Tile::NegativeExtendedBarrel";
283
284 //depth is where we split childCylVolBounds
285 tileExtendedBounds = std::make_shared<Trk::CylinderVolumeBounds>(childCylVolBounds->innerRadius(),depth,childCylVolBounds->halflengthZ());
286
287 } else if (childCylVolBounds->halflengthZ() > 100.){
288 // prepare for the EBarrel Finger : (ST) : merge with combined girder
289 //tileFingerBounds = new Trk::CylinderVolumeBounds(depth,childCylVolBounds->outerRadius(),childCylVolBounds->halflengthZ());
290
291 } else if ( childLogVol->getName()=="Gap" && !gapBounds ) {
292
293 gapVolBounds = make_unique<Trk::CylinderVolumeBounds>(childCylVolBounds->innerRadius(),childCylVolBounds->outerRadius(),
294 childCylVolBounds->halflengthZ());
295
296 gapZ = fabs(childZposition);
297
298 } else {
299 ATH_MSG_VERBOSE( " ---> This Volume is not gonna built !" );
300 break;
301 }
302
303 // only account for misalignment along z
304 Amg::Vector3D childPosition(0.,0.,childZposition);
305 Trk::TrackingVolume* tileExtendedTrackingVolume = nullptr;
306
307 if(m_useCaloSurfBuilder && childCylVolBounds->halflengthZ() > 1000.){
308
309 // get some output
310 ATH_MSG_VERBOSE ( "[C1] Creating TrackingVolume '" << volumeName );
311
312 // construct bin utilities
313 std::vector<float> steps;
314 steps.push_back(tileExtendedBounds->innerRadius());
315 steps.push_back(entrySurf[CaloCell_ID::TileExt0].first->bounds().r());
316 steps.push_back(entrySurf[CaloCell_ID::TileExt1].first->bounds().r());
317 steps.push_back(entrySurf[CaloCell_ID::TileExt2].first->bounds().r());
318 steps.push_back(tileExtendedBounds->outerRadius());
319 auto eBU = Trk::BinUtility(steps, Trk::open, Trk::binR);
320
321 extendedMaterialBinned = Trk::BinnedMaterial(*extendedBarrelProperties,eBU,ltb,matETB);
322
323 tileExtendedTrackingVolume = new Trk::AlignableTrackingVolume(
324 std::make_unique<Amg::Transform3D>(Amg::Translation3D(childPosition)),
325 tileExtendedBounds,
326 extendedMaterialBinned, 18, volumeName);
327
328 } else {
329 if ( gapVolBounds ) {
330 gapBounds = std::move(gapVolBounds);
331
332 } else if (tileExtendedBounds) {
333
334 // construct bin utilities
335 std::vector<float> steps;
336 steps.push_back(tileExtendedBounds->innerRadius());
337 steps.push_back(entrySurf[CaloCell_ID::TileExt0].first->bounds().r());
338 steps.push_back(entrySurf[CaloCell_ID::TileExt1].first->bounds().r());
339 steps.push_back(entrySurf[CaloCell_ID::TileExt2].first->bounds().r());
340 steps.push_back(tileExtendedBounds->outerRadius());
341 auto eBU = Trk::BinUtility(steps, Trk::open, Trk::binR);
342
343 extendedMaterialBinned = Trk::BinnedMaterial(*extendedBarrelProperties.get(),eBU,ltb,matETB);
344
345 tileExtendedTrackingVolume = new Trk::AlignableTrackingVolume(
346 std::make_unique<Amg::Transform3D>(Amg::Translation3D(childPosition)),
347 tileExtendedBounds,
348 extendedMaterialBinned,
349 18,
350 volumeName);
351 }
352 }
353 // and assign it to the right one
354 if (childCylVolBounds->halflengthZ() > 1000.){
355 if (childZposition > 0.) {
356 tilePositiveExtendedBarrel = tileExtendedTrackingVolume;
357 tilePositiveExtendedBarrelBounds = *tileExtendedBounds;
358 } else {
359 tileNegativeExtendedBarrel = tileExtendedTrackingVolume;
360 }
361 } else if (childCylVolBounds->halflengthZ() > 100.) {
362 tileZ = fabs(childZposition)+childCylVolBounds->halflengthZ();
363 }
364 } break;
365 } // end of switch
366 } // end of ? cylVolBounds
367 } //end of ichild loop
368 } // end of treetop loop
369
370 if (!gapBounds) std::abort();
371 if (!tileBarrelGirderBounds) std::abort();
372 if (!tilePositiveExtendedBarrel) std::abort();
373 if (!tileNegativeExtendedBarrel) std::abort();
374
375 ATH_MSG_DEBUG( "TileDetDescrManager parsed successfully! " );
376
377 // combined girder volume
378 {
379 auto tileGirderBounds = std::make_shared<Trk::CylinderVolumeBounds>
380 (tileBarrelGirderBounds->innerRadius(),
381 tileBarrelGirderBounds->outerRadius(),
382 tileZ);
383
384 tileGirder = new Trk::TrackingVolume(nullptr,
385 std::move(tileGirderBounds),
386 girderProperties,
387 nullptr, nullptr,
388 "Calo::Girder::TileCombined");
389 }
390
391 // build the gap volumes ( crack done by CaloTG )
392 double tileExtZ = tilePositiveExtendedBarrel->center().z()-tilePositiveExtendedBarrelBounds.halflengthZ();
393
394 // binned material for ITC :
395 std::vector<Trk::IdentifiedMaterial> matITC;
396 // layer material can be adjusted here
397 baseID = Trk::GeometrySignature(Trk::Calo)*1000;
398 matITC.emplace_back(barrelProperties,baseID+15);
399 matITC.emplace_back(barrelProperties,baseID+16);
400 matITC.emplace_back(barrelProperties,baseID+17);
401
402 // ITCPlug1
403 double p1Z = 0.5*(plug1Z-plug1hZ+tileExtZ);
404 double hp1Z = 0.5*(tileExtZ-plug1Z+plug1hZ);
405 itcPlug1Bounds = std::make_shared<Trk::CylinderVolumeBounds>(
406 plug1R,
407 tileBarrelBounds->outerRadius(),
408 hp1Z);
409
410 Amg::Vector3D itcP1Pos(0.,0.,p1Z);
411 Amg::Vector3D itcP1Neg(0.,0.,-p1Z);
412 auto itcP1PosTransform = std::make_unique<Amg::Transform3D>(Amg::Translation3D(itcP1Pos));
413 auto itcP1NegTransform = std::make_unique<Amg::Transform3D>(Amg::Translation3D(itcP1Neg));
414
415
416 std::vector<size_t> dummylay(1,1);
417 std::vector<float> bpsteps{float(plug1R), float(tileBarrelBounds->outerRadius())};
418 auto rBU = Trk::BinUtility(bpsteps, Trk::open, Trk::binR);
419 const Trk::BinUtility& rBUc(rBU);
420 const Trk::BinnedMaterial plug1MatPos(*barrelProperties,rBU,dummylay,matITC);
421 const Trk::BinnedMaterial plug1MatNeg(*barrelProperties,rBUc,dummylay,matITC);
422
424 std::move(itcP1PosTransform),
425 itcPlug1Bounds,
426 plug1MatPos,
427 16,
428 "Calo::Detectors::Tile::ITCPlug1Pos");
429
431 std::move(itcP1NegTransform),
432 std::shared_ptr<Trk::CylinderVolumeBounds>(itcPlug1Bounds->clone()),
433 plug1MatNeg, 16, "Calo::Detectors::Tile::ITCPlug1Neg");
434
435 // ITCPlug2
436 double p2Z = 0.5*(plug2Z-plug2hZ+tileExtZ);
437 double hp2Z = 0.5*(tileExtZ-plug2Z+plug2hZ);
438 itcPlug2Bounds =
439 std::make_shared<Trk::CylinderVolumeBounds>(plug2R, plug1R, hp2Z);
440
441 Amg::Vector3D itcP2Pos(0.,0.,p2Z);
442 Amg::Vector3D itcP2Neg(0.,0.,-p2Z);
443 auto itcP2PosTransform = std::make_unique<Amg::Transform3D>(Amg::Translation3D(itcP2Pos));
444 auto itcP2NegTransform = std::make_unique<Amg::Transform3D>(Amg::Translation3D(itcP2Neg));
445
446 std::vector<size_t> p2lay(1,0);
447 std::vector<float> p2steps{float(plug2R), float(plug1R)};
448 auto p2BU = Trk::BinUtility(p2steps, Trk::open, Trk::binR);
449 const Trk::BinUtility& p2BUc(p2BU);
450 const Trk::BinnedMaterial plug2MatPos(*barrelProperties,p2BU,p2lay,matITC);
451 const Trk::BinnedMaterial plug2MatNeg(*barrelProperties,p2BUc,p2lay,matITC);
452
454 std::move(itcP2PosTransform),
455 itcPlug2Bounds,
456 plug2MatPos,
457 15,
458 "Calo::Detectors::Tile::ITCPlug2Pos");
459
461 std::move(itcP2NegTransform),
462 std::shared_ptr<Trk::CylinderVolumeBounds> (itcPlug2Bounds->clone()),
463 plug2MatNeg, 15,
464 "Calo::Detectors::Tile::ITCPlug2Neg");
465
466 //std::cout <<"ITC Plug2 ok:"<< std::endl;
467
468 // Gap
469 float gapi = 0.5*(gapZ-gapBounds->halflengthZ()+tileExtZ);
470 double hgZ = 0.5*(tileExtZ-gapZ+gapBounds->halflengthZ());
471 gapBounds = std::make_shared<Trk::CylinderVolumeBounds>(
472 tileBarrelBounds->innerRadius(), plug2R, hgZ);
473
474 Amg::Vector3D gPos(0.,0.,gapi);
475 Amg::Vector3D gNeg(0.,0.,-gapi);
476 auto gapPosTransform = std::make_unique<Amg::Transform3D>(Amg::Translation3D(gPos));
477 auto gapNegTransform = std::make_unique<Amg::Transform3D>(Amg::Translation3D(gNeg));
478
479 std::vector<size_t> glay(1,2);
480 std::vector<float> gsteps{float(gapi-gapBounds->halflengthZ()), float(gapi+gapBounds->halflengthZ())};
481 auto gp = Trk::BinUtility(gsteps, Trk::open, Trk::binZ);
482 const Trk::BinnedMaterial gpMat(*barrelProperties,gp,glay,matITC);
483
486 std::move(gapPosTransform),
487 gapBounds, gpMat,
488 17, "Calo::Detectors::Tile::GapPos");
489
490 std::vector<float> nsteps{float(-gapi-gapBounds->halflengthZ()), float(-gapi+gapBounds->halflengthZ())};
491 auto gn = Trk::BinUtility(nsteps, Trk::open, Trk::binZ);
492 const Trk::BinnedMaterial gnMat(*barrelProperties,gn,glay,matITC);
493
495 std::move(gapNegTransform),
496 std::shared_ptr<Trk::CylinderVolumeBounds>(gapBounds->clone()),
497 gnMat, 15,
498 "Calo::Detectors::Tile::GapNeg");
499
500 // add buffer volumes and glue together gap sections
501 float p1i = itcPlug1Pos->center().z()-itcPlug1Bounds->halflengthZ();
502 float p2i = itcPlug2Pos->center().z()-itcPlug2Bounds->halflengthZ();
503 float gi = gapPos->center().z()-gapBounds->halflengthZ();
504 float zgBuff = 0.5*(p1i+gi);
505 float hgBuff = 0.5*(gi-p1i);
506 Amg::Vector3D gBuffPos(0.,0.,zgBuff);
507 Amg::Vector3D gBuffNeg(0.,0.,-zgBuff);
508 auto gBuffPosTransform = std::make_unique<Amg::Transform3D>(Amg::Translation3D(gBuffPos));
509 auto gBuffNegTransform = std::make_unique<Amg::Transform3D>(Amg::Translation3D(gBuffNeg));
510
511 auto gapBuffBounds = std::make_shared<Trk::CylinderVolumeBounds>(
512 gapBounds->innerRadius(),
513 gapBounds->outerRadius(),
514 hgBuff);
515
517 std::move(gBuffPosTransform), gapBuffBounds, fingerProperties,
518 nullptr, nullptr, "Calo::GapVolumes::Tile::GapBufferPos");
519
521 std::move(gBuffNegTransform),
522 std::shared_ptr<Trk::CylinderVolumeBounds>(gapBuffBounds->clone()),
523 fingerProperties, nullptr, nullptr,
524 "Calo::GapVolumes::Tile::GapBufferNeg");
525
526 Trk::TrackingVolume* positiveGapSector = nullptr;
527 if (gBufferPos) {
528 std::vector<Trk::TrackingVolume*> volsPosGap;
529 volsPosGap.push_back(gBufferPos);
530 volsPosGap.push_back(gapPos);
531 positiveGapSector = m_trackingVolumeCreator->createContainerTrackingVolume
532 (volsPosGap,
533 tileMaterial,
534 "Calo::Container::PositiveGap");
535 }
536 Trk::TrackingVolume* negativeGapSector = nullptr;
537 if (gBufferNeg) {
538 std::vector<Trk::TrackingVolume*> volsNegGap;
539 volsNegGap.push_back(gapNeg);
540 volsNegGap.push_back(gBufferNeg);
541 negativeGapSector = m_trackingVolumeCreator->createContainerTrackingVolume
542 (volsNegGap,
543 tileMaterial,
544 "Calo::Container::NegativeGap");
545 }
546
547 // plug2 sector
548 float z2Buff = 0.5*(p1i+p2i);
549 float h2Buff = 0.5*(p2i-p1i);
550 Amg::Vector3D p2BuffPos(0.,0.,z2Buff);
551 Amg::Vector3D p2BuffNeg(0.,0.,-z2Buff);
552 auto p2BuffPosTransform = std::make_unique<Amg::Transform3D>(Amg::Translation3D(p2BuffPos));
553 auto p2BuffNegTransform = std::make_unique<Amg::Transform3D>(Amg::Translation3D(p2BuffNeg));
554
555 auto p2BuffBounds = std::make_shared<Trk::CylinderVolumeBounds>(
556 itcPlug2Bounds->innerRadius(), itcPlug2Bounds->outerRadius(), h2Buff);
557
558 Trk::TrackingVolume* p2BufferPos = new Trk::TrackingVolume(
559 std::move(p2BuffPosTransform), p2BuffBounds, fingerProperties, nullptr,
560 nullptr, "Calo::GapVolumes::Tile::Plug2BufferPos");
561
562 Trk::TrackingVolume* p2BufferNeg = new Trk::TrackingVolume(
563 std::move(p2BuffNegTransform),
564 std::shared_ptr<Trk::CylinderVolumeBounds>(p2BuffBounds->clone()),
565 fingerProperties, nullptr,
566 nullptr, "Calo::GapVolumes::Tile::Plug2BufferNeg");
567
568 Trk::TrackingVolume* positiveP2Sector = nullptr;
569 if (p2BufferPos) {
570 std::vector<Trk::TrackingVolume*> volsPosP2;
571 volsPosP2.push_back(p2BufferPos);
572 volsPosP2.push_back(itcPlug2Pos);
573 positiveP2Sector = m_trackingVolumeCreator->createContainerTrackingVolume
574 (volsPosP2,
575 tileMaterial,
576 "Calo::Container::PositiveP2");
577 }
578 Trk::TrackingVolume* negativeP2Sector = nullptr;
579 if (itcPlug2Neg) {
580 std::vector<Trk::TrackingVolume*> volsNegP2;
581 volsNegP2.push_back(itcPlug2Neg);
582 volsNegP2.push_back(p2BufferNeg);
583 negativeP2Sector = m_trackingVolumeCreator->createContainerTrackingVolume
584 (volsNegP2,
585 tileMaterial,
586 "Calo::Container::NegativeP2");
587 }
588
589 // glue ITC sector radially
590 Trk::TrackingVolume* positiveITCSector = nullptr;
591 if (positiveGapSector && positiveP2Sector) {
592 std::vector<Trk::TrackingVolume*> volsITCPos;
593 volsITCPos.push_back(positiveGapSector);
594 volsITCPos.push_back(positiveP2Sector);
595 volsITCPos.push_back(itcPlug1Pos);
596 positiveITCSector = m_trackingVolumeCreator->createContainerTrackingVolume
597 (volsITCPos,
598 tileMaterial,
599 "Calo::Container::ITCPos");
600 }
601 Trk::TrackingVolume* negativeITCSector = nullptr;
602 if (negativeGapSector && negativeP2Sector) {
603 std::vector<Trk::TrackingVolume*> volsITCNeg;
604 volsITCNeg.push_back(negativeGapSector);
605 volsITCNeg.push_back(negativeP2Sector);
606 volsITCNeg.push_back(itcPlug1Neg);
607 negativeITCSector = m_trackingVolumeCreator->createContainerTrackingVolume
608 (volsITCNeg,
609 tileMaterial,
610 "Calo::Container::ITCNeg");
611 }
612
613 ATH_MSG_DEBUG( "Gap volumes (ITC sector) built " );
614
615 // ------------------------------ BARREL SECTION COMPLETION --------------------------------------------------
616
617 // the Finger Gap Volumes to be constructed
618 double rMin = tileBarrelBounds->innerRadius();
619 double rMax = tileBarrelBounds->outerRadius();
620
621 double zFG = 0.5*(tileBarrelBounds->halflengthZ()+p1i);
622 double hZ = 0.5*(p1i-tileBarrelBounds->halflengthZ());
623 auto tileBarrelFingerGapBounds = std::make_shared<Trk::CylinderVolumeBounds>(rMin,rMax,hZ);
624
625 Amg::Vector3D pBFPos(0.,0.,zFG);
626 Amg::Vector3D pBFNeg(0.,0.,-zFG);
627 auto bfPosTransform = std::make_unique<Amg::Transform3D>(Amg::Translation3D(pBFPos));
628 auto bfNegTransform = std::make_unique<Amg::Transform3D>(Amg::Translation3D(pBFNeg));
629
630 tileBarrelPositiveFingerGap = new Trk::TrackingVolume(
631 std::move(bfPosTransform), tileBarrelFingerGapBounds, barrelFingerGapProperties,
632 nullptr, nullptr,
633 "Calo::GapVolumes::Tile::BarrelPositiveFingerGap");
634
635 tileBarrelNegativeFingerGap = new Trk::TrackingVolume(
636 std::move(bfNegTransform),
637 std::shared_ptr<Trk::CylinderVolumeBounds>(
638 tileBarrelFingerGapBounds->clone()),
639 barrelFingerGapProperties, nullptr, nullptr,
640 "Calo::GapVolumes::Tile::BarrelNegativeFingerGap");
641
642 // ------------------------------ ENDCAP SECTION COMPLETION --------------------------------------------------
643
644 double zBE = tilePositiveExtendedBarrel->center().z()+tilePositiveExtendedBarrelBounds.halflengthZ();
645 zFG = 0.5*(tileZ + zBE);
646 hZ = 0.5*(tileZ - zBE);
647
648 auto tilePositiveFingerGapBounds = std::make_shared<Trk::CylinderVolumeBounds>(
649 tilePositiveExtendedBarrelBounds.innerRadius(),
650 tilePositiveExtendedBarrelBounds.outerRadius(),
651 hZ);
652
653 Amg::Vector3D pEFPos(0.,0.,zFG);
654 Amg::Vector3D pEFNeg(0.,0.,-zFG);
655 auto efPosTransform = std::make_unique<Amg::Transform3D>(Amg::Translation3D(pEFPos));
656 auto efNegTransform = std::make_unique<Amg::Transform3D>(Amg::Translation3D(pEFNeg));
657
658 tilePositiveFingerGap = new Trk::TrackingVolume(
659 std::move(efPosTransform), tilePositiveFingerGapBounds, fingerGapProperties,
660 nullptr, nullptr, "Calo::GapVolumes::Tile::PositiveFingerGap");
661
662 tileNegativeFingerGap = new Trk::TrackingVolume(
663 std::move(efNegTransform),
664 std::shared_ptr<Trk::CylinderVolumeBounds>(tilePositiveFingerGapBounds->clone()),
665 fingerGapProperties, nullptr, nullptr, "Calo::GapVolumes::Tile::NegativeFingerGap");
666
667 // set the color code for displaying
668 tileBarrel->registerColorCode( 4 );
669 tilePositiveExtendedBarrel->registerColorCode( 4 );
670 tileNegativeExtendedBarrel->registerColorCode( 4 );
671
672 gapPos->registerColorCode( 4 );
673 gapNeg->registerColorCode( 4 );
674 itcPlug1Pos->registerColorCode( 4 );
675 itcPlug1Neg->registerColorCode( 4 );
676 itcPlug2Pos->registerColorCode( 4 );
677 itcPlug2Neg->registerColorCode( 4 );
678
679 tileGirder->registerColorCode( 12 );
680
681 // finalize Tile : glue locally and return 1 volume
682 ATH_MSG_DEBUG( "Gluing Tile volumes" );
683
684 // glue tile volumes in z
685 std::vector<Trk::TrackingVolume*> tileVols;
686 tileVols.push_back(tileNegativeFingerGap);
687 tileVols.push_back(tileNegativeExtendedBarrel);
688 tileVols.push_back(negativeITCSector);
689 tileVols.push_back(tileBarrelNegativeFingerGap);
690 tileVols.push_back(tileBarrel);
691 tileVols.push_back(tileBarrelPositiveFingerGap);
692 tileVols.push_back(positiveITCSector);
693 tileVols.push_back(tilePositiveExtendedBarrel);
694 tileVols.push_back(tilePositiveFingerGap);
695 Trk::TrackingVolume* tileCombinedSector = m_trackingVolumeCreator->createContainerTrackingVolume
696 (tileVols,
697 tileMaterial,
698 "Calo::Container::Tile::InnerSector");
699
700 // glue with combined girder
701 std::vector<Trk::TrackingVolume*> tileVolumes;
702 tileVolumes.push_back(tileCombinedSector);
703 tileVolumes.push_back(tileGirder);
704 Trk::TrackingVolume* tile = m_trackingVolumeCreator->createContainerTrackingVolume
705 (tileVolumes,
706 tileMaterial,
707 "Calo::Container::Tile::Combined");
708
709 ATH_MSG_DEBUG( "Combined Tile built " );
710
711 tileTrackingVolumes.push_back(tile); // [0]
712 tileTrackingVolumes.push_back(tilePositiveExtendedBarrel);// [1]
713
714 if (msgLvl(MSG::INFO)) {
715 ATH_MSG_DEBUG( "Checking the existence of all Tracking Volumes:" );
716 ATH_MSG_DEBUG( " -> Tile::Barrel ");
717 printCheckResult(msg(MSG::DEBUG), tileBarrel);
718 ATH_MSG_DEBUG( " -> Tile::PositiveExtendedBarrel ");
719 printCheckResult(msg(MSG::DEBUG), tilePositiveExtendedBarrel);
720 ATH_MSG_DEBUG( " -> Tile::NegativeExtendedBarrel ");
721 printCheckResult(msg(MSG::DEBUG), tileNegativeExtendedBarrel);
722 ATH_MSG_DEBUG( " -> Tile::BarrelPositiveFingerGap ");
723 printCheckResult(msg(MSG::DEBUG), tileBarrelPositiveFingerGap);
724 ATH_MSG_DEBUG( " -> Tile::BarrelNegativeFingerGap ");
725 printCheckResult(msg(MSG::DEBUG), tileBarrelNegativeFingerGap);
726 ATH_MSG_DEBUG( " -> Tile::PositiveFingerGap ");
727 printCheckResult(msg(MSG::DEBUG), tilePositiveFingerGap);
728 ATH_MSG_DEBUG( " -> Tile::NegativeFingerGap ");
729 printCheckResult(msg(MSG::DEBUG), tileNegativeFingerGap);
730 ATH_MSG_DEBUG( " -> Tile::Girder ");
731 printCheckResult(msg(MSG::DEBUG), tileGirder);
732 } // end of detailed output
733
734 return tileTrackingVolumes;
735}
736
738{
739 if (vol) log << "... ok" << endmsg;
740 else log << "... missing" << endmsg;
741}
742
743void Tile::TileVolumeBuilder::printInfo(const PVConstLink& pv) const {
744 const GeoLogVol* lv = pv->getLogVol();
745 std::cout << "New Tile Object:" << lv->getName() << ", made of"
746 << lv->getMaterial()->getName() << "," << lv->getShape()->type()
747 << std::endl;
748 // m_geoShapeConverter->decodeShape(lv->getShape());
749 int igen = 0;
750 Amg::Transform3D transf = pv->getX();
751 printChildren(pv, igen, transf);
752}
753
755 const PVConstLink& pv, int igen, const Amg::Transform3D& trIn) const {
756 // subcomponents
757 unsigned int nc = pv->getNChildVols();
758 igen++;
759 std::string cname;
760 for (unsigned int ic = 0; ic < nc; ic++) {
761 Amg::Transform3D transf = trIn * pv->getXToChildVol(ic);
762
763 const PVConstLink cv = pv->getChildVol(ic);
764 const GeoLogVol* clv = cv->getLogVol();
765 std::cout << " ";
766 std::cout << "subcomponent:" << igen << ":" << ic << ":" << clv->getName()
767 << ", made of" << clv->getMaterial()->getName() << ","
768 << clv->getShape()->type() << std::endl;
769 std::cout << "position:" << "R:" << transf.translation().perp()
770 << ",phi:" << transf.translation().phi()
771 << ",x:" << transf.translation().x()
772 << ",y:" << transf.translation().y()
773 << ",z:" << transf.translation().z() << std::endl;
774 const GeoTrd* trd = dynamic_cast<const GeoTrd*>(clv->getShape());
775 if (trd)
776 std::cout << "trddim:" << trd->getXHalfLength1() << ","
777 << trd->getXHalfLength2() << "," << trd->getYHalfLength1()
778 << "," << trd->getYHalfLength2() << "," << trd->getZHalfLength()
779 << std::endl;
780 const GeoTubs* tub = dynamic_cast<const GeoTubs*>(clv->getShape());
781 if (tub)
782 std::cout << "tubdim:" << tub->getRMin() << "," << tub->getRMax() << ","
783 << tub->getZHalfLength() << std::endl;
784 const GeoPcon* con = dynamic_cast<const GeoPcon*>(clv->getShape());
785 if (con) {
786 const unsigned int nPlanes = con->getNPlanes();
787 for (unsigned int i = 0; i < nPlanes; i++) {
788 std::cout << "polycone:" << i << ":" << con->getRMinPlane(i) << ","
789 << con->getRMaxPlane(i) << "," << con->getZPlane(i)
790 << std::endl;
791 }
792 }
793
794 if (ic == 0 || cname != clv->getName()) {
795 // m_geoShapeConverter->decodeShape(clv->getShape());
796 printChildren(cv, igen, transf);
797 cname = clv->getName();
798 }
799 }
800}
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
Declaration of CaloDepthTool.
Definition of CaloDetDescrManager.
Definition of CaloDetDescriptor.
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const ServiceHandle< StoreGateSvc > & detStore() const
bool msgLvl(const MSG::Level lvl) const
This class provides the client interface for accessing the detector description information common to...
Ensure that the extensions for the Vector3D are properly loaded.
ToolHandle< Trk::ITrackingVolumeCreator > m_trackingVolumeCreator
Second helper for volume creation.
void printChildren(const GeoPVConstLink &pv, int igen, const Amg::Transform3D &trIn) const
bool m_useCaloSurfBuilder
if true use DetDescr based layering, if false use biequidistant layering
const TileDetDescrManager * m_tileMgr
Calo DetDescrMgr.
bool m_forceSymmetry
forces volume symmetry between negative/positive part
static void printCheckResult(MsgStream &log, const Trk::TrackingVolume *vol)
ToolHandle< ICaloSurfaceBuilder > m_surfBuilder
tool required for definition of active volumes
virtual std::vector< Trk::TrackingVolume * > trackingVolumes(const CaloDetDescrManager &caloDDM, const GeoAlignmentStore *geoAlign) const override final
TrackingVolumeBuilder interface method - returns vector of ptrs to volumes.
void printInfo(const GeoPVConstLink &pv) const
double m_tileBarrelEnvelope
envelope Cover of the Barrel
virtual StatusCode initialize() override final
AlgTool initialize method.
TileVolumeBuilder(const std::string &, const std::string &, const IInterface *)
AlgTool style constructor.
unsigned int m_tileBarrelLayersPerSampling
if m_useCaloSurfBuilder == true, number of layers per dead material region or sampling
std::string m_tileMgrLocation
Location of the CaloDetDescrMgr.
Base Class for a navigation object (active) in the Calo realm.
A generic symmetric BinUtility, for fully symmetric binning in terms of binning grid and binning type...
Definition BinUtility.h:39
for description of non-homogenous dense volumes
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.
static std::shared_ptr< CylinderVolumeBounds > convert(const GeoTubs *gtub)
Convert a tubs.
A common object to be contained by.
Definition Material.h:117
Full Volume description used in Tracking, it inherits from Volume to get the geometrical structure,...
void registerColorCode(unsigned int icolor)
Register the color code.
const Amg::Vector3D & center() const
returns the center of the volume
Definition Volume.h:90
std::string depth
tag string for intendation
Definition fastadd.cxx:46
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
Eigen::Translation< double, 3 > Translation3D
@ open
Definition BinningType.h:40
@ binR
Definition BinningType.h:50
@ binZ
Definition BinningType.h:49
MsgStream & msg
Definition testRead.cxx:32