Skip to content
Snippets Groups Projects
Commit 5bf8a20d authored by Graeme Stewart's avatar Graeme Stewart
Browse files

Simulation/G4Sim/FADS/FadsField deleted from 21.0

Former-commit-id: 2833a7744a7723ea2575a78829978217e196d2aa
parent b70239a6
No related branches found
Tags release/21.0.11
No related merge requests found
Showing
with 0 additions and 1023 deletions
################################################################################
# Package: FadsField
################################################################################
# Declare the package name:
atlas_subdir( FadsField )
# External dependencies:
find_package( CLHEP )
find_package( Geant4 )
find_package( XercesC )
# Component(s) in the package:
atlas_add_library( FadsField
src/*.cxx
PUBLIC_HEADERS FadsField
INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
DEFINITIONS ${CLHEP_DEFINITIONS}
LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} )
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef EqOfMotionFactory_H
#define EqOfMotionFactory_H
#include "FadsField/EqOfMotionFactoryBase.h"
#include "FadsField/FieldManager.h"
#include "G4Mag_EqRhs.hh"
#include "G4MagneticField.hh"
namespace FADS {
template <class T>
class EqOfMotionFactory : public EqOfMotionFactoryBase {
private:
T* theEqOfMotion;
public:
EqOfMotionFactory(std::string n): EqOfMotionFactoryBase(n) , theEqOfMotion(0)
{
RegisterToStore();
}
void Create()
{
if (!theEqOfMotion)
{
theEqOfMotion=
new T(FieldManager::GetFieldManager()->GetMagneticFieldMap());
}
}
void Delete()
{
if (theEqOfMotion)
{
delete theEqOfMotion;
theEqOfMotion=0;
}
}
virtual G4Mag_EqRhs* Build()
{
Create(); return theEqOfMotion;
}
void RegisterToStore() {FieldManager::GetFieldManager()->RegisterEqOfMotion(this);}
};
} // end namespace
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef EqOfMotionFactoryBase_H
#define EqOfMotionFactoryBase_H
#include <string>
class G4EquationOfMotion;
class G4Mag_EqRhs;
namespace FADS {
// abstract base class for implementing a templated stepper factory
class EqOfMotionFactoryBase {
public:
EqOfMotionFactoryBase(std::string n):EqOfMotionName(n) {}
virtual G4Mag_EqRhs* Build()=0;
std::string GetName() const {return EqOfMotionName;}
void SetName(std::string n) {EqOfMotionName=n;}
protected:
std::string EqOfMotionName;
};
} // end namespace
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef FadsFieldManager_H
#define FadsFieldManager_H
#include "G4FieldManager.hh"
#include <string>
#include "FadsField/FieldIntParameters.h"
class G4Track;
class G4Region;
class G4MagneticField;
class G4MagIntegratorStepper;
namespace FADS {
class FadsFieldManager: public G4FieldManager {
public:
FadsFieldManager(std::string);
std::string GetName() const;
void SetField(std::string);
virtual ~FadsFieldManager() {;}
void SetStepper(G4MagIntegratorStepper* );
private:
std::string m_name;
FADS::FieldIntParameters* defaultParameters;
const G4Track* previousTrack;
G4Region* previousRegion;
};
} // end namespace
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef FieldIntParameters_H
#define FieldIntParameters_H
class G4Track;
#include "globals.hh"
namespace FADS {
class FieldIntParameters
{
public:
FieldIntParameters();
virtual ~FieldIntParameters();
public:
void List(G4int iFlg=0) const;
public:
virtual void GetParameters(const G4Track*,
G4double& /*maxLengthForConstField*/,
G4double& /*missDistance*/,
G4double& /*typicalLongStep*/,
G4double& /*tolerableBiasError*/,
G4double& /*tolerableIntegrationError*/,
G4double& /*expectedNumBoundaries*/,
G4double& /*expectedTrackLength*/);
//
// This method is invoked when a track gets into the region.
//
// Return values
//
// maxLengthForConstField:
// if the estimated step size is shorter than this maxLengthForConstField,
// the field is assumed to be constant for the step.
//
// missDistance:
// tolerable deviation between actual trajectory and estimated
// chord.
//
// typicalLongStep:
// typicalLongStep is a suggestion to G4PathFinder. There is no
// need to be exact in this parameter but just the typical length
// of the "long" step in this detector region.
// Typically it would be 95-98 percentile of the step length in
// the region. For example, it could be (a factor times) distance
// between layers for barrel silicon detector.
//
// tolerableBiasError:
// tolerable biasing error (in length) accumulated in the region
//
// tolerableIntegrationError:
// tolerable integration (statistical) error (in length) accumulated
// in the region
//
// expectedNumBoundaries:
// number of geometrical boundaries this track is exprected to cross
// in the region
//
// expectedTrackLength:
// maximum distance this track could travel (neglecting spiral path)
// in the region
//
// Note:
// deltaIntersection, deltaOneStep, maxEpsilonStep, minEpsilonStep
// are given by
// deltaIntersection = tolerableBiasError / expectedNumBoundaries
// maxEpsilonStep = 2. * tolerableIntegrationError / expectedTrackLength
// minEpsilonStep = maxEpsilonStep / 10.
// deltaOneStep = minEpsilonStep * typicalLongStep
//
protected:
static G4double default_kineticEnergyThreshold;
static G4double default_maxLengthForConstField;
static G4double default_missDistance;
static G4double default_typicalLongStep;
static G4double default_tolerableBiasError;
static G4double default_tolerableIntegrationError;
static G4double default_expectedNumBoundaries;
static G4double default_expectedTrackLength;
G4double current_kineticEnergyThreshold;
// in the following parameters
// idx=0 for e+/e- track below E-threshold
// idx=1 for e+/e- track above E-threshold
// and all other charged track except mu+/mu-
// of any kinetic energy
// idx=2 for mu+/mu- track of any kinetic energy
G4double current_maxLengthForConstField[3];
G4double current_missDistance[3];
G4double current_typicalLongStep[3];
G4double current_tolerableBiasError[3];
G4double current_tolerableIntegrationError[3];
G4double current_expectedNumBoundaries[3];
G4double current_expectedTrackLength[3];
public:
inline static G4double GetDefault_kineticEnergyThreshold()
{ return default_kineticEnergyThreshold; }
inline static void SetDefault_kineticEnergyThreshold(G4double val)
{ default_kineticEnergyThreshold= val; }
inline static G4double GetDefault_maxLengthForConstField()
{ return default_maxLengthForConstField; }
inline static void SetDefault_maxLengthForConstField(G4double val)
{ default_maxLengthForConstField= val; }
inline static G4double GetDefault_missDistance()
{ return default_missDistance; }
inline static void SetDefault_missDistance(G4double val)
{ default_missDistance = val; }
inline static G4double GetDefault_typicalLongStep()
{ return default_typicalLongStep; }
inline static void SetDefault_typicalLongStep(G4double val)
{ default_typicalLongStep = val; }
inline static G4double GetDefault_tolerableBiasError()
{ return default_tolerableBiasError; }
inline static void SetDefault_tolerableBiasError(G4double val)
{ default_tolerableBiasError = val; }
inline static G4double GetDefault_tolerableIntegrationError()
{ return default_tolerableIntegrationError; }
inline static void SetDefault_tolerableIntegrationError(G4double val)
{ default_tolerableIntegrationError = val; }
inline static G4double GetDefault_expectedNumBoundaries()
{ return default_expectedNumBoundaries; }
inline static void SetDefault_expectedNumBoundaries(G4double val)
{ default_expectedNumBoundaries = val; }
inline static G4double GetDefault_expectedTrackLength()
{ return default_expectedTrackLength; }
inline static void SetDefault_expectedTrackLength(G4double val)
{ default_expectedTrackLength = val; }
inline G4double GetCurrent_kineticEnergyThreshold() const
{ return current_kineticEnergyThreshold; }
inline void SetCurrent_kineticEnergyThreshold(G4double val)
{ current_kineticEnergyThreshold= val; }
// in the following parameters
// idx=0 for e+/e- track below E-threshold
// idx=1 for e+/e- track above E-threshold
// and all other charged track except mu+/mu-
// of any kinetic energy
// idx=2 for mu+/mu- track of any kinetic energy
inline G4double GetCurrent_maxLengthForConstField(G4int idx) const
{ return current_maxLengthForConstField[idx]; }
inline void SetCurrent_maxLengthForConstField(G4int idx,G4double val)
{ current_maxLengthForConstField[idx]= val; }
inline G4double GetCurrent_missDistance(G4int idx) const
{ return current_missDistance[idx]; }
inline void SetCurrent_missDistance(G4int idx,G4double val)
{ current_missDistance[idx] = val; }
inline G4double GetCurrent_typicalLongStep(G4int idx) const
{ return current_typicalLongStep[idx]; }
inline void SetCurrent_typicalLongStep(G4int idx,G4double val)
{ current_typicalLongStep[idx] = val; }
inline G4double GetCurrent_tolerableBiasError(G4int idx) const
{ return current_tolerableBiasError[idx]; }
inline void SetCurrent_tolerableBiasError(G4int idx,G4double val)
{ current_tolerableBiasError[idx] = val; }
inline G4double GetCurrent_tolerableIntegrationError(G4int idx) const
{ return current_tolerableIntegrationError[idx]; }
inline void SetCurrent_tolerableIntegrationError(G4int idx,G4double val)
{ current_tolerableIntegrationError[idx] = val; }
inline G4double GetCurrent_expectedNumBoundaries(G4int idx) const
{ return current_expectedNumBoundaries[idx]; }
inline void SetCurrent_expectedNumBoundaries(G4int idx,G4double val)
{ current_expectedNumBoundaries[idx] = val; }
inline G4double GetCurrent_expectedTrackLength(G4int idx) const
{ return current_expectedTrackLength[idx]; }
inline void SetCurrent_expectedTrackLength(G4int idx,G4double val)
{ current_expectedTrackLength[idx] = val; }
private:
G4int nLongStep[3];
G4int nShortStep[3];
G4int idx;
public:
inline void LongStep()
{ nLongStep[idx]++; }
inline void ShortStep()
{ nShortStep[idx]++; }
};
}
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef FieldManager_H
#define FieldManager_H
#include <string>
#include <map>
class G4MagIntegratorStepper;
class G4Mag_EqRhs;
class G4ChordFinder;
#include "G4MagneticField.hh"
#include "FadsField/MagneticFieldMap.h"
namespace FADS {
class MagneticFieldMap;
class IntegratorStepperBase;
class EqOfMotionFactoryBase;
typedef std::map<std::string, MagneticFieldMap*, std::less<std::string> > FieldMap;
typedef std::map<std::string, IntegratorStepperBase*, std::less<std::string> > StepperMap;
typedef std::map<std::string, EqOfMotionFactoryBase*, std::less<std::string> > EquationMap;
class FieldManager {
private:
static FieldManager* thePointer;
FieldManager();
public:
static FieldManager* GetFieldManager();
void RegisterMagneticField(MagneticFieldMap* map);
void SelectMagneticField(const std::string& name);
void SelectAndCreateMagneticField(const std::string& name);
MagneticFieldMap* GetMagneticField(const std::string& name);
const MagneticFieldMap* GetMagneticField(const std::string& name) const;
void InitializeField();
void PrintFieldList() const;
void RegisterEqOfMotion(EqOfMotionFactoryBase*);
G4Mag_EqRhs* GetEqOfMotion(const std::string);
void RegisterStepper(IntegratorStepperBase* stepper);
void ListSteppers() const;
const StepperMap Steppers() const { return theSteppers; }
std::string CurrentStepper() const { return currentStepperName; }
void SetCurrentStepper(const std::string& name);
void UseCurrentStepper();
void UseStepper(const std::string& name);
G4MagIntegratorStepper* GetStepper(const std::string&);
G4Mag_EqRhs *GetEquationOfMotion();
static void SetDeltaOneStep(double);
static void SetDeltaIntersection(double);
static void SetMinimumEpsilonStep(double);
static void SetMaximumEpsilonStep(double);
void EquationOfMotion(const std::string s) {eqOfMotion=s;}
std::string EquationOfMotion() const {return eqOfMotion;}
G4MagneticField* GetMagneticFieldMap() {return currentField;}
G4MagIntegratorStepper* GetCurrentStepper() {return currentStepper;}
private:
FieldMap fieldCatalog;
StepperMap theSteppers;
EquationMap theEquations;
MagneticFieldMap* currentField;
G4MagIntegratorStepper* currentStepper;
std::string currentStepperName;
G4Mag_EqRhs* theEquation;
G4ChordFinder* theChordFinder;
std::string eqOfMotion;
};
}
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef FieldManagerFactory_H
#define FieldManagerFactory_H
#include "FadsField/FadsFieldManager.h"
#include <string>
namespace FADS {
class FieldManagerFactory {
public:
FieldManagerFactory(std::string n):name(n) { RegisterToStore(); }
std::string GetName() {return name;}
virtual FadsFieldManager *CreateFieldManager(std::string) = 0;
virtual ~FieldManagerFactory() {}
private:
std::string name;
void RegisterToStore();
};
}
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef FieldManagerFactoryStore_H
#define FieldManagerFactoryStore_H
#include "FadsField/FieldManagerFactory.h"
#include <map>
namespace FADS {
// class FieldManagerFactory;
typedef std::map<std::string,FieldManagerFactory*,std::less<std::string> > factoryMap;
class FieldManagerFactoryStore {
public:
static FieldManagerFactoryStore* GetStore();
void AddFieldManagerFactory(FieldManagerFactory *);
FieldManagerFactory *GetFieldManagerFactory(std::string n);
private:
FieldManagerFactoryStore();
factoryMap theFactories;
};
}
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef FieldManagerFactoryT_H
#define FieldManagerFactoryT_H
#include "FadsField/FieldManagerFactory.h"
namespace FADS {
template <class T> class FieldManagerFactoryT:public FieldManagerFactory {
public:
FieldManagerFactoryT(std::string n):FieldManagerFactory(n),theFactory(0) {}
FadsFieldManager *CreateFieldManager(std::string n)
{
if (!theFactory) theFactory=new T(n);
return theFactory;
}
private:
T* theFactory;
};
}
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef FieldManagerStore_H
#define FieldManagerStore_H
#include <map>
#include <string>
namespace FADS {
class FadsFieldManager;
typedef std::map<std::string,FadsFieldManager*,std::less<std::string> > fmList;
class FieldManagerStore {
friend class FadsFieldManager;
public:
static FieldManagerStore* GetFieldManagerStore();
FadsFieldManager* GetFieldManager(std::string);
private:
FieldManagerStore();
FieldManagerStore(const FieldManagerStore&);
static FieldManagerStore* GetFMStore();
static FieldManagerStore* p_fieldManagerStore;
void RegisterFieldManager(FadsFieldManager*);
fmList m_fieldManagerList;
};
} // end namespace
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef IntegratorStepperBase_H
#define IntegratorStepperBase_H
#include <string>
#include "G4MagIntegratorStepper.hh"
namespace FADS {
/// Abstract base class for implementing a templated stepper factory
class IntegratorStepperBase {
public:
IntegratorStepperBase(const std::string& n)
: stepperName(n)
{ }
virtual G4MagIntegratorStepper* Build() = 0;
std::string GetName() const {
return stepperName;
}
void SetName(const std::string& n) {
stepperName = n;
}
protected:
std::string stepperName;
};
}
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef IntegratorStepperFactory_H
#define IntegratorStepperFactory_H
#include "FadsField/IntegratorStepperBase.h"
#include "FadsField/FieldManager.h"
#include "G4MagIntegratorStepper.hh"
namespace FADS {
template <class T>
class IntegratorStepperFactory : public IntegratorStepperBase {
private:
T* theStepper;
public:
IntegratorStepperFactory(std::string n): IntegratorStepperBase(n) , theStepper(0)
{
RegisterToStore();
}
void Create()
{
if (!theStepper)
{
theStepper=
new T(FieldManager::GetFieldManager()->GetEquationOfMotion());
}
}
void Delete()
{
if (theStepper)
{
delete theStepper;
theStepper=0;
}
}
virtual G4MagIntegratorStepper* Build()
{
Create(); return theStepper;
}
void RegisterToStore() {FieldManager::GetFieldManager()->RegisterStepper(this);}
};
} // end namespace
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef MagneticFieldMap_H
#define MagneticFieldMap_H
#include "G4MagneticField.hh"
#include <string>
namespace FADS {
class MagneticFieldMap: public G4MagneticField {
public:
MagneticFieldMap();
MagneticFieldMap(std::string n);
void GetFieldValue( const double *xyzPos, double *xyzField) const;
virtual void Initialize() {}
virtual void Terminate() {}
virtual MagneticFieldMap* Create() {return this;}
virtual MagneticFieldMap* Create(std::string) {return this;}
bool IsInitialized() {return initialized;}
virtual void FieldValue( const double *xyzPos, double *xyzField) const = 0;
std::string GetName() {return name;}
void SetInitialValues();
protected:
std::string name;
bool initialized;
};
} // end namespace
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef MagneticFieldMapT_H
#define MagneticFieldMapT_H
#include "FadsField/MagneticFieldMap.h"
#include "FadsField/FieldManager.h"
#include <map>
#include <string>
#include <iostream>
namespace FADS {
template <class T> class MagneticFieldMapT: public MagneticFieldMap {
private:
MagneticFieldMap *g;
std::map<std::string, MagneticFieldMap *, std::less<std::string> > fMaps;
public:
MagneticFieldMapT(std::string n): MagneticFieldMap(n),g(0)
{
FieldManager::GetFieldManager()->RegisterMagneticField(this);
}
~MagneticFieldMapT() {if (g) delete g;}
MagneticFieldMap* Create() {
//std::cout<<" This is "<<GetName()<<std::endl;
if (g) return g;
g=new T;
return g;
}
MagneticFieldMap* Create(std::string n) {
//std::cout<<" This is "<<GetName()<<" field name "<<n<<std::endl;
//std::cout<<" building the map ";
if (fMaps.find(n) != fMaps.end() )
return fMaps[n];
else
{
//std::cout<<" Map not found in the list: building it ";
fMaps[n]=new T(n);
if (g==0) g=fMaps[n];
//std::cout<<fMaps[n]<<std::endl;
return fMaps[n];
}
}
void Initialize() {
if (g) g->Initialize();
}
void Terminate() {
g->Terminate();
delete g;
g=0;
}
void FieldValue(const double *xyzPos, double *xyzField) const {
if (g) g->FieldValue(xyzPos, xyzField);
else
for (int i=0;i<3;i++) xyzField[i] = 0.;
}
};
} // end namespace
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef RegionInformation_H
#define RegionInformation_H
#include "G4VUserRegionInformation.hh"
#include "FadsField/FieldIntParameters.h"
namespace FADS {
class RegionInformation : public G4VUserRegionInformation
{
public:
RegionInformation();
virtual ~RegionInformation();
public:
void Print() const;
private:
FADS::FieldIntParameters* fieldIntPara;
public:
inline FADS::FieldIntParameters* GetFieldIntParameters() const
{ return fieldIntPara; }
inline void SetFieldIntParameters(FADS::FieldIntParameters* fip)
{ fieldIntPara = fip; }
};
}
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TestFieldManager_H
#define TestFieldManager_H
#include "FadsField/FadsFieldManager.h"
class TestFieldManager: public FADS::FadsFieldManager {
public:
TestFieldManager(std::string s):FADS::FadsFieldManager(s) {;}
void ConfigureForTrack(const G4Track* );
};
#endif
package FadsField
author ADA
use AtlasPolicy AtlasPolicy-*
use Geant4 Geant4-* External
include_dirs "$(FadsField_root)"
library FadsField ../src/*.cxx
apply_pattern installed_library
#=======================================================
#private
#
#macro_remove cppflags "-O3 "
#macro_remove cppflags "-O "
#macro_remove cppflags "-Wall "
#
#macro_remove CLHEP_pp_cppflags "-DCLHEP_SQR_DEFINED "
#macro_remove CLHEP_pp_cppflags "-DCLHEP_MAX_MIN_DEFINED "
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/**
@mainpage
@ref used_FadsField
@ref requirements_FadsField
*/
/**
@page used_FadsField Used Packages
@htmlinclude used_packages.html
*/
/**
@page requirements_FadsField Requirements
@include requirements
*/
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include "FadsField/FadsFieldManager.h"
#include "FadsField/FieldManagerStore.h"
#include "FadsField/FieldManager.h"
#include "FadsField/MagneticFieldMap.h"
#include "G4ChordFinder.hh"
#include "G4Mag_UsualEqRhs.hh"
#include "G4Track.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4Region.hh"
#include "G4MagIntegratorStepper.hh"
#include "FadsField/RegionInformation.h"
#include "FadsField/FieldIntParameters.h"
namespace FADS {
FadsFieldManager::FadsFieldManager(std::string name):G4FieldManager(),m_name(name)
{
FieldManagerStore* fms=FieldManagerStore::GetFMStore();
fms->RegisterFieldManager(this);
defaultParameters = new FADS::FieldIntParameters();
previousTrack = NULL;
previousRegion = NULL;
}
void FadsFieldManager::SetField(std::string /*fName*/)
{
// FADS::FieldManager *fm=FADS::FieldManager::GetFieldManager();
// step one - get the field map, create it, initialize it
// MagneticFieldMap* magField=fm->GetMagneticField(fName);
// if (!magField) return;
// G4MagneticField* theMap=magField->Create(fName);
// if (!magField->IsInitialized()) magField->SetInitialValues();
// std::cout<<"Field initialization completed!"<<std::endl;
// G4Mag_EqRhs* eqMotion = fm->GetEquationOfMotion();
// fStepperDispatcher = new FADS::StepperDispatcher(eqMotion);
// G4double minStep = 0.001*CLHEP::mm;
// std::cout<<"Making a chord finder with the stepper dispatcher!"<<std::endl;
// G4ChordFinder* chordFinder = new G4ChordFinder(theMap,minStep,fStepperDispatcher);
// SetDetectorField(theMap);
// SetChordFinder(chordFinder);
// std::cout<<"Construction of FadsFieldManager complete!!"<<std::endl;
}
std::string FadsFieldManager::GetName() const
{
return m_name;
}
void FadsFieldManager::SetStepper(G4MagIntegratorStepper* stepper)
{
if (stepper == 0)
{
std::cout<<"FadsFieldManager: Can't set NULL stepper. Nothing changed." <<std::endl;
return;
}
G4ChordFinder * theChordFinder = this->GetChordFinder();
if (theChordFinder)
{
if (theChordFinder->GetIntegrationDriver())
{
theChordFinder->GetIntegrationDriver()->RenewStepperAndAdjust(stepper);
}
else
{
std::cout<<"FadsFieldManager: theChordFinder=" << theChordFinder <<
" theChordFinder->GetIntegrationDriver()=" <<
theChordFinder->GetIntegrationDriver() <<
". Something is wrong. " <<std::endl;
}
}
else
{
std::cout<<"FadsFieldManager: theChordFinder=NULL. Something is wrong. " <<std::endl;
}
return;
}
}
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include "FadsField/FieldIntParameters.h"
#include "G4Track.hh"
#include "G4ParticleDefinition.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4MuonPlus.hh"
#include "G4MuonMinus.hh"
//#include "G4ChargedGeantino.hh"
namespace FADS {
G4double FieldIntParameters::default_kineticEnergyThreshold = 1.0*CLHEP::GeV;
G4double FieldIntParameters::default_maxLengthForConstField = 1.0*CLHEP::mm;
G4double FieldIntParameters::default_missDistance = 0.25*CLHEP::mm;
G4double FieldIntParameters::default_typicalLongStep = 1.0*CLHEP::cm;
G4double FieldIntParameters::default_tolerableBiasError = 1.0e-5*CLHEP::m;
G4double FieldIntParameters::default_tolerableIntegrationError = 1.0e-4*CLHEP::m;
G4double FieldIntParameters::default_expectedNumBoundaries = 1.0e2;
G4double FieldIntParameters::default_expectedTrackLength = 20.0*CLHEP::m;
FieldIntParameters::FieldIntParameters()
{
current_kineticEnergyThreshold = default_kineticEnergyThreshold;
// for e+/e- track below current_kineticEnergyThreshold
current_maxLengthForConstField[0] = default_maxLengthForConstField * 100.;
current_missDistance[0] = default_missDistance;
current_typicalLongStep[0] = default_typicalLongStep;
current_tolerableBiasError[0] = default_tolerableBiasError;
current_tolerableIntegrationError[0] = default_tolerableIntegrationError * 10.;
current_expectedNumBoundaries[0] = default_expectedNumBoundaries / 10.;
current_expectedTrackLength[0] = default_expectedTrackLength / 100.;
// for e+/e- track above current_kineticEnergyThreshold
// and all other charged track except mu+/mu- of any kinetic energy
current_maxLengthForConstField[1] = default_maxLengthForConstField / 1000.;
current_missDistance[1] = default_missDistance;
current_typicalLongStep[1] = default_typicalLongStep;
current_tolerableBiasError[1] = default_tolerableBiasError;
current_tolerableIntegrationError[1] = default_tolerableIntegrationError;
current_expectedNumBoundaries[1] = default_expectedNumBoundaries;
current_expectedTrackLength[1] = default_expectedTrackLength;
// for mu+/mu- track of any kinetic energy
current_maxLengthForConstField[2] = default_maxLengthForConstField / 1000.;
current_missDistance[2] = default_missDistance;
current_typicalLongStep[2] = default_typicalLongStep;
current_tolerableBiasError[2] = default_tolerableBiasError / 10.;
current_tolerableIntegrationError[2] = default_tolerableIntegrationError;
current_expectedNumBoundaries[2] = default_expectedNumBoundaries;
current_expectedTrackLength[2] = default_expectedTrackLength;
for(int i=0;i<3;i++)
{
nLongStep[i] = 0;
nShortStep[i] = 0;
}
idx = -1;
}
FieldIntParameters::~FieldIntParameters()
{;}
void FieldIntParameters::List(G4int iFlg) const
{
if(iFlg)
{
G4cout<<" Number of Long Steps for each pType \t"<<nLongStep[0]<<"\t"<<nLongStep[1]
<<"\t"<<nLongStep[2]<<"\t-- Total long steps "<<nLongStep[0]+nLongStep[1]+nLongStep[2]<<G4endl;
G4cout<<" Number of Short Steps for each pType\t"<<nShortStep[0]<<"\t"<<nShortStep[1]
<<"\t"<<nShortStep[2]<<"\t-- Total short steps "<<nShortStep[0]+nShortStep[1]+nShortStep[2]<<G4endl;
}
G4cout<<" kineticEnergyThreshold [MeV] \t"<<current_kineticEnergyThreshold<<G4endl;
G4cout<<" maxLengthForConstField [mm] \t"<<current_maxLengthForConstField[0]<<"\t"
<<current_maxLengthForConstField[1]<<"\t"
<<current_maxLengthForConstField[2]<<G4endl;
G4cout<<" missDistance [mm] \t"<<current_missDistance[0]<<"\t"
<<current_missDistance[1]<<"\t"
<<current_missDistance[2]<<G4endl;
G4cout<<" tolerableBiasError [mm] \t"<<current_tolerableBiasError[0]<<"\t"
<<current_tolerableBiasError[1]<<"\t"
<<current_tolerableBiasError[2]<<G4endl;
G4cout<<" tolerableIntegrationError [mm] \t"<<current_tolerableIntegrationError[0]<<"\t"
<<current_tolerableIntegrationError[1]<<"\t"
<<current_tolerableIntegrationError[2]<<G4endl;
}
void FieldIntParameters::GetParameters(const G4Track* aTrack,
G4double& maxLengthForConstField,
G4double& missDistance,
G4double& typicalLongStep,
G4double& tolerableBiasError,
G4double& tolerableIntegrationError,
G4double& expectedNumBoundaries,
G4double& expectedTrackLength)
{
idx = 1;
G4ParticleDefinition* partDef = aTrack->GetDefinition();
if(partDef==G4Electron::Definition() || partDef==G4Positron::Definition())
{ if(aTrack->GetKineticEnergy() < current_kineticEnergyThreshold) idx = 0; }
else if(partDef==G4MuonPlus::Definition() || partDef==G4MuonMinus::Definition())
{ idx = 2; }
maxLengthForConstField = current_maxLengthForConstField[idx];
missDistance = current_missDistance[idx];
typicalLongStep = current_typicalLongStep[idx];
tolerableBiasError = current_tolerableBiasError[idx];
tolerableIntegrationError = current_tolerableIntegrationError[idx];
expectedNumBoundaries = current_expectedNumBoundaries[idx];
expectedTrackLength = current_expectedTrackLength[idx];
}
}
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