32 declareInterface<ILayerArrayCreator>(
this);
45 ATH_MSG_VERBOSE(
" build LayerArray with " << cylLayersInput.size() <<
" cylindrical material layers." );
49 std::vector<Trk::CylinderLayer*> cylLayers(cylLayersInput);
52 std::sort(cylLayers.begin(), cylLayers.end(), rSorter);
58 std::vector< std::pair<Trk::SharedObject<Trk::Layer>,
Amg::Vector3D> > layerOrderVector;
66 unsigned int layers = cylLayers.size();
68 for (
auto& layIter : cylLayers ) {
71 double currentR = layerSurface.
bounds().
r();
72 ATH_MSG_VERBOSE(
"equidistant : registering cylindrical MaterialLayer at radius : " << currentR );
78 ATH_MSG_VERBOSE(
"equidistant : created a BinUtility as " << *binUtility );
89 unsigned int layers = cylLayers.size();
91 double layerThickness = cylLayers[0]->thickness();
93 double radialStep = (rmax-rmin)/(
layers-1);
96 double navigationR = 0.;
97 double navLayerHalflengthZ = 0.;
101 for (
auto& layIter : cylLayers ) {
104 layerTransform = layerSurface.
transform().isApprox(Amg::Transform3D::Identity()) ?
nullptr : &layerSurface.
transform();
106 double currentR = layerSurface.
bounds().
r();
107 navigationR = currentR - 0.5*radialStep;
110 ATH_MSG_VERBOSE(
"bi-equidistant : creating cylindrical NavigationLayer at radius : " << navigationR );
119 ATH_MSG_VERBOSE(
"bi-equidistant : registering cylindrical MaterialLayer at radius : " << currentR );
126 ATH_MSG_VERBOSE(
"bi-equidistant : creating cylindrical NavigationLayer at radius : " << navigationR+radialStep);
136 ATH_MSG_VERBOSE( layerOrderVector.size() <<
" cylindrical Layers (material + navigation) built. " );
139 double rMinBoundary = rmin-radialStep+0.5*layerThickness;
140 double rMaxBoundary = rmax+radialStep+0.5*layerThickness;
142 ATH_MSG_VERBOSE(
"bi-equidistant : created a BinUtility as " << *binUtility );
152 std::vector<float> boundaries;
154 double halfLengthZ = 0;
158 boundaries.push_back(rmin);
161 for (
auto& layIter : cylLayers) {
164 layerTransform = layerSurface.
transform().isApprox(Amg::Transform3D::Identity()) ? nullptr : &layerSurface.
transform();
168 double layerRadius = layerSurface.
bounds().
r();
169 double layerThickness = layIter->thickness();
171 double navLayerRadius = 0.5*( (layerRadius-0.5*layerThickness) + boundaries[boundaries.size()-1] );
176 cylinderLayer = checkAndReplaceEmptyLayer(layIter);
178 ATH_MSG_VERBOSE(
"arbitrary : creating cylindrical NavigationLayer at radius : " << navLayerRadius );
179 layerOrderVector.emplace_back(
182 ATH_MSG_VERBOSE(
"arbitrary : registering cylindrical MaterialLayer at radius :" << layerRadius );
183 layerOrderVector.emplace_back(
186 boundaries.push_back(layerRadius-0.5*layerThickness);
187 boundaries.push_back(layerRadius+0.5*layerThickness);
189 ATH_MSG_VERBOSE(
"arbitrary : empty layer configuration cancelled this building of navigation layer.");
190 delete navLayerSurface;
194 double navLayerRadiusFinal = 0.5*(rmax+boundaries[boundaries.size()-1]);
198 boundaries.push_back(rmax);
199 ATH_MSG_VERBOSE(
"arbitrary : creating cylindrical NavigationLayer at radius : " << navLayerRadiusFinal );
200 layerOrderVector.emplace_back(
204 ATH_MSG_VERBOSE( layerOrderVector.size() <<
" cylindrical Layers (material + navigation) built. " );
207 ATH_MSG_VERBOSE(
"arbitrary : created a BinUtility as " << *binUtility );
218 return cylinderLayerArray;
228 ATH_MSG_VERBOSE(
" build LayerArray with " << discLayersInput.size() <<
" disc-like material layers." );
234 std::vector<std::pair<Trk::SharedObject<Trk::Layer>,
Amg::Vector3D>> layerOrderVector;
237 std::vector<Trk::DiscLayer*> discLayers(discLayersInput);
240 std::sort(discLayers.begin(), discLayers.end(), zSorter);
250 size_t layers = discLayers.size();
253 discLayer = checkAndReplaceEmptyLayer(layIter);
256 ATH_MSG_VERBOSE(
"equidistant : registering disc-like MaterialLayer at z-Position : " << layerSurface.
center().z() );
262 ATH_MSG_VERBOSE(
"equidistant : created a BinUtility as " << *binUtility );
273 unsigned int layers = discLayers.size();
275 double layerThickness = discLayers[0]->thickness();
284 double navigationZ = 0.;
286 for (
auto& layIter : discLayers) {
289 double currentZ = layerSurface.
center().z();
291 navigationZ = currentZ - 0.5*(zStep);
295 ATH_MSG_VERBOSE(
"bi-equidistant : creating disc-like NavigationLayer at z-Position : " << navigationZ );
296 layerOrderVector.emplace_back(
298 navLayerSurface->
center());
302 minR = dbounds->
rMin();
303 maxR = dbounds->
rMax();
309 ATH_MSG_VERBOSE(
"bi-equidistant : registering disc-like MaterialLayer at z-Position : " << currentZ );
314 ATH_MSG_VERBOSE(
"bi-equidistant : creating disc-like NavigationLayer at z-Position : " << navigationZ + zStep );
317 layerOrderVector.emplace_back(
319 navLayerSurface->
center());
321 ATH_MSG_VERBOSE( layerOrderVector.size() <<
" disc Layers (material + navigation) built. " );
324 double zminBoundary =
zmin-zStep+0.5*layerThickness;
325 double zmaxBoundary =
zmax+zStep+0.5*layerThickness;
327 ATH_MSG_VERBOSE(
"bi-equidistant : created a BinUtility as " << *binUtility );
337 std::vector<float> boundaries;
344 boundaries.push_back(
zmin);
347 for (
auto& layIter : discLayers ) {
353 double layInnerR = dbounds->
rMin();
354 double layOuterR = dbounds->
rMax();
355 minR = (layInnerR < minR) ? layInnerR : minR;
356 maxR = (layOuterR > maxR) ? layOuterR : maxR;
362 double layerPositionZ = layerSurface.
center().z();
363 double layerThickness = layIter->thickness();
365 double navLayerPositionZ = 0.5*((layerPositionZ-0.5*layerThickness)+boundaries[boundaries.size()-1]);
372 discLayer = checkAndReplaceEmptyLayer(layIter);
374 ATH_MSG_VERBOSE(
"arbitrary : creating disc-like NavigationLayer at z-Position : " << navLayerPositionZ );
375 layerOrderVector.emplace_back(
378 ATH_MSG_VERBOSE(
"arbitrary : registering disc-like MaterialLayer at z-Position : " << layerPositionZ );
379 layerOrderVector.emplace_back(
382 boundaries.push_back(layerPositionZ-0.5*layerThickness);
383 boundaries.push_back(layerPositionZ+0.5*layerThickness);
385 ATH_MSG_VERBOSE(
"arbitrary : empty layer configuration cancelled this building of navigation layer.");
386 delete navLayerSurface;
390 double navLayerPositionZFinal = 0.5*(
zmax+boundaries[boundaries.size()-1]);
395 ATH_MSG_VERBOSE(
"arbitrary : creating disc-like NavigationLayer at z-Position : " << navLayerPositionZFinal );
396 layerOrderVector.emplace_back(
399 ATH_MSG_VERBOSE( layerOrderVector.size() <<
" disc Layers (material + navigation) built. " );
401 boundaries.push_back(
zmax);
404 ATH_MSG_VERBOSE(
"arbitrary : created a BinUtility as " << *binUtility );
416 return discLayerArray;
423 ATH_MSG_VERBOSE(
" build LayerArray with " << planeLayersInput.size() <<
" plane-like material layers." );
428 std::vector< std::pair< Trk::SharedObject<Trk::Layer>,
Amg::Vector3D> > layerOrderVector;
432 std::vector<Trk::PlaneLayer*> planeLayers(planeLayersInput);
434 auto sortBegin = planeLayers.begin();
435 auto sortEnd = planeLayers.end();
441 ATH_MSG_WARNING(
"Plane Layers can only be sorted in x/y/z. Returning 0.");
447 auto layIter = planeLayers.begin();
455 unsigned int layers = planeLayers.size();
457 for ( ; layIter != planeLayers.end(); ++layIter) {
460 ATH_MSG_VERBOSE(
"equidistant : registering plane-like MaterialLayer at position : " << layerSurface.
center() );
462 layerOrderVector.emplace_back(
477 unsigned int layers = planeLayers.size();
479 double posStep = (posmax-posmin)/(
layers+1);
481 double currentPos = posmin + posStep;
482 double lastPos = posmin;
484 double minHalfX = 0.;
485 double maxHalfX = 0.;
488 double layerThickness = 0.;
491 for ( ; layIter != planeLayers.end() ; ++layIter) {
516 layerThickness = ((*layIter)->thickness() > layerThickness ) ? (*layIter)->thickness() : layerThickness;
519 double navigationPos = 0.5*(currentPos+lastPos);
520 double navigationX = (bv ==
Trk::binX) ? navigationPos : 0.;
521 double navigationY = (bv ==
Trk::binY) ? navigationPos : 0.;
522 double navigationZ = (bv ==
Trk::binZ) ? navigationPos : 0.;
528 if (std::abs(minHalfX)<10
e-5) {
539 ATH_MSG_VERBOSE(
"bi-equidistant : creating plane-like NavigationLayer at position : " << navigationX );
541 layerOrderVector.emplace_back(
545 lastPos = currentPos;
548 ATH_MSG_VERBOSE(
"bi-equidistant : registering plane-like MaterialLayer at position : " << currentPos );
549 layerOrderVector.emplace_back(
554 currentPos += posStep;
558 double navigationPosFinal = 0.5*(currentPos+lastPos);
559 double navigationXFinal = (bv ==
Trk::binX) ? navigationPosFinal : 0.;
560 double navigationYFinal = (bv ==
Trk::binY) ? navigationPosFinal : 0.;
561 double navigationZFinal = (bv ==
Trk::binZ) ? navigationPosFinal : 0.;
569 ATH_MSG_VERBOSE(
"bi-equidistant : creating plane-like NavigationLayer at position : " << navLayerSurface->
center() );
571 layerOrderVector.emplace_back(
573 navLayerSurface->
center() );
587 std::vector<float> boundaries;
588 boundaries.push_back(posmin);
590 double minHalfX = 0.;
591 double maxHalfX = 0.;
595 for ( ; layIter != planeLayers.end(); ++layIter) {
621 layerCenter = layerSurface.
center();
622 double layerPosition = layerCenter[bv];
624 double layerThickness = (*layIter)->thickness();
626 boundaries.push_back(layerPosition-0.5*layerThickness);
627 double navLayerPositionX = (bv ==
Trk::binX) ? 0.5*(layerPosition+boundaries[boundaries.size()-1]) : layerCenter.x();
628 double navLayerPositionY = (bv ==
Trk::binY) ? 0.5*(layerPosition+boundaries[boundaries.size()-1]) : layerCenter.y();
629 double navLayerPositionZ = (bv ==
Trk::binZ) ? 0.5*(layerPosition+boundaries[boundaries.size()-1]) : layerCenter.z();
630 Amg::Translation3D navLayerPosition(navLayerPositionX,navLayerPositionY,navLayerPositionZ);
636 ATH_MSG_VERBOSE(
"arbitrary : creating plane-like NavigationLayer at position : " << navLayerPositionX );
637 layerOrderVector.emplace_back(
639 Amg::Vector3D(navLayerPositionX, navLayerPositionY, navLayerPositionZ));
641 boundaries.push_back(layerPosition+0.5*layerThickness);
643 layerOrderVector.emplace_back(
649 double navLayerPositionXFinal = (bv ==
Trk::binX) ? 0.5*(posmax+boundaries[boundaries.size()-1]) : layerCenter.x();
650 double navLayerPositionYFinal = (bv ==
Trk::binY) ? 0.5*(posmax+boundaries[boundaries.size()-1]) : layerCenter.y();
651 double navLayerPositionZFinal = (bv ==
Trk::binZ) ? 0.5*(posmax+boundaries[boundaries.size()-1]) : layerCenter.z();
652 Amg::Translation3D navLayerPositionFinal(navLayerPositionXFinal,navLayerPositionYFinal,navLayerPositionZFinal);
658 ATH_MSG_VERBOSE(
"arbitrary : creating plane-like NavigationLayer at position : " << 0.5*(posmax+boundaries[boundaries.size()-1]) );
659 layerOrderVector.emplace_back(
661 Amg::Vector3D(navLayerPositionXFinal, navLayerPositionYFinal, navLayerPositionZFinal));
663 ATH_MSG_VERBOSE( layerOrderVector.size() <<
" plane Layers (material + navigation) built. " );
675 return planeLayerArray;
681 if (m_emptyLayerMode){
683 ATH_MSG_VERBOSE(
" replacing dummyMaterial layer with " << ( m_emptyLayerMode > 1 ?
" nothing" :
" NavigationLayer." ) );