Skip to content
Snippets Groups Projects
Commit 12b5ef94 authored by Walter Lampl's avatar Walter Lampl
Browse files

Merge branch 'GSFSMoother_no_component' into 'master'

GSFSmoother does not need to be a separate component

See merge request atlas/athena!36160
parents 1f60f7e3 f818f37b
No related branches found
No related tags found
No related merge requests found
......@@ -9,20 +9,22 @@
* @brief Class for fitting according to the Gaussian Sum Filter formalism
*/
#include "AthenaBaseComps/AthAlgTool.h"
#include "GaudiKernel/EventContext.h"
#include "GaudiKernel/ToolHandle.h"
#include "TrkCaloCluster_OnTrack/CaloCluster_OnTrack.h"
#include "TrkDetElementBase/TrkDetElementBase.h"
#include "TrkEventPrimitives/PropDirection.h"
#include "TrkEventUtils/TrkParametersComparisonFunction.h"
#include "TrkFitterInterfaces/ITrackFitter.h"
#include "TrkGaussianSumFilter/IGsfSmoother.h"
#include "TrkFitterUtils/FitterTypes.h"
#include "TrkFitterUtils/TrackFitInputPreparator.h"
#include "TrkGaussianSumFilter/GsfMeasurementUpdator.h"
#include "TrkGaussianSumFilter/IMultiStateExtrapolator.h"
#include "TrkGaussianSumFilter/QuickCloseComponentsMultiStateMerger.h"
#include "TrkParameters/TrackParameters.h"
#include "TrkSurfaces/Surface.h"
#include "TrkToolInterfaces/IRIO_OnTrackCreator.h"
#include "AthenaBaseComps/AthAlgTool.h"
#include "GaudiKernel/EventContext.h"
#include "GaudiKernel/ToolHandle.h"
#include <atomic>
namespace Trk {
......@@ -118,6 +120,25 @@ private:
//* Calculate the fit quality */
const Trk::FitQuality* buildFitQuality(const Trk::SmoothedTrajectory&) const;
/** Gsf smoothe trajectory*/
SmoothedTrajectory* fit(
const EventContext& ctx,
Trk::IMultiStateExtrapolator::Cache&,
const ForwardTrajectory&,
const ParticleHypothesis particleHypothesis = nonInteracting,
const CaloCluster_OnTrack* ccot = nullptr) const;
/** Method for combining the forwards fitted state and the smoothed state */
MultiComponentState combine(const MultiComponentState&,
const MultiComponentState&) const;
/** Methof to add the CaloCluster onto the track */
MultiComponentState addCCOT(
const EventContext& ctx,
const Trk::TrackStateOnSurface* currentState,
const Trk::CaloCluster_OnTrack* ccot,
Trk::SmoothedTrajectory* smoothedTrajectory) const;
/** Forward GSF fit using PrepRawData */
std::unique_ptr<ForwardTrajectory> fitPRD(
const EventContext& ctx,
......@@ -159,10 +180,12 @@ private:
""
};
ToolHandle<IGsfSmoother> m_gsfSmoother{ this,
"GsfSmoother",
"Trk::GsfSmoother/GsfSmoother",
"" };
Gaudi::Property<unsigned int> m_maximumNumberOfComponents{
this,
"MaximumNumberOfComponents",
12,
"Maximum number of components"
};
Gaudi::Property<bool> m_StoreMCSOS{
this,
......@@ -192,22 +215,31 @@ private:
true,
"Do Hit Sorting" };
Gaudi::Property<bool> m_combineWithFitter{
this,
"CombineStateWithFitter",
false,
"Combine with forwards state during Smoothing"
};
// Measurement updator
GsfMeasurementUpdator m_updator;
PropDirection m_directionToPerigee;
std::unique_ptr<TrkParametersComparisonFunction>
m_trkParametersComparisonFunction;
std::unique_ptr<TrackFitInputPreparator> m_inputPreparator;
std::vector<double> m_sortingReferencePoint;
// Measurement updator
GsfMeasurementUpdator m_updator;
// For the forward fit part
double m_cutChiSquaredPerNumberDOF;
int m_overideMaterialEffects;
ParticleHypothesis m_overideParticleHypothesis;
bool m_overideMaterialEffectsSwitch;
// Counters for fit statistics
// Number of Fit PrepRawData Calls
mutable std::atomic<int> m_FitPRD;
// Number of Fit MeasurementBase Calls
......
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
/**
* @file GsfSmoother.h
* @date Friday 25th February 2005
* @author Tom Athkinson, Anthony Morley, Christos Anastopoulos
* @brief Class definition for the GSF smoother
*/
#ifndef TrkGsfSmoother_H
#define TrkGsfSmoother_H
#include "TrkGaussianSumFilter/IGsfSmoother.h"
#include "TrkGaussianSumFilter/GsfMeasurementUpdator.h"
#include "AthenaBaseComps/AthAlgTool.h"
#include "GaudiKernel/ToolHandle.h"
#include "TrkEventPrimitives/ParticleHypothesis.h"
#include "TrkFitterUtils/FitterTypes.h"
#include "TrkMultiComponentStateOnSurface/MultiComponentState.h"
namespace Trk {
class IMultiStateMeasurementUpdator;
class IMultiStateExtrapolator;
class CaloCluster_OnTrack;
class GsfSmoother
: public AthAlgTool
, virtual public IGsfSmoother
{
public:
/** Constructor with AlgTool parameters */
GsfSmoother(const std::string&, const std::string&, const IInterface*);
/** Virtual destructor */
virtual ~GsfSmoother() = default;
/** AlgTool initialise method */
virtual StatusCode initialize() override final ;
/** Configure the GSF smoother
- Configure the extrapolator
- Configure the measurement updator */
virtual StatusCode configureTools(
const ToolHandle<IMultiStateExtrapolator>& extrapolator) override final;
/** Gsf smoother method */
virtual SmoothedTrajectory* fit(
const EventContext& ctx,
Trk::IMultiStateExtrapolator::Cache&,
const ForwardTrajectory&,
const ParticleHypothesis particleHypothesis = nonInteracting,
const CaloCluster_OnTrack* ccot = nullptr) const override final;
private:
/** Method for combining the forwards fitted state and the smoothed state */
MultiComponentState combine(const MultiComponentState&,
const MultiComponentState&) const;
/** Methof to add the CaloCluster onto the track */
MultiComponentState addCCOT(
const EventContext& ctx,
const Trk::TrackStateOnSurface* currentState,
const Trk::CaloCluster_OnTrack* ccot,
Trk::SmoothedTrajectory* smoothedTrajectory) const;
private:
GsfMeasurementUpdator m_updator;
bool m_combineWithFitter;
Gaudi::Property<unsigned int> m_maximumNumberOfComponents{
this,
"MaximumNumberOfComponents",
12,
"Maximum number of components"
};
/*
* Special Tool Handle set by the configureTools
*/
ToolHandle<IMultiStateExtrapolator> m_extrapolator;
};
} // end Trk namespace
#endif
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
/**
* @file IGsfSmoother.h
* @date Thursday 8th January 2009
* @author Anthony Morley, Christos Anastopoulos
* @brief Abstract interface for the GSF smoother
*/
#ifndef TrkIGsfSmoother_H
#define TrkIGsfSmoother_H
#include "TrkEventPrimitives/ParticleHypothesis.h"
#include "TrkFitterUtils/FitterTypes.h"
#include "TrkGaussianSumFilter/IMultiStateExtrapolator.h"
#include "TrkMultiComponentStateOnSurface/MultiComponentState.h"
#include "GaudiKernel/EventContext.h"
#include "GaudiKernel/IAlgTool.h"
#include "GaudiKernel/ToolHandle.h"
namespace Trk {
class IMultiStateMeasurementUpdator;
class CaloCluster_OnTrack;
static const InterfaceID InterfaceID_GsfSmoother("GsfSmoother", 1, 0);
class IGsfSmoother : virtual public IAlgTool
{
public:
/** AlgTool interface method */
static const InterfaceID& interfaceID() { return InterfaceID_GsfSmoother; };
/** Virtual destructor */
virtual ~IGsfSmoother() = default;
/** Configure the GSF smoother
- Configure the extrapolator
- Configure the measurement updator */
virtual StatusCode configureTools(
const ToolHandle<IMultiStateExtrapolator>& extrapolator) = 0;
/** Gsf smoother method */
virtual SmoothedTrajectory* fit(
const EventContext& ctx,
Trk::IMultiStateExtrapolator::Cache&,
const ForwardTrajectory&,
const ParticleHypothesis particleHypothesis = nonInteracting,
const CaloCluster_OnTrack* ccot = nullptr) const = 0;
};
} // end Trk namespace
#endif
......@@ -28,8 +28,6 @@ component. The class TrkMultiComponentStateOnSurface handles this at present.
The following interfaces are declared
- IForwardGsfFitter - Forward GSF filter
- IGsfSmoother - GSF smoother
- Trk::IMultiStateExtrapolator - for extrapolation of
Trk::MultiComponentState objects
- Trk::IMultiStateMaterialEffectsUpdator - for convolution of
......@@ -42,10 +40,6 @@ all material effects packages).
The following implementation of the above Interfaces are provided
- Trk::GaussianSumFitter (implements Trk::ITrackFitter)
- Trk::ForwardGsfFitter (implements IForwardGsfFitter) Performs the filter
steps of the GSF
- Trk::GsfSmoother (implements IGsfSmoother) Performs the smoother steps of
the GSF
- Trk::GsfExtrapolator (implements Trk::IMultiStateExtrapolator) for the
Gaussian Sum Filter extrapolation proceedure
- Trk::GsfMaterialEffectsUpdator (implements
......
......@@ -38,10 +38,10 @@ Trk::GaussianSumFitter::GaussianSumFitter(const std::string& type,
const std::string& name,
const IInterface* parent)
: AthAlgTool(type, name, parent)
, m_updator{}
, m_directionToPerigee(Trk::oppositeMomentum)
, m_trkParametersComparisonFunction(nullptr)
, m_inputPreparator(nullptr)
, m_updator{}
, m_cutChiSquaredPerNumberDOF(50.)
, m_overideMaterialEffects(4)
, m_overideParticleHypothesis(nonInteracting)
......@@ -70,10 +70,7 @@ Trk::GaussianSumFitter::GaussianSumFitter(const std::string& type,
StatusCode
Trk::GaussianSumFitter::initialize()
{
StatusCode sc;
// Request the GSF smoother - hardwired type and instance name for the GSF
ATH_CHECK(m_gsfSmoother.retrieve());
// Request the GSF extrapolator
ATH_CHECK(m_extrapolator.retrieve());
......@@ -81,7 +78,6 @@ Trk::GaussianSumFitter::initialize()
// No need to return if RioOnTrack creator tool, only if PrepRawData is used
// in fit
if (m_rioOnTrackCreator.retrieve().isFailure()) {
if (!m_refitOnMeasurementBase) {
ATH_MSG_FATAL("Attempting to use PrepRawData with no RIO_OnTrack creator "
"tool provided... Exiting!");
......@@ -110,13 +106,6 @@ Trk::GaussianSumFitter::initialize()
<< m_overideMaterialEffects);
}
// Configure smoother
sc = m_gsfSmoother->configureTools(m_extrapolator);
if (sc.isFailure()) {
ATH_MSG_FATAL("Could not configure the GSF smoother... Exiting!");
return StatusCode::FAILURE;
}
m_inputPreparator = std::make_unique<TrackFitInputPreparator>();
ATH_MSG_INFO("Initialisation of " << name() << " was successful");
return StatusCode::SUCCESS;
......@@ -322,8 +311,8 @@ Trk::GaussianSumFitter::fit(
}
// Perform GSF smoother operation
SmoothedTrajectory* smoothedTrajectory = m_gsfSmoother->fit(
ctx, extrapolatorCache, *forwardTrajectory, particleHypothesis);
SmoothedTrajectory* smoothedTrajectory =
fit(ctx, extrapolatorCache, *forwardTrajectory, particleHypothesis);
// Protect against failed smoother fit
if (!smoothedTrajectory) {
......@@ -482,8 +471,8 @@ Trk::GaussianSumFitter::fit(
// Perform GSF smoother operation
SmoothedTrajectory* smoothedTrajectory = m_gsfSmoother->fit(
ctx, extrapolatorCache, *forwardTrajectory, particleHypothesis, ccot);
SmoothedTrajectory* smoothedTrajectory =
fit(ctx, extrapolatorCache, *forwardTrajectory, particleHypothesis, ccot);
// Protect against failed smoother fit
if (!smoothedTrajectory) {
......
......@@ -6,14 +6,12 @@
* @file GsfSmoother.cxx
* @date Wednesday 9th March 2005
* @author Tom Athkinson, Anthony Morley, Christos Anastopoulos
* @brief Implementation code for the class GsfSmoother
* @brief Implementation code for the smoothing part of the GSF fitter
*/
#include "TrkGaussianSumFilter/GsfSmoother.h"
#include "GaudiKernel/ToolHandle.h"
#include "TrkCaloCluster_OnTrack/CaloCluster_OnTrack.h"
#include "TrkDetElementBase/TrkDetElementBase.h"
#include "TrkGaussianSumFilter/GaussianSumFitter.h"
#include "TrkMeasurementBase/MeasurementBase.h"
#include "TrkParameters/TrackParameters.h"
#include "TrkPseudoMeasurementOnTrack/PseudoMeasurementOnTrack.h"
......@@ -24,50 +22,21 @@
#include "TrkGaussianSumFilter/QuickCloseComponentsMultiStateMerger.h"
#include "TrkMultiComponentStateOnSurface/MultiComponentStateOnSurface.h"
Trk::GsfSmoother::GsfSmoother(const std::string& type,
const std::string& name,
const IInterface* parent)
: AthAlgTool(type, name, parent)
, m_updator{}
, m_combineWithFitter(false)
{
declareInterface<IGsfSmoother>(this);
declareProperty("CombineStateWithFitter", m_combineWithFitter);
}
StatusCode
Trk::GsfSmoother::initialize()
{
return StatusCode::SUCCESS;
}
StatusCode
Trk::GsfSmoother::configureTools(
const ToolHandle<IMultiStateExtrapolator>& extrapolator)
{
m_extrapolator = extrapolator;
return StatusCode::SUCCESS;
}
Trk::SmoothedTrajectory*
Trk::GsfSmoother::fit(const EventContext& ctx,
Trk::IMultiStateExtrapolator::Cache& extrapolatorCache,
const ForwardTrajectory& forwardTrajectory,
const ParticleHypothesis particleHypothesis,
const Trk::CaloCluster_OnTrack* ccot) const
Trk::GaussianSumFitter::fit(
const EventContext& ctx,
Trk::IMultiStateExtrapolator::Cache& extrapolatorCache,
const ForwardTrajectory& forwardTrajectory,
const ParticleHypothesis particleHypothesis,
const Trk::CaloCluster_OnTrack* ccot) const
{
if (!m_extrapolator) {
ATH_MSG_ERROR("The extrapolator is not configured... Exiting!");
return nullptr;
}
// Check that the forward trajectory is filled
if (forwardTrajectory.empty()) {
ATH_MSG_ERROR(
"Attempting to smooth an empty forward trajectory... Exiting!");
return nullptr;
}
/* Instansiate the return trajectory. This is a vectory of TrackStateOnSurface
/* Instantiate the returned trajectoy. This is a vector of TrackStateOnSurface
object In the GSF Smoother these TrackStateOnSurface objects are the base
class for the MultiComponentStateOnSurface. This memory should be freed by
the fitter / smoother master method */
......@@ -365,7 +334,7 @@ Trk::GsfSmoother::fit(const EventContext& ctx,
}
Trk::MultiComponentState
Trk::GsfSmoother::combine(
Trk::GaussianSumFitter::combine(
const Trk::MultiComponentState& forwardsMultiState,
const Trk::MultiComponentState& smootherMultiState) const
{
......@@ -463,10 +432,11 @@ Trk::GsfSmoother::combine(
}
Trk::MultiComponentState
Trk::GsfSmoother::addCCOT(const EventContext& ctx,
const Trk::TrackStateOnSurface* currentState,
const Trk::CaloCluster_OnTrack* ccot,
Trk::SmoothedTrajectory* smoothedTrajectory) const
Trk::GaussianSumFitter::addCCOT(
const EventContext& ctx,
const Trk::TrackStateOnSurface* currentState,
const Trk::CaloCluster_OnTrack* ccot,
Trk::SmoothedTrajectory* smoothedTrajectory) const
{
const Trk::MultiComponentStateOnSurface* currentMultiStateOS = nullptr;
......
......@@ -4,7 +4,6 @@
#include "TrkGaussianSumFilter/GsfBetheHeitlerEffects.h"
#include "TrkGaussianSumFilter/GaussianSumFitter.h"
#include "TrkGaussianSumFilter/GsfExtrapolator.h"
#include "TrkGaussianSumFilter/GsfSmoother.h"
DECLARE_COMPONENT( Trk::GsfMaterialMixtureConvolution )
DECLARE_COMPONENT( Trk::GsfCombinedMaterialEffects )
......@@ -12,4 +11,3 @@ DECLARE_COMPONENT( Trk::GsfMaterialEffectsUpdator )
DECLARE_COMPONENT( Trk::GsfBetheHeitlerEffects )
DECLARE_COMPONENT( Trk::GaussianSumFitter )
DECLARE_COMPONENT( Trk::GsfExtrapolator )
DECLARE_COMPONENT( Trk::GsfSmoother )
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment