diff --git a/Core/include/Acts/Vertexing/AdaptiveMultiVertexFinder.hpp b/Core/include/Acts/Vertexing/AdaptiveMultiVertexFinder.hpp index 1ef31dd6a144b631e9b141358403b5237da834f4..0ae7a5ca1fc4da78281584031c5ae7a5c6f5b4a9 100644 --- a/Core/include/Acts/Vertexing/AdaptiveMultiVertexFinder.hpp +++ b/Core/include/Acts/Vertexing/AdaptiveMultiVertexFinder.hpp @@ -15,8 +15,7 @@ #include "Acts/Utilities/Units.hpp" #include "Acts/Vertexing/AMVFInfo.hpp" #include "Acts/Vertexing/TrackToVertexIPEstimator.hpp" -#include "Acts/Vertexing/VertexFinderOptions.hpp" -#include "Acts/Vertexing/VertexFitterOptions.hpp" +#include "Acts/Vertexing/VertexingOptions.hpp" namespace Acts { /// @class AdaptiveMultiVertexFinder @@ -68,7 +67,7 @@ class AdaptiveMultiVertexFinder { // Track linearizer Linearizer_t linearizer; - // Use a beam spot constraint, vertexConstraint in VertexFinderOptions + // Use a beam spot constraint, vertexConstraint in VertexingOptions // has to be set in this case bool useBeamSpotConstraint = true; @@ -189,12 +188,12 @@ class AdaptiveMultiVertexFinder { /// multi-vertex finding /// /// @param allTracks Input track collection - /// @param vFinderOptions Vertex finder options + /// @param vertexingOptions Vertexing options /// /// @return Vector of all reconstructed vertices Result<std::vector<Vertex<InputTrack_t>>> find( const std::vector<const InputTrack_t*>& allTracks, - const VertexFinderOptions<InputTrack_t>& vFinderOptions) const; + const VertexingOptions<InputTrack_t>& vertexingOptions) const; private: /// Configuration object @@ -218,13 +217,13 @@ class AdaptiveMultiVertexFinder { /// /// @param trackVector All tracks to be used for seeding /// @param currentConstraint Vertex constraint - /// @param vFinderOptions Vertex finder options + /// @param vertexingOptions Vertexing options /// /// @return The seed vertex Result<Vertex<InputTrack_t>> doSeeding( const std::vector<const InputTrack_t*>& trackVector, Vertex<InputTrack_t>& currentConstraint, - const VertexFinderOptions<InputTrack_t>& vFinderOptions) const; + const VertexingOptions<InputTrack_t>& vertexingOptions) const; /// @brief Estimates delta Z between a track and a vertex position /// @@ -239,19 +238,23 @@ class AdaptiveMultiVertexFinder { /// /// @param track The track /// @param vtx The vertex + /// @param vertexingOptions Vertexing options /// /// @return The IP significance - Result<double> getIPSignificance(const InputTrack_t* track, - const Vertex<InputTrack_t>& vtx) const; + Result<double> getIPSignificance( + const InputTrack_t* track, const Vertex<InputTrack_t>& vtx, + const VertexingOptions<InputTrack_t>& vertexingOptions) const; /// @brief Adds compatible track to vertex candidate /// /// @param tracks The tracks /// @param vtx The vertex candidate /// @param[out] fitterState The vertex fitter state + /// @param vertexingOptions Vertexing options Result<void> addCompatibleTracksToVertex( const std::vector<const InputTrack_t*>& tracks, Vertex<InputTrack_t>& vtx, - FitterState_t& fitterState) const; + FitterState_t& fitterState, + const VertexingOptions<InputTrack_t>& vertexingOptions) const; /// @brief Method that tries to recover from cases where no tracks /// were added to the vertex candidate after seeding @@ -262,13 +265,15 @@ class AdaptiveMultiVertexFinder { /// @param[out] vtx The vertex candidate /// @param currentConstraint Vertex constraint /// @param[out] fitterState The vertex fitter state + /// @param vertexingOptions Vertexing options /// /// return True if recovery was successful, false otherwise Result<bool> canRecoverFromNoCompatibleTracks( const std::vector<const InputTrack_t*>& allTracks, const std::vector<const InputTrack_t*>& seedTracks, Vertex<InputTrack_t>& vtx, const Vertex<InputTrack_t>& currentConstraint, - FitterState_t& fitterState) const; + FitterState_t& fitterState, + const VertexingOptions<InputTrack_t>& vertexingOptions) const; /// @brief Method that tries to prepare the vertex for the fit /// @@ -278,13 +283,15 @@ class AdaptiveMultiVertexFinder { /// @param[out] vtx The vertex candidate /// @param currentConstraint Vertex constraint /// @param[out] fitterState The vertex fitter state + /// @param vertexingOptions Vertexing options /// /// @return True if preparation was successful, false otherwise Result<bool> canPrepareVertexForFit( const std::vector<const InputTrack_t*>& allTracks, const std::vector<const InputTrack_t*>& seedTracks, Vertex<InputTrack_t>& vtx, const Vertex<InputTrack_t>& currentConstraint, - FitterState_t& fitterState) const; + FitterState_t& fitterState, + const VertexingOptions<InputTrack_t>& vertexingOptions) const; /// @brief Method that checks if vertex is a good vertex and if /// compatible tracks are available @@ -354,13 +361,13 @@ class AdaptiveMultiVertexFinder { /// @param allVerticesPtr Vector containing the actual addresses /// @param fitterState The current vertex fitter state /// @param oldFitterState The old vertex fitter state - /// @param vFitterOptions The vertex fitter options + /// @param vertexingOptions Vertexing options Result<void> deleteLastVertex( Vertex<InputTrack_t>& vtx, std::vector<std::unique_ptr<Vertex<InputTrack_t>>>& allVertices, std::vector<Vertex<InputTrack_t>*>& allVerticesPtr, FitterState_t& fitterState, FitterState_t& oldFitterState, - const VertexFitterOptions<InputTrack_t>& vFitterOptions) const; + const VertexingOptions<InputTrack_t>& vertexingOptions) const; /// @brief Prepares the output vector of vertices /// diff --git a/Core/include/Acts/Vertexing/AdaptiveMultiVertexFinder.ipp b/Core/include/Acts/Vertexing/AdaptiveMultiVertexFinder.ipp index a3dd9dd6a3e48be0b718cd1349839d193f638022..1653da1084726b8efc3f4b92643e5259a73a265e 100644 --- a/Core/include/Acts/Vertexing/AdaptiveMultiVertexFinder.ipp +++ b/Core/include/Acts/Vertexing/AdaptiveMultiVertexFinder.ipp @@ -11,7 +11,7 @@ template <typename vfitter_t, typename sfinder_t> auto Acts::AdaptiveMultiVertexFinder<vfitter_t, sfinder_t>::find( const std::vector<const InputTrack_t*>& allTracks, - const VertexFinderOptions<InputTrack_t>& vFinderOptions) const + const VertexingOptions<InputTrack_t>& vertexingOptions) const -> Result<std::vector<Vertex<InputTrack_t>>> { if (allTracks.empty()) { return VertexingError::EmptyInput; @@ -22,11 +22,6 @@ auto Acts::AdaptiveMultiVertexFinder<vfitter_t, sfinder_t>::find( // Seed tracks std::vector<const InputTrack_t*> seedTracks = allTracks; - // Construct the vertex fitter options from vertex finder options - VertexFitterOptions<InputTrack_t> vFitterOptions( - vFinderOptions.geoContext, vFinderOptions.magFieldContext, - vFinderOptions.vertexConstraint); - FitterState_t fitterState; std::vector<std::unique_ptr<Vertex<InputTrack_t>>> allVertices; @@ -47,9 +42,10 @@ auto Acts::AdaptiveMultiVertexFinder<vfitter_t, sfinder_t>::find( } else { allTracks = seedTracks; } - Vertex<InputTrack_t> currentConstraint = vFinderOptions.vertexConstraint; + Vertex<InputTrack_t> currentConstraint = vertexingOptions.vertexConstraint; // Retrieve seed vertex from all remaining seedTracks - auto seedResult = doSeeding(seedTracks, currentConstraint, vFinderOptions); + auto seedResult = + doSeeding(seedTracks, currentConstraint, vertexingOptions); if (!seedResult.ok()) { return seedResult.error(); } @@ -67,8 +63,9 @@ auto Acts::AdaptiveMultiVertexFinder<vfitter_t, sfinder_t>::find( allVerticesPtr.pop_back(); break; } - auto prepResult = canPrepareVertexForFit( - allTracks, seedTracks, vtxCandidate, currentConstraint, fitterState); + auto prepResult = canPrepareVertexForFit(allTracks, seedTracks, + vtxCandidate, currentConstraint, + fitterState, vertexingOptions); if (!prepResult.ok()) { return prepResult.error(); @@ -84,7 +81,7 @@ auto Acts::AdaptiveMultiVertexFinder<vfitter_t, sfinder_t>::find( // Perform the fit auto fitResult = m_cfg.vertexFitter.addVtxToFit( - fitterState, vtxCandidate, m_cfg.linearizer, vFitterOptions); + fitterState, vtxCandidate, m_cfg.linearizer, vertexingOptions); if (!fitResult.ok()) { return fitResult.error(); } @@ -118,7 +115,7 @@ auto Acts::AdaptiveMultiVertexFinder<vfitter_t, sfinder_t>::find( if (not keepVertex) { auto deleteVertexResult = deleteLastVertex(vtxCandidate, allVertices, allVerticesPtr, - fitterState, oldFitterState, vFitterOptions); + fitterState, oldFitterState, vertexingOptions); if (not deleteVertexResult.ok()) { return deleteVertexResult.error(); } @@ -133,9 +130,9 @@ template <typename vfitter_t, typename sfinder_t> auto Acts::AdaptiveMultiVertexFinder<vfitter_t, sfinder_t>::doSeeding( const std::vector<const InputTrack_t*>& trackVector, Vertex<InputTrack_t>& currentConstraint, - const VertexFinderOptions<InputTrack_t>& vFinderOptions) const + const VertexingOptions<InputTrack_t>& vertexingOptions) const -> Result<Vertex<InputTrack_t>> { - VertexFinderOptions<InputTrack_t> seedOptions = vFinderOptions; + VertexingOptions<InputTrack_t> seedOptions = vertexingOptions; seedOptions.vertexConstraint = currentConstraint; // Run seed finder auto seedResult = m_cfg.seedFinder.find(trackVector, seedOptions); @@ -184,7 +181,8 @@ auto Acts::AdaptiveMultiVertexFinder<vfitter_t, sfinder_t>::estimateDeltaZ( template <typename vfitter_t, typename sfinder_t> auto Acts::AdaptiveMultiVertexFinder<vfitter_t, sfinder_t>::getIPSignificance( - const InputTrack_t* track, const Vertex<InputTrack_t>& vtx) const + const InputTrack_t* track, const Vertex<InputTrack_t>& vtx, + const VertexingOptions<InputTrack_t>& vertexingOptions) const -> Result<double> { // TODO: In original implementation the covariance of the given vertex is set // to zero. I did the same here now, but consider removing this and just @@ -196,7 +194,9 @@ auto Acts::AdaptiveMultiVertexFinder<vfitter_t, sfinder_t>::getIPSignificance( newVtx.setFullCovariance(SpacePointSymMatrix::Zero()); } - auto estRes = m_cfg.ipEstimator.estimate(*track, newVtx); + auto estRes = + m_cfg.ipEstimator.estimate(*track, newVtx, vertexingOptions.geoContext, + vertexingOptions.magFieldContext); if (!estRes.ok()) { return estRes.error(); } @@ -214,12 +214,13 @@ auto Acts::AdaptiveMultiVertexFinder<vfitter_t, sfinder_t>::getIPSignificance( template <typename vfitter_t, typename sfinder_t> auto Acts::AdaptiveMultiVertexFinder<vfitter_t, sfinder_t>:: - addCompatibleTracksToVertex(const std::vector<const InputTrack_t*>& tracks, - Vertex<InputTrack_t>& vtx, - FitterState_t& fitterState) const + addCompatibleTracksToVertex( + const std::vector<const InputTrack_t*>& tracks, + Vertex<InputTrack_t>& vtx, FitterState_t& fitterState, + const VertexingOptions<InputTrack_t>& vertexingOptions) const -> Result<void> { for (const auto& trk : tracks) { - auto sigRes = getIPSignificance(trk, vtx); + auto sigRes = getIPSignificance(trk, vtx, vertexingOptions); if (!sigRes.ok()) { return sigRes.error(); } @@ -247,7 +248,9 @@ auto Acts::AdaptiveMultiVertexFinder<vfitter_t, sfinder_t>:: const std::vector<const InputTrack_t*>& seedTracks, Vertex<InputTrack_t>& vtx, const Vertex<InputTrack_t>& currentConstraint, - FitterState_t& fitterState) const -> Result<bool> { + FitterState_t& fitterState, + const VertexingOptions<InputTrack_t>& vertexingOptions) const + -> Result<bool> { // Recover from cases where no compatible tracks to vertex // candidate were found // TODO: This is for now how it's done in athena... this look a bit @@ -275,7 +278,8 @@ auto Acts::AdaptiveMultiVertexFinder<vfitter_t, sfinder_t>:: VertexInfo<InputTrack_t>(currentConstraint, vtx.fullPosition()); // Try to add compatible track with adapted vertex position - auto res = addCompatibleTracksToVertex(allTracks, vtx, fitterState); + auto res = addCompatibleTracksToVertex(allTracks, vtx, fitterState, + vertexingOptions); if (!res.ok()) { return Result<bool>::failure(res.error()); } @@ -298,24 +302,29 @@ auto Acts::AdaptiveMultiVertexFinder<vfitter_t, sfinder_t>:: template <typename vfitter_t, typename sfinder_t> auto Acts::AdaptiveMultiVertexFinder<vfitter_t, sfinder_t>:: - canPrepareVertexForFit(const std::vector<const InputTrack_t*>& allTracks, - const std::vector<const InputTrack_t*>& seedTracks, - Vertex<InputTrack_t>& vtx, - const Vertex<InputTrack_t>& currentConstraint, - FitterState_t& fitterState) const -> Result<bool> { + canPrepareVertexForFit( + const std::vector<const InputTrack_t*>& allTracks, + const std::vector<const InputTrack_t*>& seedTracks, + Vertex<InputTrack_t>& vtx, + const Vertex<InputTrack_t>& currentConstraint, + FitterState_t& fitterState, + const VertexingOptions<InputTrack_t>& vertexingOptions) const + -> Result<bool> { // Add vertex info to fitter state fitterState.vtxInfoMap[&vtx] = VertexInfo<InputTrack_t>(currentConstraint, vtx.fullPosition()); // Add all compatible tracks to vertex - auto resComp = addCompatibleTracksToVertex(allTracks, vtx, fitterState); + auto resComp = addCompatibleTracksToVertex(allTracks, vtx, fitterState, + vertexingOptions); if (!resComp.ok()) { return Result<bool>::failure(resComp.error()); } // Try to recover from cases where adding compatible track was not possible - auto resRec = canRecoverFromNoCompatibleTracks( - allTracks, seedTracks, vtx, currentConstraint, fitterState); + auto resRec = canRecoverFromNoCompatibleTracks(allTracks, seedTracks, vtx, + currentConstraint, fitterState, + vertexingOptions); if (!resRec.ok()) { return Result<bool>::failure(resRec.error()); } @@ -517,7 +526,7 @@ auto Acts::AdaptiveMultiVertexFinder<vfitter_t, sfinder_t>::deleteLastVertex( std::vector<std::unique_ptr<Vertex<InputTrack_t>>>& allVertices, std::vector<Vertex<InputTrack_t>*>& allVerticesPtr, FitterState_t& fitterState, FitterState_t& oldFitterState, - const VertexFitterOptions<InputTrack_t>& vFitterOptions) const + const VertexingOptions<InputTrack_t>& vertexingOptions) const -> Result<void> { allVertices.pop_back(); allVerticesPtr.pop_back(); @@ -542,7 +551,7 @@ auto Acts::AdaptiveMultiVertexFinder<vfitter_t, sfinder_t>::deleteLastVertex( // Do the fit with removed vertex auto fitResult = m_cfg.vertexFitter.fit(fitterState, allVerticesPtr, - m_cfg.linearizer, vFitterOptions); + m_cfg.linearizer, vertexingOptions); if (!fitResult.ok()) { return fitResult.error(); } diff --git a/Core/include/Acts/Vertexing/AdaptiveMultiVertexFitter.hpp b/Core/include/Acts/Vertexing/AdaptiveMultiVertexFitter.hpp index dc7c03bccba4209930436cffd2a9a20bf57f544a..eaafee956d1da2f83949e3fb0e1e2f162f7afd1a 100644 --- a/Core/include/Acts/Vertexing/AdaptiveMultiVertexFitter.hpp +++ b/Core/include/Acts/Vertexing/AdaptiveMultiVertexFitter.hpp @@ -18,7 +18,7 @@ #include "Acts/Vertexing/LinearizerConcept.hpp" #include "Acts/Vertexing/TrackAtVertex.hpp" #include "Acts/Vertexing/Vertex.hpp" -#include "Acts/Vertexing/VertexFitterOptions.hpp" +#include "Acts/Vertexing/VertexingOptions.hpp" #include <functional> @@ -162,13 +162,13 @@ class AdaptiveMultiVertexFitter { /// @param state The state object /// @param verticesToFit Vector containing all vertices to be fitted /// @param linearizer The track linearizer - /// @param vFitterOptions Vertex fitter options + /// @param vertexingOptions Vertexing options /// /// @return Result<void> object Result<void> fit( State& state, const std::vector<Vertex<InputTrack_t>*>& verticesToFit, const Linearizer_t& linearizer, - const VertexFitterOptions<InputTrack_t>& vFitterOptions) const; + const VertexingOptions<InputTrack_t>& vertexingOptions) const; /// @brief Adds new vertex to an existing multi-vertex fit /// and fits everything together (by invoking the fit_impl method): @@ -190,13 +190,13 @@ class AdaptiveMultiVertexFitter { /// @param state The state object /// @param newVertex New vertex to be added to fit /// @param linearizer The track linearizer - /// @param vFitterOptions Vertex fitter options + /// @param vertexingOptions Vertexing options /// /// @return Result<void> object Result<void> addVtxToFit( State& state, Vertex<InputTrack_t>& newVertex, const Linearizer_t& linearizer, - const VertexFitterOptions<InputTrack_t>& vFitterOptions) const; + const VertexingOptions<InputTrack_t>& vertexingOptions) const; private: /// Configuration object @@ -220,12 +220,12 @@ class AdaptiveMultiVertexFitter { /// /// @param state The state object /// @param linearizer The track linearizer - /// @param vFitterOptions Vertex fitter options + /// @param vertexingOptions Vertexing options /// /// @return Result<void> object Result<void> fitImpl( State& state, const Linearizer_t& linearizer, - const VertexFitterOptions<InputTrack_t>& vFitterOptions) const; + const VertexingOptions<InputTrack_t>& vertexingOptions) const; /// @brief Tests if vertex is already in list of vertices or not /// @@ -244,28 +244,30 @@ class AdaptiveMultiVertexFitter { /// with different vertices /// /// @param vtx The vertex object - /// @param vFitterOptions Vertex fitter options + /// @param vertexingOptions Vertexing options Result<void> prepareVertexForFit( State& state, Vertex<InputTrack_t>* vtx, - const VertexFitterOptions<InputTrack_t>& vFitterOptions) const; + const VertexingOptions<InputTrack_t>& vertexingOptions) const; /// @brief Sets vertexCompatibility for all TrackAtVertex objects /// at current vertex /// /// @param state The state object - /// @param geoContext The geometry context /// @param currentVtx Current vertex + /// @param vertexingOptions Vertexing options Result<void> setAllVertexCompatibilities( - State& state, const GeometryContext& geoContext, - Vertex<InputTrack_t>* currentVtx) const; + State& state, Vertex<InputTrack_t>* currentVtx, + const VertexingOptions<input_track_t>& vertexingOptions) const; /// @brief Sets weights to the track according to Eq.(5.46) in Ref.(1) /// and updates the vertices by calling the VertexUpdater /// /// @param state The state object /// @param linearizer The track linearizer - Result<void> setWeightsAndUpdate(State& state, - const Linearizer_t& linearizer) const; + /// @param vertexingOptions Vertexing options + Result<void> setWeightsAndUpdate( + State& state, const Linearizer_t& linearizer, + const VertexingOptions<input_track_t>& vertexingOptions) const; /// @brief Collects all compatibility values of the track `trk` /// at all vertices it is currently attached to and outputs diff --git a/Core/include/Acts/Vertexing/AdaptiveMultiVertexFitter.ipp b/Core/include/Acts/Vertexing/AdaptiveMultiVertexFitter.ipp index 4cdfd4732cc87604b715b27cbf74d683bcc952a3..053b9ed08264cdb883c349c8fa8eea8a37de0bf2 100644 --- a/Core/include/Acts/Vertexing/AdaptiveMultiVertexFitter.ipp +++ b/Core/include/Acts/Vertexing/AdaptiveMultiVertexFitter.ipp @@ -15,12 +15,12 @@ Acts::Result<void> Acts::AdaptiveMultiVertexFitter<input_track_t, linearizer_t>::fit( State& state, const std::vector<Vertex<input_track_t>*>& verticesToFit, const linearizer_t& linearizer, - const VertexFitterOptions<input_track_t>& vFitterOptions) const { + const VertexingOptions<input_track_t>& vertexingOptions) const { // Set all vertices to fit in the current state state.vertexCollection = verticesToFit; // Perform fit on all vertices simultaneously - auto fitRes = fitImpl(state, linearizer, vFitterOptions); + auto fitRes = fitImpl(state, linearizer, vertexingOptions); if (!fitRes.ok()) { return fitRes.error(); @@ -33,8 +33,8 @@ template <typename input_track_t, typename linearizer_t> Acts::Result<void> Acts::AdaptiveMultiVertexFitter<input_track_t, linearizer_t>::fitImpl( State& state, const linearizer_t& linearizer, - const VertexFitterOptions<input_track_t>& vFitterOptions) const { - auto& geoContext = vFitterOptions.geoContext; + const VertexingOptions<input_track_t>& vertexingOptions) const { + auto& geoContext = vertexingOptions.geoContext; // Reset annealing tool state.annealingState = AnnealingUtility::State(); @@ -71,7 +71,7 @@ Acts::AdaptiveMultiVertexFitter<input_track_t, linearizer_t>::fitImpl( // Relinearization needed, distance too big currentVtxInfo.relinearize = true; // Prepare for fit with new vertex position - prepareVertexForFit(state, currentVtx, vFitterOptions); + prepareVertexForFit(state, currentVtx, vertexingOptions); } // Determine if constraint vertex exist if (state.vtxInfoMap[currentVtx].constraintVertex.fullCovariance() != @@ -94,13 +94,13 @@ Acts::AdaptiveMultiVertexFitter<input_track_t, linearizer_t>::fitImpl( // Set vertexCompatibility for all TrackAtVertex objects // at current vertex - setAllVertexCompatibilities(state, geoContext, currentVtx); + setAllVertexCompatibilities(state, currentVtx, vertexingOptions); } // End loop over vertex collection // Now after having estimated all compatibilities of all tracks at // all vertices, run again over all vertices to set track weights // and update the vertex - setWeightsAndUpdate(state, linearizer); + setWeightsAndUpdate(state, linearizer, vertexingOptions); if (!state.annealingState.equilibriumReached) { m_cfg.annealingTool.anneal(state.annealingState); } @@ -123,7 +123,7 @@ Acts::Result<void> Acts::AdaptiveMultiVertexFitter<input_track_t, linearizer_t>::addVtxToFit( State& state, Vertex<input_track_t>& newVertex, const linearizer_t& linearizer, - const VertexFitterOptions<input_track_t>& vFitterOptions) const { + const VertexingOptions<input_track_t>& vertexingOptions) const { if (state.vtxInfoMap[&newVertex].trackLinks.empty()) { return VertexingError::EmptyInput; } @@ -132,7 +132,7 @@ Acts::AdaptiveMultiVertexFitter<input_track_t, linearizer_t>::addVtxToFit( // Prepares vtx and tracks for fast estimation method of their // compatibility with vertex - auto res = prepareVertexForFit(state, &newVertex, vFitterOptions); + auto res = prepareVertexForFit(state, &newVertex, vertexingOptions); if (!res.ok()) { return res.error(); } @@ -178,7 +178,7 @@ Acts::AdaptiveMultiVertexFitter<input_track_t, linearizer_t>::addVtxToFit( state.vertexCollection = verticesToFit; // Perform fit on all added vertices - auto fitRes = fitImpl(state, linearizer, vFitterOptions); + auto fitRes = fitImpl(state, linearizer, vertexingOptions); if (!fitRes.ok()) { return fitRes.error(); } @@ -199,17 +199,17 @@ template <typename input_track_t, typename linearizer_t> Acts::Result<void> Acts:: AdaptiveMultiVertexFitter<input_track_t, linearizer_t>::prepareVertexForFit( State& state, Vertex<input_track_t>* vtx, - const VertexFitterOptions<input_track_t>& vFitterOptions) const { + const VertexingOptions<input_track_t>& vertexingOptions) const { // The current vertex info object auto& currentVtxInfo = state.vtxInfoMap[vtx]; // The seed position const Vector3D& seedPos = currentVtxInfo.seedPosition.template head<3>(); - auto& geoContext = vFitterOptions.geoContext; // Loop over all tracks at current vertex for (const auto& trk : currentVtxInfo.trackLinks) { auto res = m_cfg.ipEst.getParamsAtClosestApproach( - geoContext, m_extractParameters(*trk), seedPos); + vertexingOptions.geoContext, vertexingOptions.magFieldContext, + m_extractParameters(*trk), seedPos); if (!res.ok()) { return res.error(); } @@ -222,8 +222,9 @@ Acts::Result<void> Acts:: template <typename input_track_t, typename linearizer_t> Acts::Result<void> Acts::AdaptiveMultiVertexFitter<input_track_t, linearizer_t>:: - setAllVertexCompatibilities(State& state, const GeometryContext& geoContext, - Vertex<input_track_t>* currentVtx) const { + setAllVertexCompatibilities( + State& state, Vertex<input_track_t>* currentVtx, + const VertexingOptions<input_track_t>& vertexingOptions) const { VertexInfo<input_track_t>& currentVtxInfo = state.vtxInfoMap[currentVtx]; // Loop over tracks at current vertex and @@ -236,7 +237,8 @@ Acts::AdaptiveMultiVertexFitter<input_track_t, linearizer_t>:: if (currentVtxInfo.ip3dParams.find(trk) == currentVtxInfo.ip3dParams.end()) { auto res = m_cfg.ipEst.getParamsAtClosestApproach( - geoContext, m_extractParameters(*trk), + vertexingOptions.geoContext, vertexingOptions.magFieldContext, + m_extractParameters(*trk), VectorHelpers::position(currentVtxInfo.linPoint)); if (!res.ok()) { return res.error(); @@ -246,7 +248,7 @@ Acts::AdaptiveMultiVertexFitter<input_track_t, linearizer_t>:: } // Set compatibility with current vertex auto compRes = m_cfg.ipEst.getVertexCompatibility( - geoContext, &(currentVtxInfo.ip3dParams.at(trk)), + vertexingOptions.geoContext, &(currentVtxInfo.ip3dParams.at(trk)), VectorHelpers::position(currentVtxInfo.oldPosition)); if (!compRes.ok()) { return compRes.error(); @@ -257,10 +259,10 @@ Acts::AdaptiveMultiVertexFitter<input_track_t, linearizer_t>:: } template <typename input_track_t, typename linearizer_t> -Acts::Result<void> Acts::AdaptiveMultiVertexFitter< - input_track_t, linearizer_t>::setWeightsAndUpdate(State& state, - const linearizer_t& - linearizer) const { +Acts::Result<void> Acts:: + AdaptiveMultiVertexFitter<input_track_t, linearizer_t>::setWeightsAndUpdate( + State& state, const linearizer_t& linearizer, + const VertexingOptions<input_track_t>& vertexingOptions) const { for (auto vtx : state.vertexCollection) { VertexInfo<input_track_t>& currentVtxInfo = state.vtxInfoMap[vtx]; @@ -279,7 +281,8 @@ Acts::Result<void> Acts::AdaptiveMultiVertexFitter< BoundSymMatrix::Zero() || state.vtxInfoMap[vtx].relinearize) { auto result = linearizer.linearizeTrack( - m_extractParameters(*trk), state.vtxInfoMap[vtx].oldPosition); + m_extractParameters(*trk), state.vtxInfoMap[vtx].oldPosition, + vertexingOptions.geoContext, vertexingOptions.magFieldContext); if (!result.ok()) { return result.error(); } diff --git a/Core/include/Acts/Vertexing/DummyVertexFitter.hpp b/Core/include/Acts/Vertexing/DummyVertexFitter.hpp index 2e4170db3c75f156d98e476c1dd8ffa70d1ecce8..810536bed7b12d340a72980aaf4c52d463180dfa 100644 --- a/Core/include/Acts/Vertexing/DummyVertexFitter.hpp +++ b/Core/include/Acts/Vertexing/DummyVertexFitter.hpp @@ -11,7 +11,7 @@ #include "Acts/EventData/TrackParameters.hpp" #include "Acts/Utilities/Result.hpp" #include "Acts/Vertexing/Vertex.hpp" -#include "Acts/Vertexing/VertexFitterOptions.hpp" +#include "Acts/Vertexing/VertexingOptions.hpp" namespace Acts { @@ -36,7 +36,7 @@ class DummyVertexFitter { /// @brief Dummy fit method Result<Vertex<input_track_t>> fit( const std::vector<input_track_t>&, const linearizer_t&, - const VertexFitterOptions<input_track_t>&) const; + const VertexingOptions<input_track_t>&) const; }; } // namespace Acts diff --git a/Core/include/Acts/Vertexing/FullBilloirVertexFitter.hpp b/Core/include/Acts/Vertexing/FullBilloirVertexFitter.hpp index b7aee51db019b3e2116fc49e86951544976ab816..0e08121c3ceee0513d38941183b41c3dcb2ace83 100644 --- a/Core/include/Acts/Vertexing/FullBilloirVertexFitter.hpp +++ b/Core/include/Acts/Vertexing/FullBilloirVertexFitter.hpp @@ -13,7 +13,7 @@ #include "Acts/Vertexing/HelicalTrackLinearizer.hpp" #include "Acts/Vertexing/LinearizerConcept.hpp" #include "Acts/Vertexing/Vertex.hpp" -#include "Acts/Vertexing/VertexFitterOptions.hpp" +#include "Acts/Vertexing/VertexingOptions.hpp" namespace Acts { /// @class FullBilloirVertexFitter @@ -65,13 +65,13 @@ class FullBilloirVertexFitter { /// /// @param paramVector Vector of track objects to fit vertex to /// @param linearizer The track linearizer - /// @param vFitterOptions Vertex fitter options + /// @param vertexingOptions Vertexing options /// /// @return Fitted vertex Result<Vertex<input_track_t>> fit( const std::vector<const input_track_t*>& paramVector, const linearizer_t& linearizer, - const VertexFitterOptions<input_track_t>& vFitterOptions) const; + const VertexingOptions<input_track_t>& vertexingOptions) const; private: /// Configuration object diff --git a/Core/include/Acts/Vertexing/FullBilloirVertexFitter.ipp b/Core/include/Acts/Vertexing/FullBilloirVertexFitter.ipp index 5c65f5543b4e7a37c2e078cbfa5010ee9b40c0f5..5ee028ada573aca71bc4593de3c2c2ab01929119 100644 --- a/Core/include/Acts/Vertexing/FullBilloirVertexFitter.ipp +++ b/Core/include/Acts/Vertexing/FullBilloirVertexFitter.ipp @@ -65,7 +65,7 @@ Acts::Result<Acts::Vertex<input_track_t>> Acts::FullBilloirVertexFitter<input_track_t, linearizer_t>::fit( const std::vector<const input_track_t*>& paramVector, const linearizer_t& linearizer, - const VertexFitterOptions<input_track_t>& vFitterOptions) const { + const VertexingOptions<input_track_t>& vertexingOptions) const { double chi2 = std::numeric_limits<double>::max(); double newChi2 = 0; unsigned int nTracks = paramVector.size(); @@ -84,7 +84,7 @@ Acts::FullBilloirVertexFitter<input_track_t, linearizer_t>::fit( // Determine if we do contraint fit or not by checking if an // invertible non-zero constraint vertex covariance is given bool isConstraintFit = false; - if (vFitterOptions.vertexConstraint.covariance().determinant() != 0) { + if (vertexingOptions.vertexConstraint.covariance().determinant() != 0) { isConstraintFit = true; ndf += 3; } @@ -93,7 +93,7 @@ Acts::FullBilloirVertexFitter<input_track_t, linearizer_t>::fit( std::vector<Vector3D> trackMomenta; - SpacePointVector linPoint(vFitterOptions.vertexConstraint.fullPosition()); + SpacePointVector linPoint(vertexingOptions.vertexConstraint.fullPosition()); Vertex<input_track_t> fittedVertex; @@ -114,7 +114,9 @@ Acts::FullBilloirVertexFitter<input_track_t, linearizer_t>::fit( trackMomenta.push_back(Vector3D(phi, theta, qop)); } - auto result = linearizer.linearizeTrack(trackParams, linPoint); + auto result = linearizer.linearizeTrack(trackParams, linPoint, + vertexingOptions.geoContext, + vertexingOptions.magFieldContext); if (result.ok()) { const auto& linTrack = *result; const auto& parametersAtPCA = linTrack.parametersAtPCA; @@ -194,18 +196,13 @@ Acts::FullBilloirVertexFitter<input_track_t, linearizer_t>::fit( billoirVertex.Amat - billoirVertex.BCBmat; // VwgtMat = Amat-sum{BiMat*Ci^-1*BiMat^T} if (isConstraintFit) { - SpacePointVector posInBilloirFrame; // this will be 0 for first iteration but != 0 from second on - posInBilloirFrame[0] = - vFitterOptions.vertexConstraint.position()[0] - linPoint[0]; - posInBilloirFrame[1] = - vFitterOptions.vertexConstraint.position()[1] - linPoint[1]; - posInBilloirFrame[2] = - vFitterOptions.vertexConstraint.position()[2] - linPoint[2]; - - Vdel += vFitterOptions.vertexConstraint.fullCovariance().inverse() * + SpacePointVector posInBilloirFrame = + vertexingOptions.vertexConstraint.fullPosition() - linPoint; + + Vdel += vertexingOptions.vertexConstraint.fullCovariance().inverse() * posInBilloirFrame; - VwgtMat += vFitterOptions.vertexConstraint.fullCovariance().inverse(); + VwgtMat += vertexingOptions.vertexConstraint.fullCovariance().inverse(); } // cov(deltaV) = VwgtMat^-1 @@ -223,9 +220,7 @@ Acts::FullBilloirVertexFitter<input_track_t, linearizer_t>::fit( (bTrack.CiInv) * (bTrack.UiVec - bTrack.BiMat.transpose() * deltaV); // update track momenta - trackMomenta[iTrack][0] += deltaP[0]; - trackMomenta[iTrack][1] += deltaP[1]; - trackMomenta[iTrack][2] += deltaP[2]; + trackMomenta[iTrack] += deltaP; // correct for 2PI / PI periodicity auto correctedPhiTheta = detail::ensureThetaBounds( @@ -284,20 +279,19 @@ Acts::FullBilloirVertexFitter<input_track_t, linearizer_t>::fit( } if (isConstraintFit) { - Vector3D deltaTrk; // last term will also be 0 again but only in the first iteration // = calc. vtx in billoir frame - ( isConstraintFit pos. in billoir // frame ) - deltaTrk[0] = deltaV[0] - (vFitterOptions.vertexConstraint.position()[0] - - linPoint[0]); - deltaTrk[1] = deltaV[1] - (vFitterOptions.vertexConstraint.position()[1] - - linPoint[1]); - deltaTrk[2] = deltaV[2] - (vFitterOptions.vertexConstraint.position()[2] - - linPoint[2]); + + SpacePointVector deltaTrk = + deltaV - + (vertexingOptions.vertexConstraint.fullPosition() - linPoint); + newChi2 += (deltaTrk.transpose()) - .dot(vFitterOptions.vertexConstraint.covariance().inverse() * - deltaTrk); + .dot( + vertexingOptions.vertexConstraint.fullCovariance().inverse() * + deltaTrk); } if (!std::isnormal(newChi2)) { @@ -328,7 +322,7 @@ Acts::FullBilloirVertexFitter<input_track_t, linearizer_t>::fit( paramVec << 0., 0., trackMomenta[iTrack](0), trackMomenta[iTrack](1), trackMomenta[iTrack](2), 0.; - BoundParameters refittedParams(vFitterOptions.geoContext, + BoundParameters refittedParams(vertexingOptions.geoContext, covDeltaPmat[iTrack], paramVec, perigee); TrackAtVertex<input_track_t> trackVx(bTrack.chi2, refittedParams, diff --git a/Core/include/Acts/Vertexing/HelicalTrackLinearizer.hpp b/Core/include/Acts/Vertexing/HelicalTrackLinearizer.hpp index d2b6bedc2a4bde7c8cd3c83b2e41c45d64ec8bae..c24f7a460651a4d5038bdb3842129fae79a534b8 100644 --- a/Core/include/Acts/Vertexing/HelicalTrackLinearizer.hpp +++ b/Core/include/Acts/Vertexing/HelicalTrackLinearizer.hpp @@ -42,8 +42,6 @@ namespace Acts { template <typename propagator_t, typename propagator_options_t = PropagatorOptions<>> class HelicalTrackLinearizer { - using PropagatorOptions_t = propagator_options_t; - public: using Propagator_t = propagator_t; using BField_t = typename Propagator_t::Stepper::BField; @@ -54,40 +52,22 @@ class HelicalTrackLinearizer { /// /// @param bIn The magnetic field /// @param prop The propagator - /// @param propOptions The propagator options - /// @param doBackwardPropagation Set the propagation direction to backward - Config(const BField_t& bIn, std::shared_ptr<Propagator_t> prop, - PropagatorOptions_t propOptions, bool doBackwardPropagation = true) - : bField(bIn), - propagator(std::move(prop)), - pOptions(std::move(propOptions)) { - if (doBackwardPropagation) { - pOptions.direction = backward; - } - } + Config(const BField_t& bIn, std::shared_ptr<Propagator_t> prop) + : bField(bIn), propagator(std::move(prop)) {} /// @brief Config constructor if BField_t == NullBField (no B-Field /// provided) /// /// @param prop The propagator - /// @param propOptions The propagator options - /// @param doBackwardPropagation Set the propagation direction to backward template <typename T = BField_t, std::enable_if_t<std::is_same<T, NullBField>::value, int> = 0> - Config(std::shared_ptr<Propagator_t> prop, PropagatorOptions_t propOptions, - bool doBackwardPropagation = true) - : propagator(std::move(prop)), pOptions(std::move(propOptions)) { - if (doBackwardPropagation) { - pOptions.direction = backward; - } - } + Config(std::shared_ptr<Propagator_t> prop) : propagator(std::move(prop)) {} // The magnetic field BField_t bField; // The propagator std::shared_ptr<Propagator_t> propagator; - // The propagator options - PropagatorOptions_t pOptions; + // Minimum q/p value double minQoP = 1e-15; // Maximum curvature value @@ -104,10 +84,14 @@ class HelicalTrackLinearizer { /// /// @param params Parameters to linearize /// @param linPoint Linearization point + /// @param gctx The geometry context + /// @param mctx The magnetic field context /// /// @return Linearized track Result<LinearizedTrack> linearizeTrack( - const BoundParameters& params, const SpacePointVector& linPoint) const; + const BoundParameters& params, const SpacePointVector& linPoint, + const Acts::GeometryContext& gctx, + const Acts::MagneticFieldContext& mctx) const; private: /// Configuration object diff --git a/Core/include/Acts/Vertexing/HelicalTrackLinearizer.ipp b/Core/include/Acts/Vertexing/HelicalTrackLinearizer.ipp index d1a8e16bbf34e9ad1a2f3e794af5f3d91af3e845..4f75c4c9581069e74697e1582570ffc16c13e52c 100644 --- a/Core/include/Acts/Vertexing/HelicalTrackLinearizer.ipp +++ b/Core/include/Acts/Vertexing/HelicalTrackLinearizer.ipp @@ -11,16 +11,21 @@ template <typename propagator_t, typename propagator_options_t> Acts::Result<Acts::LinearizedTrack> Acts:: HelicalTrackLinearizer<propagator_t, propagator_options_t>::linearizeTrack( - const BoundParameters& params, const SpacePointVector& linPoint) const { + const BoundParameters& params, const SpacePointVector& linPoint, + const Acts::GeometryContext& gctx, + const Acts::MagneticFieldContext& mctx) const { Vector3D linPointPos = VectorHelpers::position(linPoint); const std::shared_ptr<PerigeeSurface> perigeeSurface = Surface::makeShared<PerigeeSurface>(linPointPos); + // Create propagator options + propagator_options_t pOptions(gctx, mctx); + pOptions.direction = backward; + const BoundParameters* endParams = nullptr; // Do the propagation to linPointPos - auto result = - m_cfg.propagator->propagate(params, *perigeeSurface, m_cfg.pOptions); + auto result = m_cfg.propagator->propagate(params, *perigeeSurface, pOptions); if (result.ok()) { endParams = (*result).endParameters.get(); diff --git a/Core/include/Acts/Vertexing/ImpactPoint3dEstimator.hpp b/Core/include/Acts/Vertexing/ImpactPoint3dEstimator.hpp index 943f9adec3e2bfc68a727e9122c9761b5d5ef677..f2358e7b668d0e39a81106139587cb5871bdbb1f 100644 --- a/Core/include/Acts/Vertexing/ImpactPoint3dEstimator.hpp +++ b/Core/include/Acts/Vertexing/ImpactPoint3dEstimator.hpp @@ -34,40 +34,21 @@ class ImpactPoint3dEstimator { /// /// @param bIn The magnetic field /// @param prop The propagator - /// @param propOptions The propagator options - /// @param doBackwardPropagation Set the propagation direction to backward - Config(const BField_t& bIn, std::shared_ptr<propagator_t> prop, - propagator_options_t propOptions, bool doBackwardPropagation = true) - : bField(bIn), - propagator(std::move(prop)), - pOptions(std::move(propOptions)) { - if (doBackwardPropagation) { - pOptions.direction = backward; - } - } + Config(const BField_t& bIn, std::shared_ptr<propagator_t> prop) + : bField(bIn), propagator(std::move(prop)) {} /// @brief Config constructor if BField_t == NullBField (no B-Field /// provided) /// /// @param prop The propagator - /// @param propOptions The propagator options - /// @param doBackwardPropagation Set the propagation direction to backward template <typename T = BField_t, std::enable_if_t<std::is_same<T, NullBField>::value, int> = 0> - Config(std::shared_ptr<propagator_t> prop, propagator_options_t propOptions, - bool doBackwardPropagation = true) - : propagator(std::move(prop)), pOptions(std::move(propOptions)) { - if (doBackwardPropagation) { - pOptions.direction = backward; - } - } + Config(std::shared_ptr<propagator_t> prop) : propagator(std::move(prop)) {} /// Magnetic field BField_t bField; /// Propagator std::shared_ptr<propagator_t> propagator; - // The propagator options - propagator_options_t pOptions; /// Max. number of iterations in Newton method int maxIterations = 20; /// Desired precision in deltaPhi in Newton method @@ -103,13 +84,14 @@ class ImpactPoint3dEstimator { /// given reference point (vertex). /// /// @param gctx The geometry context + /// @param mctx The magnetic field context /// @param trkParams Track parameters /// @param vtxPos Reference position (vertex) /// /// @return New track params Result<std::unique_ptr<const BoundParameters>> getParamsAtClosestApproach( - const GeometryContext& gctx, const BoundParameters& trkParams, - const Vector3D& vtxPos) const; + const GeometryContext& gctx, const Acts::MagneticFieldContext& mctx, + const BoundParameters& trkParams, const Vector3D& vtxPos) const; /// @brief Estimates the compatibility of a /// track to a vertex position based on the 3d diff --git a/Core/include/Acts/Vertexing/ImpactPoint3dEstimator.ipp b/Core/include/Acts/Vertexing/ImpactPoint3dEstimator.ipp index 3ed4680858b4b940fed2102b69d2969c5f78a238..d3b1cf6e1fec07f2bed53980079f304211770f35 100644 --- a/Core/include/Acts/Vertexing/ImpactPoint3dEstimator.ipp +++ b/Core/include/Acts/Vertexing/ImpactPoint3dEstimator.ipp @@ -38,6 +38,7 @@ Acts::Result<std::unique_ptr<const Acts::BoundParameters>> Acts::ImpactPoint3dEstimator<input_track_t, propagator_t, propagator_options_t>:: getParamsAtClosestApproach(const GeometryContext& gctx, + const Acts::MagneticFieldContext& mctx, const BoundParameters& trkParams, const Vector3D& vtxPos) const { Vector3D deltaR; @@ -70,9 +71,12 @@ Acts::ImpactPoint3dEstimator<input_track_t, propagator_t, Surface::makeShared<PlaneSurface>( std::make_shared<Transform3D>(thePlane)); + // Create propagator options + propagator_options_t pOptions(gctx, mctx); + pOptions.direction = backward; + // Do the propagation to linPointPos - auto result = - m_cfg.propagator->propagate(trkParams, *planeSurface, m_cfg.pOptions); + auto result = m_cfg.propagator->propagate(trkParams, *planeSurface, pOptions); if (result.ok()) { return std::move((*result).endParameters); } else { diff --git a/Core/include/Acts/Vertexing/IterativeVertexFinder.hpp b/Core/include/Acts/Vertexing/IterativeVertexFinder.hpp index 9ba61ed22804736ae418cf1de41bad8fcf71779f..36983f5309c89bbc0a746d1d7558c13860763230 100644 --- a/Core/include/Acts/Vertexing/IterativeVertexFinder.hpp +++ b/Core/include/Acts/Vertexing/IterativeVertexFinder.hpp @@ -17,8 +17,8 @@ #include "Acts/Vertexing/HelicalTrackLinearizer.hpp" #include "Acts/Vertexing/ImpactPoint3dEstimator.hpp" #include "Acts/Vertexing/Vertex.hpp" -#include "Acts/Vertexing/VertexFinderOptions.hpp" #include "Acts/Vertexing/VertexFitterConcept.hpp" +#include "Acts/Vertexing/VertexingOptions.hpp" #include "Acts/Vertexing/ZScanVertexFinder.hpp" namespace Acts { @@ -137,12 +137,12 @@ class IterativeVertexFinder { /// @brief Finds vertices corresponding to input trackVector /// /// @param trackVector Input tracks - /// @param vFinderOptions Vertex finder options + /// @param vertexingOptions Vertexing options /// /// @return Collection of vertices found by finder Result<std::vector<Vertex<InputTrack_t>>> find( const std::vector<const InputTrack_t*>& trackVector, - const VertexFinderOptions<InputTrack_t>& vFinderOptions) const; + const VertexingOptions<InputTrack_t>& vertexingOptions) const; private: /// Configuration object @@ -164,10 +164,10 @@ class IterativeVertexFinder { /// @brief Method that calls seed finder to retrieve a vertex seed /// /// @param seedTracks Seeding tracks - /// @param vFinderOptions Vertex finder options + /// @param vertexingOptions Vertexing options Result<Vertex<InputTrack_t>> getVertexSeed( const std::vector<const InputTrack_t*>& seedTracks, - const VertexFinderOptions<InputTrack_t>& vFinderOptions) const; + const VertexingOptions<InputTrack_t>& vertexingOptions) const; /// @brief Removes all tracks in perigeesToFit from seedTracks /// @@ -180,9 +180,11 @@ class IterativeVertexFinder { /// a given track is to a given vertex /// /// @param params Track parameters - /// @param vertex Vertex - Result<double> getCompatibility(const BoundParameters& params, - const Vertex<InputTrack_t>& vertex) const; + /// @param vertex The vertex + /// @param vertexingOptions Vertexing options + Result<double> getCompatibility( + const BoundParameters& params, const Vertex<InputTrack_t>& vertex, + const VertexingOptions<InputTrack_t>& vertexingOptions) const; /// @brief Function that removes used tracks compatible with /// current vertex (`myVertex`) from `perigeesToFit` and `seedTracks` @@ -191,10 +193,12 @@ class IterativeVertexFinder { /// @param myVertex Current vertex /// @param perigeesToFit Tracks used to fit `myVertex` /// @param seedTracks Tracks used for vertex seeding + /// @param vertexingOptions Vertexing options Result<void> removeUsedCompatibleTracks( Vertex<InputTrack_t>& myVertex, std::vector<const InputTrack_t*>& perigeesToFit, - std::vector<const InputTrack_t*>& seedTracks) const; + std::vector<const InputTrack_t*>& seedTracks, + const VertexingOptions<InputTrack_t>& vertexingOptions) const; /// @brief Function that fills vector with tracks compatible with seed vertex /// @@ -202,13 +206,13 @@ class IterativeVertexFinder { /// @param seedVertex Seed vertex /// @param perigeesToFitOut Perigees to fit /// @param perigeesToFitSplitVertexOut Perigees to fit split vertex - /// @param vFinderOptions Vertex finder options + /// @param vertexingOptions Vertexing options Result<void> fillPerigeesToFit( const std::vector<const InputTrack_t*>& perigeeList, const Vertex<InputTrack_t>& seedVertex, std::vector<const InputTrack_t*>& perigeesToFitOut, std::vector<const InputTrack_t*>& perigeesToFitSplitVertexOut, - const VertexFinderOptions<InputTrack_t>& vFinderOptions) const; + const VertexingOptions<InputTrack_t>& vertexingOptions) const; /// @brief Function that reassigns tracks from other vertices /// to the current vertex if they are more compatible @@ -218,7 +222,7 @@ class IterativeVertexFinder { /// @param perigeesToFit Perigees to fit vector /// @param seedTracks Seed tracks vector /// @param origTracks Vector of original track objects - /// @param vFitterOptions Vertex fitter options + /// @param vertexingOptions Vertexing options /// /// @return Bool if currentVertex is still a good vertex Result<bool> reassignTracksToNewVertex( @@ -227,7 +231,7 @@ class IterativeVertexFinder { std::vector<const InputTrack_t*>& perigeesToFit, std::vector<const InputTrack_t*>& seedTracks, const std::vector<const InputTrack_t*>& origTracks, - const VertexFitterOptions<InputTrack_t>& vFitterOptions) const; + const VertexingOptions<InputTrack_t>& vertexingOptions) const; /// @brief Counts all tracks that are significant for a vertex /// diff --git a/Core/include/Acts/Vertexing/IterativeVertexFinder.ipp b/Core/include/Acts/Vertexing/IterativeVertexFinder.ipp index 83b16e07e29cdc162f17a8a9228f957e1dc6df6f..729dd830cf5cd6f951d3e436aea54d49c9f1c770 100644 --- a/Core/include/Acts/Vertexing/IterativeVertexFinder.ipp +++ b/Core/include/Acts/Vertexing/IterativeVertexFinder.ipp @@ -6,23 +6,16 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -#include "Acts/Vertexing/VertexFitterOptions.hpp" - template <typename vfitter_t, typename sfinder_t> auto Acts::IterativeVertexFinder<vfitter_t, sfinder_t>::find( const std::vector<const InputTrack_t*>& trackVector, - const VertexFinderOptions<InputTrack_t>& vFinderOptions) const + const VertexingOptions<InputTrack_t>& vertexingOptions) const -> Result<std::vector<Vertex<InputTrack_t>>> { // Original tracks const std::vector<const InputTrack_t*>& origTracks = trackVector; // Tracks for seeding std::vector<const InputTrack_t*> seedTracks = trackVector; - // Construct the vertex fitter options from vertex finder options - VertexFitterOptions<InputTrack_t> vFitterOptions( - vFinderOptions.geoContext, vFinderOptions.magFieldContext, - vFinderOptions.vertexConstraint); - // List of vertices to be filled below std::vector<Vertex<InputTrack_t>> vertexCollection; @@ -30,7 +23,7 @@ auto Acts::IterativeVertexFinder<vfitter_t, sfinder_t>::find( // begin iterating while (seedTracks.size() > 1 && nInterations < m_cfg.maxVertices) { /// Begin seeding - auto seedRes = getVertexSeed(seedTracks, vFinderOptions); + auto seedRes = getVertexSeed(seedTracks, vertexingOptions); if (!seedRes.ok()) { return seedRes.error(); } @@ -45,7 +38,7 @@ auto Acts::IterativeVertexFinder<vfitter_t, sfinder_t>::find( // Fill vector with tracks to fit, only compatible with seed: auto res = fillPerigeesToFit(seedTracks, seedVertex, perigeesToFit, - perigeesToFitSplitVertex, vFinderOptions); + perigeesToFitSplitVertex, vertexingOptions); if (!res.ok()) { return res.error(); @@ -59,7 +52,7 @@ auto Acts::IterativeVertexFinder<vfitter_t, sfinder_t>::find( if (m_cfg.useBeamConstraint && !perigeesToFit.empty()) { auto fitResult = m_cfg.vertexFitter.fit(perigeesToFit, m_cfg.linearizer, - vFitterOptions); + vertexingOptions); if (fitResult.ok()) { currentVertex = std::move(*fitResult); } else { @@ -67,7 +60,7 @@ auto Acts::IterativeVertexFinder<vfitter_t, sfinder_t>::find( } } else if (!m_cfg.useBeamConstraint && perigeesToFit.size() > 1) { auto fitResult = m_cfg.vertexFitter.fit(perigeesToFit, m_cfg.linearizer, - vFitterOptions); + vertexingOptions); if (fitResult.ok()) { currentVertex = std::move(*fitResult); } else { @@ -75,8 +68,8 @@ auto Acts::IterativeVertexFinder<vfitter_t, sfinder_t>::find( } } if (m_cfg.createSplitVertices && perigeesToFitSplitVertex.size() > 1) { - auto fitResult = m_cfg.vertexFitter.fit(perigeesToFitSplitVertex, - m_cfg.linearizer, vFitterOptions); + auto fitResult = m_cfg.vertexFitter.fit( + perigeesToFitSplitVertex, m_cfg.linearizer, vertexingOptions); if (fitResult.ok()) { currentSplitVertex = std::move(*fitResult); } else { @@ -107,7 +100,7 @@ auto Acts::IterativeVertexFinder<vfitter_t, sfinder_t>::find( auto result = reassignTracksToNewVertex(vertexCollection, currentVertex, perigeesToFit, seedTracks, - origTracks, vFitterOptions); + origTracks, vertexingOptions); if (!result.ok()) { return result.error(); } @@ -116,7 +109,8 @@ auto Acts::IterativeVertexFinder<vfitter_t, sfinder_t>::find( } // end reassignTracksAfterFirstFit case // still good vertex? might have changed in the meanwhile if (isGoodVertex) { - removeUsedCompatibleTracks(currentVertex, perigeesToFit, seedTracks); + removeUsedCompatibleTracks(currentVertex, perigeesToFit, seedTracks, + vertexingOptions); ACTS_DEBUG( "Number of seed tracks after removal of compatible tracks " @@ -134,7 +128,7 @@ auto Acts::IterativeVertexFinder<vfitter_t, sfinder_t>::find( removeAllTracks(perigeesToFitSplitVertex, seedTracks); } else { removeUsedCompatibleTracks(currentSplitVertex, perigeesToFitSplitVertex, - seedTracks); + seedTracks, vertexingOptions); } } // Now fill vertex collection with vertex @@ -155,9 +149,9 @@ auto Acts::IterativeVertexFinder<vfitter_t, sfinder_t>::find( template <typename vfitter_t, typename sfinder_t> auto Acts::IterativeVertexFinder<vfitter_t, sfinder_t>::getVertexSeed( const std::vector<const InputTrack_t*>& seedTracks, - const VertexFinderOptions<InputTrack_t>& vFinderOptions) const + const VertexingOptions<InputTrack_t>& vertexingOptions) const -> Result<Vertex<InputTrack_t>> { - auto res = m_cfg.seedFinder.find(seedTracks, vFinderOptions); + auto res = m_cfg.seedFinder.find(seedTracks, vertexingOptions); if (res.ok()) { auto vertexCollection = *res; if (vertexCollection.empty()) { @@ -203,9 +197,12 @@ void Acts::IterativeVertexFinder<vfitter_t, sfinder_t>::removeAllTracks( template <typename vfitter_t, typename sfinder_t> Acts::Result<double> Acts::IterativeVertexFinder<vfitter_t, sfinder_t>::getCompatibility( - const BoundParameters& params, const Vertex<InputTrack_t>& vertex) const { + const BoundParameters& params, const Vertex<InputTrack_t>& vertex, + const VertexingOptions<InputTrack_t>& vertexingOptions) const { // Linearize track - auto result = m_cfg.linearizer.linearizeTrack(params, vertex.fullPosition()); + auto result = m_cfg.linearizer.linearizeTrack( + params, vertex.fullPosition(), vertexingOptions.geoContext, + vertexingOptions.magFieldContext); if (!result.ok()) { return result.error(); } @@ -237,7 +234,8 @@ Acts::Result<void> Acts::IterativeVertexFinder<vfitter_t, sfinder_t>::removeUsedCompatibleTracks( Vertex<InputTrack_t>& myVertex, std::vector<const InputTrack_t*>& perigeesToFit, - std::vector<const InputTrack_t*>& seedTracks) const { + std::vector<const InputTrack_t*>& seedTracks, + const VertexingOptions<InputTrack_t>& vertexingOptions) const { std::vector<TrackAtVertex<InputTrack_t>> tracksAtVertex = myVertex.tracks(); for (const auto& trackAtVtx : tracksAtVertex) { @@ -281,8 +279,8 @@ Acts::IterativeVertexFinder<vfitter_t, sfinder_t>::removeUsedCompatibleTracks( for (const auto& myPerigeeToFit : perigeesToFit) { // calculate chi2 w.r.t. last fitted vertex - auto result = - getCompatibility(m_extractParameters(*myPerigeeToFit), myVertex); + auto result = getCompatibility(m_extractParameters(*myPerigeeToFit), + myVertex, vertexingOptions); if (!result.ok()) { return result.error(); @@ -331,7 +329,7 @@ Acts::IterativeVertexFinder<vfitter_t, sfinder_t>::fillPerigeesToFit( const Vertex<InputTrack_t>& seedVertex, std::vector<const InputTrack_t*>& perigeesToFitOut, std::vector<const InputTrack_t*>& perigeesToFitSplitVertexOut, - const VertexFinderOptions<InputTrack_t>& vFinderOptions) const { + const VertexingOptions<InputTrack_t>& vertexingOptions) const { int numberOfTracks = perigeeList.size(); // Count how many tracks are used for fit @@ -360,7 +358,7 @@ Acts::IterativeVertexFinder<vfitter_t, sfinder_t>::fillPerigeesToFit( // check first that distance is not too large const BoundParameters& sTrackParams = m_extractParameters(*sTrack); auto distanceRes = m_cfg.ipEst.calculateDistance( - vFinderOptions.geoContext, sTrackParams, seedVertex.position()); + vertexingOptions.geoContext, sTrackParams, seedVertex.position()); if (!distanceRes.ok()) { return distanceRes.error(); } @@ -400,7 +398,7 @@ Acts::IterativeVertexFinder<vfitter_t, sfinder_t>::reassignTracksToNewVertex( std::vector<const InputTrack_t*>& perigeesToFit, std::vector<const InputTrack_t*>& seedTracks, const std::vector<const InputTrack_t*>& origTracks, - const VertexFitterOptions<InputTrack_t>& vFitterOptions) const { + const VertexingOptions<InputTrack_t>& vertexingOptions) const { int numberOfAddedTracks = 0; // iterate over all vertices and check if tracks need to be reassigned @@ -423,13 +421,15 @@ Acts::IterativeVertexFinder<vfitter_t, sfinder_t>::reassignTracksToNewVertex( m_extractParameters(*(tracksIter->originalParams)); // compute compatibility - auto resultNew = getCompatibility(trackPerigee, currentVertex); + auto resultNew = + getCompatibility(trackPerigee, currentVertex, vertexingOptions); if (!resultNew.ok()) { return Result<bool>::failure(resultNew.error()); } double chi2NewVtx = *resultNew; - auto resultOld = getCompatibility(trackPerigee, vertexIt); + auto resultOld = + getCompatibility(trackPerigee, vertexIt, vertexingOptions); if (!resultOld.ok()) { return Result<bool>::failure(resultOld.error()); } @@ -478,16 +478,16 @@ Acts::IterativeVertexFinder<vfitter_t, sfinder_t>::reassignTracksToNewVertex( // later currentVertex = Vertex<InputTrack_t>(); if (m_cfg.useBeamConstraint && !perigeesToFit.empty()) { - auto fitResult = - m_cfg.vertexFitter.fit(perigeesToFit, m_cfg.linearizer, vFitterOptions); + auto fitResult = m_cfg.vertexFitter.fit(perigeesToFit, m_cfg.linearizer, + vertexingOptions); if (fitResult.ok()) { currentVertex = std::move(*fitResult); } else { return Result<bool>::success(false); } } else if (!m_cfg.useBeamConstraint && perigeesToFit.size() > 1) { - auto fitResult = - m_cfg.vertexFitter.fit(perigeesToFit, m_cfg.linearizer, vFitterOptions); + auto fitResult = m_cfg.vertexFitter.fit(perigeesToFit, m_cfg.linearizer, + vertexingOptions); if (fitResult.ok()) { currentVertex = std::move(*fitResult); } else { diff --git a/Core/include/Acts/Vertexing/LinearizerConcept.hpp b/Core/include/Acts/Vertexing/LinearizerConcept.hpp index bfa7eeadf6b1a573dc60d34533197786ef6bb171..62c571aeeb68ee570e7d820258329be2899106e3 100644 --- a/Core/include/Acts/Vertexing/LinearizerConcept.hpp +++ b/Core/include/Acts/Vertexing/LinearizerConcept.hpp @@ -31,7 +31,9 @@ namespace concept { constexpr static bool linTrack_exists = has_method<const S, Result<LinearizedTrack>, linTrack_t, const BoundParameters&, - const SpacePointVector&>; + const SpacePointVector&, + const Acts::GeometryContext&, + const Acts::MagneticFieldContext&>; static_assert(linTrack_exists, "linearizeTrack method not found"); diff --git a/Core/include/Acts/Vertexing/TrackDensityVertexFinder.hpp b/Core/include/Acts/Vertexing/TrackDensityVertexFinder.hpp index f85b29662590a1f3e5af0987403d39d8004a250c..5f3265224087d11205ccf516f0f479c038965332 100644 --- a/Core/include/Acts/Vertexing/TrackDensityVertexFinder.hpp +++ b/Core/include/Acts/Vertexing/TrackDensityVertexFinder.hpp @@ -13,8 +13,8 @@ #include "Acts/Utilities/Result.hpp" #include "Acts/Vertexing/GaussianTrackDensity.hpp" #include "Acts/Vertexing/Vertex.hpp" -#include "Acts/Vertexing/VertexFinderOptions.hpp" #include "Acts/Vertexing/VertexFitterConcept.hpp" +#include "Acts/Vertexing/VertexingOptions.hpp" namespace Acts { @@ -51,13 +51,13 @@ class TrackDensityVertexFinder { /// @brief Function that finds single vertex candidate /// /// @param trackVector Input track collection - /// @param vFinderOptions Vertex finder options + /// @param vertexingOptions Vertexing options /// /// @return Vector of vertices, filled with a single /// vertex (for consistent interfaces) Result<std::vector<Vertex<InputTrack_t>>> find( const std::vector<const InputTrack_t*>& trackVector, - const VertexFinderOptions<InputTrack_t>& vFinderOptions) const; + const VertexingOptions<InputTrack_t>& vertexingOptions) const; /// @brief Constructor used if InputTrack_t type == BoundParameters /// diff --git a/Core/include/Acts/Vertexing/TrackDensityVertexFinder.ipp b/Core/include/Acts/Vertexing/TrackDensityVertexFinder.ipp index ed26c5631246d27c29b91db7e21eb06bf8a19c13..b24c1016b6ea8608dc6033e2851f980e29d5d4fd 100644 --- a/Core/include/Acts/Vertexing/TrackDensityVertexFinder.ipp +++ b/Core/include/Acts/Vertexing/TrackDensityVertexFinder.ipp @@ -9,7 +9,7 @@ template <typename vfitter_t, typename track_density_t> auto Acts::TrackDensityVertexFinder<vfitter_t, track_density_t>::find( const std::vector<const InputTrack_t*>& trackVector, - const VertexFinderOptions<InputTrack_t>& vFinderOptions) const + const VertexingOptions<InputTrack_t>& vertexingOptions) const -> Result<std::vector<Vertex<InputTrack_t>>> { typename track_density_t::State densityState; @@ -30,11 +30,11 @@ auto Acts::TrackDensityVertexFinder<vfitter_t, track_density_t>::find( // Calculate seed position // Note: constraint position is (0,0,0) if no constraint provided Vector3D seedPos = - vFinderOptions.vertexConstraint.position() + Vector3D(0., 0., z); + vertexingOptions.vertexConstraint.position() + Vector3D(0., 0., z); Vertex<InputTrack_t> returnVertex = Vertex<InputTrack_t>(seedPos); - ActsSymMatrixD<3> seedCov = vFinderOptions.vertexConstraint.covariance(); + ActsSymMatrixD<3> seedCov = vertexingOptions.vertexConstraint.covariance(); // Check if a constraint is provided and set the new z position constraint if (seedCov != ActsSymMatrixD<3>::Zero() && std::isnormal(zAndWidth.second)) { diff --git a/Core/include/Acts/Vertexing/TrackToVertexIPEstimator.hpp b/Core/include/Acts/Vertexing/TrackToVertexIPEstimator.hpp index 8c34eea4d5de0c3a37013650689e8843d7a211be..2666a51c68412b8f51712d85235591f82080cf5e 100644 --- a/Core/include/Acts/Vertexing/TrackToVertexIPEstimator.hpp +++ b/Core/include/Acts/Vertexing/TrackToVertexIPEstimator.hpp @@ -39,22 +39,11 @@ class TrackToVertexIPEstimator { public: /// @brief Configuration struct /// - /// @param p The propagator - /// @param propOptions The propagator options - /// @param doBackwardPropagation Set the propagation direction to backward + /// @param prop The propagator struct Config { - Config(std::shared_ptr<propagator_t> p, - const propagator_options_t& propOptions, - bool doBackwardPropagation = true) - : propagator(std::move(p)), pOptions(propOptions) { - if (doBackwardPropagation) { - pOptions.direction = backward; - } - } + Config(std::shared_ptr<propagator_t> prop) : propagator(std::move(prop)) {} std::shared_ptr<propagator_t> propagator; - - propagator_options_t pOptions; }; /// @brief Default constructor @@ -77,8 +66,12 @@ class TrackToVertexIPEstimator { /// /// @param track Track to estimate IP from /// @param vtx Vertex the track belongs to + /// @param gctx The geometry context + /// @param mctx The magnetic field context Result<ImpactParametersAndSigma> estimate( - const BoundParameters& track, const Vertex<input_track_t>& vtx) const; + const BoundParameters& track, const Vertex<input_track_t>& vtx, + const GeometryContext& gctx, + const Acts::MagneticFieldContext& mctx) const; private: /// Config diff --git a/Core/include/Acts/Vertexing/TrackToVertexIPEstimator.ipp b/Core/include/Acts/Vertexing/TrackToVertexIPEstimator.ipp index 3d3989b21ceae04bd4736e1eaca8204d026d15b4..853dcedcf40600adbeac2e951c94bd63eb113384 100644 --- a/Core/include/Acts/Vertexing/TrackToVertexIPEstimator.ipp +++ b/Core/include/Acts/Vertexing/TrackToVertexIPEstimator.ipp @@ -13,7 +13,10 @@ template <typename input_track_t, typename propagator_t, Acts::Result<Acts::ImpactParametersAndSigma> Acts::TrackToVertexIPEstimator< input_track_t, propagator_t, propagator_options_t>::estimate(const BoundParameters& track, - const Vertex<input_track_t>& vtx) const { + const Vertex<input_track_t>& vtx, + const GeometryContext& gctx, + const Acts::MagneticFieldContext& mctx) + const { // estimating the d0 and its significance by propagating the trajectory state // towards // the vertex position. By this time the vertex should NOT contain this @@ -21,9 +24,12 @@ Acts::Result<Acts::ImpactParametersAndSigma> Acts::TrackToVertexIPEstimator< const std::shared_ptr<PerigeeSurface> perigeeSurface = Surface::makeShared<PerigeeSurface>(vtx.position()); + // Create propagator options + propagator_options_t pOptions(gctx, mctx); + pOptions.direction = backward; + // Do the propagation to linPoint - auto result = - m_cfg.propagator->propagate(track, *perigeeSurface, m_cfg.pOptions); + auto result = m_cfg.propagator->propagate(track, *perigeeSurface, pOptions); if (!result.ok()) { return result.error(); diff --git a/Core/include/Acts/Vertexing/VertexFinderConcept.hpp b/Core/include/Acts/Vertexing/VertexFinderConcept.hpp index 57e57eccad395a085778460442c783f92e85bcb1..11e0bbec45bc03632f75331e24c4010b7654b71e 100644 --- a/Core/include/Acts/Vertexing/VertexFinderConcept.hpp +++ b/Core/include/Acts/Vertexing/VertexFinderConcept.hpp @@ -12,7 +12,7 @@ #include "Acts/Utilities/Result.hpp" #include "Acts/Utilities/TypeTraits.hpp" #include "Acts/Vertexing/Vertex.hpp" -#include "Acts/Vertexing/VertexFinderOptions.hpp" +#include "Acts/Vertexing/VertexingOptions.hpp" namespace Acts { @@ -27,7 +27,7 @@ namespace concept { constexpr static bool find_exists = has_method<const S, Result<std::vector<Vertex<typename S::InputTrack_t>>>, find_t, const std::vector<const typename S::InputTrack_t*>&, - const VertexFinderOptions<typename S::InputTrack_t>&>; + const VertexingOptions<typename S::InputTrack_t>&>; static_assert(find_exists, "find method not found"); constexpr static bool value = require<find_exists>; diff --git a/Core/include/Acts/Vertexing/VertexFitterConcept.hpp b/Core/include/Acts/Vertexing/VertexFitterConcept.hpp index 9164c714d97966c8bb145c435cae4eb3c10631c0..af9529afa9fd2794a98c6a5b37832c9acb8c6352 100644 --- a/Core/include/Acts/Vertexing/VertexFitterConcept.hpp +++ b/Core/include/Acts/Vertexing/VertexFitterConcept.hpp @@ -12,7 +12,7 @@ #include "Acts/Utilities/Result.hpp" #include "Acts/Utilities/TypeTraits.hpp" #include "Acts/Vertexing/Vertex.hpp" -#include "Acts/Vertexing/VertexFitterOptions.hpp" +#include "Acts/Vertexing/VertexingOptions.hpp" namespace Acts { @@ -35,7 +35,7 @@ namespace concept { fit_t, const std::vector<const typename S::InputTrack_t*>&, const typename S::Linearizer_t&, - const VertexFitterOptions<typename S::InputTrack_t>&>; + const VertexingOptions<typename S::InputTrack_t>&>; static_assert(fit_exists, "fit method not found"); constexpr static bool track_exists = exists<track_t, S>; diff --git a/Core/include/Acts/Vertexing/VertexFitterOptions.hpp b/Core/include/Acts/Vertexing/VertexFitterOptions.hpp deleted file mode 100644 index ad354dd090a4713003b66102eda9850a78072e3e..0000000000000000000000000000000000000000 --- a/Core/include/Acts/Vertexing/VertexFitterOptions.hpp +++ /dev/null @@ -1,44 +0,0 @@ -// This file is part of the Acts project. -// -// Copyright (C) 2019 CERN for the benefit of the Acts project -// -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at http://mozilla.org/MPL/2.0/. - -#pragma once - -#include "Acts/Geometry/GeometryContext.hpp" -#include "Acts/MagneticField/MagneticFieldContext.hpp" -#include "Acts/Vertexing/Vertex.hpp" - -namespace Acts { - -/// @brief Vertex Fitter Options -/// -template <typename input_track_t> -struct VertexFitterOptions { - /// Default contstructor is deleted - VertexFitterOptions() = delete; - - /// VertexFitterOptions with context - /// - /// @param gctx The goemetry context for this fit - /// @param mctx The magnetic context for this fit - /// @param vconstr The pointing contraint to a vertex - VertexFitterOptions( - std::reference_wrapper<const GeometryContext> gctx, - std::reference_wrapper<const MagneticFieldContext> mctx, - const Vertex<input_track_t>& vconstr = Vertex<input_track_t>()) - - : geoContext(gctx), magFieldContext(mctx), vertexConstraint(vconstr) {} - - /// Context object for the geometry - std::reference_wrapper<const GeometryContext> geoContext; - /// Context object for the magnetic field - std::reference_wrapper<const MagneticFieldContext> magFieldContext; - /// The vertex constraint for the fitting - Vertex<input_track_t> vertexConstraint; -}; - -} // namespace Acts diff --git a/Core/include/Acts/Vertexing/VertexFinderOptions.hpp b/Core/include/Acts/Vertexing/VertexingOptions.hpp similarity index 91% rename from Core/include/Acts/Vertexing/VertexFinderOptions.hpp rename to Core/include/Acts/Vertexing/VertexingOptions.hpp index 5c0340771212dc6d288114319158c0cb15eec5ed..bff6d97a3acf168ada750e5a1f4048ec7214bb06 100644 --- a/Core/include/Acts/Vertexing/VertexFinderOptions.hpp +++ b/Core/include/Acts/Vertexing/VertexingOptions.hpp @@ -17,16 +17,16 @@ namespace Acts { /// @brief Vertex Finder Options /// template <typename input_track_t> -struct VertexFinderOptions { +struct VertexingOptions { /// Default contstructor is deleted - VertexFinderOptions() = delete; + VertexingOptions() = delete; - /// VertexFinderOptions with context + /// VertexingOptions with context /// /// @param gctx The goemetry context for this fit /// @param mctx The magnetic context for this fit /// @param vconstr The pointing contraint to a vertex - VertexFinderOptions( + VertexingOptions( std::reference_wrapper<const GeometryContext> gctx, std::reference_wrapper<const MagneticFieldContext> mctx, const Vertex<input_track_t>& vconstr = Vertex<input_track_t>()) diff --git a/Core/include/Acts/Vertexing/ZScanVertexFinder.hpp b/Core/include/Acts/Vertexing/ZScanVertexFinder.hpp index e738d705d96bfe7160b56df3720b6a807462e906..4d2812db853d2edc85bcd4ac0f2870d07335e471 100644 --- a/Core/include/Acts/Vertexing/ZScanVertexFinder.hpp +++ b/Core/include/Acts/Vertexing/ZScanVertexFinder.hpp @@ -18,8 +18,8 @@ #include "Acts/Vertexing/FsmwMode1dFinder.hpp" #include "Acts/Vertexing/TrackToVertexIPEstimator.hpp" #include "Acts/Vertexing/Vertex.hpp" -#include "Acts/Vertexing/VertexFinderOptions.hpp" #include "Acts/Vertexing/VertexFitterConcept.hpp" +#include "Acts/Vertexing/VertexingOptions.hpp" namespace Acts { @@ -103,13 +103,13 @@ class ZScanVertexFinder { /// using a Half Sample Mode algorithm /// /// @param trackVector Input track collection - /// @param vFinderOptions Vertex finder options + /// @param vertexingOptions Vertexing options /// /// @return Vector of vertices, filled with a single /// vertex (for consistent interfaces) Result<std::vector<Vertex<InputTrack_t>>> find( const std::vector<const InputTrack_t*>& trackVector, - const VertexFinderOptions<InputTrack_t>& vFinderOptions) const; + const VertexingOptions<InputTrack_t>& vertexingOptions) const; private: Config m_cfg; diff --git a/Core/include/Acts/Vertexing/ZScanVertexFinder.ipp b/Core/include/Acts/Vertexing/ZScanVertexFinder.ipp index f15579ec21729c3400e289120fb90b690374bb88..491253247c90bef584818698f4b8d18f2fbc9680 100644 --- a/Core/include/Acts/Vertexing/ZScanVertexFinder.ipp +++ b/Core/include/Acts/Vertexing/ZScanVertexFinder.ipp @@ -9,11 +9,11 @@ template <typename vfitter_t> auto Acts::ZScanVertexFinder<vfitter_t>::find( const std::vector<const InputTrack_t*>& trackVector, - const VertexFinderOptions<InputTrack_t>& vFinderOptions) const + const VertexingOptions<InputTrack_t>& vertexingOptions) const -> Result<std::vector<Vertex<InputTrack_t>>> { // Determine if we use constraint or not bool useConstraint = false; - if (vFinderOptions.vertexConstraint.fullCovariance().determinant() != 0) { + if (vertexingOptions.vertexConstraint.fullCovariance().determinant() != 0) { useConstraint = true; } @@ -29,9 +29,10 @@ auto Acts::ZScanVertexFinder<vfitter_t>::find( std::pair<double, double> z0AndWeight; ImpactParametersAndSigma ipas; if (useConstraint && - vFinderOptions.vertexConstraint.covariance()(0, 0) != 0) { - auto estRes = - m_cfg.ipEstimator.estimate(params, vFinderOptions.vertexConstraint); + vertexingOptions.vertexConstraint.covariance()(0, 0) != 0) { + auto estRes = m_cfg.ipEstimator.estimate( + params, vertexingOptions.vertexConstraint, + vertexingOptions.geoContext, vertexingOptions.magFieldContext); if (estRes.ok()) { ipas = *estRes; } else { @@ -42,7 +43,7 @@ auto Acts::ZScanVertexFinder<vfitter_t>::find( if (ipas.sigmad0 > 0) { // calculate z0 z0AndWeight.first = - ipas.IPz0 + vFinderOptions.vertexConstraint.position().z(); + ipas.IPz0 + vertexingOptions.vertexConstraint.position().z(); // calculate chi2 of IP double chi2IP = std::pow(ipas.IPd0 / ipas.sigmad0, 2); @@ -96,9 +97,9 @@ auto Acts::ZScanVertexFinder<vfitter_t>::find( } // constraint x()/y() equals 0 if no constraint - SpacePointVector output(vFinderOptions.vertexConstraint.position().x(), - vFinderOptions.vertexConstraint.position().y(), - ZResult, vFinderOptions.vertexConstraint.time()); + SpacePointVector output(vertexingOptions.vertexConstraint.position().x(), + vertexingOptions.vertexConstraint.position().y(), + ZResult, vertexingOptions.vertexConstraint.time()); Vertex<InputTrack_t> vtxResult = Vertex<InputTrack_t>(output); // Vector to be filled with one single vertex diff --git a/Core/src/Utilities/AnnealingUtility.cpp b/Core/src/Utilities/AnnealingUtility.cpp index 635f51bb655bf331d9c7c8c41b176231b790d729..3e339515b4bcc82038a3ac830e905191ddd3112c 100644 --- a/Core/src/Utilities/AnnealingUtility.cpp +++ b/Core/src/Utilities/AnnealingUtility.cpp @@ -15,7 +15,7 @@ /// /// @return exp(-1./2. * chi2 / temp) static double gaussFunc(double chi2, double temp) { - return std::exp(-1. / 2. * chi2 / temp); + return std::exp(-chi2 / (2. * temp)); } void AnnealingUtility::anneal(State& state) const { @@ -31,20 +31,20 @@ double AnnealingUtility::getWeight(State& state, double chi2, const double currentTemp = m_cfg.setOfTemperatures[state.currentTemperatureIndex]; - double allWeights = 0.; - for (auto val : allChi2) { - allWeights += gaussFunc(val, currentTemp); - } + double base = gaussFunc(1., currentTemp); + + double denom = std::pow(base, m_cfg.cutOff - chi2); - double actualWeight = gaussFunc(chi2, currentTemp); + for (double val : allChi2) { + denom += std::pow(base, val - chi2); + } - return actualWeight / (gaussFunc(m_cfg.cutOff, currentTemp) + allWeights); + return 1. / denom; } double AnnealingUtility::getWeight(State& state, double chi2) const { const double currentTemp = m_cfg.setOfTemperatures[state.currentTemperatureIndex]; - return gaussFunc(chi2, currentTemp) / - (gaussFunc(m_cfg.cutOff, currentTemp) + gaussFunc(chi2, currentTemp)); + return 1. / (1. + gaussFunc(m_cfg.cutOff - chi2, currentTemp)); } diff --git a/Tests/UnitTests/Core/Vertexing/AdaptiveMultiVertexFinderTests.cpp b/Tests/UnitTests/Core/Vertexing/AdaptiveMultiVertexFinderTests.cpp index 105c59607d349d20486621ca7a05e116fa4c1277..2aa5af3c50022df8a20595d19fa309b2c51be56a 100644 --- a/Tests/UnitTests/Core/Vertexing/AdaptiveMultiVertexFinderTests.cpp +++ b/Tests/UnitTests/Core/Vertexing/AdaptiveMultiVertexFinderTests.cpp @@ -35,8 +35,8 @@ using Propagator = Propagator<EigenStepper<ConstantBField>>; using Linearizer = HelicalTrackLinearizer<Propagator>; // Create a test context -GeometryContext tgContext = GeometryContext(); -MagneticFieldContext mfContext = MagneticFieldContext(); +GeometryContext geoContext = GeometryContext(); +MagneticFieldContext magFieldContext = MagneticFieldContext(); BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_finder_test) { // Set debug mode @@ -50,15 +50,11 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_finder_test) { // Set up propagator with void navigator auto propagator = std::make_shared<Propagator>(stepper); - PropagatorOptions<> pOptions(tgContext, mfContext); - pOptions.direction = backward; - - VertexFitterOptions<BoundParameters> fitterOptions(tgContext, mfContext); // IP 3D Estimator using IPEstimator = ImpactPoint3dEstimator<BoundParameters, Propagator>; - IPEstimator::Config ip3dEstCfg(bField, propagator, pOptions, false); + IPEstimator::Config ip3dEstCfg(bField, propagator); IPEstimator ip3dEst(ip3dEstCfg); std::vector<double> temperatures{8.0, 4.0, 2.0, 1.4142136, 1.2247449, 1.0}; @@ -72,7 +68,7 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_finder_test) { fitterCfg.annealingTool = annealingUtility; // Linearizer for BoundParameters type test - Linearizer::Config ltConfig(bField, propagator, pOptions); + Linearizer::Config ltConfig(bField, propagator); Linearizer linearizer(ltConfig); // Test smoothing @@ -86,7 +82,7 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_finder_test) { using IPEstimater = TrackToVertexIPEstimator<BoundParameters, Propagator>; - IPEstimater::Config ipEstCfg(propagator, pOptions); + IPEstimater::Config ipEstCfg(propagator); // Create TrackToVertexIPEstimator IPEstimater ipEst(ipEstCfg); @@ -122,7 +118,8 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_finder_test) { tracksPtr.push_back(&trk); } - VertexFinderOptions<BoundParameters> finderOptions(tgContext, mfContext); + VertexingOptions<BoundParameters> vertexingOptions(geoContext, + magFieldContext); Vector3D constraintPos{0._mm, 0._mm, 0_mm}; ActsSymMatrixD<3> constraintCov; @@ -133,9 +130,9 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_finder_test) { constraintVtx.setPosition(constraintPos); constraintVtx.setCovariance(constraintCov); - finderOptions.vertexConstraint = constraintVtx; + vertexingOptions.vertexConstraint = constraintVtx; - auto findResult = finder.find(tracksPtr, finderOptions); + auto findResult = finder.find(tracksPtr, vertexingOptions); if (!findResult.ok()) { std::cout << findResult.error().message() << std::endl; diff --git a/Tests/UnitTests/Core/Vertexing/AdaptiveMultiVertexFitterTests.cpp b/Tests/UnitTests/Core/Vertexing/AdaptiveMultiVertexFitterTests.cpp index dffb8fc63ec1528bc6fab95d2480bb0814009cf7..b8f385ba6224c9725a426a10d5f57350d41f3a17 100644 --- a/Tests/UnitTests/Core/Vertexing/AdaptiveMultiVertexFitterTests.cpp +++ b/Tests/UnitTests/Core/Vertexing/AdaptiveMultiVertexFitterTests.cpp @@ -30,8 +30,8 @@ using Propagator = Propagator<EigenStepper<ConstantBField>>; using Linearizer = HelicalTrackLinearizer<Propagator>; // Create a test context -GeometryContext tgContext = GeometryContext(); -MagneticFieldContext mfContext = MagneticFieldContext(); +GeometryContext geoContext = GeometryContext(); +MagneticFieldContext magFieldContext = MagneticFieldContext(); // Vertex x/y position distribution std::uniform_real_distribution<> vXYDist(-0.1_mm, 0.1_mm); @@ -75,21 +75,21 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_fitter_test) { // Set up propagator with void navigator auto propagator = std::make_shared<Propagator>(stepper); - PropagatorOptions<> pOptions(tgContext, mfContext); - VertexFitterOptions<BoundParameters> fitterOptions(tgContext, mfContext); + VertexingOptions<BoundParameters> vertexingOptions(geoContext, + magFieldContext); // IP 3D Estimator using IPEstimator = ImpactPoint3dEstimator<BoundParameters, Propagator>; - IPEstimator::Config ip3dEstCfg(bField, propagator, pOptions); + IPEstimator::Config ip3dEstCfg(bField, propagator); IPEstimator ip3dEst(ip3dEstCfg); AdaptiveMultiVertexFitter<BoundParameters, Linearizer>::Config fitterCfg( ip3dEst); // Linearizer for BoundParameters type test - Linearizer::Config ltConfig(bField, propagator, pOptions); + Linearizer::Config ltConfig(bField, propagator); Linearizer linearizer(ltConfig); // Test smoothing @@ -163,7 +163,7 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_fitter_test) { std::shared_ptr<PerigeeSurface> perigeeSurface = Surface::makeShared<PerigeeSurface>(vtxPosVec[vtxIdx]); - allTracks.push_back(BoundParameters(tgContext, std::move(covMat), paramVec, + allTracks.push_back(BoundParameters(geoContext, std::move(covMat), paramVec, perigeeSurface)); } @@ -228,7 +228,7 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_fitter_test) { std::vector<Vertex<BoundParameters>> seedListCopy = vtxList; auto res1 = - fitter.addVtxToFit(state, vtxList.at(0), linearizer, fitterOptions); + fitter.addVtxToFit(state, vtxList.at(0), linearizer, vertexingOptions); if (debugMode) { std::cout << "Tracks linked to each vertex AFTER fit: " << std::endl; int c = 0; @@ -283,7 +283,7 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_fitter_test) { seedListCopy.at(1).fullPosition(), 1_mm); auto res2 = - fitter.addVtxToFit(state, vtxList.at(2), linearizer, fitterOptions); + fitter.addVtxToFit(state, vtxList.at(2), linearizer, vertexingOptions); BOOST_CHECK(res2.ok()); // Now also the third vertex should have been modified and fitted @@ -321,14 +321,14 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_fitter_test_athena) { // Set up propagator with void navigator auto propagator = std::make_shared<Propagator>(stepper); - PropagatorOptions<> pOptions(tgContext, mfContext); - VertexFitterOptions<BoundParameters> fitterOptions(tgContext, mfContext); + VertexingOptions<BoundParameters> vertexingOptions(geoContext, + magFieldContext); // IP 3D Estimator using IPEstimator = ImpactPoint3dEstimator<BoundParameters, Propagator>; - IPEstimator::Config ip3dEstCfg(bField, propagator, pOptions, false); + IPEstimator::Config ip3dEstCfg(bField, propagator); IPEstimator ip3dEst(ip3dEstCfg); std::vector<double> temperatures(1, 3.); @@ -341,7 +341,7 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_fitter_test_athena) { fitterCfg.annealingTool = annealingUtility; // Linearizer for BoundParameters type test - Linearizer::Config ltConfig(bField, propagator, pOptions); + Linearizer::Config ltConfig(bField, propagator); Linearizer linearizer(ltConfig); // Test smoothing @@ -373,22 +373,22 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_fitter_test_athena) { std::vector<BoundParameters> params1; params1.push_back( - BoundParameters(tgContext, covMat1, pos1a, mom1a, 1, 0, + BoundParameters(geoContext, covMat1, pos1a, mom1a, 1, 0, Surface::makeShared<PerigeeSurface>(pos1a))); params1.push_back( - BoundParameters(tgContext, covMat1, pos1b, mom1b, -1, 0, + BoundParameters(geoContext, covMat1, pos1b, mom1b, -1, 0, Surface::makeShared<PerigeeSurface>(pos1b))); params1.push_back( - BoundParameters(tgContext, covMat1, pos1c, mom1c, 1, 0, + BoundParameters(geoContext, covMat1, pos1c, mom1c, 1, 0, Surface::makeShared<PerigeeSurface>(pos1c))); params1.push_back( - BoundParameters(tgContext, covMat1, pos1d, mom1d, -1, 0, + BoundParameters(geoContext, covMat1, pos1d, mom1d, -1, 0, Surface::makeShared<PerigeeSurface>(pos1d))); params1.push_back( - BoundParameters(tgContext, covMat1, pos1e, mom1e, 1, 0, + BoundParameters(geoContext, covMat1, pos1e, mom1e, 1, 0, Surface::makeShared<PerigeeSurface>(pos1e))); params1.push_back( - BoundParameters(tgContext, covMat1, pos1f, mom1f, -1, 0, + BoundParameters(geoContext, covMat1, pos1f, mom1f, -1, 0, Surface::makeShared<PerigeeSurface>(pos1f))); // Create second vector of tracks @@ -404,13 +404,13 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_fitter_test_athena) { std::vector<BoundParameters> params2; params2.push_back( - BoundParameters(tgContext, covMat2, pos2a, mom2a, 1, 0, + BoundParameters(geoContext, covMat2, pos2a, mom2a, 1, 0, Surface::makeShared<PerigeeSurface>(pos2a))); params2.push_back( - BoundParameters(tgContext, covMat2, pos2b, mom2b, -1, 0, + BoundParameters(geoContext, covMat2, pos2b, mom2b, -1, 0, Surface::makeShared<PerigeeSurface>(pos2b))); params2.push_back( - BoundParameters(tgContext, covMat2, pos2c, mom2c, -1, 0, + BoundParameters(geoContext, covMat2, pos2c, mom2c, -1, 0, Surface::makeShared<PerigeeSurface>(pos2c))); std::vector<Vertex<BoundParameters>*> vtxList; @@ -483,7 +483,7 @@ BOOST_AUTO_TEST_CASE(adaptive_multi_vertex_fitter_test_athena) { state.addVertexToMultiMap(vtx2); // Fit vertices - fitter.fit(state, vtxList, linearizer, fitterOptions); + fitter.fit(state, vtxList, linearizer, vertexingOptions); auto vtx1Pos = state.vertexCollection.at(0)->position(); auto vtx1Cov = state.vertexCollection.at(0)->covariance(); diff --git a/Tests/UnitTests/Core/Vertexing/FullBilloirVertexFitterTests.cpp b/Tests/UnitTests/Core/Vertexing/FullBilloirVertexFitterTests.cpp index cf4c7933242b7462d9117c928377428a47b76384..8239c0035a18a83917d2c9c3d30f9aebca9adb09 100644 --- a/Tests/UnitTests/Core/Vertexing/FullBilloirVertexFitterTests.cpp +++ b/Tests/UnitTests/Core/Vertexing/FullBilloirVertexFitterTests.cpp @@ -33,8 +33,8 @@ using Linearizer = HelicalTrackLinearizer<Propagator<EigenStepper<ConstantBField>>>; // Create a test context -GeometryContext tgContext = GeometryContext(); -MagneticFieldContext mfContext = MagneticFieldContext(); +GeometryContext geoContext = GeometryContext(); +MagneticFieldContext magFieldContext = MagneticFieldContext(); /// @brief Unit test for FullBilloirVertexFitter /// @@ -49,9 +49,7 @@ BOOST_AUTO_TEST_CASE(billoir_vertex_fitter_empty_input_test) { auto propagator = std::make_shared<Propagator<EigenStepper<ConstantBField>>>(stepper); - PropagatorOptions<> pOptions(tgContext, mfContext); - - Linearizer::Config ltConfig(bField, propagator, pOptions); + Linearizer::Config ltConfig(bField, propagator); Linearizer linearizer(ltConfig); // Set up Billoir Vertex Fitter @@ -72,8 +70,8 @@ BOOST_AUTO_TEST_CASE(billoir_vertex_fitter_empty_input_test) { const std::vector<const BoundParameters*> emptyVector; - VertexFitterOptions<BoundParameters> vfOptions(tgContext, mfContext, - myConstraint); + VertexingOptions<BoundParameters> vfOptions(geoContext, magFieldContext, + myConstraint); Vertex<BoundParameters> fittedVertex = billoirFitter.fit(emptyVector, linearizer, vfOptions).value(); @@ -133,9 +131,7 @@ BOOST_AUTO_TEST_CASE(billoir_vertex_fitter_defaulttrack_test) { auto propagator = std::make_shared<Propagator<EigenStepper<ConstantBField>>>(stepper); - PropagatorOptions<> pOptions(tgContext, mfContext); - - Linearizer::Config ltConfig(bField, propagator, pOptions); + Linearizer::Config ltConfig(bField, propagator); Linearizer linearizer(ltConfig); // Number of events @@ -159,10 +155,10 @@ BOOST_AUTO_TEST_CASE(billoir_vertex_fitter_defaulttrack_test) { myCovMat(3, 3) = 30.; myConstraint.setFullCovariance(std::move(myCovMat)); myConstraint.setFullPosition(SpacePointVector(0, 0, 0, 0)); - VertexFitterOptions<BoundParameters> vfOptions(tgContext, mfContext); + VertexingOptions<BoundParameters> vfOptions(geoContext, magFieldContext); - VertexFitterOptions<BoundParameters> vfOptionsConstr(tgContext, mfContext, - myConstraint); + VertexingOptions<BoundParameters> vfOptionsConstr( + geoContext, magFieldContext, myConstraint); // Create position of vertex and perigee surface double x = vXYDist(gen); double y = vXYDist(gen); @@ -202,7 +198,7 @@ BOOST_AUTO_TEST_CASE(billoir_vertex_fitter_defaulttrack_test) { covMat << resD0 * resD0, 0., 0., 0., 0., 0., 0., resZ0 * resZ0, 0., 0., 0., 0., 0., 0., resPh * resPh, 0., 0., 0., 0., 0., 0., resTh * resTh, 0., 0., 0., 0., 0., 0., resQp * resQp, 0., 0., 0., 0., 0., 0., 1.; - tracks.push_back(BoundParameters(tgContext, std::move(covMat), paramVec, + tracks.push_back(BoundParameters(geoContext, std::move(covMat), paramVec, perigeeSurface)); } @@ -267,9 +263,7 @@ BOOST_AUTO_TEST_CASE(billoir_vertex_fitter_usertrack_test) { auto propagator = std::make_shared<Propagator<EigenStepper<ConstantBField>>>(stepper); - PropagatorOptions<> pOptions(tgContext, mfContext); - - Linearizer::Config ltConfig(bField, propagator, pOptions); + Linearizer::Config ltConfig(bField, propagator); Linearizer linearizer(ltConfig); const int nEvents = 10; @@ -298,10 +292,10 @@ BOOST_AUTO_TEST_CASE(billoir_vertex_fitter_usertrack_test) { myConstraint.setFullCovariance(std::move(myCovMat)); myConstraint.setFullPosition(SpacePointVector(0, 0, 0, 0)); - VertexFitterOptions<InputTrack> vfOptions(tgContext, mfContext); + VertexingOptions<InputTrack> vfOptions(geoContext, magFieldContext); - VertexFitterOptions<InputTrack> vfOptionsConstr(tgContext, mfContext, - myConstraint); + VertexingOptions<InputTrack> vfOptionsConstr(geoContext, magFieldContext, + myConstraint); // Create position of vertex and perigee surface double x = vXYDist(gen); @@ -343,7 +337,7 @@ BOOST_AUTO_TEST_CASE(billoir_vertex_fitter_usertrack_test) { covMat << resD0 * resD0, 0., 0., 0., 0., 0., 0., resZ0 * resZ0, 0., 0., 0., 0., 0., 0., resPh * resPh, 0., 0., 0., 0., 0., 0., resTh * resTh, 0., 0., 0., 0., 0., 0., resQp * resQp, 0., 0., 0., 0., 0., 0., 1.; - tracks.push_back(InputTrack(BoundParameters(tgContext, std::move(covMat), + tracks.push_back(InputTrack(BoundParameters(geoContext, std::move(covMat), paramVec, perigeeSurface))); } diff --git a/Tests/UnitTests/Core/Vertexing/ImpactPoint3dEstimatorTests.cpp b/Tests/UnitTests/Core/Vertexing/ImpactPoint3dEstimatorTests.cpp index b1dd2458c2fdbd979b8b9278af91dc4c8c37133a..e39f700348f253ed848fd65c4770e82bf4adbdd1 100644 --- a/Tests/UnitTests/Core/Vertexing/ImpactPoint3dEstimatorTests.cpp +++ b/Tests/UnitTests/Core/Vertexing/ImpactPoint3dEstimatorTests.cpp @@ -28,8 +28,8 @@ namespace Test { using Covariance = BoundSymMatrix; using Propagator = Propagator<EigenStepper<ConstantBField>>; // Create a test context -GeometryContext tgContext = GeometryContext(); -MagneticFieldContext mfContext = MagneticFieldContext(); +GeometryContext geoContext = GeometryContext(); +MagneticFieldContext magFieldContext = MagneticFieldContext(); // Track d0 distribution std::uniform_real_distribution<> d0Dist(-0.01_mm, 0.01_mm); @@ -70,11 +70,10 @@ BOOST_AUTO_TEST_CASE(impactpoint_3d_estimator_params_distance_test) { // Set up propagator with void navigator auto propagator = std::make_shared<Propagator>(stepper); - PropagatorOptions<> pOptions(tgContext, mfContext); // Set up the ImpactPoint3dEstimator ImpactPoint3dEstimator<BoundParameters, Propagator>::Config ipEstCfg( - bField, propagator, pOptions); + bField, propagator); ImpactPoint3dEstimator<BoundParameters, Propagator> ipEstimator(ipEstCfg); @@ -117,7 +116,7 @@ BOOST_AUTO_TEST_CASE(impactpoint_3d_estimator_params_distance_test) { Surface::makeShared<PerigeeSurface>(refPosition); // Creating the track - BoundParameters myTrack(tgContext, std::move(covMat), paramVec, + BoundParameters myTrack(geoContext, std::move(covMat), paramVec, perigeeSurface); // Distance in transverse plane @@ -125,7 +124,7 @@ BOOST_AUTO_TEST_CASE(impactpoint_3d_estimator_params_distance_test) { // Estimate 3D distance auto distanceRes = - ipEstimator.calculateDistance(tgContext, myTrack, refPosition); + ipEstimator.calculateDistance(geoContext, myTrack, refPosition); BOOST_CHECK(distanceRes.ok()); double distance = *distanceRes; @@ -140,8 +139,8 @@ BOOST_AUTO_TEST_CASE(impactpoint_3d_estimator_params_distance_test) { << std::endl; } - auto res = - ipEstimator.getParamsAtClosestApproach(tgContext, myTrack, refPosition); + auto res = ipEstimator.getParamsAtClosestApproach( + geoContext, magFieldContext, myTrack, refPosition); BOOST_CHECK(res.ok()); @@ -190,11 +189,10 @@ BOOST_AUTO_TEST_CASE(impactpoint_3d_estimator_compatibility_test) { // Set up propagator with void navigator auto propagator = std::make_shared<Propagator>(stepper); - PropagatorOptions<> pOptions(tgContext, mfContext); // Set up the ImpactPoint3dEstimator ImpactPoint3dEstimator<BoundParameters, Propagator>::Config ipEstCfg( - bField, propagator, pOptions); + bField, propagator); ImpactPoint3dEstimator<BoundParameters, Propagator> ipEstimator(ipEstCfg); @@ -240,25 +238,25 @@ BOOST_AUTO_TEST_CASE(impactpoint_3d_estimator_compatibility_test) { Surface::makeShared<PerigeeSurface>(refPosition); // Creating the track - BoundParameters myTrack(tgContext, std::move(covMat), paramVec, + BoundParameters myTrack(geoContext, std::move(covMat), paramVec, perigeeSurface); // Estimate 3D distance auto distanceRes = - ipEstimator.calculateDistance(tgContext, myTrack, refPosition); + ipEstimator.calculateDistance(geoContext, myTrack, refPosition); BOOST_CHECK(distanceRes.ok()); distancesList.push_back(*distanceRes); - auto res = - ipEstimator.getParamsAtClosestApproach(tgContext, myTrack, refPosition); + auto res = ipEstimator.getParamsAtClosestApproach( + geoContext, magFieldContext, myTrack, refPosition); BOOST_CHECK(res.ok()); BoundParameters params = std::move(**res); auto compRes = - ipEstimator.getVertexCompatibility(tgContext, ¶ms, refPosition); + ipEstimator.getVertexCompatibility(geoContext, ¶ms, refPosition); BOOST_CHECK(compRes.ok()); @@ -310,11 +308,10 @@ BOOST_AUTO_TEST_CASE(impactpoint_3d_estimator_athena_test) { // Set up propagator with void navigator auto propagator = std::make_shared<Propagator>(stepper); - PropagatorOptions<> pOptions(tgContext, mfContext); // Set up the ImpactPoint3dEstimator ImpactPoint3dEstimator<BoundParameters, Propagator>::Config ipEstCfg( - bField, propagator, pOptions); + bField, propagator); ImpactPoint3dEstimator<BoundParameters, Propagator> ipEstimator(ipEstCfg); @@ -329,9 +326,9 @@ BOOST_AUTO_TEST_CASE(impactpoint_3d_estimator_athena_test) { Surface::makeShared<PerigeeSurface>(pos1); // Some fixed track parameter values - BoundParameters params1(tgContext, covMat, pos1, mom1, 1, 0, perigeeSurface); + BoundParameters params1(geoContext, covMat, pos1, mom1, 1, 0, perigeeSurface); - auto res1 = ipEstimator.calculateDistance(tgContext, params1, vtxPos); + auto res1 = ipEstimator.calculateDistance(geoContext, params1, vtxPos); BOOST_CHECK(res1.ok()); double distance = (*res1); @@ -339,11 +336,11 @@ BOOST_AUTO_TEST_CASE(impactpoint_3d_estimator_athena_test) { const double result = 3.10391_mm; CHECK_CLOSE_ABS(distance, result, 0.00001_mm); - auto res2 = - ipEstimator.getParamsAtClosestApproach(tgContext, params1, vtxPos); + auto res2 = ipEstimator.getParamsAtClosestApproach( + geoContext, magFieldContext, params1, vtxPos); BOOST_CHECK(res2.ok()); BoundParameters endParams = std::move(**res2); - Vector3D surfaceCenter = endParams.referenceSurface().center(tgContext); + Vector3D surfaceCenter = endParams.referenceSurface().center(geoContext); BOOST_CHECK_EQUAL(surfaceCenter, vtxPos); } diff --git a/Tests/UnitTests/Core/Vertexing/IterativeVertexFinderTests.cpp b/Tests/UnitTests/Core/Vertexing/IterativeVertexFinderTests.cpp index 99bf17eec4e5a3b62800c774df6b00fd851b202f..0d2addda7bb00a53bd87609d547e4d82065accc0 100644 --- a/Tests/UnitTests/Core/Vertexing/IterativeVertexFinderTests.cpp +++ b/Tests/UnitTests/Core/Vertexing/IterativeVertexFinderTests.cpp @@ -37,8 +37,8 @@ using Propagator = Propagator<EigenStepper<ConstantBField>>; using Linearizer = HelicalTrackLinearizer<Propagator>; // Create a test context -GeometryContext tgContext = GeometryContext(); -MagneticFieldContext mfContext = MagneticFieldContext(); +GeometryContext geoContext = GeometryContext(); +MagneticFieldContext magFieldContext = MagneticFieldContext(); // Vertex x/y position distribution std::uniform_real_distribution<> vXYDist(-0.1_mm, 0.1_mm); @@ -102,10 +102,8 @@ BOOST_AUTO_TEST_CASE(iterative_finder_test) { // Set up propagator with void navigator auto propagator = std::make_shared<Propagator>(stepper); - PropagatorOptions<> pOptions(tgContext, mfContext); - // Linearizer for BoundParameters type test - Linearizer::Config ltConfig(bField, propagator, pOptions); + Linearizer::Config ltConfig(bField, propagator); Linearizer linearizer(ltConfig); using BilloirFitter = FullBilloirVertexFitter<BoundParameters, Linearizer>; @@ -117,7 +115,7 @@ BOOST_AUTO_TEST_CASE(iterative_finder_test) { // Set up all seed finder related things TrackToVertexIPEstimator<BoundParameters, Propagator>::Config ipEstCfg( - propagator, pOptions); + propagator); TrackToVertexIPEstimator<BoundParameters, Propagator> ipEst(ipEstCfg); using ZScanSeedFinder = ZScanVertexFinder<BilloirFitter>; @@ -139,7 +137,7 @@ BOOST_AUTO_TEST_CASE(iterative_finder_test) { using ImpactPointEstimator = ImpactPoint3dEstimator<BoundParameters, Propagator>; - ImpactPointEstimator::Config ip3dEstCfg(bField, propagator, pOptions); + ImpactPointEstimator::Config ip3dEstCfg(bField, propagator); ImpactPointEstimator ip3dEst(ip3dEstCfg); VertexFinder::Config cfg(std::move(bFitter), std::move(linearizer), @@ -210,7 +208,7 @@ BOOST_AUTO_TEST_CASE(iterative_finder_test) { 0., 0., 0., 0., 0., res_ph * res_ph, 0., 0., 0., 0., 0., 0., res_th * res_th, 0., 0., 0., 0., 0., 0., res_qp * res_qp, 0., 0., 0., 0., 0., 0., 1.; - auto params = BoundParameters(tgContext, std::move(covMat), paramVec, + auto params = BoundParameters(geoContext, std::move(covMat), paramVec, perigeeSurface); tracks.push_back(std::make_unique<BoundParameters>(params)); @@ -231,10 +229,11 @@ BOOST_AUTO_TEST_CASE(iterative_finder_test) { tracksPtr.push_back(trk.get()); } - VertexFinderOptions<BoundParameters> vFinderOptions(tgContext, mfContext); + VertexingOptions<BoundParameters> vertexingOptions(geoContext, + magFieldContext); // find vertices - auto res = finder.find(tracksPtr, vFinderOptions); + auto res = finder.find(tracksPtr, vertexingOptions); BOOST_CHECK(res.ok()); @@ -326,10 +325,8 @@ BOOST_AUTO_TEST_CASE(iterative_finder_test_user_track_type) { // Set up propagator with void navigator auto propagator = std::make_shared<Propagator>(stepper); - PropagatorOptions<> pOptions(tgContext, mfContext); - // Linearizer for user defined InputTrack type test - Linearizer::Config ltConfigUT(bField, propagator, pOptions); + Linearizer::Config ltConfigUT(bField, propagator); Linearizer linearizer(ltConfigUT); // Set up vertex fitter for user track type @@ -347,7 +344,7 @@ BOOST_AUTO_TEST_CASE(iterative_finder_test_user_track_type) { // Set up all seed finder related things TrackToVertexIPEstimator<InputTrack, Propagator>::Config ipEstCfg( - propagator, pOptions); + propagator); TrackToVertexIPEstimator<InputTrack, Propagator> ipEst(ipEstCfg); using ZScanSeedFinder = ZScanVertexFinder<BilloirFitter>; @@ -358,7 +355,7 @@ BOOST_AUTO_TEST_CASE(iterative_finder_test_user_track_type) { // IP 3D Estimator using ImpactPointEstimator = ImpactPoint3dEstimator<InputTrack, Propagator>; - ImpactPointEstimator::Config ip3dEstCfg(bField, propagator, pOptions); + ImpactPointEstimator::Config ip3dEstCfg(bField, propagator); ImpactPointEstimator ip3dEst(ip3dEstCfg); // Vertex Finder @@ -431,8 +428,8 @@ BOOST_AUTO_TEST_CASE(iterative_finder_test_user_track_type) { 0., 0., 0., 0., 0., res_ph * res_ph, 0., 0., 0., 0., 0., 0., res_th * res_th, 0., 0., 0., 0., 0., 0., res_qp * res_qp, 0., 0., 0., 0., 0., 0., 1.; - auto paramsUT = InputTrack(BoundParameters(tgContext, std::move(covMat), - paramVec, perigeeSurface)); + auto paramsUT = InputTrack(BoundParameters( + geoContext, std::move(covMat), paramVec, perigeeSurface)); tracks.push_back(std::make_unique<InputTrack>(paramsUT)); @@ -454,10 +451,11 @@ BOOST_AUTO_TEST_CASE(iterative_finder_test_user_track_type) { tracksPtr.push_back(trk.get()); } - VertexFinderOptions<InputTrack> vFinderOptionsUT(tgContext, mfContext); + VertexingOptions<InputTrack> vertexingOptionsUT(geoContext, + magFieldContext); // find vertices - auto res = finder.find(tracksPtr, vFinderOptionsUT); + auto res = finder.find(tracksPtr, vertexingOptionsUT); BOOST_CHECK(res.ok()); diff --git a/Tests/UnitTests/Core/Vertexing/KalmanVertexTrackUpdaterTests.cpp b/Tests/UnitTests/Core/Vertexing/KalmanVertexTrackUpdaterTests.cpp index 864d36741668fdc3416405b890575d40c959fc4f..211ea49e8d897edf59d82233c3fff5f6d9f7f0da 100644 --- a/Tests/UnitTests/Core/Vertexing/KalmanVertexTrackUpdaterTests.cpp +++ b/Tests/UnitTests/Core/Vertexing/KalmanVertexTrackUpdaterTests.cpp @@ -30,11 +30,11 @@ namespace Test { using Covariance = BoundSymMatrix; using Propagator = Propagator<EigenStepper<ConstantBField>>; -using Linearizer_t = HelicalTrackLinearizer<Propagator>; +using Linearizer = HelicalTrackLinearizer<Propagator>; // Create a test context -GeometryContext tgContext = GeometryContext(); -MagneticFieldContext mfContext = MagneticFieldContext(); +GeometryContext geoContext = GeometryContext(); +MagneticFieldContext magFieldContext = MagneticFieldContext(); // Vertex x/y position distribution std::uniform_real_distribution<> vXYDist(-0.1_mm, 0.1_mm); @@ -80,18 +80,17 @@ BOOST_AUTO_TEST_CASE(Kalman_Vertex_TrackUpdater) { // Set up propagator with void navigator auto propagator = std::make_shared<Propagator>(stepper); - PropagatorOptions<> pOptions(tgContext, mfContext); // Set up ImpactPoint3dEstimator, used for comparisons later ImpactPoint3dEstimator<BoundParameters, Propagator>::Config ip3dEstConfig( - bField, propagator, pOptions); + bField, propagator); ImpactPoint3dEstimator<BoundParameters, Propagator> ip3dEst(ip3dEstConfig); // Set up HelicalTrackLinearizer, needed for linearizing the tracks // Linearizer for BoundParameters type test - Linearizer_t::Config ltConfig(bField, propagator, pOptions); - Linearizer_t linearizer(ltConfig); + Linearizer::Config ltConfig(bField, propagator); + Linearizer linearizer(ltConfig); // Create perigee surface at origin std::shared_ptr<PerigeeSurface> perigeeSurface = @@ -129,12 +128,15 @@ BOOST_AUTO_TEST_CASE(Kalman_Vertex_TrackUpdater) { 0., 0., 0., 0., res_ph * res_ph, 0., 0., 0., 0., 0., 0., res_th * res_th, 0., 0., 0., 0., 0., 0., res_qp * res_qp, 0., 0., 0., 0., 0., 0., 1.; - BoundParameters params(tgContext, std::move(covMat), paramVec, + BoundParameters params(geoContext, std::move(covMat), paramVec, perigeeSurface); // Linearized state of the track LinearizedTrack linTrack = - linearizer.linearizeTrack(params, SpacePointVector::Zero()).value(); + linearizer + .linearizeTrack(params, SpacePointVector::Zero(), geoContext, + magFieldContext) + .value(); // Create TrackAtVertex TrackAtVertex<BoundParameters> trkAtVtx(0., params, ¶ms); @@ -150,15 +152,16 @@ BOOST_AUTO_TEST_CASE(Kalman_Vertex_TrackUpdater) { Vertex<BoundParameters> vtx(vtxPos); // Update trkAtVertex with assumption of originating from vtx - KalmanVertexTrackUpdater::update<BoundParameters>(tgContext, trkAtVtx, vtx); + KalmanVertexTrackUpdater::update<BoundParameters>(geoContext, trkAtVtx, + vtx); // The old distance double oldDistance = - ip3dEst.calculateDistance(tgContext, fittedParamsCopy, vtxPos).value(); + ip3dEst.calculateDistance(geoContext, fittedParamsCopy, vtxPos).value(); // The new distance after update double newDistance = - ip3dEst.calculateDistance(tgContext, trkAtVtx.fittedParams, vtxPos) + ip3dEst.calculateDistance(geoContext, trkAtVtx.fittedParams, vtxPos) .value(); if (debug) { std::cout << "Old distance: " << oldDistance << std::endl; diff --git a/Tests/UnitTests/Core/Vertexing/KalmanVertexUpdaterTests.cpp b/Tests/UnitTests/Core/Vertexing/KalmanVertexUpdaterTests.cpp index 8141369f751d2b0207f8df7fd2ca49b442d112d7..a8ba6b6172b9b032c1053ecc69d930e4a2a31e7e 100644 --- a/Tests/UnitTests/Core/Vertexing/KalmanVertexUpdaterTests.cpp +++ b/Tests/UnitTests/Core/Vertexing/KalmanVertexUpdaterTests.cpp @@ -29,11 +29,11 @@ namespace Test { using Covariance = BoundSymMatrix; using Propagator = Propagator<EigenStepper<ConstantBField>>; -using Linearizer_t = HelicalTrackLinearizer<Propagator>; +using Linearizer = HelicalTrackLinearizer<Propagator>; // Create a test context -GeometryContext tgContext = GeometryContext(); -MagneticFieldContext mfContext = MagneticFieldContext(); +GeometryContext geoContext = GeometryContext(); +MagneticFieldContext magFieldContext = MagneticFieldContext(); // Vertex x/y position distribution std::uniform_real_distribution<> vXYDist(-0.1_mm, 0.1_mm); @@ -81,12 +81,9 @@ BOOST_AUTO_TEST_CASE(Kalman_Vertex_Updater) { // Set up propagator with void navigator auto propagator = std::make_shared<Propagator>(stepper); - // Set up LinearizedTrackFactory, needed for linearizing the tracks - PropagatorOptions<> pOptions(tgContext, mfContext); - // Linearizer for BoundParameters type test - Linearizer_t::Config ltConfig(bField, propagator, pOptions); - Linearizer_t linearizer(ltConfig); + Linearizer::Config ltConfig(bField, propagator); + Linearizer linearizer(ltConfig); // Create perigee surface at origin std::shared_ptr<PerigeeSurface> perigeeSurface = @@ -126,12 +123,15 @@ BOOST_AUTO_TEST_CASE(Kalman_Vertex_Updater) { 0., 0., 0., 0., res_ph * res_ph, 0., 0., 0., 0., 0., 0., res_th * res_th, 0., 0., 0., 0., 0., 0., res_qp * res_qp, 0., 0., 0., 0., 0., 0., 1.; - BoundParameters params(tgContext, std::move(covMat), paramVec, + BoundParameters params(geoContext, std::move(covMat), paramVec, perigeeSurface); // Linearized state of the track LinearizedTrack linTrack = - linearizer.linearizeTrack(params, SpacePointVector::Zero()).value(); + linearizer + .linearizeTrack(params, SpacePointVector::Zero(), geoContext, + magFieldContext) + .value(); // Create TrackAtVertex TrackAtVertex<BoundParameters> trkAtVtx(0., params, ¶ms); diff --git a/Tests/UnitTests/Core/Vertexing/LinearizedTrackFactoryTests.cpp b/Tests/UnitTests/Core/Vertexing/LinearizedTrackFactoryTests.cpp index 48a9cae8f92cfe572c5d3a2c73723c5c94f69037..c450d6bf706859f3842ebecbcd8d454037105015 100644 --- a/Tests/UnitTests/Core/Vertexing/LinearizedTrackFactoryTests.cpp +++ b/Tests/UnitTests/Core/Vertexing/LinearizedTrackFactoryTests.cpp @@ -32,8 +32,8 @@ using Linearizer = HelicalTrackLinearizer<Propagator<EigenStepper<ConstantBField>>>; // Create a test context -GeometryContext tgContext = GeometryContext(); -MagneticFieldContext mfContext = MagneticFieldContext(); +GeometryContext geoContext = GeometryContext(); +MagneticFieldContext magFieldContext = MagneticFieldContext(); // Vertex x/y position distribution std::uniform_real_distribution<> vXYDist(-0.1_mm, 0.1_mm); @@ -79,7 +79,6 @@ BOOST_AUTO_TEST_CASE(linearized_track_factory_test) { auto propagator = std::make_shared<Propagator<EigenStepper<ConstantBField>>>(stepper); - PropagatorOptions<> pOptions(tgContext, mfContext); // Create perigee surface std::shared_ptr<PerigeeSurface> perigeeSurface = Surface::makeShared<PerigeeSurface>(Vector3D(0., 0., 0.)); @@ -120,11 +119,11 @@ BOOST_AUTO_TEST_CASE(linearized_track_factory_test) { covMat << resD0 * resD0, 0., 0., 0., 0., 0., 0., resZ0 * resZ0, 0., 0., 0., 0., 0., 0., resPh * resPh, 0., 0., 0., 0., 0., 0., resTh * resTh, 0., 0., 0., 0., 0., 0., resQp * resQp, 0., 0., 0., 0., 0., 0., 1.; - tracks.push_back(BoundParameters(tgContext, std::move(covMat), paramVec, + tracks.push_back(BoundParameters(geoContext, std::move(covMat), paramVec, perigeeSurface)); } - Linearizer::Config ltConfig(bField, propagator, pOptions); + Linearizer::Config ltConfig(bField, propagator); Linearizer linFactory(ltConfig); BoundVector vecBoundZero = BoundVector::Zero(); @@ -136,7 +135,10 @@ BOOST_AUTO_TEST_CASE(linearized_track_factory_test) { for (const BoundParameters& parameters : tracks) { LinearizedTrack linTrack = - linFactory.linearizeTrack(parameters, SpacePointVector::Zero()).value(); + linFactory + .linearizeTrack(parameters, SpacePointVector::Zero(), geoContext, + magFieldContext) + .value(); BOOST_CHECK_NE(linTrack.parametersAtPCA, vecBoundZero); BOOST_CHECK_NE(linTrack.covarianceAtPCA, matBoundZero); @@ -166,7 +168,6 @@ BOOST_AUTO_TEST_CASE(linearized_track_factory_straightline_test) { // Set up propagator with void navigator auto propagator = std::make_shared<Propagator<StraightLineStepper>>(stepper); - PropagatorOptions<> pOptions(tgContext, mfContext); // Create perigee surface std::shared_ptr<PerigeeSurface> perigeeSurface = Surface::makeShared<PerigeeSurface>(Vector3D(0., 0., 0.)); @@ -207,13 +208,13 @@ BOOST_AUTO_TEST_CASE(linearized_track_factory_straightline_test) { covMat << resD0 * resD0, 0., 0., 0., 0., 0., 0., resZ0 * resZ0, 0., 0., 0., 0., 0., 0., resPh * resPh, 0., 0., 0., 0., 0., 0., resTh * resTh, 0., 0., 0., 0., 0., 0., resQp * resQp, 0., 0., 0., 0., 0., 0., 1.; - tracks.push_back(BoundParameters(tgContext, std::move(covMat), paramVec, + tracks.push_back(BoundParameters(geoContext, std::move(covMat), paramVec, perigeeSurface)); } // Set up helical track linearizer for the case of a non-existing // magnetic field, which results in the extreme case of a straight line - LinearizerStraightLine::Config ltConfig(propagator, pOptions); + LinearizerStraightLine::Config ltConfig(propagator); LinearizerStraightLine linFactory(ltConfig); BoundVector vecBoundZero = BoundVector::Zero(); @@ -225,7 +226,10 @@ BOOST_AUTO_TEST_CASE(linearized_track_factory_straightline_test) { for (const BoundParameters& parameters : tracks) { LinearizedTrack linTrack = - linFactory.linearizeTrack(parameters, SpacePointVector::Zero()).value(); + linFactory + .linearizeTrack(parameters, SpacePointVector::Zero(), geoContext, + magFieldContext) + .value(); BOOST_CHECK_NE(linTrack.parametersAtPCA, vecBoundZero); BOOST_CHECK_NE(linTrack.covarianceAtPCA, matBoundZero); diff --git a/Tests/UnitTests/Core/Vertexing/TrackDensityVertexFinderTests.cpp b/Tests/UnitTests/Core/Vertexing/TrackDensityVertexFinderTests.cpp index 607b77daa89cf8fcb4866b83835cce39003be223..513c35cd7ea330e455d74b09b71179c5792ca4ad 100644 --- a/Tests/UnitTests/Core/Vertexing/TrackDensityVertexFinderTests.cpp +++ b/Tests/UnitTests/Core/Vertexing/TrackDensityVertexFinderTests.cpp @@ -29,8 +29,8 @@ namespace Test { using Covariance = BoundSymMatrix; // Create a test context -GeometryContext tgContext = GeometryContext(); -MagneticFieldContext mfContext = MagneticFieldContext(); +GeometryContext geoContext = GeometryContext(); +MagneticFieldContext magFieldContext = MagneticFieldContext(); /// /// @brief Unit test for TrackDensityVertexFinder using same configuration @@ -47,7 +47,8 @@ BOOST_AUTO_TEST_CASE(track_density_finder_test) { Vector3D pos1c{1.2_mm, 1.3_mm, -7_mm}; Vector3D mom1c{300_MeV, 1000_MeV, 100_MeV}; - VertexFinderOptions<BoundParameters> vFinderOptions(tgContext, mfContext); + VertexingOptions<BoundParameters> vertexingOptions(geoContext, + magFieldContext); TrackDensityVertexFinder<DummyVertexFitter<>, GaussianTrackDensity> finder; @@ -57,19 +58,19 @@ BOOST_AUTO_TEST_CASE(track_density_finder_test) { Surface::makeShared<PerigeeSurface>(pos0); // Test finder for some fixed track parameter values - BoundParameters params1a(tgContext, covMat, pos1a, mom1a, 1, 0, + BoundParameters params1a(geoContext, covMat, pos1a, mom1a, 1, 0, perigeeSurface); - BoundParameters params1b(tgContext, covMat, pos1b, mom1b, -1, 0, + BoundParameters params1b(geoContext, covMat, pos1b, mom1b, -1, 0, perigeeSurface); - BoundParameters params1c(tgContext, covMat, pos1c, mom1c, -1, 0, + BoundParameters params1c(geoContext, covMat, pos1c, mom1c, -1, 0, perigeeSurface); // Vectors of track parameters in different orders std::vector<const BoundParameters*> vec1 = {¶ms1a, ¶ms1b, ¶ms1c}; std::vector<const BoundParameters*> vec2 = {¶ms1c, ¶ms1a, ¶ms1b}; - auto res1 = finder.find(vec1, vFinderOptions); - auto res2 = finder.find(vec2, vFinderOptions); + auto res1 = finder.find(vec1, vertexingOptions); + auto res2 = finder.find(vec2, vertexingOptions); if (!res1.ok()) { std::cout << res1.error().message() << std::endl; @@ -106,7 +107,8 @@ BOOST_AUTO_TEST_CASE(track_density_finder_constr_test) { double const expectedZResult = -13.013; // Finder options - VertexFinderOptions<BoundParameters> vFinderOptions(tgContext, mfContext); + VertexingOptions<BoundParameters> vertexingOptions(geoContext, + magFieldContext); // Create constraint for seed finding Vector3D constraintPos{1.7_mm, 1.3_mm, -6_mm}; @@ -115,7 +117,7 @@ BOOST_AUTO_TEST_CASE(track_density_finder_constr_test) { Vertex<BoundParameters> vertexConstraint(constraintPos); vertexConstraint.setCovariance(constrCov); - vFinderOptions.vertexConstraint = vertexConstraint; + vertexingOptions.vertexConstraint = vertexConstraint; TrackDensityVertexFinder<DummyVertexFitter<>, GaussianTrackDensity> finder; @@ -125,17 +127,17 @@ BOOST_AUTO_TEST_CASE(track_density_finder_constr_test) { Surface::makeShared<PerigeeSurface>(pos0); // Test finder for some fixed track parameter values - BoundParameters params1a(tgContext, covMat, pos1a, mom1a, 1, 0, + BoundParameters params1a(geoContext, covMat, pos1a, mom1a, 1, 0, perigeeSurface); - BoundParameters params1b(tgContext, covMat, pos1b, mom1b, -1, 0, + BoundParameters params1b(geoContext, covMat, pos1b, mom1b, -1, 0, perigeeSurface); - BoundParameters params1c(tgContext, covMat, pos1c, mom1c, -1, 0, + BoundParameters params1c(geoContext, covMat, pos1c, mom1c, -1, 0, perigeeSurface); // Vector of track parameters std::vector<const BoundParameters*> vec1 = {¶ms1a, ¶ms1b, ¶ms1c}; - auto res = finder.find(vec1, vFinderOptions); + auto res = finder.find(vec1, vertexingOptions); if (!res.ok()) { std::cout << res.error().message() << std::endl; @@ -179,7 +181,8 @@ BOOST_AUTO_TEST_CASE(track_density_finder_random_test) { std::shared_ptr<PerigeeSurface> perigeeSurface = Surface::makeShared<PerigeeSurface>(pos0); - VertexFinderOptions<BoundParameters> vFinderOptions(tgContext, mfContext); + VertexingOptions<BoundParameters> vertexingOptions(geoContext, + magFieldContext); TrackDensityVertexFinder<DummyVertexFitter<>, GaussianTrackDensity> finder; @@ -209,7 +212,7 @@ BOOST_AUTO_TEST_CASE(track_density_finder_random_test) { Vector3D mom(pt * std::cos(phi), pt * std::sin(phi), pt * std::sinh(eta)); double charge = etaDist(gen) > 0 ? 1 : -1; - trackVec.push_back(BoundParameters(tgContext, covMat, pos, mom, charge, 0, + trackVec.push_back(BoundParameters(geoContext, covMat, pos, mom, charge, 0, perigeeSurface)); } @@ -218,7 +221,7 @@ BOOST_AUTO_TEST_CASE(track_density_finder_random_test) { trackPtrVec.push_back(&trk); } - auto res3 = finder.find(trackPtrVec, vFinderOptions); + auto res3 = finder.find(trackPtrVec, vertexingOptions); if (!res3.ok()) { std::cout << res3.error().message() << std::endl; } @@ -260,7 +263,7 @@ BOOST_AUTO_TEST_CASE(track_density_finder_usertrack_test) { double const expectedZResult = -13.013; // Finder options - VertexFinderOptions<InputTrack> vFinderOptions(tgContext, mfContext); + VertexingOptions<InputTrack> vertexingOptions(geoContext, magFieldContext); // Create constraint for seed finding Vector3D constraintPos{1.7_mm, 1.3_mm, -6_mm}; @@ -269,7 +272,7 @@ BOOST_AUTO_TEST_CASE(track_density_finder_usertrack_test) { Vertex<InputTrack> vertexConstraint(constraintPos); vertexConstraint.setCovariance(constrCov); - vFinderOptions.vertexConstraint = vertexConstraint; + vertexingOptions.vertexConstraint = vertexConstraint; std::function<BoundParameters(InputTrack)> extractParameters = [](InputTrack params) { return params.parameters(); }; @@ -284,16 +287,16 @@ BOOST_AUTO_TEST_CASE(track_density_finder_usertrack_test) { // Test finder for some fixed track parameter values InputTrack params1a( - BoundParameters(tgContext, covMat, pos1a, mom1a, 1, 0, perigeeSurface)); + BoundParameters(geoContext, covMat, pos1a, mom1a, 1, 0, perigeeSurface)); InputTrack params1b( - BoundParameters(tgContext, covMat, pos1b, mom1b, -1, 0, perigeeSurface)); + BoundParameters(geoContext, covMat, pos1b, mom1b, -1, 0, perigeeSurface)); InputTrack params1c( - BoundParameters(tgContext, covMat, pos1c, mom1c, -1, 0, perigeeSurface)); + BoundParameters(geoContext, covMat, pos1c, mom1c, -1, 0, perigeeSurface)); // Vector of track parameters std::vector<const InputTrack*> vec1 = {¶ms1a, ¶ms1b, ¶ms1c}; - auto res = finder.find(vec1, vFinderOptions); + auto res = finder.find(vec1, vertexingOptions); if (!res.ok()) { std::cout << res.error().message() << std::endl; diff --git a/Tests/UnitTests/Core/Vertexing/TrackToVertexIPEstimatorTests.cpp b/Tests/UnitTests/Core/Vertexing/TrackToVertexIPEstimatorTests.cpp index 9e99cc1631b9e3fe059ff67eb210173cde0a172d..377ce121430aa55debf991132274aaba2ff0601b 100644 --- a/Tests/UnitTests/Core/Vertexing/TrackToVertexIPEstimatorTests.cpp +++ b/Tests/UnitTests/Core/Vertexing/TrackToVertexIPEstimatorTests.cpp @@ -30,8 +30,8 @@ namespace Test { using Covariance = BoundSymMatrix; // Create a test context -GeometryContext tgContext = GeometryContext(); -MagneticFieldContext mfContext = MagneticFieldContext(); +GeometryContext geoContext = GeometryContext(); +MagneticFieldContext magFieldContext = MagneticFieldContext(); // Vertex x/y position distribution std::uniform_real_distribution<> vXYDist(-0.1_mm, 0.1_mm); @@ -79,8 +79,6 @@ BOOST_AUTO_TEST_CASE(track_to_vertex_ip_estimator_test) { auto propagator = std::make_shared<Propagator<EigenStepper<ConstantBField>>>(stepper); - PropagatorOptions<> pOptions(tgContext, mfContext); - // Create perigee surface std::shared_ptr<PerigeeSurface> perigeeSurface = Surface::makeShared<PerigeeSurface>(Vector3D(0., 0., 0.)); @@ -111,7 +109,7 @@ BOOST_AUTO_TEST_CASE(track_to_vertex_ip_estimator_test) { TrackToVertexIPEstimator<BoundParameters, Propagator<EigenStepper<ConstantBField>>>; - IPEst_t::Config ipEstCfg(propagator, pOptions); + IPEst_t::Config ipEstCfg(propagator); // Create TrackToVertexIPEstimator IPEst_t ipEst(ipEstCfg); @@ -140,12 +138,13 @@ BOOST_AUTO_TEST_CASE(track_to_vertex_ip_estimator_test) { 0., 0., 0., resPh * resPh, 0., 0., 0., 0., 0., 0., resTh * resTh, 0., 0., 0., 0., 0., 0., resQp * resQp, 0., 0., 0., 0., 0., 0., 1.; - BoundParameters track = - BoundParameters(tgContext, std::move(covMat), paramVec, perigeeSurface); + BoundParameters track = BoundParameters(geoContext, std::move(covMat), + paramVec, perigeeSurface); // Check if IP are retrieved ImpactParametersAndSigma output = - ipEst.estimate(track, myConstraint).value(); + ipEst.estimate(track, myConstraint, geoContext, magFieldContext) + .value(); BOOST_CHECK_NE(output.IPd0, 0.); BOOST_CHECK_NE(output.IPz0, 0.); } diff --git a/Tests/UnitTests/Core/Vertexing/ZScanVertexFinderTests.cpp b/Tests/UnitTests/Core/Vertexing/ZScanVertexFinderTests.cpp index c92a866418ea696715916444ce158ee02a1d5a90..f0c991b3d9a4c932b1def92dbdb1c5fb7d53a9cd 100644 --- a/Tests/UnitTests/Core/Vertexing/ZScanVertexFinderTests.cpp +++ b/Tests/UnitTests/Core/Vertexing/ZScanVertexFinderTests.cpp @@ -36,8 +36,8 @@ using Propagator = Propagator<EigenStepper<ConstantBField>>; using Linearizer_t = HelicalTrackLinearizer<Propagator>; // Create a test context -GeometryContext tgContext = GeometryContext(); -MagneticFieldContext mfContext = MagneticFieldContext(); +GeometryContext geoContext = GeometryContext(); +MagneticFieldContext magFieldContext = MagneticFieldContext(); // Vertex x/y position distribution std::uniform_real_distribution<> vXYDist(-0.1_mm, 0.1_mm); @@ -84,7 +84,6 @@ BOOST_AUTO_TEST_CASE(zscan_finder_test) { // Set up propagator with void navigator auto propagator = std::make_shared<Propagator>(stepper); - PropagatorOptions<> pOptions(tgContext, mfContext); typedef FullBilloirVertexFitter<BoundParameters, Linearizer_t> BilloirFitter; @@ -131,7 +130,7 @@ BOOST_AUTO_TEST_CASE(zscan_finder_test) { 0., 0., 0., 0., resPh * resPh, 0., 0., 0., 0., 0., 0., resTh * resTh, 0., 0., 0., 0., 0., 0., resQp * resQp, 0., 0., 0., 0., 0., 0., 1.; - tracks.push_back(BoundParameters(tgContext, std::move(covMat), paramVec, + tracks.push_back(BoundParameters(geoContext, std::move(covMat), paramVec, perigeeSurface)); } @@ -146,16 +145,17 @@ BOOST_AUTO_TEST_CASE(zscan_finder_test) { "Vertex finder does not fulfill vertex finder concept."); TrackToVertexIPEstimator<BoundParameters, Propagator>::Config ipEstCfg( - propagator, pOptions); + propagator); TrackToVertexIPEstimator<BoundParameters, Propagator> ipEst(ipEstCfg); VertexFinder::Config cfg(std::move(ipEst)); VertexFinder finder(std::move(cfg)); - VertexFinderOptions<BoundParameters> vFinderOptions(tgContext, mfContext); + VertexingOptions<BoundParameters> vertexingOptions(geoContext, + magFieldContext); - auto res = finder.find(tracksPtr, vFinderOptions); + auto res = finder.find(tracksPtr, vertexingOptions); BOOST_CHECK(res.ok()); @@ -205,7 +205,6 @@ BOOST_AUTO_TEST_CASE(zscan_finder_usertrack_test) { // Set up propagator with void navigator auto propagator = std::make_shared<Propagator>(stepper); - PropagatorOptions<> pOptions(tgContext, mfContext); typedef FullBilloirVertexFitter<InputTrack, Linearizer_t> BilloirFitter; @@ -251,7 +250,7 @@ BOOST_AUTO_TEST_CASE(zscan_finder_usertrack_test) { 0., 0., 0., 0., resPh * resPh, 0., 0., 0., 0., 0., 0., resTh * resTh, 0., 0., 0., 0., 0., 0., resQp * resQp, 0., 0., 0., 0., 0., 0., 1.; - tracks.push_back(InputTrack(BoundParameters(tgContext, std::move(covMat), + tracks.push_back(InputTrack(BoundParameters(geoContext, std::move(covMat), paramVec, perigeeSurface))); } @@ -266,7 +265,7 @@ BOOST_AUTO_TEST_CASE(zscan_finder_usertrack_test) { "Vertex finder does not fulfill vertex finder concept."); TrackToVertexIPEstimator<InputTrack, Propagator>::Config ipEstCfg( - propagator, pOptions); + propagator); TrackToVertexIPEstimator<InputTrack, Propagator> ipEst(ipEstCfg); VertexFinder::Config cfg(std::move(ipEst)); @@ -278,9 +277,9 @@ BOOST_AUTO_TEST_CASE(zscan_finder_usertrack_test) { VertexFinder finder(std::move(cfg), extractParameters); - VertexFinderOptions<InputTrack> vFinderOptions(tgContext, mfContext); + VertexingOptions<InputTrack> vertexingOptions(geoContext, magFieldContext); - auto res = finder.find(tracksPtr, vFinderOptions); + auto res = finder.find(tracksPtr, vertexingOptions); BOOST_CHECK(res.ok());