ATLAS Offline Software
Loading...
Searching...
No Matches
Trk::GsfExtrapolator Class Referencefinal

#include <GsfExtrapolator.h>

Inheritance diagram for Trk::GsfExtrapolator:
Collaboration diagram for Trk::GsfExtrapolator:

Public Member Functions

 GsfExtrapolator (const std::string &, const std::string &, const IInterface *)
 Constructor with AlgTool parameters.
virtual ~GsfExtrapolator () override final
virtual StatusCode initialize () override final
virtual MultiComponentState extrapolate (const EventContext &ctx, Cache &, const MultiComponentState &, const Surface &, PropDirection direction, const BoundaryCheck &boundaryCheck) const override final
 Extrapolation method applying material affects.
virtual MultiComponentState extrapolateDirectly (const EventContext &ctx, const MultiComponentState &, const Surface &, PropDirection direction, const BoundaryCheck &boundaryCheck) const override final
 Extrapolation method without material effects.
virtual Trk::ParticleHypothesis particleHypothesis () const override final
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Static Public Member Functions

static const InterfaceID & interfaceID ()
 AlgTool interface method.

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

MultiComponentState extrapolateImpl (const EventContext &ctx, Cache &cache, const MultiComponentState &, const Surface &, PropDirection direction, const BoundaryCheck &boundaryCheck) const
 Implementation of main extrapolation method.
MultiComponentState extrapolateDirectlyImpl (const EventContext &ctx, const MultiComponentState &, const Surface &, PropDirection direction, const BoundaryCheck &boundaryCheck) const
 Implementation of extrapolation without material effects.
void extrapolateToVolumeBoundary (const EventContext &ctx, Cache &cache, const MultiComponentState &, const Layer *, const TrackingVolume &, PropDirection direction) const
 Two primary private extrapolation methods.
MultiComponentState extrapolateInsideVolume (const EventContext &ctx, Cache &cache, const MultiComponentState &, const Surface &, const Layer *, const TrackingVolume &, PropDirection direction, const BoundaryCheck &boundaryCheck) const
MultiComponentState extrapolateFromLayerToLayer (const EventContext &ctx, Cache &cache, const MultiComponentState &, const TrackingVolume &, const Layer *startLayer, const Layer *destinationLayer, PropDirection direction) const
 Layer stepping, stopping at the last layer before destination.
MultiComponentState extrapolateToIntermediateLayer (const EventContext &ctx, Cache &cache, const MultiComponentState &, const Layer &, const TrackingVolume &, PropDirection direction) const
 Single extrapolation step to an intermediate layer.
MultiComponentState extrapolateToDestinationLayer (const EventContext &ctx, Cache &cache, const MultiComponentState &, const Surface &, const Layer &, const Layer *, PropDirection direction, const BoundaryCheck &boundaryCheck) const
 Final extrapolation step to a destination layer.
std::unique_ptr< Trk::TrackParametersinitialiseNavigation (const EventContext &ctx, Cache &cache, const MultiComponentState &initialState, const Surface &surface, const Layer *&associatedLayer, const TrackingVolume *&currentVolume, const TrackingVolume *&destinationVolume, PropDirection &direction) const
 Method to initialise navigation parameters including starting state, layer and volume, and destination volume.
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ToolHandle< IPropagatorm_propagator {this, "Propagator", "", ""}
ToolHandle< INavigatorm_navigator
ToolHandle< IMaterialMixtureConvolutionm_materialUpdator
BooleanProperty m_fastField {this, "UseFastField", false}
Trk::MagneticFieldProperties m_fieldProperties = Trk::FullField
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 50 of file GsfExtrapolator.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ GsfExtrapolator()

Trk::GsfExtrapolator::GsfExtrapolator ( const std::string & type,
const std::string & name,
const IInterface * parent )

Constructor with AlgTool parameters.

Definition at line 141 of file GsfExtrapolator.cxx.

144 : AthAlgTool(type, name, parent)
145{
146 declareInterface<IMultiStateExtrapolator>(this);
147}
AthAlgTool()
Default constructor:

◆ ~GsfExtrapolator()

Trk::GsfExtrapolator::~GsfExtrapolator ( )
finaloverridevirtualdefault

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extrapolate()

Trk::MultiComponentState Trk::GsfExtrapolator::extrapolate ( const EventContext & ctx,
Cache & cache,
const MultiComponentState & multiComponentState,
const Surface & surface,
Trk::PropDirection direction,
const BoundaryCheck & boundaryCheck ) const
finaloverridevirtual

Extrapolation method applying material affects.

