279 {
280
281
282
283
284
285 std::unique_ptr<const Trk::TrackParameters> returnParameters = nullptr;
287 const Trk::TrackingVolume *currVol = nullptr;
288 const Trk::TrackingVolume *nextVol = nullptr;
289 std::vector<unsigned int> solutions;
290 const Trk::TrackingVolume *assocVol = nullptr;
291 unsigned int iDest = 0;
292 const EventContext& ctx = Gaudi::Hive::currentContext();
294
295 if (destVol &&
m_navigator->atVolumeBoundary(currPar, destVol, dir, nextVol,
m_tolerance) && nextVol != destVol) {
297 }
298
301 }
302
304
307 }
309
310
311 if (destVol) {
312 const Trk::TrackingVolume *tgVol =
m_navigator->trackingGeometry(ctx)->trackingVolume(destVol->
volumeName());
313 if (!tgVol || tgVol != destVol) {
315 for (
unsigned int ib = 0;
ib < bounds.size();
ib++) {
316 const Trk::Surface &surf = (bounds[
ib])->surfaceRepresentation();
318 }
319 iDest = bounds.size();
320 }
321 }
322
323
324 bool updateStatic = false;
326
329 updateStatic = true;
330 }
333
334 if (!nextVol) {
338 }
340 updateStatic = true;
341 }
342
343
345
346
348 const Trk::AlignableTrackingVolume *alignTV =
dynamic_cast<const Trk::AlignableTrackingVolume *
> (cache.
m_currentStatic);
349 if (alignTV) {
351 alignTV);
353 if (!aPar) {
354 return returnParameters;
355 }
357
359 }
360 }
361
362
363 if (updateStatic) {
366 for (
unsigned int ib = 0;
ib < bounds.size();
ib++) {
367 const Trk::Surface &surf = (bounds[
ib])->surfaceRepresentation();
369 }
370
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
398 if (!detVols.empty()) {
399 Trk::ArraySpan<const Trk::DetachedTrackingVolume* const>::iterator iTer = detVols.begin();
400 for (; iTer != detVols.end(); ++iTer) {
401
402 const Trk::Layer *layR = (*iTer)->layerRepresentation();
404 const auto& detBounds = (*iTer)->trackingVolume()->boundarySurfaces();
407 detBounds.size());
408 for (unsigned int ibb = 0; ibb < detBounds.size(); ibb++) {
409 const Trk::Surface &surf = (detBounds[ibb])->surfaceRepresentation();
411 }
414 (*iTer)->name().substr((*iTer)->name().size() - 4, 4) ==
415 "PERM") {
416
417
418
419
420
421 if ((*iTer)->trackingVolume()->zOverAtimesRho() != 0. &&
422 ((*iTer)->trackingVolume()->confinedDenseVolumes().empty())
423 && (*iTer)->trackingVolume()->confinedArbitraryLayers().empty()) {
424 cache.
m_denseVols.emplace_back((*iTer)->trackingVolume(), detBounds.size());
425 for (unsigned int ibb = 0; ibb < detBounds.size(); ibb++) {
426 const Trk::Surface &surf = (detBounds[ibb])->surfaceRepresentation();
428 }
429 }
431 if (!(*iTer)->trackingVolume()->confinedDenseVolumes().empty() || (confLays.size() > detBounds.size())) {
433 for (unsigned int ibb = 0; ibb < detBounds.size(); ibb++) {
434 const Trk::Surface &surf = (detBounds[ibb])->surfaceRepresentation();
436 }
437 } else if (!confLays.empty()) {
438 for (const Trk::Layer* const lIt : confLays) {
439 cache.
m_layers.emplace_back(&(lIt->surfaceRepresentation()),
440 true);
441 cache.
m_navigLays.emplace_back((*iTer)->trackingVolume(), lIt);
442 }
443 }
444 }
445 }
446 }
449 }
450
452
453
456
457
462 }
465 }
468 }
471 }
472
473
474
476
477 std::vector<std::pair<const Trk::TrackingVolume *, unsigned int> > navigVols;
478
480 std::vector<const Trk::DetachedTrackingVolume *> detVols =
481 m_navigator->trackingGeometry(ctx)->lowestDetachedTrackingVolumes(gp);
482 std::vector<const Trk::DetachedTrackingVolume *>::iterator dIter = detVols.begin();
483 for (; dIter != detVols.end(); ++dIter) {
484 const Trk::Layer *layR = (*dIter)->layerRepresentation();
487 continue;
488 }
490 m_useMuonMatApprox && (*dIter)->name().substr((*dIter)->name().size() - 4, 4) !=
"PERM") {
491 continue;
492 }
493 const Trk::TrackingVolume *dVol = (*dIter)->trackingVolume();
494
496 if (dExit) {
497 continue;
498 }
499
502
503 if (!
active && confinedDense.empty() && confinedLays.empty()) {
504 continue;
505 }
507 if (!
active && confinedDense.empty() && confinedLays.size() <= bounds.size()) {
508 continue;
509 }
510 if (!confinedDense.empty() || !confinedLays.empty()) {
511 navigVols.emplace_back(dVol, bounds.size());
512 for (
unsigned int ib = 0;
ib < bounds.size();
ib++) {
513 const Trk::Surface &surf = (bounds[
ib])->surfaceRepresentation();
515 }
516
517 if (!confinedDense.empty()) {
518 auto vIter = confinedDense.begin();
519 for (; vIter != confinedDense.end(); ++vIter) {
520 const auto& bounds = (*vIter)->boundarySurfaces();
521 cache.
m_denseVols.emplace_back(*vIter, bounds.size());
522 for (
unsigned int ib = 0;
ib < bounds.size();
ib++) {
523 const Trk::Surface &surf = (bounds[
ib])->surfaceRepresentation();
525 }
526 }
527 }
528
529 if (!confinedLays.empty()) {
530 for (const auto *confinedLay : confinedLays) {
531 cache.
m_layers.emplace_back(&(confinedLay->surfaceRepresentation()),
true);
533 }
534 }
535 } else {
539 for (const auto *subvol : subvols) {
541 detVol = subvol;
542 break;
543 }
544 }
545 }
546
547 if (!detVol) {
548 detVol = dVol;
549 }
550 bool vExit =
m_navigator->atVolumeBoundary(currPar, detVol, dir, nextVol,
m_tolerance) && nextVol != detVol;
552 detVol = nextVol;
553 vExit = false;
554 }
555 if (!vExit) {
557 navigVols.emplace_back(detVol, bounds.size());
558 for (
unsigned int ib = 0;
ib < bounds.size();
ib++) {
559 const Trk::Surface &surf = (bounds[
ib])->surfaceRepresentation();
561 }
563 cache.
m_denseVols.emplace_back(detVol, bounds.size());
564 for (
unsigned int ib = 0;
ib < bounds.size();
ib++) {
565 const Trk::Surface &surf = (bounds[
ib])->surfaceRepresentation();
567 }
568 }
569
573 for (const auto *cLay : cLays) {
574 if (cLay->layerType() > 0 || cLay->layerMaterialProperties()) {
575 cache.
m_layers.emplace_back(&(cLay->surfaceRepresentation()),
true);
577 cLay);
578 }
579 }
580 } else {
582
583
584 if (lay) {
586 true);
588 }
590 dir * currPar->
momentum().normalized(),
true);
591 if (nextLayer && nextLayer != lay) {
594 }
595 }
598 for (const auto *layer : layers) {
599 cache.
m_layers.emplace_back(&(
layer->surfaceRepresentation()),
true);
601 }
602 }
603 }
604 }
605 }
606
607
609
612 for (const auto *cLay : cLays) {
613 if (cLay->layerType() > 0 || cLay->layerMaterialProperties()) {
614 cache.
m_layers.emplace_back(&(cLay->surfaceRepresentation()),
615 true);
617 }
618 }
619 } else {
620
622
623
624
625
626 if (lay) {
628 Trk::BoundaryCheck(false));
631 if (nextLayer && nextLayer != lay) {
633 Trk::BoundaryCheck(false));
635 nextLayer);
636 }
638 if (backLayer && backLayer != lay) {
640 Trk::BoundaryCheck(false));
642 backLayer);
643 }
644 }
645 }
646 }
647
648
649
650
653 }
656 }
659 }
662 }
663
664
665
669 } else {
670 for (
unsigned int i = 0;
i < cache.
m_denseVols.size();
i++) {
671 const Trk::TrackingVolume *dVol = cache.
m_denseVols[
i].first;
675 }
676 }
677 }
678 }
679
680
682 for (
unsigned int i = 0;
i < cache.
m_navigLays.size();
i++) {
685
688 particle);
689 } else {
690 ATH_MSG_VERBOSE(
" [o] Collecting intersection with active input layer.");
692 }
693 }
694 }
695 }
696
697
698
699
700
701 nextVol = nullptr;
702 while (currPar) {
703 std::vector<unsigned int> solutions;
704
705
707 <<
" (current momentum: " << currPar->
momentum().mag() <<
708 ")");
710
711
712
713
714
715
719 }
721 ->propagateT(ctx,
722 *currPar,
724 dir,
726 particle,
727 solutions,
729 timeLim,
730 true,
733 .release();
735 if (nextPar) {
737 nextPar->
position()) <<
", timed at " << timeLim.time);
738 }
739
740 if (!nextPar) {
743 return returnParameters;
744 }
745
747
748
752
753
756
759 ->interact(
761 .release();
762
763 if (!iPar) {
764 return returnParameters;
765 }
766
769 }
770 return returnParameters;
771
772 }
773
774 if (timeLim.tMax > 0. && timeLim.time >= timeLim.tMax) {
775
777
780 ->interact(timeLim.time, nextPar->
position(), nextPar->
momentum(), particle, timeLim.process)
781 .release();
782 if (!iPar) {
783 return returnParameters;
784 }
787 }
788 return returnParameters;
789
790 }
791
792
796 }
797
798
799 ATH_MSG_DEBUG(
" [+] Number of intersection solutions: " << solutions.size());
800
801 unsigned int iSol = 0;
802 while (iSol < solutions.size()) {
803 if (solutions[iSol] < iDest) {
806
807 const Trk::Layer *
mb = cache.
m_navigSurfs[solutions[iSol]].first->materialLayer();
809 if (
mb->layerMaterialProperties() &&
mb->layerMaterialProperties()->fullMaterial(nextPar->
position())) {
811 nextPar = currentUpdator ? currentUpdator
812 ->update(nextPar,
813 *mb,
814 timeLim,
817 dir,
818 particle)
819 .release()
820 : nextPar;
821
822 if (!nextPar) {
823 ATH_MSG_VERBOSE(
" [+] Update may have killed neutral track - return.");
825 return returnParameters;
826 }
828 } else {
830 }
831 }
832
833
834 unsigned int index = solutions[iSol] - iDest;
835
836
839
840 if (nextVol && !(nextVol->
inside(nextPar->
position() + 0.01 * dir * nextPar->
momentum().normalized(), 0.))) {
844 nextVol =
m_navigator->trackingGeometry(ctx)->lowestStaticTrackingVolume(
846 if (nextVol) {
848 }
849 }
850
857 }
858
859 if (!nextVol) {
861 nextPar->
position()) <<
", timed at " << timeLim.time);
863 if (!destVol) {
865 }
866 }
867
868 if (nextVol ) {
874 }
875 }
877 }
879
882
883
884
887
889 if (matUp) {
890 double pIn = nextPar->
momentum().mag();
891 nextPar = currentUpdator ? currentUpdator->update(nextPar, *nextLayer, timeLim, cache.
m_path,
893 particle).release() : nextPar;
894 if (!nextPar) {
897 return returnParameters;
898 }
900 " Layer energy loss:" << nextPar->
momentum().mag() - pIn <<
"at position:" << nextPar->
position() <<
", current momentum:" <<
903
904 }
905
908
914 }
915 }
916
917
921 dir * nextPar->
momentum().normalized());
922 if (newLayer && newLayer != nextLayer) {
925 for (
unsigned int i = 0;
i < cache.
m_navigLays.size();
i++) {
928 break;
929 }
932 }
933 }
934 if (!found) {
938 } else {
939
941 }
942 }
943 }
944 }
945 }
946 currPar = nextPar;
948
950 std::vector< std::pair<const Trk::TrackingVolume *, unsigned int> >::iterator dIter = cache.
m_denseVols.begin();
951 while (dIter != cache.
m_denseVols.end() && index >= (*dIter).second) {
952 index -= (*dIter).second;
953 ++dIter;
954 }
956 currVol = (*dIter).first;
958
964 } else {
965 for (
unsigned int i = 0;
i < cache.
m_denseVols.size();
i++) {
966 const Trk::TrackingVolume *dVol = cache.
m_denseVols[
i].first;
970 break;
971 }
972 }
973 }
974 } else {
977 }
978 }
981
984 std::vector< std::pair<const Trk::TrackingVolume *, unsigned int> >::iterator nIter = navigVols.begin();
985 while (nIter != navigVols.end() && index >= (*nIter).second) {
986 index -= (*nIter).second;
987 ++nIter;
988 }
989 if (nIter != navigVols.end()) {
990 currVol = (*nIter).first;
991 nextVol = ((*nIter).first->boundarySurfaces())[
index]->attachedVolume(*nextPar, dir);
992 if (!nextVol) {
993 ATH_MSG_DEBUG(
" [+] Navigation volume boundary, leaving volume '"
995 } else {
997 }
998 currPar = nextPar;
999
1000
1001 if (nextVol) {
1003 }
1004 }
1007
1010 std::vector< std::pair<const Trk::DetachedTrackingVolume *,
1012 while (dIter != cache.
m_detachedVols.end() && index >= (*dIter).second) {
1013 index -= (*dIter).second;
1014 ++dIter;
1015 }
1017 currVol = (*dIter).first->trackingVolume();
1018 nextVol =
1019 ((*dIter).first->trackingVolume()->boundarySurfaces())[
index]->attachedVolume(*nextPar, dir);
1020 if (!nextVol) {
1022 } else {
1024 }
1025 currPar = nextPar;
1026
1027 if (nextVol) {
1029 }
1030 }
1031 }
1032 iSol++;
1033 }
1034 currPar = nextPar;
1035 }
1036
1037 return returnParameters;
1038}
virtual std::span< T *const > arrayObjects()=0
Return all objects of the Array non-const we can still modify the T.
int layerType() const
get the Layer coding
virtual const Surface & surfaceRepresentation() const =0
Transforms the layer into a Surface representation for extrapolation.
const MaterialProperties * fullUpdateMaterialProperties(const TrackParameters &par) const
getting the MaterialProperties back - for full update
virtual bool isOnLayer(const Amg::Vector3D &gp, const BoundaryCheck &bcheck=BoundaryCheck(true)) const
isOnLayer() method, using isOnSurface() with Layer specific tolerance
const Layer * nextLayer(const Amg::Vector3D &gp, const Amg::Vector3D &udir) const
getting the next/previous Layer if registered - unit for direction vector required
const SurfaceArray * surfaceArray() const
Return the entire SurfaceArray, returns nullptr if no SurfaceArray.
float zOverAtimesRho() const
access to members
const LayerArray * confinedLayers() const
Return the subLayer array.
const Layer * associatedLayer(const Amg::Vector3D &gp) const
Return the associated Layer.
const TrackingVolumeArray * confinedVolumes() const
Return the subLayer array.
const TrackingVolume * associatedSubVolume(const Amg::Vector3D &gp) const
Return the associated sub Volume, returns THIS if no subVolume exists.
const Layer * nextLayer(const Amg::Vector3D &gp, const Amg::Vector3D &mom, bool asres=true, bool skipNavLayer=false) const
Return the next Layer if existing, NULL if no next layer corresponds.
ArraySpan< DetachedTrackingVolume const *const > confinedDetachedVolumes() const
Return detached subVolumes - not the ownership.
ArraySpan< Layer const *const > confinedArbitraryLayers() const
Return the confined subLayer array.
ArraySpan< TrackingVolume const *const > confinedDenseVolumes() const
Return unordered subVolumes - not the ownership.
std::string replace(std::string s, const std::string &s2, const std::string &s3)
layers(flags, cells_name, *args, **kw)
Here we define wrapper functions to set up all of the standard corrections.
const double mb
1mb to cm2
const TrackParameters * trPar
void boundaryInformation(const TrackingVolume *tvol, const TrackParameters *nextPars, const TrackParameters *navPars, BoundarySurfaceFace face=undefinedFace)
reset the boundary information by invalidating it
void resetBoundaryInformation()