Skip to content
Snippets Groups Projects
Commit 1180abbe authored by Christos Anastopoulos's avatar Christos Anastopoulos
Browse files

Clean up / consolidate previous commits

Former-commit-id: 21179526
parent 3867968a
No related branches found
No related tags found
No related merge requests found
......@@ -41,7 +41,10 @@ atlas_add_component( TrkExTools
src/*.cxx
src/components/*.cxx
INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS}
LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps AthenaKernel GeoPrimitives EventPrimitives xAODTracking GaudiKernel TrkDetDescrUtils TrkGeometry TrkSurfaces TrkVolumes TrkEventPrimitives TrkNeutralParameters TrkParameters TrkExInterfaces TrkExUtils AthContainers CxxUtils TrkDetDescrInterfaces TrkEventUtils TrkMaterialOnTrack TrkParticleBase TrkTrack )
LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps AthenaKernel GeoPrimitives
EventPrimitives xAODTracking GaudiKernel TrkDetDescrUtils TrkGeometry TrkSurfaces TrkVolumes TrkEventPrimitives
TrkNeutralParameters TrkParameters TrkExInterfaces TrkExUtils AthContainers CxxUtils TrkDetDescrInterfaces TrkEventUtils
TrkMaterialOnTrack TrkParticleBase TrkTrack )
# Install files from the package:
atlas_install_headers( TrkExTools )
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
......@@ -109,18 +109,18 @@ namespace Trk {
virtual ~EnergyLossUpdator();
/** AlgTool initailize method.*/
StatusCode initialize();
virtual StatusCode initialize() override;
/** AlgTool finalize method */
StatusCode finalize();
virtual StatusCode finalize() override;
/** dEdX calculation when providing MaterialProperties,
a momentum, a pathlength, and a ParicleHypothesis:
Units: [MeV/mm]
*/
double dEdX(const MaterialProperties& mat,
double p,
ParticleHypothesis particle=pion) const;
virtual double dEdX(const MaterialProperties& mat,
double p,
ParticleHypothesis particle=pion) const override;
/** deltaE calculation
using dEdX and integrating along pathlength,
......@@ -131,35 +131,34 @@ namespace Trk {
mpv steers the most probable energy loss
*/
EnergyLoss* energyLoss(
virtual EnergyLoss* energyLoss(
const MaterialProperties& mat,
double p,
double pathcorrection,
PropDirection dir=alongMomentum,
ParticleHypothesis particle=pion,
bool mpv = false,
bool usePDGformula = false) const;
bool usePDGformula = false) const override;
/** Method to recalculate Eloss values for the fit setting an elossFlag using as an input
the detailed Eloss information Calorimeter energy, error momentum and momentum error */
EnergyLoss* updateEnergyLoss(EnergyLoss* eLoss, double caloEnergy, double caloEnergyError,
double pCaloEntry, double momentumError, int & elossFlag) const;
virtual EnergyLoss* updateEnergyLoss(EnergyLoss* eLoss, double caloEnergy, double caloEnergyError,
double pCaloEntry, double momentumError, int & elossFlag) const override;
/** Routine to calculate X0 and Eloss scale factors for the Calorimeter and Muon System */
void getX0ElossScales(int icalo, double eta, double phi, double & X0Scale, double & ElossScale ) const;
virtual void getX0ElossScales(int icalo, double eta, double phi, double & X0Scale, double & ElossScale ) const override;
private:
/** Method to return the variance of the change in q/p for the Bethe-Heitler parameterisation */
double varianceDeltaQoverP(const MaterialProperties&,
double p,
double pathcorrection,
PropDirection direction = alongMomentum,
ParticleHypothesis particleHypothesis = electron ) const;
ParticleHypothesis particleHypothesis = electron ) const ;
private:
Trk::MaterialInteraction m_matInt;
/** dEdX BetheBloch calculation:
Units: [MeV]
*/
......@@ -182,12 +181,13 @@ namespace Trk {
double dEdXBetheHeitler(const MaterialProperties& mat,
double initialE,
ParticleHypothesis particle=pion) const;
Trk::MaterialInteraction m_matInt;
double m_stragglingErrorScale; //!< stragglingErrorScale
double m_mpvScale; //!< a scalor that can be introduced for the MPV
bool m_useTrkUtils; //!< use eloss parametrisation from TrkUtils MaterialInterAction.h
bool m_gaussianVavilovTheory; //!< include energy loss straggling or not
bool m_useBetheBlochForElectrons; //!< use adopted bethe bloch for electrons
double m_stragglingErrorScale; //!< stragglingErrorScale
double m_mpvScale; //!< a scalor that can be introduced for the MPV
bool m_mpvSigmaParametric; //!< take the (crude) parametric mpv sigma
bool m_detailedEloss; //!< provide extended EnergyLoss info
bool m_optimalRadiation; //!< use calorimeter more optimal for radiation detection
......
......@@ -18,10 +18,13 @@
#include "TrkEventPrimitives/ParticleHypothesis.h"
#include "TrkParameters/TrackParameters.h"
#include "TrkExUtils/MaterialUpdateMode.h"
#include <vector>
#include <string>
#define TRKEXTOOLS_MAXUPDATES 100
#include <boost/thread/tss.hpp>
#define TRKEXTOOLS_MAXUPDATES 100
#ifndef COVARIANCEUPDATEWITHCHECK
#define COVARIANCEUPDATEWITHCHECK(cov, sign, value) cov += ( sign > 0 ? value : ( value > cov ? 0 : sign*value ) )
#endif
......@@ -65,9 +68,9 @@ class MaterialEffectsUpdator : public AthAlgTool,
virtual ~MaterialEffectsUpdator();
/** AlgTool initailize method.*/
StatusCode initialize() override;
virtual StatusCode initialize() override ;
/** AlgTool finalize method */
StatusCode finalize() override;
StatusCode finalize() override ;
/*
* The concrete cache class for this specialization of the IMaterialEffectsUpdator
......@@ -90,7 +93,7 @@ class MaterialEffectsUpdator : public AthAlgTool,
virtual std::unique_ptr<ICache> getCache() const override {
return std::make_unique<Cache>();
}
}
/** Updator interface (full update for a layer)
---> ALWAYS the same pointer is returned
......@@ -101,7 +104,7 @@ class MaterialEffectsUpdator : public AthAlgTool,
const Layer& sf,
PropDirection dir=alongMomentum,
ParticleHypothesis particle=pion,
MaterialUpdateMode matupmode=addNoise) const override{
MaterialUpdateMode matupmode=addNoise) const override {
Cache& cache= dynamic_cast<Cache&> (icache);
const TrackParameters* outparam = updateImpl(cache,parm,sf,dir,particle,matupmode);
......@@ -116,7 +119,7 @@ class MaterialEffectsUpdator : public AthAlgTool,
virtual const TrackParameters* update(ICache& icache, const TrackParameters* parm,
const MaterialEffectsOnTrack& meff,
Trk::ParticleHypothesis particle=pion,
MaterialUpdateMode matupmode=addNoise) const override{
MaterialUpdateMode matupmode=addNoise) const override {
Cache& cache= dynamic_cast<Cache&> (icache);
const TrackParameters* outparam = updateImpl(cache,parm,meff,particle,matupmode);
......@@ -132,7 +135,7 @@ class MaterialEffectsUpdator : public AthAlgTool,
const Layer& sf,
PropDirection dir=alongMomentum,
ParticleHypothesis particle=pion,
MaterialUpdateMode matupmode=addNoise) const override{
MaterialUpdateMode matupmode=addNoise) const override {
Cache& cache= dynamic_cast<Cache&> (icache);
const TrackParameters* outparam = preUpdateImpl(cache,parm,sf,dir,particle,matupmode);
......@@ -159,7 +162,7 @@ class MaterialEffectsUpdator : public AthAlgTool,
double pathcorrection,
PropDirection dir=alongMomentum,
ParticleHypothesis particle=pion,
MaterialUpdateMode matupmode=addNoise) const override{
MaterialUpdateMode matupmode=addNoise) const override {
Cache& cache= dynamic_cast<Cache&> (icache);
const TrackParameters* outparam = updateImpl(cache,parm,mprop,pathcorrection,dir,particle,matupmode);
......@@ -167,7 +170,7 @@ class MaterialEffectsUpdator : public AthAlgTool,
}
/** Validation Action - calls the writing and resetting of the TTree variables */
virtual void validationAction(ICache& icache) const override{
virtual void validationAction(ICache& icache) const override {
Cache& cache= dynamic_cast<Cache&> (icache);
validationActionImpl(cache);
......@@ -177,7 +180,7 @@ class MaterialEffectsUpdator : public AthAlgTool,
/** Only has an effect if m_landauMode == true.
Resets mutable variables used for non-local calculation of energy loss if
parm == 0. Otherwise, modifies parm with the final update of the covariance matrix*/
virtual void modelAction(ICache& icache, const TrackParameters* parm = 0) const override{
virtual void modelAction(ICache& icache, const TrackParameters* parm = 0) const override {
Cache& cache= dynamic_cast<Cache&> (icache);
modelActionImpl(cache,parm);
......@@ -192,7 +195,7 @@ class MaterialEffectsUpdator : public AthAlgTool,
const Layer& sf,
PropDirection dir=alongMomentum,
ParticleHypothesis particle=pion,
MaterialUpdateMode matupmode=addNoise) const override{
MaterialUpdateMode matupmode=addNoise) const override {
Cache& cache = getTLSCache();
const TrackParameters* outparam = updateImpl(cache,parm,sf,dir,particle,matupmode);
......@@ -202,7 +205,7 @@ class MaterialEffectsUpdator : public AthAlgTool,
virtual const TrackParameters* update(const TrackParameters* parm,
const MaterialEffectsOnTrack& meff,
Trk::ParticleHypothesis particle=pion,
MaterialUpdateMode matupmode=addNoise) const override{
MaterialUpdateMode matupmode=addNoise) const override {
Cache& cache = getTLSCache();
const TrackParameters* outparam = updateImpl(cache,parm,meff,particle,matupmode);
return outparam;
......@@ -212,7 +215,7 @@ class MaterialEffectsUpdator : public AthAlgTool,
const Layer& sf,
PropDirection dir=alongMomentum,
ParticleHypothesis particle=pion,
MaterialUpdateMode matupmode=addNoise) const override{
MaterialUpdateMode matupmode=addNoise) const override {
Cache& cache = getTLSCache();
const TrackParameters* outparam = preUpdateImpl(cache,parm,sf,dir,particle,matupmode);
return outparam;
......@@ -233,7 +236,7 @@ class MaterialEffectsUpdator : public AthAlgTool,
double pathcorrection,
PropDirection dir=alongMomentum,
ParticleHypothesis particle=pion,
MaterialUpdateMode matupmode=addNoise) const override{
MaterialUpdateMode matupmode=addNoise) const override {
Cache& cache = getTLSCache();
const TrackParameters* outparam = updateImpl(cache,parm,mprop,pathcorrection,dir,particle,matupmode);
return outparam;
......@@ -245,7 +248,7 @@ class MaterialEffectsUpdator : public AthAlgTool,
return;
}
virtual void modelAction(const TrackParameters* parm = 0) const override{
virtual void modelAction(const TrackParameters* parm = 0) const override {
Cache& cache = getTLSCache();
modelActionImpl(cache,parm);
return;
......@@ -328,13 +331,13 @@ class MaterialEffectsUpdator : public AthAlgTool,
ToolHandle< IMaterialMapper > m_materialMapper; //!< the material mapper for recording the layer material
/*
* TLS part
* The solution adopted here is an effort to implement
* TLS part
* The solution adopted here is an effort to implement
* "Schmidt, Douglas & Pryce, Nat & H. Harrison, Timothy. (1998).
* Thread-Specific Storage for C/C++ - An Object
* Behavioral Pattern for Accessing per-Thread State Efficiently."
* Published in "More C++ Gems (SIGS Reference Library)".
* Adopted here via boost::thread_specific_ptr
* Done here via boost::thread_specific_ptr
*/
mutable boost::thread_specific_ptr<Cache> m_cache_tls;
......@@ -346,8 +349,6 @@ class MaterialEffectsUpdator : public AthAlgTool,
}
return *cache;
}
};
} // end of namespace
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
......@@ -50,19 +50,19 @@ namespace Trk {
virtual ~MultipleScatteringUpdator();
/** AlgTool initailize method.*/
StatusCode initialize();
virtual StatusCode initialize() override;
/** AlgTool finalize method */
StatusCode finalize();
virtual StatusCode finalize() override;
/** Calculate the sigma on theta introduced by multiple scattering,
according to the RutherFord-Scott Formula
*/
double sigmaSquare(const MaterialProperties& mat,
virtual double sigmaSquare(const MaterialProperties& mat,
double p,
double pathcorrection,
ParticleHypothesis particle=pion,
double deltaE=0.) const;
double deltaE=0.) const override;
private:
......@@ -76,7 +76,7 @@ namespace Trk {
/** Random Generator service */
ServiceHandle<IAtRndmGenSvc> m_rndGenSvc;
/** Random engine */
CLHEP::HepRandomEngine* m_randomEngine;
CLHEP::HepRandomEngine* m_randomEngine;
std::string m_randomEngineName; //!< Name of the random number stream
};
......
......@@ -22,7 +22,8 @@
// STD
#include <cstring>
#include <exception>
#include <atomic>
#include "GaudiKernel/Counters.h"
namespace Trk {
......@@ -32,7 +33,7 @@ namespace Trk {
/** Exception to be thrown when TrackingGeometry not found */
class NavigatorException : public std::exception
{
virtual const char* what() const throw()
const char* what() const throw()
{ return "Problem with TrackingGeometry loading"; }
};
......@@ -67,35 +68,35 @@ namespace Trk {
virtual ~Navigator();
/** AlgTool initailize method.*/
StatusCode initialize();
StatusCode initialize() override;
/** AlgTool finalize method */
StatusCode finalize();
StatusCode finalize() override;
/** INavigator interface method - returns the TrackingGeometry used for navigation */
virtual const TrackingGeometry* trackingGeometry() const override;
virtual const TrackingGeometry* trackingGeometry() const override final;
/** INavigator interface methods - global search for the Volume one is in */
virtual const TrackingVolume* volume(const Amg::Vector3D& gp) const override;
virtual const TrackingVolume* volume(const Amg::Vector3D& gp) const override final;
/** INavigator interface method - forward hightes TrackingVolume */
virtual const TrackingVolume* highestVolume() const override;
virtual const TrackingVolume* highestVolume() const override final;
/** INavigator interface methods - getting the next BoundarySurface not knowing the Volume*/
virtual const BoundarySurface<TrackingVolume>* nextBoundarySurface( const IPropagator& prop,
const TrackParameters& parms,
PropDirection dir) const override;
PropDirection dir) const override final;
/** INavigator interface methods - getting the next BoundarySurface when knowing the Volume*/
virtual const BoundarySurface<TrackingVolume>* nextBoundarySurface( const IPropagator& prop,
const TrackParameters& parms,
PropDirection dir,
const TrackingVolume& vol ) const override;
const TrackingVolume& vol ) const override final;
/** INavigator interface method - getting the next Volume and the parameter for the next Navigation*/
virtual const NavigationCell nextTrackingVolume( const IPropagator& prop,
const TrackParameters& parms,
PropDirection dir,
const TrackingVolume& vol) const override;
const TrackingVolume& vol) const override final;
/** INavigator interface method - getting the next Volume and the parameter for the next Navigation
- contains full loop over volume boundaries
......@@ -106,19 +107,19 @@ namespace Trk {
PropDirection dir,
ParticleHypothesis particle,
const TrackingVolume& vol,
double& path) const override;
double& path) const override final;
/** INavigator interface method - getting the closest TrackParameters from a Track to a Surface*/
virtual const TrackParameters* closestParameters( const Track& trk,
const Surface& sf,
const IPropagator* prop = 0) const override;
const IPropagator* prop = 0) const override final;
/** INavigator method to resolve navigation at boundary */
virtual bool atVolumeBoundary( const Trk::TrackParameters* parms,
const Trk::TrackingVolume* vol,
Trk::PropDirection dir,
const Trk::TrackingVolume*& nextVol,
double tol) const override;
double tol) const override final;
/** Validation Action:
Can be implemented optionally, outside access to internal validation steps */
......@@ -163,18 +164,18 @@ namespace Trk {
// ------ PERFORMANCE STATISTICS -------------------------------- //
/* All performance stat counters are atomic (the simplest solution perhaps not the most performant one)*/
mutable std::atomic<int> m_forwardCalls; //!< counter for forward nextBounday calls
mutable std::atomic<int> m_forwardFirstBoundSwitch; //!< counter for failed first forward nextBounday calls
mutable std::atomic<int> m_forwardSecondBoundSwitch; //!< counter for failed second forward nextBounday calls
mutable std::atomic<int> m_forwardThirdBoundSwitch; //!< counter for failed third forward nextBounday calls
mutable Gaudi::Accumulators::Counter<int> m_forwardCalls; //!< counter for forward nextBounday calls
mutable Gaudi::Accumulators::Counter<int> m_forwardFirstBoundSwitch; //!< counter for failed first forward nextBounday calls
mutable Gaudi::Accumulators::Counter<int> m_forwardSecondBoundSwitch; //!< counter for failed second forward nextBounday calls
mutable Gaudi::Accumulators::Counter<int> m_forwardThirdBoundSwitch; //!< counter for failed third forward nextBounday calls
mutable std::atomic<int> m_backwardCalls; //!< counter for backward nextBounday calls
mutable std::atomic<int> m_backwardFirstBoundSwitch; //!< counter for failed first backward nextBounday calls
mutable std::atomic<int> m_backwardSecondBoundSwitch; //!< counter for failed second backward nextBounday calls
mutable std::atomic<int> m_backwardThirdBoundSwitch; //!< counter for failed third backward nextBounday calls
mutable Gaudi::Accumulators::Counter<int> m_backwardCalls; //!< counter for backward nextBounday calls
mutable Gaudi::Accumulators::Counter<int> m_backwardFirstBoundSwitch; //!< counter for failed first backward nextBounday calls
mutable Gaudi::Accumulators::Counter<int> m_backwardSecondBoundSwitch; //!< counter for failed second backward nextBounday calls
mutable Gaudi::Accumulators::Counter<int> m_backwardThirdBoundSwitch; //!< counter for failed third backward nextBounday calls
mutable std::atomic<int> m_outsideVolumeCase; //!< counter for navigation-break in outside volume cases (ovc)
mutable std::atomic<int> m_sucessfulBackPropagation; //!< counter for sucessful recovery of navigation-break in ovc
mutable Gaudi::Accumulators::Counter<int> m_outsideVolumeCase; //!< counter for navigation-break in outside volume cases (ovc)
mutable Gaudi::Accumulators::Counter<int> m_sucessfulBackPropagation; //!< counter for sucessful recovery of navigation-break in ovc
};
......
......@@ -38,13 +38,13 @@ namespace Trk{
virtual ~NavigatorValidation();
/** Validation Action:
Can be implemented optionally, outside access to internal validation steps */
virtual void validationAction() const override;
virtual void validationAction() const override final;
private:
virtual void validationInitialize() override ;
virtual void validationInitialize() override final;
/* no-op here */
virtual void validationFill(const Trk::TrackParameters* trackPar) const override;
virtual void validationFill(const Trk::TrackParameters* trackPar) const override final;
//------VALIDATION MODE SECTION ----------------------------------//
std::string m_validationTreeName; //!< validation tree name - to be acessed by this from root
......
......@@ -35,11 +35,11 @@ constexpr double s_mpv_p2 = -4.85133e-01;
// constructor
Trk::EnergyLossUpdator::EnergyLossUpdator(const std::string &t, const std::string &n, const IInterface *p) :
AthAlgTool(t, n, p),
m_stragglingErrorScale(1.),
m_mpvScale(0.98),
m_useTrkUtils(true),
m_gaussianVavilovTheory(false),
m_useBetheBlochForElectrons(true),
m_stragglingErrorScale(1.),
m_mpvScale(0.98),
m_mpvSigmaParametric(false),
m_detailedEloss(true),
m_optimalRadiation(true) {
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
......@@ -51,16 +51,16 @@ Trk::Navigator::Navigator(const std::string &t, const std::string &n, const IInt
m_useStraightLineApproximation(false),
m_searchWithDistance(true),
m_fastField(false),
m_forwardCalls{0},
m_forwardFirstBoundSwitch{0},
m_forwardSecondBoundSwitch{0},
m_forwardThirdBoundSwitch{0},
m_backwardCalls{0},
m_backwardFirstBoundSwitch{0},
m_backwardSecondBoundSwitch{0},
m_backwardThirdBoundSwitch{0},
m_outsideVolumeCase{0},
m_sucessfulBackPropagation{0}
m_forwardCalls{},
m_forwardFirstBoundSwitch{},
m_forwardSecondBoundSwitch{},
m_forwardThirdBoundSwitch{},
m_backwardCalls{},
m_backwardFirstBoundSwitch{},
m_backwardSecondBoundSwitch{},
m_backwardThirdBoundSwitch{},
m_outsideVolumeCase{},
m_sucessfulBackPropagation{}
{
declareInterface<INavigator>(this);
// steering of algorithms
......@@ -244,12 +244,12 @@ Trk::Navigator::nextTrackingVolume(const Trk::IPropagator &prop,
int tryBoundary = 0;
/* local counted to increment in the loop*/
int forwardFirstBoundSwitch{0};
int forwardSecondBoundSwitch{0};
int forwardThirdBoundSwitch{0};
int backwardFirstBoundSwitch{0};
int backwardSecondBoundSwitch{0};
int backwardThirdBoundSwitch{0};
auto forwardFirstBoundSwitch=m_forwardFirstBoundSwitch.buffer();
auto forwardSecondBoundSwitch=m_forwardSecondBoundSwitch.buffer();
auto forwardThirdBoundSwitch=m_forwardThirdBoundSwitch.buffer();
auto backwardFirstBoundSwitch=m_backwardFirstBoundSwitch.buffer();
auto backwardSecondBoundSwitch=m_backwardSecondBoundSwitch.buffer();
auto backwardThirdBoundSwitch=m_backwardThirdBoundSwitch.buffer();
for (surfAcc.begin(); surfAcc.end(); surfAcc.operator ++ ()) {
++tryBoundary;
......@@ -323,14 +323,6 @@ Trk::Navigator::nextTrackingVolume(const Trk::IPropagator &prop,
}
// ---------------------------------------------------
}
/* update the object level atomic ones*/
m_forwardFirstBoundSwitch+=forwardFirstBoundSwitch;
m_forwardSecondBoundSwitch+=forwardSecondBoundSwitch;
m_forwardThirdBoundSwitch+=forwardThirdBoundSwitch;
m_backwardFirstBoundSwitch+=backwardFirstBoundSwitch;
m_backwardSecondBoundSwitch+=backwardSecondBoundSwitch;
m_backwardThirdBoundSwitch+=backwardThirdBoundSwitch;
// return what you have : no idea
return Trk::NavigationCell(0, 0);
}
......
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