Implements Trk::IMultiStateExtrapolator.

Definition at line 174 of file GsfExtrapolator.cxx.

181{
182 if (multiComponentState.empty()) {
183 return {};
184 }
185 return extrapolateImpl(ctx,
186 cache,
187 multiComponentState,
188 surface,
189 direction,
190 boundaryCheck);
191}
MultiComponentState extrapolateImpl(const EventContext &ctx, Cache &cache, const MultiComponentState &, const Surface &, PropDirection direction, const BoundaryCheck &boundaryCheck) const
Implementation of main extrapolation method.

◆ extrapolateDirectly()

Trk::MultiComponentState Trk::GsfExtrapolator::extrapolateDirectly ( const EventContext & ctx,
const MultiComponentState & multiComponentState,
const Surface & surface,
Trk::PropDirection direction,
const BoundaryCheck & boundaryCheck ) const
finaloverridevirtual

Extrapolation method without material effects.

The particle hypothesis used.

Implements Trk::IMultiStateExtrapolator.

Definition at line 197 of file GsfExtrapolator.cxx.

203{
204 if (multiComponentState.empty()) {
205 return {};
206 }
207
208 const Trk::TrackingVolume* currentVolume = m_navigator->highestVolume(ctx);
209 if (!currentVolume) {
211 "Current tracking volume could not be determined... returning {}");
212 return {};
213 }
214 return extrapolateDirectlyImpl(ctx,
215 multiComponentState,
216 surface,
217 direction,
218 boundaryCheck);
219}
#define ATH_MSG_WARNING(x)
MultiComponentState extrapolateDirectlyImpl(const EventContext &ctx, const MultiComponentState &, const Surface &, PropDirection direction, const BoundaryCheck &boundaryCheck) const
Implementation of extrapolation without material effects.
ToolHandle< INavigator > m_navigator

◆ extrapolateDirectlyImpl()

Trk::MultiComponentState Trk::GsfExtrapolator::extrapolateDirectlyImpl ( const EventContext & ctx,
const MultiComponentState & multiComponentState,
const Surface & surface,
Trk::PropDirection direction,
const BoundaryCheck & boundaryCheck ) const
private

Implementation of extrapolation without material effects.

Definition at line 420 of file GsfExtrapolator.cxx.

426{
427 return m_propagator->multiStatePropagate(ctx,
428 multiComponentState,
429 surface,
431 direction,
432 boundaryCheck,
434}
ToolHandle< IPropagator > m_propagator
Trk::MagneticFieldProperties m_fieldProperties

◆ extrapolateFromLayerToLayer()

Trk::MultiComponentState Trk::GsfExtrapolator::extrapolateFromLayerToLayer ( const EventContext & ctx,
Cache & cache,
const MultiComponentState & multiComponentState,
const TrackingVolume & trackingVolume,
const Layer * startLayer,
const Layer * destinationLayer,
PropDirection direction ) const
private

Layer stepping, stopping at the last layer before destination.

Definition at line 687 of file GsfExtrapolator.cxx.

695{
696
697 const Trk::Layer* currentLayer = startLayer;
698 Trk::MultiComponentState currentState{};
699
700 const Trk::TrackParameters* combinedState =
701 multiComponentState.begin()->params.get();
702 Amg::Vector3D currentPosition = combinedState->position();
703 Amg::Vector3D currentDirection = direction * combinedState->momentum().unit();
704
705 // No need to extrapolate to start layer, find the next one
706 const Trk::Layer* nextLayer =
707 currentLayer->nextLayer(currentPosition, currentDirection);
708
709 using LayerSet = boost::container::flat_set<
710 const Trk::Layer*,
711 std::less<const Trk::Layer*>,
712 boost::container::small_vector<const Trk::Layer*, 8>>;
713 LayerSet layersHit;
714
715 layersHit.insert(currentLayer);
716
717 // Begin while loop over all intermediate layers
718 while (nextLayer && nextLayer != destinationLayer) {
719 layersHit.insert(nextLayer);
720 // Only extrapolate to an intermediate layer if it requires material
721 // update. Otherwise step over it
722 if (nextLayer->layerMaterialProperties()) {
723 currentState = extrapolateToIntermediateLayer(
724 ctx,
725 cache,
726 !currentState.empty() ? currentState : multiComponentState,
727 *nextLayer,
728 trackingVolume,
729 direction);
730 }
731
732 if (!currentState.empty()) {
733 combinedState = currentState.begin()->params.get();
734 currentPosition = combinedState->position();
735 currentDirection = direction * combinedState->momentum().unit();
736 }
737
738 // Find the next layer
739 currentLayer = nextLayer;
740 nextLayer = currentLayer->nextLayer(currentPosition, currentDirection);
741 if (layersHit.find(nextLayer) != layersHit.end()) {
742 break;
743 }
744 }
745
746 if (destinationLayer && nextLayer != destinationLayer &&
747 !currentState.empty()) {
748 currentState.clear();
749 }
750
751 return currentState;
752}
static int layersHit(FPGATrackSimRoad &r)
MultiComponentState extrapolateToIntermediateLayer(const EventContext &ctx, Cache &cache, const MultiComponentState &, const Layer &, const TrackingVolume &, PropDirection direction) const
Single extrapolation step to an intermediate layer.
const Layer * nextLayer(const Amg::Vector3D &gp, const Amg::Vector3D &udir) const
getting the next/previous Layer if registered - unit for direction vector required
Definition Layer.cxx:161
const LayerMaterialProperties * layerMaterialProperties() const
getting the LayerMaterialProperties including full/pre/post update
const Amg::Vector3D & momentum() const
Access method for the momentum.
const Amg::Vector3D & position() const
Access method for the position.
Eigen::Matrix< double, 3, 1 > Vector3D
std::vector< ComponentParameters > MultiComponentState
ParametersBase< TrackParametersDim, Charged > TrackParameters

◆ extrapolateImpl()

Trk::MultiComponentState Trk::GsfExtrapolator::extrapolateImpl ( const EventContext & ctx,
Cache & cache,
const MultiComponentState & multiComponentState,
const Surface & surface,
Trk::PropDirection direction,
const BoundaryCheck & boundaryCheck ) const
private

Implementation of main extrapolation method.

Definition at line 232 of file GsfExtrapolator.cxx.

239{
240
241 // Empty the garbage bin
242 emptyRecycleBins(cache);
243 const Trk::Layer* associatedLayer = nullptr;
244 const Trk::TrackingVolume* startVolume = nullptr;
245 const Trk::TrackingVolume* destinationVolume = nullptr;
246 std::unique_ptr<Trk::TrackParameters> referenceParameters =
247 initialiseNavigation(ctx, cache, multiComponentState, surface,
248 associatedLayer, startVolume, destinationVolume,
249 direction);
250
251 // Bail to direct extrapolation if the direction cannot be determined
252 if (direction == Trk::anyDirection) {
253 return extrapolateDirectlyImpl(ctx,
254 multiComponentState,
255 surface,
256 direction,
257 boundaryCheck);
258 }
259
260 const Trk::TrackParameters* combinedState =
261 multiComponentState.begin()->params.get();
262
263 const Trk::MultiComponentState* currentState = &multiComponentState;
264
265 /* Define the initial distance between destination and current position.
266 Destination should be determined from either
267 - reference parameters (prefered if they exist) or
268 - destination surface
269 */
270 const Amg::Vector3D globalSeparation =
271 referenceParameters
272 ? referenceParameters->position() - combinedState->position()
273 : surface.globalReferencePoint() - combinedState->position();
274 const double initialDistance = globalSeparation.mag();
275 // Clean up memory from combiner. It is no longer needed
276 combinedState = nullptr;
277
278 /* There are two parts to the extrapolation:
279 - Extrapolate from start point to volume boundary
280 - Extrapolate from volume boundary to destination surface
281 */
282 /*
283 * Extrapolation to destination volume boundary
284 */
285 bool foundFinalBoundary(true);
286 int fallbackOscillationCounter(0);
287 const Trk::TrackingVolume* currentVolume = startVolume;
288 const Trk::TrackingVolume* previousVolume = nullptr;
289
290 while (currentVolume && currentVolume != destinationVolume) {
291 // Extrapolate to volume boundary
293 cache,
294 *currentState,
295 associatedLayer,
296 *currentVolume,
297 direction);
298
299 // New current state is the state extrapolated to the tracking volume
300 // boundary.
301 currentState = cache.m_stateAtBoundary;
302 // The volume that the extrapolation is about to enter into is called the
303 // nextVolume
304 const Trk::TrackingVolume* nextVolume = cache.m_trackingVolume;
305 // Break the loop if the next tracking volume is the same as the current one
306 if (!nextVolume || nextVolume == currentVolume) {
307 foundFinalBoundary = false;
308 break;
309 }
310 // Break the loop if an oscillation is detected
311 if (previousVolume == nextVolume) {
312 ++fallbackOscillationCounter;
313 }
314 if (fallbackOscillationCounter > 10) {
315 foundFinalBoundary = false;
316 break;
317 }
318 // Break the loop if the distance between the surface and the track
319 // parameters has increased
320 combinedState = currentState->begin()->params.get();
321
322 auto parametersAtDestination =
323 m_propagator->propagateParameters(ctx,
324 *combinedState,
325 surface,
326 direction,
327 false,
330 Amg::Vector3D newDestination;
331 if (parametersAtDestination) {
332 newDestination = parametersAtDestination->position();
333 // delete parametersAtDestination;
334 } else {
335 newDestination = surface.center();
336 }
337
338 const double revisedDistance =
339 (cache.m_navigationParameters->position() - newDestination).mag();
340
341 const double distanceChange = std::abs(revisedDistance - initialDistance);
342
343 if (revisedDistance > initialDistance && distanceChange > 0.01) {
344 foundFinalBoundary = false;
345 break;
346 }
347
348 combinedState = nullptr;
349 // Initialise the oscillation checker
350 previousVolume = currentVolume;
351 // As the extrapolation is moving into the next volume, the next volume ->
352 // current volume
353 currentVolume = nextVolume;
354 // Associated layer now needs to be reset
355 // if(!entryLayerFound)
356 associatedLayer = nullptr;
357 } // end while loop
358
359 // catch failures now
360 if (!currentState || (currentVolume != destinationVolume)) {
361 currentState = &multiComponentState;
362 foundFinalBoundary = false;
363 }
364
365 if (!foundFinalBoundary) {
366 Trk::MultiComponentState bailOutState =
367 m_propagator->multiStatePropagate(ctx,
368 *currentState,
369 surface,
372 boundaryCheck,
374
375 emptyRecycleBins(cache);
376 return bailOutState;
377 }
378
379 /*
380 * Extrapolation from volume boundary to surface
381 */
382
383 // extrapolate inside destination volume
384 Trk::MultiComponentState destinationState =
386 cache,
387 *currentState,
388 surface,
389 associatedLayer,
390 *currentVolume,
391 direction,
392 boundaryCheck);
393
394 // FALLBACK POINT: Crisis if extrapolation fails here... As per extrapolation
395 // to volume boundary, in emergency revert to extrapolateDirectly
396
397 // or we failed to reach the target
398 if (!destinationState.empty() &&
399 &((*(destinationState.begin())).params->associatedSurface()) != &surface) {
400 destinationState.clear();
401 }
402
403 if (destinationState.empty()) {
404 destinationState = m_propagator->multiStatePropagate(ctx,
405 *currentState,
406 surface,
409 boundaryCheck,
411 }
412 emptyRecycleBins(cache);
413 return destinationState;
414}
std::unique_ptr< Trk::TrackParameters > initialiseNavigation(const EventContext &ctx, Cache &cache, const MultiComponentState &initialState, const Surface &surface, const Layer *&associatedLayer, const TrackingVolume *&currentVolume, const TrackingVolume *&destinationVolume, PropDirection &direction) const
Method to initialise navigation parameters including starting state, layer and volume,...
void extrapolateToVolumeBoundary(const EventContext &ctx, Cache &cache, const MultiComponentState &, const Layer *, const TrackingVolume &, PropDirection direction) const
Two primary private extrapolation methods.
MultiComponentState extrapolateInsideVolume(const EventContext &ctx, Cache &cache, const MultiComponentState &, const Surface &, const Layer *, const TrackingVolume &, PropDirection direction, const BoundaryCheck &boundaryCheck) const
@ anyDirection

◆ extrapolateInsideVolume()

Trk::MultiComponentState Trk::GsfExtrapolator::extrapolateInsideVolume ( const EventContext & ctx,
Cache & cache,
const MultiComponentState & multiComponentState,
const Surface & surface,
const Layer * layer,
const TrackingVolume & trackingVolume,
Trk::PropDirection direction,
const BoundaryCheck & boundaryCheck ) const
private

Definition at line 569 of file GsfExtrapolator.cxx.

578{
579 //curent state is a plainn ptr to keep track
580 const Trk::MultiComponentState* currentState = &multiComponentState;
581
582 // Retrieve the destination layer
583 // 1. Association
584 const Trk::Layer* destinationLayer = surface.associatedLayer();
585
586 // 2. Recall and Global Search
587 if (!destinationLayer) {
588 destinationLayer =
589 (&surface == cache.m_recallSurface)
590 ? cache.m_recallLayer
591 : trackingVolume.associatedLayer(surface.globalReferencePoint());
592 }
593
594 // Retrieve the current layer
595 // Produce a combined state
596 const Trk::TrackParameters* combinedState =
597 currentState->begin()->params.get();
598
599 const Trk::Layer* associatedLayer = layer;
600
601 Trk::MultiComponentState updatedState{};
602 if (!associatedLayer) {
603 // Get entry layer but do not use it as it should have already be hit if it
604 // was desired
605 associatedLayer = trackingVolume.associatedLayer(combinedState->position());
606 associatedLayer =
607 associatedLayer
608 ? associatedLayer
609 : trackingVolume.nextLayer(combinedState->position(),
610 direction * combinedState->momentum().unit(),
611 associatedLayer);
612 }
613
614 else if (associatedLayer != destinationLayer &&
615 trackingVolume.confinedLayers() &&
616 associatedLayer->layerMaterialProperties()) {
617
618 updatedState = m_materialUpdator->postUpdate(cache.m_materialEffectsCaches,
619 *currentState,
620 *associatedLayer,
621 direction);
622
623 if (!updatedState.empty()) {
624 // Refresh the current state pointer
625 currentState = &updatedState;
626 }
627 }
628
629 // Reset combined state target
630 combinedState = nullptr;
632 if (destinationLayer) {
633 // If there are intermediate layers then additional extrapolations need to
634 // be done
635 if (associatedLayer && associatedLayer != destinationLayer) {
637 cache,
638 *currentState,
639 trackingVolume,
640 associatedLayer,
641 destinationLayer,
642 direction);
643
644 // currentState is now the next
645 if (!nextState.empty()) {
646 // Refresh the current state pointer
647 currentState = &nextState;
648 }
649 }
650 // Final extrapolation to destination surface
651 Trk::MultiComponentState returnState =
653 cache,
654 *currentState,
655 surface,
656 *destinationLayer,
657 associatedLayer,
658 direction,
659 boundaryCheck);
660 // Set the information for the current layer, surface, tracking volume
661 setRecallInformation(cache, surface, *destinationLayer, trackingVolume);
662 return returnState;
663 }
664
665 // FALLBACK POINT: If no destination layer is found fall-back and extrapolate
666 // directly
667 Trk::MultiComponentState returnState =
668 m_propagator->multiStatePropagate(ctx,
669 *currentState,
670 surface,
672 direction,
673 boundaryCheck,
675
676 // No destination layer exists so layer recall method cannot be used and
677 // should be reset
678 resetRecallInformation(cache);
679
680 return returnState;
681}
static JobState::Enum nextState(JobState::Enum state, Status::Enum status)
MultiComponentState extrapolateFromLayerToLayer(const EventContext &ctx, Cache &cache, const MultiComponentState &, const TrackingVolume &, const Layer *startLayer, const Layer *destinationLayer, PropDirection direction) const
Layer stepping, stopping at the last layer before destination.
ToolHandle< IMaterialMixtureConvolution > m_materialUpdator
MultiComponentState extrapolateToDestinationLayer(const EventContext &ctx, Cache &cache, const MultiComponentState &, const Surface &, const Layer &, const Layer *, PropDirection direction, const BoundaryCheck &boundaryCheck) const
Final extrapolation step to a destination layer.
@ layer
Definition HitInfo.h:79

◆ extrapolateToDestinationLayer()

Trk::MultiComponentState Trk::GsfExtrapolator::extrapolateToDestinationLayer ( const EventContext & ctx,
Cache & cache,
const MultiComponentState & multiComponentState,
const Surface & surface,
const Layer & layer,
const Layer * startLayer,
Trk::PropDirection direction,
const BoundaryCheck & boundaryCheck ) const
private

Final extrapolation step to a destination layer.

Definition at line 825 of file GsfExtrapolator.cxx.

834{
835
836 const Trk::MultiComponentState* initialState = &multiComponentState;
837 const Trk::TrackParameters* combinedState = nullptr;
838
839 // Propagate over all components
840 Trk::MultiComponentState destinationState =
841 m_propagator->multiStatePropagate(ctx,
842 multiComponentState,
843 surface,
845 direction,
846 boundaryCheck,
848
849 // Require a fall-back if the initial state is close to the destination
850 // surface then a fall-back solution is required
851
852 if (destinationState.empty()) {
853 combinedState = initialState->begin()->params.get();
854 if (surface.isOnSurface(
855 combinedState->position(), true, 0.5 * layer.thickness())) {
856 destinationState = m_propagator->multiStatePropagate(ctx,
857 *initialState,
858 surface,
861 boundaryCheck,
863 }
864 combinedState = nullptr;
865 if (destinationState.empty()) {
866 return {};
867 }
868 }
869
870 /* ----------------------------------------
871 Material effects
872 ---------------------------------------- */
873
874 Trk::MultiComponentState updatedState{};
875 if (startLayer != &layer) {
876 updatedState = m_materialUpdator->preUpdate(cache.m_materialEffectsCaches,
877 destinationState,
878 layer,
879 direction);
880 }
881
882 if (updatedState.empty()) {
883 return destinationState;
884 }
885
886 return updatedState;
887}

◆ extrapolateToIntermediateLayer()

Trk::MultiComponentState Trk::GsfExtrapolator::extrapolateToIntermediateLayer ( const EventContext & ctx,
Cache & cache,
const MultiComponentState & multiComponentState,
const Layer & layer,
const TrackingVolume & trackingVolume,
Trk::PropDirection direction ) const
private

Single extrapolation step to an intermediate layer.

Definition at line 758 of file GsfExtrapolator.cxx.

765{
766 const Trk::MultiComponentState* initialState = &multiComponentState;
767
768 // Propagate over all components
769 Trk::MultiComponentState destinationState =
770 m_propagator->multiStatePropagate(ctx,
771 *initialState,
772 layer.surfaceRepresentation(),
774 direction,
775 true,
777
778 if (destinationState.empty()) {
779 return {};
780 }
781
782 // the layer has been intersected
783 // ------------------------------------------------------------------------
784 // check for radial direction change
785 // ---------------------------------------------------------------------
786 const int rDirection = radialDirection(multiComponentState, direction);
787 const int newrDirection = radialDirection(destinationState, direction);
788 if (newrDirection != rDirection) {
789 // it is unfortunate that the cancelling could invalidate the material
790 // collection
791 // reset the nextParameters if the radial change is not allowed
792 // resetting is ok - since the parameters are in the garbage bin already
793 if (!radialDirectionCheck(ctx,
795 multiComponentState,
796 destinationState,
797 trackingVolume,
799 direction)) {
800 return {};
801 }
802 }
803
804 /* -------------------------------------
805 Material effects
806 ------------------------------------- */
807
808 Trk::MultiComponentState updatedState =
809 m_materialUpdator->update(cache.m_materialEffectsCaches,
810 destinationState,
811 layer,
812 direction);
813
814 if (updatedState.empty()) {
815 return destinationState;
816 }
817
818 return updatedState;
819}

◆ extrapolateToVolumeBoundary()

void Trk::GsfExtrapolator::extrapolateToVolumeBoundary ( const EventContext & ctx,
Cache & cache,
const MultiComponentState & multiComponentState,
const Layer * layer,
const TrackingVolume & trackingVolume,
Trk::PropDirection direction ) const
private

Two primary private extrapolation methods.

  • extrapolateToVolumeBoundary : extrapolates to the exit of the destination tracking volume The exit layer surface will be hit in this method.
  • extrapolateInsideVolume : extrapolates to the destination surface in the final tracking volume

Definition at line 440 of file GsfExtrapolator.cxx.

447{
448
449 //We 1st point to the input.
450 //As we move on we might change to point to the
451 //last element held by
452 //cache.m_mcsRecycleBin
453 cache.m_stateAtBoundary = &multiComponentState;
454
455 const Trk::TrackParameters* combinedState =
456 cache.m_stateAtBoundary->begin()->params.get();
457 const Trk::Layer* associatedLayer = layer;
458
459 if (!associatedLayer) {
460 // Get entry layer but do not use it as it should have already be hit if it
461 // was desired
462 associatedLayer = trackingVolume.associatedLayer(combinedState->position());
463 associatedLayer = associatedLayer
464 ? associatedLayer
465 : trackingVolume.nextLayer(
466 combinedState->position(),
467 direction * combinedState->momentum().unit(),
468 associatedLayer);
469 }
470 // Only loop over layers if they can be found within the tracking volume
471 else if (trackingVolume.confinedLayers() &&
472 associatedLayer->layerMaterialProperties()) {
473 Trk::MultiComponentState updatedState = m_materialUpdator->postUpdate(
474 cache.m_materialEffectsCaches,
475 *(cache.m_stateAtBoundary),
476 *layer,
477 direction);
478
479 if (!updatedState.empty()) {
480 addMultiComponentToCache(cache,std::move(updatedState));
481 }
482 }
483
484 // If an associated surface can be found, extrapolation within the tracking
485 // volume is mandatory This will take extrapolate to the last layer in the
486 // volume
487 if (associatedLayer) {
489 ctx,
490 cache,
491 *(cache.m_stateAtBoundary),
492 trackingVolume,
493 associatedLayer,
494 nullptr,
495 direction);
496 // if we have a next State update the currentState
497 if (!nextState.empty()) {
498 addMultiComponentToCache(cache,std::move(nextState));
499 }
500 }
501
502 /* =============================================
503 Find the boundary surface using the navigator
504 ============================================= */
505
506 Trk::NavigationCell nextNavigationCell(nullptr, nullptr);
507
508 combinedState = cache.m_stateAtBoundary->begin()->params.get();
509
510 const Trk::TrackingVolume* nextVolume = nullptr;
511 const Trk::TrackParameters* navigationParameters =
512 cache.m_navigationParameters
513 ? cache.m_navigationParameters.get()
514 : combinedState;
515
516 nextNavigationCell = m_navigator->nextTrackingVolume(
517 ctx, *m_propagator, *navigationParameters, direction, trackingVolume);
518
519 nextVolume = nextNavigationCell.nextVolume;
520
521 std::unique_ptr<Trk::TrackParameters> nextNavigationParameters =
522 std::move(nextNavigationCell.parametersOnBoundary);
523
524 if (!nextVolume) {
525 // Reset the layer recall
526 resetRecallInformation(cache);
527 }
528
529 if (useBoundaryMaterialUpdate) {
530 // Check for two things:
531 // 1. If the next volume was found
532 // 2. If there is material associated with the boundary layer.
533 // If so, apply material effects update.
534
535 // Get layer associated with boundary surface.
536 const Trk::MaterialLayer * layerAtBoundary =
537 (nextNavigationCell.parametersOnBoundary)
538 ? (nextNavigationCell.parametersOnBoundary->associatedSurface())
539 .materialLayer()
540 : nullptr;
541 Trk::MultiComponentState matUpdatedState{};
542 if (nextVolume && layerAtBoundary) {
543 if (layerAtBoundary->layerMaterialProperties()) {
544 matUpdatedState = m_materialUpdator->postUpdate(
545 cache.m_materialEffectsCaches,
546 *(cache.m_stateAtBoundary),
547 *layerAtBoundary,
548 direction);
549 }
550 }
551
552 // If state has changed due to boundary material, modify state, parameters
553 // accordingly.
554 if (!matUpdatedState.empty()) {
555 addMultiComponentToCache(cache, std::move(matUpdatedState));
556 nextNavigationParameters =
557 cache.m_stateAtBoundary->begin()->params->uniqueClone();
558 }
559 }
560 // Update the rest of the boundary information in the cache
561 cache.m_navigationParameters = std::move(nextNavigationParameters);
562 cache.m_trackingVolume = nextVolume;
563}
const TrackingVolume * nextVolume(const Amg::Vector3D &gp, const Amg::Vector3D &dir, PropDirection pDir=alongMomentum) const
Return the next volume along the navigation stream.

◆ initialiseNavigation()

std::unique_ptr< Trk::TrackParameters > Trk::GsfExtrapolator::initialiseNavigation ( const EventContext & ctx,
Cache & cache,
const MultiComponentState & initialState,
const Surface & surface,
const Layer *& associatedLayer,
const TrackingVolume *& currentVolume,
const TrackingVolume *& destinationVolume,
Trk::PropDirection & direction ) const
private

Method to initialise navigation parameters including starting state, layer and volume, and destination volume.

Definition at line 893 of file GsfExtrapolator.cxx.

902{
903 //Get the highest weight parameters. We will just use those
904 const Trk::TrackParameters* combinedState = multiComponentState.begin()->params.get();
905 /* =============================================
906 Look for current volume
907 ============================================= */
908 // 1. See if the current layer is associated with a tracking volume
909 const Trk::Surface* associatedSurface = &(combinedState->associatedSurface());
910 currentLayer = associatedSurface ? associatedSurface->associatedLayer() : currentLayer;
911 currentVolume = currentLayer ? currentLayer->enclosingTrackingVolume() : currentVolume;
912 // If the association method failed
913 if (!currentVolume) {
914 //Try the recall in case the associatedSurface is the recall one
915 if (associatedSurface == cache.m_recallSurface) {
916 currentVolume = cache.m_recallTrackingVolume;
917 currentLayer = cache.m_recallLayer;
918 }
919 // Global search method if this fails
920 else {
921 // If the recall method fails reset the cache
922 resetRecallInformation(cache);
923 currentVolume = m_navigator->volume(ctx, combinedState->position());
924 currentLayer = currentVolume
925 ? currentVolume->associatedLayer(combinedState->position())
926 : nullptr;
927 }
928 }
929 /* =============================================
930 Determine the resolved direction
931 ============================================= */
932 std::unique_ptr<Trk::TrackParameters> referenceParameters =
933 currentVolume ? m_propagator->propagateParameters(
934 ctx, *combinedState, surface, direction, false,
936 : nullptr;
937 // Find concrete direction based on reference parameters
938 if (direction == Trk::anyDirection && referenceParameters) {
939 const Amg::Vector3D surfaceDirection(referenceParameters->position() -
940 combinedState->position());
941 direction = (surfaceDirection.dot(combinedState->momentum()) > 0.)
944 }
945 /* =============================================
946 Look for destination volume
947 ============================================= */
948 // See if the destination layer is associated with a tracking volume
949 destinationVolume = surface.associatedLayer()
950 ? surface.associatedLayer()->enclosingTrackingVolume()
951 : nullptr;
952 // Association failed
953 if (!destinationVolume) {
954 // See if the cached recall surface is the destination one
955 if (&surface == cache.m_recallSurface) {
956 destinationVolume = cache.m_recallTrackingVolume;
957 } else {
958 // Global search of tracking geometry to find the destination volume
959 destinationVolume = m_navigator->volume(
960 ctx, referenceParameters ? referenceParameters->position()
961 : surface.globalReferencePoint());
962 }
963 }
964 return referenceParameters;
965}
const TrackingVolume * enclosingTrackingVolume() const
get the confining TrackingVolume
virtual const Surface & associatedSurface() const override=0
Access to the Surface associated to the Parameters.
const Trk::Layer * associatedLayer() const
return the associated Layer
@ oppositeMomentum
@ alongMomentum

◆ initialize()

StatusCode Trk::GsfExtrapolator::initialize ( )
finaloverridevirtual

Definition at line 152 of file GsfExtrapolator.cxx.

153{
154
155 ATH_CHECK(m_propagator.retrieve());
156 ATH_CHECK(m_navigator.retrieve());
157 ATH_CHECK(m_materialUpdator.retrieve());
159 ? Trk::MagneticFieldProperties(Trk::FastField)
160 : Trk::MagneticFieldProperties(Trk::FullField);
161
162 return StatusCode::SUCCESS;
163}
#define ATH_CHECK
Evaluate an expression and check for errors.
BooleanProperty m_fastField
@ FastField
call the fast field access method of the FieldSvc
@ FullField
Field is set to be realistic, but within a given Volume.

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

const InterfaceID & Trk::IMultiStateExtrapolator::interfaceID ( )
inlinestaticinherited

AlgTool interface method.

Definition at line 75 of file IMultiStateExtrapolator.h.

76 {
78 };
static const InterfaceID IID_IMultiStateExtrapolator("IMultiStateExtrapolator", 1, 0)

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ particleHypothesis()

virtual Trk::ParticleHypothesis Trk::GsfExtrapolator::particleHypothesis ( ) const
inlinefinaloverridevirtual

Implements Trk::IMultiStateExtrapolator.

Definition at line 79 of file GsfExtrapolator.h.

79 {
80 return m_materialUpdator->particleHypothesis();
81 }

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_fastField

BooleanProperty Trk::GsfExtrapolator::m_fastField {this, "UseFastField", false}
private

Definition at line 174 of file GsfExtrapolator.h.

174{this, "UseFastField", false};

◆ m_fieldProperties

Trk::MagneticFieldProperties Trk::GsfExtrapolator::m_fieldProperties = Trk::FullField
private

Definition at line 176 of file GsfExtrapolator.h.

◆ m_materialUpdator

ToolHandle<IMaterialMixtureConvolution> Trk::GsfExtrapolator::m_materialUpdator
private
Initial value:
{
this, "GsfMaterialConvolution", "", "Gsf Material effects"}

Definition at line 172 of file GsfExtrapolator.h.

172 {
173 this, "GsfMaterialConvolution", "", "Gsf Material effects"};

◆ m_navigator

ToolHandle<INavigator> Trk::GsfExtrapolator::m_navigator
private
Initial value:
{this, "Navigator",
"Trk::Navigator/Navigator", ""}

Definition at line 170 of file GsfExtrapolator.h.

170 {this, "Navigator",
171 "Trk::Navigator/Navigator", ""};

◆ m_propagator

ToolHandle<IPropagator> Trk::GsfExtrapolator::m_propagator {this, "Propagator", "", ""}
private

Definition at line 169 of file GsfExtrapolator.h.

169{this, "Propagator", "", ""};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: