Import Geant4 10.6.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2019-06-28 11:59:04 +02:00
parent 28a70706e0
commit d0f911957d
1056 changed files with 95168 additions and 78160 deletions
@@ -43,8 +43,7 @@
// J. Comput. Phys. 274 (2014) 841-882
// Prog. Nucl. Sci. Tec. 2 (2011) 503-508
#ifndef G4FastList_H
#define G4FastList_H
#pragma once
#include "globals.hh"
#include "G4ReferenceCountedHandle.hh"
@@ -425,8 +424,8 @@ template<class OBJECT>
private:
G4FastList(const G4FastList<OBJECT>& other);
G4FastList<OBJECT> & operator=(const G4FastList<OBJECT> &right);
G4int operator==(const G4FastList<OBJECT> &right) const;
G4int operator!=(const G4FastList<OBJECT> &right) const;
G4bool operator==(const G4FastList<OBJECT> &right) const;
G4bool operator!=(const G4FastList<OBJECT> &right) const;
};
@@ -461,20 +460,15 @@ template<typename OBJECT>
typedef G4FastList_iterator<OBJECT> _Self;
typedef G4FastListNode<OBJECT> _Node;
G4FastList_iterator() :
fpNode(0)
{
}
G4FastList_iterator() = default;
explicit G4FastList_iterator(_Node* __x) :
fpNode(__x)
{
}
G4FastList_iterator(const G4FastList_iterator& right) :
fpNode(right.fpNode)
{
}
G4FastList_iterator(const G4FastList_iterator& right) = default;
_Self& operator=(const G4FastList_iterator& right) = default;
_Node* GetNode()
{
@@ -526,19 +520,19 @@ template<typename OBJECT>
return __tmp;
}
bool operator==(const _Self& __x) const
G4bool operator==(const _Self& __x) const
{
return (fpNode == __x.fpNode);
}
bool operator!=(const _Self& __x) const
G4bool operator!=(const _Self& __x) const
{
return (fpNode != __x.fpNode);
}
// private:
// The only member points to the G4FastList_iterator element.
_Node* fpNode;
_Node* fpNode = nullptr;
};
/**
@@ -553,26 +547,27 @@ template<typename OBJECT>
typedef G4FastList_const_iterator<OBJECT> _Self;
typedef G4FastListNode<OBJECT> _Node;
G4FastList_const_iterator() :
fpNode(0)
{
}
G4FastList_const_iterator() = default;
explicit G4FastList_const_iterator(const _Node* __x) :
fpNode(__x)
{
}
G4FastList_const_iterator(const G4FastList_const_iterator& right) :
fpNode(right.fpNode)
{
}
G4FastList_const_iterator(const G4FastList_const_iterator& right) = default;
_Self& operator=(const G4FastList_const_iterator& right) = default;
G4FastList_const_iterator(const G4FastList_iterator<OBJECT>& right) :
fpNode(right.GetNode())
{
}
_Self& operator=(const G4FastList_iterator<OBJECT>& right)
{
fpNode = right.GetNode();
return *this;
}
const OBJECT*
operator*() const
{
@@ -615,21 +610,19 @@ template<typename OBJECT>
return __tmp;
}
bool operator==(const _Self& __x) const
G4bool operator==(const _Self& __x) const
{
return (fpNode == __x.fpNode);
}
bool operator!=(const _Self& __x) const
G4bool operator!=(const _Self& __x) const
{
return (fpNode != __x.fpNode);
}
// private:
// The only member points to the G4FastList_iterator element.
const _Node* fpNode;
const _Node* fpNode = nullptr;
};
#include "G4FastList.icc"
#endif // G4FastList_H
#include "G4FastList.icc"
@@ -43,80 +43,49 @@
// J. Comput. Phys. 274 (2014) 841-882
// Prog. Nucl. Sci. Tec. 2 (2011) 503-508
#ifndef G4ITModelHandler_H
#define G4ITModelHandler_H
#pragma once
#include "G4Types.hh"
#include "G4ITType.hh"
#include "G4ITModelManager.hh"
#include <vector>
#include <memory>
class G4ITModelManager;
class G4VITStepModel;
/**
* G4ITModelHandler holds for two IT types the corresponding model manager
* \deprecated This class will be removed
*/
class G4ITModelHandler
{
public:
G4ITModelHandler();
G4ITModelHandler(const G4ITModelHandler& other);
G4ITModelHandler& operator=(const G4ITModelHandler& rhs);
G4ITModelHandler();
/** Default destructor */
~G4ITModelHandler();
G4ITModelHandler(const G4ITModelHandler& other) = delete;
void Initialize();
G4ITModelHandler& operator=(const G4ITModelHandler& rhs) = delete;
// Register a model at a starting time (time1)
// if a second model is registered at a later time (time2);
// the second model will be considered from
// time2 to the end of simulation
void RegisterModel(G4VITStepModel* aModel, const G4double globalTime);
~G4ITModelHandler();
// Model applying for type 1 and type 2
inline G4ITModelManager* GetModelManager(G4ITType, G4ITType);
void SetModel(G4ITType,
G4ITType,
G4VITStepModel* aModel,
G4double startingTime);
G4VITStepModel* GetModel(G4ITType, G4ITType, const G4double globalTime);
void Initialize();
//
inline const std::vector<std::vector<G4ITModelManager*> >* GetAllModelManager()
{
return &fModelManager;
}
// Register a model at a starting time (time1)
// if a second model is registered at a later time (time2);
// the second model will be considered from
// time2 to the end of simulation
void RegisterModel(G4VITStepModel* pModel, G4double globalTime);
inline bool GetTimeStepComputerFlag()
{
return fTimeStepComputerFlag;
}
inline bool GetReactionProcessFlag()
{
return fReactionProcessFlag;
}
std::vector<G4VITStepModel*> GetActiveModels(G4double globalTime) const;
bool GetTimeStepComputerFlag();
bool GetReactionProcessFlag();
protected:
G4bool fIsInitialized;
std::vector<std::vector<G4ITModelManager*> > fModelManager;
G4bool fIsInitialized;
std::unique_ptr<G4ITModelManager> fpModelManager;
G4bool fTimeStepComputerFlag; // Set true if a computer is registered
G4bool fReactionProcessFlag; // Set true if a reaction process is registered
};
inline G4ITModelManager* G4ITModelHandler::GetModelManager(G4ITType type1,
G4ITType type2)
{
if (fModelManager.empty())
{
return 0;
}
if ((int) fModelManager.size() < type1) return 0;
std::vector<G4ITModelManager*>* v = &(fModelManager.at(type1));
if ((int) v->size() < type2) return 0;
return v->at(type2);
}
#endif // G4ITModelHandler_H
G4bool fTimeStepComputerFlag; // Set true if a time stepper is registered
G4bool fReactionProcessFlag; // Set true if a reaction process is registered
};
@@ -43,33 +43,45 @@
// J. Comput. Phys. 274 (2014) 841-882
// Prog. Nucl. Sci. Tec. 2 (2011) 503-508
#ifndef G4ITMODELMANAGER_H
#define G4ITMODELMANAGER_H
#pragma once
#include "globals.hh"
#include <map>
#include "G4VITStepModel.hh"
#include <vector>
#include <memory>
class G4VITStepModel;
/**
* G4ITModelManager chooses which model to use according
* to the global simulation time.
* \deprecated This class will be removed
*/
class G4ITModelManager
{
public:
G4ITModelManager();
~G4ITModelManager();
void Initialize();
G4ITModelManager(const G4ITModelManager& other);
G4ITModelManager& operator=(const G4ITModelManager& rhs);
void SetModel(G4VITStepModel* aModel, G4double startingTime);
G4VITStepModel* GetModel(const G4double globalTime);
G4ITModelManager();
~G4ITModelManager();
void Initialize();
G4ITModelManager(const G4ITModelManager& other) = delete;
G4ITModelManager& operator=(const G4ITModelManager& rhs) = delete;
void SetModel(G4VITStepModel* aModel, G4double startingTime, G4double endTime = DBL_MAX);
std::vector<G4VITStepModel*> GetActiveModels(G4double globalTime) const;
protected:
typedef std::map<G4double /*startingTime*/, G4VITStepModel* /*aModel*/> mapModels;
mapModels fModels;
G4bool fIsInitialized;
};
struct ModelInfo
{
double fStartingTime;
double fEndTime;
std::unique_ptr<G4VITStepModel> fpModel;
};
#endif // G4ITMODELMANAGER_H
std::vector<ModelInfo> fModelInfoList;
G4bool fIsInitialized;
};
@@ -43,14 +43,13 @@
// J. Comput. Phys. 274 (2014) 841-882
// Prog. Nucl. Sci. Tec. 2 (2011) 503-508
#ifndef G4ITMODELPROCESSOR_H
#define G4ITMODELPROCESSOR_H
#pragma once
#include <vector>
#include "G4ITReactionChange.hh"
#include "G4ITType.hh"
#include "G4ITModelHandler.hh"
#include "G4ITStepStatus.hh"
#include <vector>
class G4VITTimeStepComputer;
class G4VITReactionProcess;
@@ -60,17 +59,6 @@ class G4UserTimeStepAction;
class G4ITTrackingManager;
class G4ITTrackHolder;
//#ifndef compTrackPerID__
//#define compTrackPerID__
// struct compTrackPerID
// {
// bool operator()(G4Track* rhs, G4Track* lhs) const
// {
// return rhs->GetTrackID() < lhs->GetTrackID();
// }
// };
//#endif
/**
* The G4ITModelProcessor will call the two processes defined in G4VITModel.
* This processes act at the beginning and end of each step.
@@ -78,155 +66,76 @@ class G4ITTrackHolder;
* the track and eventually it can return some tracks that can likely react
* at the end of the step.
* The second one, the ReactionProcess will make the tracks reacting.
* \deprecated This class will be removed
*/
class G4ITModelProcessor
{
public:
G4ITModelProcessor();
virtual ~G4ITModelProcessor();
G4ITModelProcessor();
G4ITModelProcessor(const G4ITModelProcessor& other) = delete;
G4ITModelProcessor& operator=(const G4ITModelProcessor& other) = delete;
virtual ~G4ITModelProcessor();
inline void SetModelHandler(G4ITModelHandler*);
void Initialize();
//void Initialize(G4MIWorkspace* /*workspace*/);
void SetModelHandler(G4ITModelHandler*);
void SetTrackingManager(G4ITTrackingManager* trackingManager);
void RegisterModel(double time, G4VITStepModel*);
void Initialize();
/**
* Restore original state of the modelProcessor.
* This method should be call only by the G4Scheduler
*/
inline void CleanProcessor();
void RegisterModel(double time, G4VITStepModel*);
G4double CalculateMinTimeStep(G4double currentGlobalTime,
G4double definedMinTimeStep);
/** Restore the original state. This method should be called only by G4Scheduler */
void CleanProcessor();
void ComputeTrackReaction(G4ITStepStatus fITStepStatus,
G4double fGlobalTime,
G4double currentTimeStep,
G4double previousTimeStep,
G4bool reachedUserTimeLimit,
G4double fTimeTolerance,
G4UserTimeStepAction* fpUserTimeStepAction,
G4int fVerbose);
G4double CalculateMinTimeStep(G4double currentGlobalTime,
G4double definedMinTimeStep);
//____________________________________________________________
// Time stepper part
void InitializeStepper(G4double currentGlobalTime,
G4double userMinTime);
void ComputeTrackReaction(G4ITStepStatus fITStepStatus,
G4double fGlobalTime,
G4double currentTimeStep,
G4double previousTimeStep,
G4bool reachedUserTimeLimit,
G4double fTimeTolerance,
G4UserTimeStepAction* fpUserTimeStepAction,
G4int fVerbose);
bool GetComputeTimeStep()
{
return fComputeTimeStep;
}
void InitializeStepper(G4double currentGlobalTime,
G4double userMinTime);
protected:
inline void SetTrack(const G4Track*);
bool GetComputeTimeStep() const;
public:
void CalculateTimeStep(const G4Track*, const G4double);
void DoCalculateStep();
void CalculateTimeStep(const G4Track*, G4double userMinTimeStep);
//____________________________________________________________
// Reaction process part
void FindReaction(G4ITReactionSet* reactionSet,
const double currentStepTime,
const double previousStepTime,
const bool reachedUserStepTimeLimit);
void DoCalculateStep();
//____________________________________________________________
// Get results
inline const std::vector<std::vector<G4VITStepModel*> >* GetCurrentModel();
void FindReaction(G4ITReactionSet* pReactionSet,
double currentStepTime,
double previousStepTime,
bool reachedUserStepTimeLimit);
inline std::vector<G4ITReactionChange*>* GetReactionInfo()
{
return &fReactionInfo;
}
const G4Track* GetTrack() const
{
return fpTrack;
}
void SetTrackingManager(G4ITTrackingManager* trackingManager)
{
fpTrackingManager = trackingManager;
}
const G4Track* GetTrack() const;
protected:
void ExtractTimeStepperData();
void SetTrack(const G4Track*);
void ExtractTimeStepperData();
/** Copy constructor
* \param other Object to copy from
*/
G4ITModelProcessor(const G4ITModelProcessor& other);
/** Assignment operator
* \param other Object to assign from
* \return A reference to this
*/
G4ITModelProcessor& operator=(const G4ITModelProcessor& other);
G4double fTSTimeStep;
G4ITReactionSet* fReactionSet;
G4ITTrackingManager* fpTrackingManager;
G4ITTrackHolder* fpTrackContainer;
//_____________________________
// Members
G4bool fInitialized;
G4ITModelHandler* fpModelHandler;
G4double fTSTimeStep;
G4ITReactionSet* fReactionSet;
G4ITTrackingManager* fpTrackingManager;
G4ITTrackHolder* fpTrackContainer;
const G4Track* fpTrack;
G4double fUserMinTimeStep;
G4bool fInitialized;
G4ITModelHandler* fpModelHandler;
std::vector<G4VITStepModel*> fActiveModels;
G4VITStepModel* fpActiveModelWithMinTimeStep;
const G4Track* fpTrack;
G4double fUserMinTimeStep;
std::vector<std::unique_ptr<G4ITReactionChange>> fReactionInfo;
// Interactions between different IT types
// eg : electron/proton
std::vector<std::vector<G4VITStepModel*> > fCurrentModel;
// Interactions between ITs of the same type
// eg : molecule/molecule or electron/electron
G4VITStepModel* fpModel;
G4ITModelManager* fpModelManager;
G4ITType fCurrentType1;
G4ITType fCurrentType2;
std::vector<G4ITReactionChange*> fReactionInfo;
bool fComputeTimeStep;
bool fComputeReaction;
bool fComputeTimeStep;
bool fComputeReaction;
};
///
// Inline methods
///
inline void G4ITModelProcessor::SetTrack(const G4Track* track)
{
fpTrack = track;
}
inline const std::vector<std::vector<G4VITStepModel*> >* G4ITModelProcessor::GetCurrentModel()
{
return &fCurrentModel;
}
inline void G4ITModelProcessor::SetModelHandler(G4ITModelHandler* modelHandler)
{
if (fInitialized == 1)
{
G4ExceptionDescription exceptionDescription;
exceptionDescription
<< "You are trying to set a new model while the model processor has alreaday be initialized";
G4Exception("G4ITModelProcessor::SetModelHandler", "ITModelProcessor001",
FatalErrorInArgument, exceptionDescription);
}
fpModelHandler = modelHandler;
}
inline void G4ITModelProcessor::CleanProcessor()
{
fpTrack = 0;
}
#endif // G4ITMODELPROCESSOR_H
@@ -73,9 +73,9 @@ public :
inline G4ITType & operator=(const int & rhs) { fValue = rhs; return *this;}
inline operator int & () { return fValue; }
inline operator const int & () const { return fValue; }
inline bool operator==(const G4ITType & rhs) const { return fValue == rhs.fValue; }
inline bool operator==(const int & rhs) const { return fValue == rhs; }
inline bool operator<(const G4ITType & rhs) const { return fValue < rhs.fValue; }
inline G4bool operator==(const G4ITType & rhs) const { return fValue == rhs.fValue; }
inline G4bool operator==(const int & rhs) const { return fValue == rhs; }
inline G4bool operator<(const G4ITType & rhs) const { return fValue < rhs.fValue; }
inline void operator++() { fValue++; }
};
@@ -30,8 +30,7 @@
* Author: kara
*/
#ifndef G4MANYFASTLISTS_HH_
#define G4MANYFASTLISTS_HH_
#pragma once
#include "G4FastList.hh"
#include <set>
@@ -62,7 +61,7 @@ template<class OBJECT>
{
}
virtual ~G4ManyFastLists(){;}
virtual ~G4ManyFastLists() = default;
virtual void NotifyDeletingList(G4FastList<OBJECT>* __list)
{
@@ -71,13 +70,11 @@ template<class OBJECT>
void AddGlobalWatcher(typename G4FastList<OBJECT>::Watcher* watcher)
{
if(fMainListWatchers == 0)
if(fMainListWatchers == nullptr)
{
fMainListWatchers = new WatcherSet();
}
G4cout << watcher->GetWatcherName() << G4endl;
fMainListWatchers->insert(watcher);
typename ManyLists::iterator it = fAssociatedLists.begin();
@@ -184,13 +181,9 @@ template<class OBJECT>
inline size_t size() const
{
size_t __size(0);
typename ManyLists::const_iterator __it = fAssociatedLists
.begin();
typename ManyLists::const_iterator __end = fAssociatedLists
.end();
for (; __it != __end; __it++)
for (auto __it : fAssociatedLists)
{
__size += (*__it)->size();
__size += __it->size();
}
return __size;
}
@@ -238,7 +231,6 @@ template<class OBJECT>
template<class OBJECT>
struct G4ManyFastLists_iterator
{
// friend class G4ManyFastLists<OBJECT>;
typedef G4FastList<G4FastList<OBJECT> > ManyLists;
typedef G4ManyFastLists_iterator _Self;
@@ -249,13 +241,9 @@ template<class OBJECT>
ManyLists* fLists;
private:
G4ManyFastLists_iterator() :
fIterator(), fLists(0)
{
}
G4ManyFastLists_iterator() = default;
public:
explicit G4ManyFastLists_iterator(G4FastList_iterator<OBJECT> __x,
typename ManyLists::iterator __it,
ManyLists* __lists) :
@@ -263,12 +251,8 @@ template<class OBJECT>
{
}
G4ManyFastLists_iterator(const G4ManyFastLists_iterator& __x) :
fIterator(__x.fIterator),
fCurrentListIt(__x.fCurrentListIt),
fLists(__x.fLists)
{
}
G4ManyFastLists_iterator(const G4ManyFastLists_iterator& __x) = default;
_Self& operator=(const G4ManyFastLists_iterator& __x) = default;
_Node* GetNode()
{
@@ -359,12 +343,12 @@ template<class OBJECT>
return operator--();
}
bool operator==(const _Self& __x) const
G4bool operator==(const _Self& __x) const
{
return (fIterator == __x.fIterator && fCurrentListIt == __x.fCurrentListIt);
} // Fast check
bool operator!=(const _Self& __x) const
G4bool operator!=(const _Self& __x) const
{
return !(this->operator ==(__x));
}
@@ -437,4 +421,3 @@ typename G4ManyFastLists<OBJECT>::iterator G4ManyFastLists<OBJECT>::end()
}
#include "G4ManyFastLists.icc"
#endif /* G4MANYFASTLISTS_HH_ */
@@ -107,8 +107,8 @@ public:
G4VITProcess& operator=(const G4VITProcess& other);
// equal opperators
G4int operator==(const G4VITProcess &right) const;
G4int operator!=(const G4VITProcess &right) const;
G4bool operator==(const G4VITProcess &right) const;
G4bool operator!=(const G4VITProcess &right) const;
G4IT_TO_BE_CLONED(G4VITProcess)
@@ -117,16 +117,6 @@ public:
return fProcessID;
}
// G4ProcessState_Lock* GetProcessState()
// {
// return fpState;
// }
//
// void SetProcessState(G4ProcessState_Lock* aProcInfo)
// {
// fpState = (G4ProcessState*) aProcInfo;
// }
G4shared_ptr<G4ProcessState_Lock> GetProcessState()
{
return UpcastProcessState(G4ProcessState_Lock);
@@ -44,83 +44,46 @@
// Prog. Nucl. Sci. Tec. 2 (2011) 503-508
#ifndef G4VITREACTIONPROCESS_H
#define G4VITREACTIONPROCESS_H
#pragma once
#include "globals.hh"
#include "G4IT.hh"
#include "G4ITReactionChange.hh"
#include "G4ITReactionTable.hh"
#include "AddClone_def.hh"
#include <memory>
class G4ITReactionTable;
class G4ITReactionChange;
class G4Track;
struct G4ITType;
/**
* G4VITReactionProcess defines the reaction between two G4IT.
* It should be stored in a G4VITModel.
* \deprecated This class will be removed
*/
class G4VITReactionProcess
{
public:
/** Default constructor */
G4VITReactionProcess();
/** Default destructor */
virtual ~G4VITReactionProcess();
/** Copy constructor
* \param other Object to copy from
*/
G4VITReactionProcess(const G4VITReactionProcess& other);
/** Will Clone the reaction process
* i.e. new reaction process will be created with same features
* as the parent one.
* Use preprocessor macro : AddCloneReactionProcess
* the copy constructor of the derived class must be
* implemented.
* This macro is defined in AddClone_def
*/
G4IT_TO_BE_CLONED(G4VITReactionProcess)
/** Assignment operator
* \param other Object to assign from
* \return A reference to this
*/
G4VITReactionProcess& operator=(const G4VITReactionProcess& other);
G4VITReactionProcess() = default;
virtual ~G4VITReactionProcess() = default;
G4VITReactionProcess(const G4VITReactionProcess& other) = delete;
G4VITReactionProcess& operator=(const G4VITReactionProcess& other) = delete;
/** First initialization (done once for all at the begin of the run)
* eg. check if the reaction table is given ...
*/
virtual void Initialize(){;}
virtual G4bool IsApplicable(G4ITType,G4ITType) const {return true;}
// virtual void GetApplicableTypes(G4ITType&, G4ITType&) const;
virtual G4bool IsApplicable(const G4ITType&, const G4ITType&) const;
virtual G4bool TestReactibility(const G4Track&,
const G4Track&,
const double /*currentStepTime*/,
const double /*previousStepTime*/,
double /*currentStepTime*/,
bool /*reachedUserStepTimeLimit*/) = 0;
virtual G4ITReactionChange* MakeReaction(const G4Track&, const G4Track&) = 0;
virtual std::unique_ptr<G4ITReactionChange> MakeReaction(const G4Track&, const G4Track&) = 0;
inline void SetReactionTable(const G4ITReactionTable*);
inline void ResetChanges();
virtual void SetReactionTable(const G4ITReactionTable*);
protected:
// G4ITType fApplicableType1;
// G4ITType fApplicableType2;
const G4ITReactionTable* fpReactionTable;
G4ITReactionChange* fpChanges ;
G4String fName ;
const G4ITReactionTable* fpReactionTable = nullptr;
G4String fName ;
};
inline void G4VITReactionProcess::SetReactionTable(const G4ITReactionTable* table)
{
fpReactionTable = table;
}
inline void G4VITReactionProcess::ResetChanges()
{
fpChanges = 0;
}
#endif // G4VITREACTIONPROCESS_H
@@ -48,180 +48,65 @@
// J. Comput. Phys. 274 (2014) 841-882
// Prog. Nucl. Sci. Tec. 2 (2011) 503-508
#ifndef G4VITRESTDISCRETEPROCESS_H
#define G4VITRESTDISCRETEPROCESS_H
#include <CLHEP/Units/SystemOfUnits.h>
#pragma once
#include "G4VITProcess.hh"
/**
* Identical to G4VRestDiscreteProcess with dependency from G4VITProcess
*/
/** Identical to G4VRestDiscreteProcess with dependency on G4VITProcess */
class G4VITRestDiscreteProcess : public G4VITProcess
{
// Abstract class which defines the public behavior of
// rest + discrete physics interactions.
// Abstract class which defines the public behavior of
// rest + discrete physics interactions.
public:
G4VITRestDiscreteProcess(const G4String&, G4ProcessType aType = fNotDefined);
G4VITRestDiscreteProcess(const G4VITRestDiscreteProcess &);
virtual ~G4VITRestDiscreteProcess();
G4VITRestDiscreteProcess() = delete;
G4VITRestDiscreteProcess(const G4String&, G4ProcessType aType = fNotDefined);
G4VITRestDiscreteProcess(const G4VITRestDiscreteProcess&) = delete;
G4VITRestDiscreteProcess& operator=(const G4VITRestDiscreteProcess& right) = delete;
~G4VITRestDiscreteProcess() override;
public:
// with description
virtual G4double
PostStepGetPhysicalInteractionLength(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
// with description
G4double
PostStepGetPhysicalInteractionLength(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition) override;
virtual G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&) override;
virtual G4double AtRestGetPhysicalInteractionLength(const G4Track&,
G4ForceCondition*);
G4double AtRestGetPhysicalInteractionLength(const G4Track&,
G4ForceCondition*) override;
virtual G4VParticleChange* AtRestDoIt(const G4Track&, const G4Step&);
G4VParticleChange* AtRestDoIt(const G4Track&, const G4Step&) override;
// no operation in AlongStepDoIt
virtual G4double AlongStepGetPhysicalInteractionLength(const G4Track&,
G4double,
G4double,
G4double&,
G4GPILSelection*)
{
return -1.0;
}
// no operation in AlongStepDoIt
G4double AlongStepGetPhysicalInteractionLength(const G4Track&,
G4double,
G4double,
G4double&,
G4GPILSelection*) override
{
return -1.0;
}
// no operation in AlongStepDoIt
virtual G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&)
{
return 0;
}
// no operation in AlongStepDoIt
G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&) override
{
return nullptr;
}
protected:
// with description
virtual G4double GetMeanFreePath(const G4Track& aTrack,
G4double previousStepSize,
G4ForceCondition* condition)=0;
// Calculates from the macroscopic cross section a mean
// free path, the value is returned in units of distance.
virtual G4double GetMeanLifeTime(const G4Track& aTrack,
G4ForceCondition* condition)=0;
// Calculates the mean life-time (i.e. for decays) of the
// particle at rest due to the occurence of the given process,
// or converts the probability of interaction (i.e. for
// annihilation) into the life-time of the particle for the
// occurence of the given process.
protected:
// hide default constructor and assignment operator as private
G4VITRestDiscreteProcess();
G4VITRestDiscreteProcess & operator=(const G4VITRestDiscreteProcess &right);
// with description
virtual G4double GetMeanFreePath(const G4Track& aTrack,
G4double previousStepSize,
G4ForceCondition* condition) = 0;
// Calculates from the macroscopic cross section a mean
// free path, the value is returned in units of distance.
virtual G4double GetMeanLifeTime(const G4Track& aTrack,
G4ForceCondition* condition) = 0;
// Calculates the mean life-time (i.e. for decays) of the
// particle at rest due to the occurrence of the given process,
// or converts the probability of interaction (i.e. for
// annihilation) into the life-time of the particle for the
// occurrence of the given process.
};
// -----------------------------------------
// inlined function members implementation
// -----------------------------------------
inline G4double G4VITRestDiscreteProcess::PostStepGetPhysicalInteractionLength(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition)
{
if((previousStepSize < 0.0) || (fpState->theNumberOfInteractionLengthLeft
<= 0.0))
{
// beggining of tracking (or just after DoIt of this process)
ResetNumberOfInteractionLengthLeft();
}
else if(previousStepSize > 0.0)
{
// subtract NumberOfInteractionLengthLeft
SubtractNumberOfInteractionLengthLeft(previousStepSize);
}
else
{
// zero step
// DO NOTHING
}
// condition is set to "Not Forced"
*condition = NotForced;
// get mean free path
fpState->currentInteractionLength = GetMeanFreePath(track,
previousStepSize,
condition);
G4double value;
if(fpState->currentInteractionLength < DBL_MAX)
{
value = fpState->theNumberOfInteractionLengthLeft * (fpState->currentInteractionLength);
}
else
{
value = DBL_MAX;
}
#ifdef G4VERBOSE
if(verboseLevel > 1)
{
G4cout << "G4VITRestDiscreteProcess::PostStepGetPhysicalInteractionLength ";
G4cout << "[ " << GetProcessName() << "]" << G4endl;
track.GetDynamicParticle()->DumpInfo();
G4cout << " in Material " << track.GetMaterial()->GetName() << G4endl;
G4cout << "InteractionLength= " << value / CLHEP::cm << "[cm] " << G4endl;
}
#endif
return value;
}
inline G4VParticleChange* G4VITRestDiscreteProcess::PostStepDoIt(const G4Track&,
const G4Step&)
{
// reset NumberOfInteractionLengthLeft
ClearNumberOfInteractionLengthLeft();
return pParticleChange;
}
inline G4double G4VITRestDiscreteProcess::AtRestGetPhysicalInteractionLength(const G4Track& track,
G4ForceCondition* condition)
{
// beggining of tracking
ResetNumberOfInteractionLengthLeft();
// condition is set to "Not Forced"
*condition = NotForced;
// get mean life time
fpState->currentInteractionLength = GetMeanLifeTime(track, condition);
#ifdef G4VERBOSE
if((fpState->currentInteractionLength < 0.0) || (verboseLevel > 2))
{
G4cout << "G4VITRestDiscreteProcess::AtRestGetPhysicalInteractionLength ";
G4cout << "[ " << GetProcessName() << "]" << G4endl;
track.GetDynamicParticle()->DumpInfo();
G4cout << " in Material " << track.GetMaterial()->GetName() << G4endl;
G4cout << "MeanLifeTime = " << fpState->currentInteractionLength / CLHEP::ns
<< "[ns]" << G4endl;
}
#endif
return fpState->theNumberOfInteractionLengthLeft
* (fpState->currentInteractionLength);
}
inline G4VParticleChange* G4VITRestDiscreteProcess::AtRestDoIt(const G4Track&,
const G4Step&)
{
// clear NumberOfInteractionLengthLeft
ClearNumberOfInteractionLengthLeft();
return pParticleChange;
}
#endif
@@ -111,10 +111,10 @@ protected:
virtual G4double GetMeanLifeTime(const G4Track& aTrack,
G4ForceCondition* condition)=0;
// Calculates the mean life-time (i.e. for decays) of the
// particle at rest due to the occurence of the given process,
// particle at rest due to the occurrence of the given process,
// or converts the probability of interaction (i.e. for
// annihilation) into the life-time of the particle for the
// occurence of the given process.
// occurrence of the given process.
protected:
// hide default constructor and assignment operator as private
@@ -43,104 +43,54 @@
// J. Comput. Phys. 274 (2014) 841-882
// Prog. Nucl. Sci. Tec. 2 (2011) 503-508
#ifndef G4VITMODEL_HH
#define G4VITMODEL_HH
#pragma once
#include "AddClone_def.hh"
#include "G4VITTimeStepComputer.hh"
#include "G4VITReactionProcess.hh"
#include "G4ITReactionTable.hh"
#include "G4ITType.hh"
#include <memory>
/**
* Define what to do before stepping and after stepping.
* Define actions before and after stepping.
* The concrete implementation of G4VITModel defines the interaction
* between two G4IT types. The type might be just equal like :
* between two G4IT types. The types can be equal like :
* Molecule + Molecule, or different : Molecule + Atom.
*/
class G4VITStepModel
{
public:
/** Default constructor */
G4VITStepModel(const G4String& aName = "NoName");
/** Default destructor */
virtual ~G4VITStepModel();
G4VITStepModel(std::unique_ptr<G4VITTimeStepComputer> pTimeStepper,
std::unique_ptr<G4VITReactionProcess> pReactionProcess,
const G4String& aName = "NoName");
/* Macro define in AddClone_def*/
G4IT_TO_BE_CLONED(G4VITStepModel)
G4VITStepModel(const G4VITStepModel& other) = delete;
G4VITStepModel& operator=(const G4VITStepModel& other) = delete;
void IsApplicable(G4ITType& type1, G4ITType& type2) ;
void virtual PrintInfo(){;}
virtual ~G4VITStepModel() = default;
virtual void Initialize();
void PrepareNewTimeStep();
inline void SetTimeStepper(G4VITTimeStepComputer* timeStepper);
inline void SetReactionProcess(G4VITReactionProcess* reactionProcess);
void GetApplicable(G4ITType& type1, G4ITType& type2);
void virtual PrintInfo() {;}
inline G4VITTimeStepComputer* GetTimeStepper();
inline const G4String& GetName();
G4VITTimeStepComputer* GetTimeStepper();
const G4String& GetName();
inline G4VITReactionProcess* GetReactionProcess();
inline void SetReactionTable(G4ITReactionTable*);
inline const G4ITReactionTable* GetReactionTable();
G4VITReactionProcess* GetReactionProcess();
void SetReactionTable(G4ITReactionTable*);
const G4ITReactionTable* GetReactionTable();
protected:
G4String fName;
G4VITTimeStepComputer* fpTimeStepper;
G4VITReactionProcess* fpReactionProcess;
std::unique_ptr<G4VITTimeStepComputer> fpTimeStepper;
std::unique_ptr<G4VITReactionProcess> fpReactionProcess;
const G4ITReactionTable* fpReactionTable ;
G4ITType fType1;
G4ITType fType2;
protected :
/** Copy constructor
* \param other Object to copy from
*/
G4VITStepModel(const G4VITStepModel& other);
/** Assignment operator
* \param other Object to assign from
* \return A reference to this
*/
G4VITStepModel& operator=(const G4VITStepModel& other);
};
inline void G4VITStepModel::SetReactionTable(G4ITReactionTable* table)
{
fpReactionTable = table;
}
inline const G4ITReactionTable* G4VITStepModel::GetReactionTable()
{
return fpReactionTable ;
}
inline void G4VITStepModel::SetTimeStepper(G4VITTimeStepComputer* timeStepper)
{
fpTimeStepper = timeStepper ;
}
inline void G4VITStepModel::SetReactionProcess(G4VITReactionProcess* reactionProcess)
{
fpReactionProcess = reactionProcess ;
}
inline G4VITTimeStepComputer* G4VITStepModel::GetTimeStepper()
{
return fpTimeStepper;
}
inline G4VITReactionProcess* G4VITStepModel::GetReactionProcess()
{
return fpReactionProcess ;
}
inline const G4String& G4VITStepModel::GetName()
{
return fName;
}
#endif // G4VITMODEL_HH
};