Commit 57398937 authored by Sarka Todorova's avatar Sarka Todorova Committed by Graeme Stewart
Browse files

merge with 00-02-15-branch (ISF_FatrasTools-00-03-05)

parent d3e4d319
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
// HadIntProcessorParametric.h, (c) ATLAS Detector software
///////////////////////////////////////////////////////////////////
#ifndef ISF_FATRASTOOLS_HadIntProcessorParametric_H
#define ISF_FATRASTOOLS_HadIntProcessorParametric_H
// GaudiKernel & Athena
#include "AthenaBaseComps/AthAlgTool.h"
#include "AthenaKernel/IAtRndmGenSvc.h"
#include "GaudiKernel/ServiceHandle.h"
#include "GaudiKernel/ToolHandle.h"
// Fatras
#include "ISF_FatrasInterfaces/IHadronicInteractionProcessor.h"
// Trk
#include "TrkEventPrimitives/PropDirection.h"
#include "TrkEventPrimitives/ParticleHypothesis.h"
// ISF
#include "ISF_Event/ITruthIncident.h"
#include "ISF_Event/ISFParticleVector.h"
// Barcode
#include "BarcodeInterfaces/PhysicsProcessCode.h"
#ifndef MAXHADINTCHILDREN
#define MAXHADINTCHILDREN 20
#endif
class StoreGateSvc;
class TTree;
namespace Trk {
class Material;
class MaterialProperties;
class TrackingGeometry;
class ITrackingGeometrySvc;
}
namespace ISF {
class IParticleBroker;
class ITruthSvc;
}
namespace iFatras {
class IPhysicsValidationTool;
/** @class HadIntProcessorParametric
Parametric implementation of nuclear interactions to be used
in Fatras. The parameterisation is gathered from Geant4.
@author Andreas.Salzburger@cern.ch, Carsten.Magass@cern.ch
*/
class HadIntProcessorParametric : virtual public iFatras::IHadronicInteractionProcessor,
public AthAlgTool {
public:
/**AlgTool constructor for HadIntProcessorParametric*/
HadIntProcessorParametric(const std::string&,const std::string&,const IInterface*);
/**Destructor*/
virtual ~HadIntProcessorParametric();
/** AlgTool initailize method.*/
StatusCode initialize();
/** AlgTool finalize method */
StatusCode finalize();
/** interface for processing of the nuclear interactions */
bool hadronicInteraction(const Trk::TrackParameters& parm, double p, double E,
const Trk::MaterialProperties& mprop, double pathCorrection,
Trk::ParticleHypothesis particle=Trk::pion) const;
/** interface for processing of the presampled nuclear interaction */
bool recordHadState(double time, double p,
const Amg::Vector3D& vertex,
const Amg::Vector3D& particleDir,
Trk::ParticleHypothesis particle ) const;
bool doHadronicInteraction(double time,const Trk::TrackParameters& parm,
const Trk::Material* ematprop,
Trk::ParticleHypothesis particle,
bool processSecondaries) const;
ISF::ISFParticleVector doHadIntOnLayer(const ISF::ISFParticle* parent, double time,const Trk::TrackParameters& parm,
const Trk::MaterialProperties* ematprop,
Trk::ParticleHypothesis particle) const;
private:
/** interface for calculation of absorption length */
double absorptionLength(const Trk::MaterialProperties* mat,
double p, double q, Trk::ParticleHypothesis particle=Trk::pion) const;
/** collect secondaries for layer material update */
ISF::ISFParticleVector getHadState(const ISF::ISFParticle* parent,
double time, double p,
const Amg::Vector3D& vertex,
const Amg::Vector3D& particleDir,
Trk::ParticleHypothesis particle ) const;
/** hadronic interaction setting */
double m_minimumHadOutEnergy;
double m_childMomParam;
bool m_cutChain;
bool m_hadIntFromX0;
double m_hadIntProbScale;
double m_minimumHadInitialEnergy;
/** ISF services & Tools */
ServiceHandle<ISF::IParticleBroker> m_particleBroker;
ServiceHandle<ISF::ITruthSvc> m_truthRecordSvc;
/** Random Generator service */
ServiceHandle<IAtRndmGenSvc> m_rndGenSvc;
/** MCTruth process code for TruthIncidents created by this tool */
Barcode::PhysicsProcessCode m_processCode;
/** Random engine */
CLHEP::HepRandomEngine* m_randomEngine;
std::string m_randomEngineName; //!< Name of the random number stream
/** struct of Particle Masses */
static Trk::ParticleMasses s_particleMasses;
bool m_validationMode;
ToolHandle<IPhysicsValidationTool> m_validationTool;
bool m_hadIntValidation;
std::string m_hadIntValidationTreeName; //!< validation tree name - to be acessed by this from root
std::string m_hadIntValidationTreeDescription; //!< validation tree description - second argument in TTree
std::string m_hadIntValidationTreeFolder; //!< stream/folder to for the TTree to be written out
TTree* m_hadIntValidationTree; //!< Root Validation Tree
// ------ ntuple branches
mutable float m_hadIntPointX; //!< ntuple variable : hadronic interaction point x coordinate
mutable float m_hadIntPointY; //!< ntuple variable : hadronic interaction point y coordinate
mutable float m_hadIntPointR; //!< ntuple variable : hadronic interaction point r distance
mutable float m_hadIntPointZ; //!< ntuple variable : hadronic interaction point z coordinate
mutable int m_hadIntMotherPdg; //!< ntuple variable : hadronic interaction mother Pdg
mutable int m_hadIntMotherBarcode; //!< ntuple variable : hadronic interaction mother barcode
mutable float m_hadIntMotherP; //!< ntuple variable : hadronic interaction mother momentum
mutable float m_hadIntMotherPt; //!< ntuple variable : hadronic interaction mother momentum
mutable float m_hadIntMotherPhi; //!< ntuple variable : hadronic interaction mother phi
mutable float m_hadIntMotherEta; //!< ntuple variable : hadronic interaction photon eta
mutable int m_hadIntChildren; //!< nutple variable : hadronic interaction children numbers
mutable float m_hadIntChildE; //!< nutple variable : hadronic interaction children total energy
mutable float m_hadIntChildP[MAXHADINTCHILDREN]; //!< nutple variable : hadronic interaction child Energy
mutable float m_hadIntChildPcms[MAXHADINTCHILDREN]; //!< nutple variable : hadronic interaction child Energy
mutable int m_hadIntChildPdg[MAXHADINTCHILDREN]; //!< nutple variable : hadronic interaction child Pdg
mutable float m_hadIntChildPhi[MAXHADINTCHILDREN]; //!< nutple variable : hadronic interaction child phi
mutable float m_hadIntChildEta[MAXHADINTCHILDREN]; //!< nutple variable : hadronic interaction child eta
mutable float m_hadIntChildTh[MAXHADINTCHILDREN]; //!< nutple variable : hadronic interaction child phi
mutable float m_hadIntChildThc[MAXHADINTCHILDREN]; //!< nutple variable : hadronic interaction child eta
mutable float m_hadIntChildDeltaPhi[MAXHADINTCHILDREN]; //!< nutple variable : hadronic interaction child delta phi
mutable float m_hadIntChildDeltaEta[MAXHADINTCHILDREN]; //!< nutple variable : hadronic interaction child delta eta
};
}
#endif // ISF_FATRASTOOLS_HadIntProcessorParametric_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/*********************************************************************************
McBetheHeitlerEnergyLossUpdator.h - description
-------------------------------------------------
begin : Wednesday 28th June 2006
author : atkinson
email : Tom.Atkinson@cern.ch
decription : Class for updating energy loss based on the Bethe-Heitler
distribution
*********************************************************************************/
#ifndef ISF_Fatras_McBetheHeitlerEnergyLossUpdator_H
#define ISF_Fatras_McBetheHeitlerEnergyLossUpdator_H
// Gaudi & Athena
#include "AthenaBaseComps/AthAlgTool.h"
#include "GaudiKernel/ServiceHandle.h"
#include "AthenaKernel/IAtRndmGenSvc.h"
// Trk
#include "TrkExInterfaces/IEnergyLossUpdator.h"
#include "TrkEventPrimitives/ParticleHypothesis.h"
#include "TrkEventPrimitives/PropDirection.h"
namespace Trk{
class MaterialProperties;
class EnergyLoss;
}
namespace iFatras{
class McBetheHeitlerEnergyLossUpdator : public AthAlgTool, virtual public Trk::IEnergyLossUpdator {
public:
/** Constructor with AlgTool parameters */
McBetheHeitlerEnergyLossUpdator( const std::string&, const std::string&, const IInterface* );
/** Destructor */
~McBetheHeitlerEnergyLossUpdator();
/** AlgTool initialise method */
StatusCode initialize();
/** AlgTool finalize method */
StatusCode finalize();
/** dEdx method - not used */
double dEdX( const Trk::MaterialProperties& materialProperties,
double momentum,
Trk::ParticleHypothesis particleHypothesis = Trk::electron ) const;
/** Method to determine the change in q/p and the variance */
Trk::EnergyLoss* energyLoss( const Trk::MaterialProperties& materialProperties,
double momentum,
double pathCorrection,
Trk::PropDirection direction = Trk::alongMomentum,
Trk::ParticleHypothesis particleHypothesis = Trk::electron,
bool mpv = false) const;
private:
/** Private method to compute the Bethe-Heitler PDF */
std::vector<double> betheHeitlerPDF( double pathLength ) const;
ServiceHandle<IAtRndmGenSvc> m_rndmGenSvc; //!< Random number generator
CLHEP::HepRandomEngine* m_randomEngine;
std::string m_randomEngineName; //!< Name of the random number stream
mutable std::vector<double> m_pdf;
mutable double m_cashedPathLength;
int m_numberPointsInPDF;
double m_scaleFactor; //!< the one free parameter to scale
static Trk::ParticleMasses s_particleMasses; //!< struct of Particle masses
};
} // end iFatras namespace
inline double iFatras::McBetheHeitlerEnergyLossUpdator::dEdX( const Trk::MaterialProperties&, double, Trk::ParticleHypothesis ) const
{ return 0.; }
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
// McEnergyLossUpdator.h, (c) ATLAS Detector software
///////////////////////////////////////////////////////////////////
#ifndef ISF_Fatras_McEnergyLossUpdator_H
#define ISF_Fatras_McEnergyLossUpdator_H
// GaudiKernel & Athena
#include "AthenaBaseComps/AthAlgTool.h"
#include "GaudiKernel/ServiceHandle.h"
#include "GaudiKernel/ToolHandle.h"
#include "AthenaKernel/IAtRndmGenSvc.h"
// Trk
#include "TrkExInterfaces/IEnergyLossUpdator.h"
#include "TrkEventPrimitives/PropDirection.h"
#include "TrkEventPrimitives/ParticleHypothesis.h"
namespace Trk{
class MaterialProperties;
class EnergyLoss;
}
namespace iFatras{
/** @class McEnergyLossUpdator
Updator for a eloss of a track on a Trk::Layer,
it extends the IEnergyLossUpdtor interface
@author Tom.Atkinson@cern.ch, Andreas.Salzburger@cern.ch
*/
class McEnergyLossUpdator : public AthAlgTool,
virtual public Trk::IEnergyLossUpdator {
public:
/** Constructor with AlgTool parameters */
McEnergyLossUpdator( const std::string&, const std::string&, const IInterface* );
/** Destructor */
~McEnergyLossUpdator();
/** AlgTool initialise method */
StatusCode initialize();
/** AlgTool finalise method */
StatusCode finalize();
/** IEnergyLossUpdator public method to compute dEdX */
double dEdX( const Trk::MaterialProperties& materialProperties,
double momentum,
Trk::ParticleHypothesis particleHypothesis = Trk::pion ) const;
/** IEnergyLossUpdator public method to compute the mean and variance of the energy loss */
Trk::EnergyLoss* energyLoss( const Trk::MaterialProperties& materialProperties,
double momentum,
double pathCorrection,
Trk::PropDirection direction = Trk::alongMomentum,
Trk::ParticleHypothesis particleHypothesis = Trk::pion,
bool mpv=true) const;
private:
ToolHandle<IEnergyLossUpdator> m_energyLossUpdator; //!< Pointer to the energy loss updator
int m_energyLossDistribution; //!< include energy loss straggling or not ( 0 == none, 1 == gauss, 2 == landau)
bool m_dedicatedElectronUpdator; //!< boolean switch for use of a dedicated eloss updator
ToolHandle<IEnergyLossUpdator> m_elEnergyLossUpdator; //!< Pointer to the energy loss updator - electrons
/** Random Generator service */
ServiceHandle<IAtRndmGenSvc> m_rndGenSvc;
/** Random engine */
CLHEP::HepRandomEngine* m_randomEngine;
std::string m_randomEngineName; //!< Name of the random number stream
static Trk::ParticleMasses s_particleMasses; //!< struct of Particle masses
};
} // end iFatras namespace
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
// McMaterialEffectsUpdator.h, (c) ATLAS Detector software
///////////////////////////////////////////////////////////////////
#ifndef ISF_FATRASTOOLS_TRACKONLAYERUPDATOR_H
#define ISF_FATRASTOOLS_TRACKONLAYERUPDATOR_H
// GaudiKernel & Athena
#include "AthenaBaseComps/AthAlgTool.h"
#include "AthenaKernel/IAtRndmGenSvc.h"
#include "GaudiKernel/ToolHandle.h"
#include "GaudiKernel/ServiceHandle.h"
// Trk
#include "TrkExInterfaces/ITimedMatEffUpdator.h"
#include "TrkEventPrimitives/PropDirection.h"
#include "TrkEventPrimitives/ParticleHypothesis.h"
#include "TrkParameters/TrackParameters.h"
#include "TrkEventUtils/TrkParametersManipulator.h"
#include "TrkExUtils/MaterialUpdateMode.h"
#include "TrkDetDescrUtils/LayerIndexSampleMap.h"
#include "TrkDetDescrUtils/GeometrySignature.h"
#include "TrkEventPrimitives/PdgToParticleHypothesis.h"
// ISF
#include "ISF_Event/ITruthIncident.h"
#include "ISF_Event/ISFParticleVector.h"
// Barcode
#include "BarcodeInterfaces/PhysicsProcessCode.h"
#ifndef MAXHADINTCHILDREN
#define MAXHADINTCHILDREN 20
#endif
class StoreGateSvc;
class TTree;
namespace Trk {
class EnergyLoss;
class CylinderVolumeBounds;
class IEnergyLossUpdator;
class IMultipleScatteringUpdator;
class TrackingGeometry;
class ITrackingGeometrySvc;
}
namespace ISF {
class IParticleBroker;
class ISFParticle;
class ITruthSvc;
}
namespace iFatras {
class IProcessSamplingTool;
class IPhysicsValidationTool;
class IHadronicInteractionProcessor;
class IPhotonConversionTool;
class IParticleDecayer;
/** @class McMaterialEffectsUpdator
Updator for a track on a Trk::Layer, it extends the IMaterialEffecsUpdator to
be used inside the Extrapolator with an update based on a Random number.
The McMaterialEffectsUpdator uses both an extended EnergyLossUpdator
and the standard ATLAS MultipleScatteringUpdator configured for the Gaussian-Mixture-Model.
@author Andreas.Salzburger@cern.ch, Carsten.Magass@cern.ch
*/
class McMaterialEffectsUpdator : public AthAlgTool,
public Trk::TrkParametersManipulator,
virtual public Trk::ITimedMatEffUpdator {
public:
/**AlgTool constructor for McMaterialEffectsUpdator*/
McMaterialEffectsUpdator(const std::string&,const std::string&,const IInterface*);
/**Destructor*/
virtual ~McMaterialEffectsUpdator();
/** AlgTool initailize method.*/
StatusCode initialize();
/** AlgTool finalize method */
StatusCode finalize();
/** Updator interface (full update for a layer):
given track parameters are deleted internally,
if no update has to be done,
the pointer is returned
*/
const Trk::TrackParameters* update(const Trk::TrackParameters* parm,
const Trk::Layer& sf,
Trk::TimeLimit& time, Trk::PathLimit& path,
Trk::GeometrySignature geoID,
Trk::PropDirection dir=Trk::alongMomentum,
Trk::ParticleHypothesis particle=Trk::pion) const;
const Trk::TrackParameters* update( double time,
const Trk::TrackParameters* parm,
const Trk::MaterialEffectsOnTrack& meff,
Trk::ParticleHypothesis particle=Trk::pion,
Trk::MaterialUpdateMode matupmode=Trk::addNoise) const;
/** Updator interface:
The parmeters are given as a reference,
MaterialProperties based material update
*/
const Trk::TrackParameters* update( double time,
const Trk::TrackParameters& parm,
const Trk::MaterialProperties& mprop,
double pathcorrection,
Trk::PropDirection dir=Trk::alongMomentum,
Trk::ParticleHypothesis particle=Trk::pion,
Trk::MaterialUpdateMode matupmode=Trk::addNoise) const;
const Trk::TrackParameters* interact(double time,
const Amg::Vector3D& position,
const Amg::Vector3D& momentum,
Trk::ParticleHypothesis particle,
int process,
const Trk::Material* extMatProp=0) const;
/** the helper function for a brem photon record */
void recordBremPhoton(double time,
double pElectron,
double gammaE,
const Amg::Vector3D& vertex,
Amg::Vector3D& particleDir,
Trk::ParticleHypothesis particle ) const;
private:
const Trk::TrackParameters* updateInLay(const ISF::ISFParticle* isp,
const Trk::TrackParameters* parm,
double& matFraction,
Trk::TimeLimit& time, Trk::PathLimit& path,
Trk::PropDirection dir=Trk::alongMomentum,
Trk::ParticleHypothesis particle=Trk::pion) const;
ISF::ISFParticleVector interactLay(const ISF::ISFParticle* isp,
double time,
const Trk::TrackParameters& parm,
Trk::ParticleHypothesis particle,
int process,
const Trk::MaterialProperties* extMatProp=0) const;
void radiate(const ISF::ISFParticle* parent, AmgVector(5)& updatedParameters,
const Amg::Vector3D& pos, Amg::Vector3D& dir,
Trk::TimeLimit time, double dX0, double& matFraction, double matTot,
Trk::PropDirection pdir,Trk::ParticleHypothesis particle) const;
void ionize(const Trk::TrackParameters& parm, AmgVector(5)& updatedPar,double dInX0,
Trk::PropDirection pdir,Trk::ParticleHypothesis particle ) const ;
/** handle the Energy loss */
//bool handleEnergyLoss(double time,
// const Trk::TrackParameters& parm,
// Amg::Vector3D* updatedParameter,
// Trk::EnergyLoss* sampldEnergyLoss,
// const Trk::Layer& lay,
// double p, double E, double m,
// Trk::ParticleHypothesis particle=Trk::pion) const;
/** the private multiple scattering sigma calculation*/
double msSigma(double dInX0,double p,Trk::ParticleHypothesis particle) const;
/** the private multiple Scattering update method, thetaMs is the projected random number*/
void multipleScatteringUpdate( const Trk::TrackParameters& parm,
AmgVector(5)& parameters,
double sigmaMSproj) const;
/** the helper function for a brem photon record */
void recordBremPhotonLay(const ISF::ISFParticle* parent,
Trk::TimeLimit time,
double pElectron,
double gammaE,
const Amg::Vector3D& vertex,
Amg::Vector3D& particleDir,
double matFraction,
Trk::PropDirection dir,
Trk::ParticleHypothesis particle ) const;
//!< retrieve or provide the layerIndexSampleMap */
const Trk::LayerIndexSampleMap* layerIndexSampleMap() const;
//!< retrieve TrackingGeometry (almost callback ready!)
StatusCode updateTrackingGeometry() const;
/** IEnergyLossUpdator */
bool m_eLoss;
ToolHandle<Trk::IEnergyLossUpdator> m_eLossUpdator;
/** IMultipleScatteringUpdator */
bool m_ms;
ToolHandle<Trk::IMultipleScatteringUpdator> m_msUpdator;
/** IPhotonConversionTool */
ToolHandle<iFatras::IPhotonConversionTool> m_conversionTool;
/** MCTruth process code for TruthIncidents created by this tool */
Barcode::PhysicsProcessCode m_processCode;
/** MCTruth process sampling */
ToolHandle<iFatras::IProcessSamplingTool> m_samplingTool;
/** pass geometry signature to offspring */
mutable Trk::GeometrySignature m_geomSignature;
/** hadronic interaction setting */
bool m_hadInt;
ToolHandle<IHadronicInteractionProcessor> m_hadIntProcessor;
/** Particle Decay */