Import Geant4 10.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 14:11:04 +02:00
parent c9b32a6c0a
commit d4af681f38
4886 changed files with 420149 additions and 1023309 deletions
@@ -14,6 +14,300 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------*
13-11-2015, MK, tag emdna-V10-01-55
* G4MoleculeCounter::Use / InUse => move implementation to source
file
10-11-2015, MK, tag emdna-V10-01-54
* remove unused variables
10-11-2015, MK, tag emdna-V10-01-53
* Coverity fixes
06-11-2015, MK, tag emdna-V10-01-52
* G4DNAWaterDissociationDisplacer: remove useless verbose
06-11-2015, MK, tag emdna-V10-01-51
* G4FastList.hh : use WatcherSet::iterator to avoid compilation errors
on x86_64-slc6-gcc49-Seq-BoundsCheck-UseInternalCLHEP
06-11-2015, MK, tag emdna-V10-01-50
* Avoid indirect include of G4TrackState to G4physicslists category
* Reorganize includes
* Add G4ITStepProcessorState_Lock.hh
06-11-2015, MK, tag emdna-V10-01-49
* G4MoleculeCounter: do not initialize compDoubleWithPrecision::fPrecision
to other value than 0 - causing compilation errors on windows
* G4DNAOneStepThermalizationModel: do not include G4ITNavigator in the header
but in the source file - causing crashes on windows
04-11-2015, MK, tag emdna-V10-01-48
* G4DNARevertProbability: added and used in G4DNAWaterDissociationDisplacer
* utils/sources.cmake: G4DNARevertProbability.hh added
* G4DNAWaterDissociationDisplacer: fix and speed up distributions
* models/GNUmakefile: add missing dependency
* G4DNAOneStepThermalizationModel: delete navigator state when model
is deleted
* G4FastList.icc: use typedef WatcherSet even when iterators are used
* G4ITModelProcessor: add RegisterModel, GetComputeTimeStep +
fComputeTimeStep & fComputeReaction flags
* G4DNAElectronHoleRecombination: enable using this model even when not
all dissociation products have been defined (they will just not be taken
into account)
* G4DNAMolecularReactionTable: delete reaction data when table is deleted
03-11-2015, MK, tag emdna-V10-01-47
* G4Scheduler: Update time before G4ITStepProcessor::DoIt
* G4ITStepProcessor::DoIt : reset leading tracks at the end of
the call
03-11-2015, MK, tag emdna-V10-01-46
* G4MolecularDissociation
* G4DNAOneStepSolvatationModel -> G4DNAOneStepThermalizationModel
Avoid placing products outside volume of the mother track
(causing navigator complains)
03-11-2015, MK, tag emdna-V10-01-45
* G4Serialize: Add definition in header for G4String
02-11-2015, MK, tag emdna-V10-01-44
* G4Serialize: remove inline in front of template
* molecules: fix unit tests
* G4DNAElectronHoleRecombination: add missing check on G4MoleculeCounter::InUse
* G4MoleculeCounter: add a flag to check or not against scheduler time
* G4MoleculeTable: do not store G4MolecularConf anymore
-> G4MolecularConfMan is taking care of this
30-10-2015, MK, tag emdna-V10-01-43
* Bug solved in G4MoleculeCounter
and made compatible wih G4DNAElectronHoleRecombination (temporary)
* Unit tests corrected
* G4VITDiscreteProcess added
* G4ReactionTableMessenger added
* Intermediate update for 10.2 release
27-10-2015, MK, tag emdna-V10-01-42
* G4ITStepProcessor: clean dynamic_cast to G4VITProcess
26-10-2015, MK, tag emdna-V10-01-41
* Sanche model: try to solve std::vector out of bounds
23-10-2015, MK, tag emdna-V10-01-40
* remove all CLHEP::shared_ptr usage
23-10-2015, CV, SM, tag emdna-V10-01-39
* Addded base class G4VDNAPTBModel
28-09-2015, SI, tag emdna-V10-01-38
* updated ion selection in G4DNARuddIonisationExtendedModel.cc for Z>2
19-09-2015, MK, tag emdna-V10-01-37
* added proton ionisation scaling in G4DNABornIonisationModel1*.cc
* changed ion selection in G4DNARuddIonisationExtendedModel.cc for Z>2
17-09-2015, MK, tag emdna-V10-01-36
* G4MoleculeGun: Remove compilation warnings
04-09-2015 MK, tag emdna-V10-01-35
* Fix G4MoleculeGun compilation errors
03-09-2015 SI, tag emdna-V10-01-34
* Added stationary regime to all inelastic models
19-08-2015, MK
* Update G4MoleculeGun & G4MoleculeGunMessenger:
- compatible with both Smoluchowski & Gillespie models
15-08-2015, S.Incerti, tag emdna-V10-01-33
* Added easier handling of cumulative proba. in SR elastic models
13-08-2015, G.Cosmo, tag emdna-V10-01-32, 31
* Fixed compilation warning on clang for mismatch class/struct in
declaration of G4MoleculeShoot.
13-08-2015, G.Cosmo, tag emdna-V10-01-30
* Fixed compilation warning on clang for mismatch class/struct in
declaration of G4MoleculeShootMessenger.
12-08-2015, MK, tag emdna-V10-01-29
* Add G4Serialize in the build tree temporarily
12-08-2015, MK, tag emdna-V10-01-28
* G4Serialize added
12-08-2015, MK
* G4memory : quick removal of CLHEP::shared_ptr dependency
24-07-2015, MK
- G4MolecularReactionTable
* Add get methods
- G4MoleculeGun, G4MoleculeGunMessenger
* Molecule gun : place randomly in a box
15-07-2015, MK
- G4DNAAttachment, G4DNAChargeDecrease, G4DNADissociation,
G4DNAExcitation, G4DNAIonisation
* processes & models initialisation again
15-07-2015, MK, tag emdna-V10-01-26
-G4ITModelProcessor & G4ITStepProcessor:
* add macro to prevent warnings in non-verbose mode
11-07-2015, MK, tag emdna-V10-01-25
- Add G4IosFlagsSaver.hh to sources.cmake
- G4IosFlagsSaver.hh add an extra line of the end of the file
10-07-2015, MK, tag emdna-V10-01-24
- G4DNA Processes : correct setup of energy boundaries
- G4DNAElectronHoleRecombination remove verbose
- G4DNADingfelderChargeDecreaseModel: add hole creation
- G4DNAEmfietzoglouXModel: specify energy boundaries in constructor
08-07-2015, MK, tag emdna-V10-01-23
- G4ITLeadingTracks added
- G4ITSteppingVerbose added
- G4IosFlagsSaver added
- G4VITSteppingVerbose & G4ITSteppingVerbose added
* new UI command /chem/tracking/verbose 1,2,3 ...
- G4MoleculeDefinition:
::SetFormatedName added
::NewConfiguration methods added
::NewConfiguration added
::AddDecayChannel per G4MolecularConfiguration or conf label added
And replace ::AddDecayChannel for a molecule model
::Finalize added
- G4MolecularConfiguration:
* new configuration can be defined by labels
* Add Finalize method and add exception if attempt to modified
the G4MolecularConfiguration is done after finalization
- G4MolecularDissociationChannel & G4DNAMolecularReactionTable &
G4DNAMolecularEncounterStepper use G4MolecularConfiguration rather
than molecule models
- G4Molecule add constructor where only G4MolecularConfiguration is specified
- G4Scheduler : remove entirely track specification from this class
- G4ITXProcess : deal with tracks
- G4ITTrackingManager is a "service" to start and end tracking
- G4DNAElectronHoleRecombination added
06-07-2015, Shogo Okada, SI, tag emdna-V10-01-22
- G4DNAEmfietzoglouIonisationModel: removed condition for
fasterCode usage on shell selection.
26-06-2015, MK
- G4DNAIonElasticModel: modify "validated" to "activated" in
warning message description
16-06-205, MK
- Add G4Scheduler::GetGun()
16-06-2015, MK, tag emdna-V10-01-21
- G4DNAElastic.cc : add elseif(name == ...
- G4DNAIonElasticModel: clean and fix double free
12-06-2015, MK, tag emdna-V10-01-20
- remove virtual keyword from G4IT::GetPosition()
04-06-2015, MK
- just cosmetics
- remove virtual keyword from G4IT::operator[]
26-05-2015, Robert Hatcher, tag emdna-V10-01-19
- Remove unnecessary "using namespace std" from various headers
that causes problems w/ G4AnyMethod & G4GenericPhysicsList
when using clang and/or vc12
- Fully qualify std::string elsewhere as needed to adjust
22-05-2015, John Allison, tag emdna-V10-01-18
- G4ITTrackHolder.cc: Replaced "G4Threading::IsWorkerThread() == false" by
"G4Threading::IsMasterThread()".
17-05-2015, MK, tag emdna-V10-01-17
- G4DNABornIonisationModel1/2 & G4DNABornExcitationModel2: remove unused variables
- Correct sources.cmake
- Born headears: includes both model versions when proxy header is included
16-05-2015, MK, tag emdna-V10-01-16
- Add G4DNAEmfietzoglouExcitationModel
- Add G4DNAEmfietzoglouIonisationModel
- Add G4DNAUeharaScreenedRutherfordElasticModel
- Add G4DNABornIonisationModel2 (temporary)
- Add G4DNABornExcitationModel2 (temporary)
15-05-2015, MK, tag emdna-V10-01-15
- Postpone G4DNASmoluchowskiDiffusion until c++11 is adopted
14-05-2015, MK, tag emdna-V10-01-14
- G4DNASmoluchowskiDiffusion: std::sqrt -> sqrt
14-05-2015, MK, tag emdna-V10-01-13
- G4DNASmoluchowskiDiffusion: try to solve compilation error
- G4ITReaction: try to solve compilation error
12-05-2015, MK, tag emdna-V10-01-12
- G4DNASmoluchowskiDiffusion: try to solve compilation error
12-05-2015, MK, tag emdna-V10-01-11
- Add G4DNASmoluchowskiDiffusion to the build tree
11-05-2015, MK, tag emdna-V10-01-10
- G4DNABornExcitationModel:
+Add GetPartialCrossSection
+Code cleaning
- G4DNAMillerGreenExcitationModel:
+Add GetPartialCrossSection
- G4DNAChemistryManager::GetValue(...) added
02-05-2015, MK
- Update G4TrackState & related classes
- G4DNABrownianTransportation:
+Add constructor & destructor to G4BrownianAction
+comment useless method
- G4Scheduler:
+Add fStopTime+Watched times+PrintWhyDoYouStop method (code was existing before)
+remove fTmpEndTime
+Add CanICarryOn
- add G4DNASmoluchowskiDiffusion *PRELIMINARY*
18-03-2015, MK, tag emdna-V10-01-08
- Same as before, just add the missing History file
18-03-2015, MK, tag emdna-V10-01-07
- G4UserTimeStepAction::UserReactionAction : vector of products becomes a pointer
instead of a reference
12-02-2015, MK, tag emdna-V10-01-06
- G4ITReaction: Remove "gAll" introduced for testing
- G4ITModelProcessor: Remove "assert" introduced for testing
- G4ITTransportation: Remove extra parenthesis in the undef of PrepareState
11-02-2015, MK, tag emdna-V10-01-05
- Fix reproductibility of the chemistry module
- Fix the "no reaction table found" bug: G4ITReaction class created
- G4shared_ptr refers to std::shared_ptr when C++11 is activated
16-01-2015, SI, tag emdna-V10-01-04
- added Fe56 into G4DNARuddIonisationExtendedModel
14-12-2014, MK, tag emdna-V10-01-03
- BornIonisation: correct array cleaning
- ScreenRutherfordElastic: correct retrieval of water density
13-12-2014, SI, tag emdna-V10-01-02
- Added elastic model by H. Tran.
12-12-2014, G.Cosmo, tag emdna-V10-01-01
- Explicitly initialise to zero TLS pointers in G4KDNode.hh and G4ITFinder.icc
to allow for compilation on Linux/clang-3.5.
05-12-2014, G.Cosmo, tag emdna-V10-01-00
- Corrected sources.cmake in management and molecules/management, to
include missing files:
G4ITTransportationManager.icc
G4KDNode.icc
G4KDTree.icc
G4MoleculeFinder.hh
01-12-2014, MK, tag emdna-V10-00-63
- Temporary fix for avoiding bad relocation of Brownian particles
It slows the computation by forcing the Brownian particles to stop at the volumes' boundaries
@@ -49,7 +49,7 @@
#include "globals.hh"
#include "G4ReferenceCountedHandle.hh"
#include <CLHEP/Utility/memory.h>
#include <G4memory.hh>
#include <vector>
#include <set>
//#include "G4ManyFastLists.hh"
@@ -66,6 +66,8 @@ template<typename OBJECT>
class G4ManyFastLists;
template<typename OBJECT>
struct G4ManyFastLists_iterator;
template<class OBJECT>
struct sortWatcher;
/** Comments :
@@ -87,7 +89,8 @@ template<class LIST>
struct _ListRef
{
typedef type_wrapper<LIST> traits_type;
typedef type_wrapper<G4ManyFastLists_iterator<typename LIST::object> > mli_traits_type;
typedef type_wrapper<G4ManyFastLists_iterator<typename LIST::object>>
mli_traits_type;
//#ifdef WIN32
// friend typename traits_type::type;
@@ -201,7 +204,7 @@ template<class OBJECT>
void DetachYourSelf();
bool fAttachedToList;
CLHEP::shared_ptr<_ListRef<G4FastList<OBJECT> > > fListRef;
G4shared_ptr<_ListRef<G4FastList<OBJECT> > > fListRef;
OBJECT* fpObject;
G4FastListNode<OBJECT>* fpPrevious;
G4FastListNode<OBJECT>* fpNext;
@@ -220,7 +223,7 @@ template<class OBJECT>
G4int fNbObjects;
// G4FastListNode<OBJECT> * fpStart;
// G4FastListNode<OBJECT> * fpFinish;
CLHEP::shared_ptr<_ListRef<G4FastList<OBJECT> > > fListRef;
G4shared_ptr<_ListRef<G4FastList<OBJECT> > > fListRef;
G4FastListNode<OBJECT> fBoundary;
// Must be empty and link to the last non-empty node of the list
@@ -231,8 +234,22 @@ template<class OBJECT>
class Watcher
{
public:
enum Priority
{
eExtreme,
eHigh,
eNormal,
eLow,
eVeryLow
};
typedef G4FastList<OBJECT> list;
Watcher(){;}
Watcher()
{
fPriority = Priority::eVeryLow;
}
virtual ~Watcher()
{
typename std::set<G4FastList<OBJECT>*>::iterator it = fWatching.begin();
@@ -243,10 +260,24 @@ template<class OBJECT>
}
}
virtual G4String GetWatcherName(){
return "";
}
Priority GetPriority() const{
return fPriority;
}
// ===============================
// NOTIFICATIONS
void NotifyDeletingList(G4FastList<OBJECT>*){;}
void NotifyNewObject(OBJECT*, G4FastList<OBJECT>*){;}
void NotifyRemoveObject(OBJECT*, G4FastList<OBJECT>*){;}
void NotifyEmpty(OBJECT*, G4FastList<OBJECT>*){;}
// used by PriorityList & ManyFastLists
virtual void NotifyAddObject(OBJECT*, G4FastList<OBJECT>*){;}
virtual void NotifyRemoveObject(OBJECT*, G4FastList<OBJECT>*){;}
// void NotifyEmpty(OBJECT*, G4FastList<OBJECT>*){;}
// ===============================
void Watch(G4FastList<OBJECT>* fastList)
{
@@ -262,12 +293,29 @@ template<class OBJECT>
if(removeWatcher) fastList->RemoveWatcher(this);
}
protected:
Priority fPriority;
private:
std::set<G4FastList<OBJECT>*> fWatching;
};
template<typename WATCHER_TYPE>
class TWatcher : public Watcher
{
public:
TWatcher() : Watcher(){;}
virtual ~TWatcher(){}
virtual G4String GetWatcherName()
{
return typeid(WATCHER_TYPE).name();
}
};
protected:
std::set<Watcher*> fWatchers;
typedef std::set<typename G4FastList<OBJECT>::Watcher*,
sortWatcher<OBJECT>> WatcherSet;
WatcherSet fWatchers;
G4FastListNode<G4FastList<OBJECT> >* fpNodeInManyLists;
public:
@@ -296,7 +344,7 @@ template<class OBJECT>
void RemoveWatcher(Watcher* watcher)
{
typename std::set<Watcher*>::iterator it = fWatchers.find(watcher);
typename WatcherSet::iterator it = fWatchers.find(watcher);
if(it == fWatchers.end()) return; //TODO: exception?
fWatchers.erase(it);
}
@@ -383,6 +431,25 @@ template<class OBJECT>
};
template<class OBJECT>
struct sortWatcher
{
bool operator()(const typename G4FastList<OBJECT>::Watcher* left,
const typename G4FastList<OBJECT>::Watcher* right) const
{
if(left && right)
{
if(left->GetPriority() != right->GetPriority())
{
return left->GetPriority() < right->GetPriority();
}
return left < right;
}
return false;
}
};
/**
* G4FastList_iterator enables to go through
* the tracks contained by a list.
@@ -160,8 +160,8 @@ template<class OBJECT>
}
fNbObjects = 0;
typename std::set<Watcher*>::iterator it = fWatchers.begin();
typename std::set<Watcher*>::iterator _end = fWatchers.end();
typename WatcherSet::iterator it = fWatchers.begin();
typename WatcherSet::iterator _end = fWatchers.end();
for (; it != _end; it++)
{
@@ -324,12 +324,15 @@ template<class OBJECT>
*/
fNbObjects++;
typename std::set<Watcher*>::iterator it = fWatchers.begin();
typename std::set<Watcher*>::iterator _end = fWatchers.end();
for (; it != _end; it++)
if(fWatchers.empty() == false)
{
(*it)->NotifyNewObject(__toHook->GetObject(), this);
typename WatcherSet::iterator it = fWatchers.begin();
typename WatcherSet::iterator _end = fWatchers.end();
for (; it != _end; it++)
{
(*it)->NotifyAddObject(__toHook->GetObject(), this);
}
}
}
@@ -359,8 +362,8 @@ template<class OBJECT>
fNbObjects--;
typename std::set<Watcher*>::iterator it = fWatchers.begin();
typename std::set<Watcher*>::iterator _end = fWatchers.end();
typename WatcherSet::iterator it = fWatchers.begin();
typename WatcherSet::iterator _end = fWatchers.end();
for (; it != _end; it++)
{
@@ -521,6 +524,27 @@ template<class OBJECT>
if (__destination->fNbObjects == 0)
{
if(__destination->fWatchers.empty()==false)
{
typename WatcherSet::iterator it = __destination->fWatchers.begin();
typename WatcherSet::iterator _end = __destination->fWatchers.end();
// G4cout << "G4FastList<OBJECT>::transferTo --- Watcher size = "
// << __destination->fWatchers.size()
// << G4endl;
for (; it != _end; it++)
{
for(iterator it2 = this->begin() ;
it2 != this->end(); ++it2
)
{
(*it)->NotifyAddObject(*it2, this);
}
}
}
__destination->fNbObjects = this->fNbObjects;
__destination->fBoundary.SetNext(fBoundary.GetNext());
@@ -530,6 +554,21 @@ template<class OBJECT>
}
else
{
if(__destination->fWatchers.empty()==false)
{
typename WatcherSet::iterator it = __destination->fWatchers.begin();
typename WatcherSet::iterator _end = __destination->fWatchers.end();
for (; it != _end; it++)
{
for(iterator it2 = this->begin() ;
it2 != this->end(); ++it2)
{
(*it)->NotifyAddObject(*it2, this);
}
}
}
node* lastNode = __destination->fBoundary.GetPrevious();
lastNode->SetNext(fBoundary.GetNext());
fBoundary.GetNext()->SetPrevious(lastNode);
@@ -588,7 +627,7 @@ template<class OBJECT>
G4FastListNode<OBJECT>* __node = GetNode(__obj);
if (__node == 0) return 0;
if (__node->fListRef == 0) return 0;
if (__node->fListRef == nullptr) return 0;
return __node->fListRef->fpTrackList;
}
@@ -598,7 +637,7 @@ template<class OBJECT>
G4FastList<OBJECT>::GetList(G4FastListNode<OBJECT>* __node)
{
if (__node == 0) return 0;
if (__node->fListRef == 0) return 0;
if (__node->fListRef == nullptr) return 0;
return __node->fListRef->fpList;
}
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4IT.hh 87061 2014-11-24 11:43:34Z gcosmo $
// $Id: G4IT.hh 94218 2015-11-09 08:24:48Z gcosmo $
//
// Author: Mathieu Karamitros, kara@cenbg.in2p3.fr
@@ -51,9 +51,6 @@
#include "G4ITType.hh"
#include "G4ThreeVector.hh"
#include "G4VUserTrackInformation.hh"
#include "G4TrackingInformation.hh"
#include <CLHEP/Utility/memory.h>
#include "G4Allocator.hh"
///
// To implement your own IT class, you should use
@@ -63,6 +60,7 @@
///
class G4IT;
class G4TrackingInformation;
//template<typename PointT> class G4KDNode;
class G4KDNode_Base;
class G4ITBox;
@@ -71,20 +69,12 @@ class G4Track;
G4IT* GetIT(const G4Track* track);
G4IT* GetIT(const G4Track& track);
#if defined G4EM_ALLOC_EXPORT
extern G4DLLEXPORT G4ThreadLocal G4Allocator<G4IT> *aITAllocator;
#else
extern G4DLLIMPORT G4ThreadLocal G4Allocator<G4IT> *aITAllocator;
#endif
template<class OBJECT> class G4FastListNode;
typedef G4FastListNode<G4Track> G4TrackListNode;
/**
* G4IT is a interface which allows the inheriting object :
* - to be included in ITManager for the search of nearest
* neighbour
* - to be tracked using G4ITStepManager
* G4IT is a interface which allows the inheriting object
* to be tracked using G4ITStepProcessor
* The inheriting class must implement the operator < , ==
* and != in order to enable the sorting out.
* also the concrete header of MyIT ("MyIt.hh") should contain : ITDef(MyIT)
@@ -98,8 +88,8 @@ public:
G4IT(G4Track*);
virtual ~G4IT();
inline void *operator new(size_t);
inline void operator delete(void *aIT);
// inline void *operator new(size_t);
// inline void operator delete(void *aIT);
virtual void Print() const
{
@@ -125,10 +115,12 @@ public:
inline G4Track* GetTrack();
inline const G4Track* GetTrack() const;
virtual const G4ThreeVector& GetPosition() const;
virtual const double& operator[](int i) const;
void RecordCurrentPositionNTime();
const G4ThreeVector& GetPosition() const;
double operator[](int i) const;
const G4ThreeVector& GetPreStepPosition() const;
G4double GetPreStepLocalTime() const;
G4double GetPreStepGlobalTime() const;
inline void SetPrevious(G4IT*);
inline void SetNext(G4IT*);
@@ -140,18 +132,14 @@ public:
inline const G4ITBox* GetITBox() const;
void TakeOutBox();
inline void SetNode(G4KDNode_Base*);
inline G4KDNode_Base* GetNode() const;
inline void SetParentID(int, int);
inline void GetParentID(int&, int&);
inline const G4ThreeVector& GetPreStepPosition() const;
inline G4double GetPreStepLocalTime() const;
inline G4double GetPreStepGlobalTime() const;
inline G4KDNode_Base* GetNode() const;
inline G4TrackingInformation* GetTrackingInfo()
{
return &fTrackingInformation;
return fpTrackingInformation;
}
inline G4TrackListNode* GetListNode()
@@ -184,23 +172,10 @@ private:
int fParentID_A;
int fParentID_B;
G4TrackingInformation fTrackingInformation;
G4TrackingInformation* fpTrackingInformation;
G4TrackListNode* fpTrackNode;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
///
// Inline methods
///
inline void* G4IT::operator new(size_t)
{
if (!aITAllocator) aITAllocator = new G4Allocator<G4IT>;
return (void *) aITAllocator->MallocSingle();
}
inline void G4IT::operator delete(void *aIT)
{
aITAllocator->FreeSingle((G4IT *) aIT);
}
//------------------------------------------------------------------------------
inline const G4ITBox* G4IT::GetITBox() const
{
@@ -259,21 +234,6 @@ inline void G4IT::GetParentID(int& p_a, int&p_b)
p_b = fParentID_B;
}
inline G4double G4IT::GetPreStepGlobalTime() const
{
return fTrackingInformation.GetPreStepGlobalTime();
}
inline G4double G4IT::GetPreStepLocalTime() const
{
return fTrackingInformation.GetPreStepLocalTime();
}
inline const G4ThreeVector& G4IT::GetPreStepPosition() const
{
return fTrackingInformation.GetPreStepPosition();
}
inline const G4IT* G4IT::GetPrevious() const
{
return fpPreviousIT;
@@ -111,15 +111,17 @@ public:
static void iUpdatePositionMap();
G4KDTreeResultHandle FindNearestInRange(const T* point /*from this point*/,
const T* key /*for this type*/,
int key /*for this type*/,
G4double /*range*/);
G4KDTreeResultHandle FindNearest(const G4ThreeVector&,
const T* /*for this type*/);
int key /*for this type*/);
G4KDTreeResultHandle FindNearest(const T* /*from this point*/,
int key /*for this type*/);
G4KDTreeResultHandle FindNearestInRange(const G4ThreeVector& /*from this point*/,
int key /*for this type*/,
G4double /*range*/);
G4KDTreeResultHandle FindNearest(const T* /*from this point*/,
const T* /*for this type*/);
G4KDTreeResultHandle FindNearestInRange(const G4ThreeVector& /*from this point*/,
const T* /*for this type*/,
G4double /*range*/);
};
#ifdef TEMPLATE
@@ -37,7 +37,7 @@
// -------------------------------------------------------------------
TEMPLATE
G4ThreadLocal G4ITMANAGER * G4ITMANAGER::fInstance(0);
G4ThreadLocal G4ITMANAGER * G4ITMANAGER::fInstance = 0;
TEMPLATE
G4ITMANAGER * G4ITMANAGER::Instance()
@@ -117,9 +117,9 @@ void G4ITMANAGER::Push(G4Track* track)
TEMPLATE
G4KDTreeResultHandle G4ITMANAGER::FindNearest(const G4ThreeVector& position,
const T* key)
int key)
{
TreeMap::iterator it = fTree.find(key->GetMoleculeID());
TreeMap::iterator it = fTree.find(key);
if (it != fTree.end()) return it->second->Nearest(position);
else
{
@@ -130,9 +130,9 @@ G4KDTreeResultHandle G4ITMANAGER::FindNearest(const G4ThreeVector& position,
TEMPLATE
G4KDTreeResultHandle G4ITMANAGER::FindNearest(const T* point0,
const T* key)
int key)
{
if (*point0 == *key)
if (int(*point0) == key)
{
// DEBUG
// G4cout << "Equal keys !"<< G4endl;
@@ -148,7 +148,7 @@ G4KDTreeResultHandle G4ITMANAGER::FindNearest(const T* point0,
return 0; // coverity
}
TreeMap::iterator it = fTree.find(key->GetMoleculeID());
TreeMap::iterator it = fTree.find(key);
if (it != fTree.end())
{
G4KDTreeResultHandle output(it->second->Nearest(node0));
@@ -178,7 +178,7 @@ G4KDTreeResultHandle G4ITMANAGER::FindNearest(const T* point0,
// DEBUG
// G4cout << "Not equal keys !"<< G4endl;
// const G4ThreeVector& position = point0->GetTrack()->GetPosition() ;
TreeMap::iterator it = fTree.find(key->GetMoleculeID());
TreeMap::iterator it = fTree.find(key);
if (it != fTree.end())
{
@@ -204,11 +204,21 @@ G4KDTreeResultHandle G4ITMANAGER::FindNearest(const T* point0,
TEMPLATE
G4KDTreeResultHandle
G4ITMANAGER::FindNearestInRange(const G4ThreeVector& position,
const T* key,
G4double R)
G4ITMANAGER::FindNearest(const T* source,
const T* type)
{
TreeMap::iterator it = fTree.find(key->GetMoleculeID());
return FindNearest(source,
int(*type));
}
TEMPLATE
G4KDTreeResultHandle
G4ITMANAGER::FindNearestInRange(const G4ThreeVector& position,
int key,
G4double R)
{
TreeMap::iterator it = fTree.find(key);
if (it != fTree.end()) return it->second->NearestInRange(position, R);
else
{
@@ -219,13 +229,13 @@ G4ITMANAGER::FindNearestInRange(const G4ThreeVector& position,
TEMPLATE
G4KDTreeResultHandle G4ITMANAGER::FindNearestInRange(const T* point0,
const T* key,
G4double R)
int key,
G4double R)
{
if (*point0 == *key)
if (point0->GetMoleculeID() == key)
{
G4KDNode_Base* node0 = point0->GetNode();
TreeMap::iterator it = fTree.find(key->GetMoleculeID());
TreeMap::iterator it = fTree.find(key);
if (it != fTree.end()) return it->second->NearestInRange(node0, R);
else
{
@@ -234,7 +244,7 @@ G4KDTreeResultHandle G4ITMANAGER::FindNearestInRange(const T* point0,
}
else
{
TreeMap::iterator it = fTree.find(key->GetMoleculeID());
TreeMap::iterator it = fTree.find(key);
if (it != fTree.end()) return it->second->NearestInRange(*point0, R);
else
{
@@ -0,0 +1,55 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/*
* G4ITLeadingTracks.hh
*
* Created on: Jun 26, 2015
* Author: mkaramit
*/
#ifndef SOURCE_PROCESSES_ELECTROMAGNETIC_DNA_MANAGEMENT_INCLUDE_G4ITLEADINGTRACKS_HH_
#define SOURCE_PROCESSES_ELECTROMAGNETIC_DNA_MANAGEMENT_INCLUDE_G4ITLEADINGTRACKS_HH_
#include <vector>
class G4Track;
class G4ITLeadingTracks
{
public:
G4ITLeadingTracks();
virtual ~G4ITLeadingTracks();
void Reset();
void Push(G4Track*);
void PrepareLeadingTracks();
protected:
std::vector<G4Track*> fLeadingTracks;
};
#endif /* SOURCE_PROCESSES_ELECTROMAGNETIC_DNA_MANAGEMENT_INCLUDE_G4ITLEADINGTRACKS_HH_ */
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ITModelProcessor.hh 87375 2014-12-02 08:17:28Z gcosmo $
// $Id: G4ITModelProcessor.hh 94010 2015-11-05 10:08:33Z gcosmo $
//
// Author: Mathieu Karamitros, kara@cenbg.in2p3.fr
@@ -51,10 +51,26 @@
#include "G4ITReactionChange.hh"
#include "G4ITType.hh"
#include "G4ITModelHandler.hh"
#include "G4ITStepStatus.hh"
class G4VITTimeStepComputer;
class G4VITReactionProcess;
class G4ITModelHandler;
class G4ITReactionSet;
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.
@@ -72,17 +88,38 @@ public:
inline void SetModelHandler(G4ITModelHandler*);
void Initialize();
//void Initialize(G4MIWorkspace* /*workspace*/);
void RegisterModel(double time, G4VITStepModel*);
/**
* Restaure original state of the modelProcessor.
* Restore original state of the modelProcessor.
* This method should be call only by the G4Scheduler
*/
inline void CleanProcessor();
G4double CalculateMinTimeStep(G4double currentGlobalTime,
G4double definedMinTimeStep);
void ComputeTrackReaction(G4ITStepStatus fITStepStatus,
G4double fGlobalTime,
G4double currentTimeStep,
G4double previousTimeStep,
G4bool reachedUserTimeLimit,
G4double fTimeTolerance,
G4UserTimeStepAction* fpUserTimeStepAction,
G4int fVerbose);
//____________________________________________________________
// Time stepper part
void InitializeStepper(const G4double& currentGlobalTime,
const G4double& userMinTime);
void InitializeStepper(G4double currentGlobalTime,
G4double userMinTime);
bool GetComputeTimeStep()
{
return fComputeTimeStep;
}
protected:
inline void SetTrack(const G4Track*);
@@ -93,7 +130,7 @@ public:
//____________________________________________________________
// Reaction process part
void FindReaction(std::map<G4Track*, G4TrackVectorHandle>*,
void FindReaction(G4ITReactionSet* reactionSet,
const double currentStepTime,
const double previousStepTime,
const bool reachedUserStepTimeLimit);
@@ -112,7 +149,14 @@ public:
return fpTrack;
}
void SetTrackingManager(G4ITTrackingManager* trackingManager)
{
fpTrackingManager = trackingManager;
}
protected:
void ExtractTimeStepperData();
/** Copy constructor
* \param other Object to copy from
*/
@@ -125,28 +169,34 @@ protected:
//_____________________________
// Members
G4double fTSTimeStep;
G4ITReactionSet* fReactionSet;
G4ITTrackingManager* fpTrackingManager;
G4ITTrackHolder* fpTrackContainer;
G4bool fInitialized;
G4ITModelHandler* fpModelHandler;
const G4Track* fpTrack;
G4double fUserMinTimeStep;
// Attributes for interaction between many IT types
// Interactions between different IT types
// eg : electron/proton
std::vector<std::vector<G4VITStepModel*> > fCurrentModel;
// Attributes for interaction between one type of IT
// Interactions between ITs of the same type
// eg : molecule/molecule or electron/electron
G4VITStepModel* fpModel;
G4ITModelManager* fpModelManager;
// G4double fNextTimeChangeModel ;
G4ITType fCurrentType1;
G4ITType fCurrentType2;
// Atribute for reactions
std::vector<G4ITReactionChange*> fReactionInfo;
static G4ThreadLocal std::map<const G4Track*, G4bool> *fHasReacted;
bool fComputeTimeStep;
bool fComputeReaction;
};
///
@@ -42,7 +42,7 @@
// Contact : Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
//
// WARNING : This class is released as a prototype.
// It might strongly evolve or even disapear in the next releases.
// It might strongly evolve or even disappear in the next releases.
//
// We would be very happy hearing from you, send us your feedback! :)
//
@@ -78,6 +78,7 @@
#include <iostream>
#include "G4TrackState.hh"
#include <memory>
class G4VPhysicalVolume;
@@ -123,6 +124,9 @@ public:
G4VPhysicalVolume* NewNavigatorStateAndLocate(const G4ThreeVector &p,
const G4ThreeVector &direction);
void CheckNavigatorState() const;
inline std::shared_ptr<G4ITNavigatorState_Lock2> GetSnapshotOfState();
inline void ResetFromSnapshot(std::shared_ptr<G4ITNavigatorState_Lock2>);
// <!
virtual G4double ComputeStep(const G4ThreeVector &pGlobalPoint,
@@ -182,6 +186,12 @@ public:
//
// Important Note: In order to call this the geometry MUST be closed.
//----------------------------------------------------------------------------
EInside InsideCurrentVolume(const G4ThreeVector& globalPoint) const;
void GetRandomInCurrentVolume(G4ThreeVector& rndmPoint) const;
//----------------------------------------------------------------------------
virtual
void LocateGlobalPointWithinVolume(const G4ThreeVector& position);
// Notify the Navigator that a track has moved to the new Global point
@@ -589,7 +599,7 @@ public:
G4VoxelSafety *fpVoxelSafety;
};
RegisterTrackState(G4ITNavigator2, G4ITNavigator2::G4NavigatorState)
RegisterTrackState(G4ITNavigator2, G4NavigatorState)
#define CheckNavigatorStateIsValid() \
if(fpNavigatorState == 0) \
@@ -158,6 +158,28 @@ EVolume G4ITNavigator2::CharacteriseDaughters(const G4LogicalVolume *pLog) const
return pLog->CharacteriseDaughters();
}
inline std::shared_ptr<G4ITNavigatorState_Lock2> G4ITNavigator2::GetSnapshotOfState()
{
if(fpNavigatorState)
{
std::shared_ptr<G4ITNavigatorState_Lock2>
snapShot(new G4NavigatorState(*fpNavigatorState));
return snapShot;
}
else
{
return std::shared_ptr<G4ITNavigatorState_Lock2>(0);
}
}
inline void G4ITNavigator2::ResetFromSnapshot(std::shared_ptr<G4ITNavigatorState_Lock2> snapShot)
{
if(fpNavigatorState && snapShot)
{
*fpNavigatorState = *((G4NavigatorState*) snapShot.get());
}
}
// ********************************************************************
// GetDaughtersRegularStructureId
// ********************************************************************
@@ -120,6 +120,7 @@ public:
virtual ~G4TrackState<G4ITPathFinder>(){}
G4TrackState<G4ITPathFinder>() :
G4TrackStateBase<G4ITPathFinder>(),
fEndState( G4ThreeVector(), G4ThreeVector(), 0., 0., 0., 0., 0.),
fFieldExertedForce(false),
fRelocatedPoint(true),
@@ -0,0 +1,314 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/*
* G4ITReactionInfo.hh
*
* Created on: 1 févr. 2015
* Author: matkara
*/
#ifndef G4ITREACTIONINFO_HH_
#define G4ITREACTIONINFO_HH_
#include "tls.hh"
#include <list>
#include <map>
#include <G4memory.hh>
#include "G4Track.hh"
#include <set>
typedef G4shared_ptr< std::vector<G4Track*> > G4TrackVectorHandle;
#ifndef compTrackPerID__
#define compTrackPerID__
struct compTrackPerID
{
bool operator()(G4Track* rhs, G4Track* lhs) const
{
return rhs->GetTrackID() < lhs->GetTrackID();
}
};
#endif
class G4Track;
class G4ITReactionSet;
class G4ITReactionPerTrack;
class G4ITReaction;
typedef G4shared_ptr<G4ITReaction> G4ITReactionPtr;
typedef G4shared_ptr<G4ITReactionPerTrack> G4ITReactionPerTrackPtr;
typedef std::list<G4ITReactionPtr> G4ITReactionList;
typedef std::map<G4Track*,
G4ITReactionPerTrackPtr,
compTrackPerID> G4ITReactionPerTrackMap;
typedef std::list<std::pair<G4ITReactionPerTrackPtr,
G4ITReactionList::iterator> > G4ReactionPerTrackIt;
struct compReactionPerTime
{
bool operator()(G4ITReactionPtr rhs,
G4ITReactionPtr lhs) const;
};
typedef std::multiset<G4ITReactionPtr, compReactionPerTime> G4ITReactionPerTime;
typedef std::multiset<G4ITReactionPtr, compReactionPerTime>::iterator G4ITReactionPerTimeIt;
class G4ITReaction : public G4enable_shared_from_this<G4ITReaction>
{
G4ITReaction(double time, G4Track*, G4Track*);
public:
static G4ITReactionPtr New(double time, G4Track* trackA, G4Track* trackB)
{
return G4ITReactionPtr(new G4ITReaction(time, trackA, trackB));
}
virtual ~G4ITReaction();
G4Track* GetReactant(G4Track* trackA)
{
if(fReactants.first != trackA) return fReactants.first;
return fReactants.second;
}
std::pair<G4Track*, G4Track*> GetReactants() const{return fReactants;}
std::size_t GetHash() const;
double GetTime() { return fTime; }
void RemoveMe();
void AddIterator(G4ITReactionPerTrackPtr reactionPerTrack,
G4ITReactionList::iterator it)
{
fReactionPerTrack.push_back(std::make_pair(reactionPerTrack, it));
}
void AddIterator(G4ITReactionPerTimeIt it)
{
fReactionPerTimeIt = new G4ITReactionPerTimeIt(it);
}
double fTime;
std::pair<G4Track*, G4Track*> fReactants;
G4ReactionPerTrackIt fReactionPerTrack;
G4ITReactionPerTimeIt* fReactionPerTimeIt;
//static G4ThreadLocal std::set<G4ITReaction*>* gAll;
};
class G4ITReactionPerTrack : public G4enable_shared_from_this<G4ITReactionPerTrack>
{
G4ITReactionPerTrack(){}
public:
static G4ITReactionPerTrackPtr New()
{
return G4ITReactionPerTrackPtr(new G4ITReactionPerTrack());
}
virtual ~G4ITReactionPerTrack()
{
fReactions.clear();
}
void AddReaction(G4ITReactionPtr reaction)
{
G4ITReactionList::iterator it =
fReactions.insert(fReactions.end(), reaction);
reaction->AddIterator(this->shared_from_this(), it);
}
void AddIterator(G4ITReactionPerTrackMap::iterator it)
{
fReactionSetIt.push_back(it);
}
bool RemoveThisReaction(G4ITReactionList::iterator it);
void RemoveMe()
{
G4ITReactionPerTrackPtr backMeUp = this->shared_from_this();
G4ITReactionList::iterator next;
for(G4ITReactionList::iterator it = fReactions.begin() ;
it != fReactions.end() ; it = next)
{
next = it;
++next;
(*it)->RemoveMe();
}
fReactions.clear();
fReactionSetIt.clear();
}
G4ITReactionList& GetReactionList()
{
return fReactions;
}
std::list<G4ITReactionPerTrackMap::iterator>& GetListOfIterators()
{
return fReactionSetIt;
}
protected:
G4ITReactionList fReactions;
std::list<G4ITReactionPerTrackMap::iterator> fReactionSetIt;
};
class G4ITReactionSet
{
G4ITReactionSet() //: fReactionPerTime(compReactionPerTime())
{
fpInstance = this;
fSortByTime = false;
}
public:
virtual ~G4ITReactionSet()
{
fReactionPerTrack.clear();
fReactionPerTime.clear();
}
static G4ITReactionSet* Instance()
{
if(fpInstance == 0) new G4ITReactionSet();
return fpInstance;
}
//------------------------------------------------------------------------------------
void AddReaction(double time, G4Track* trackA, G4Track* trackB)
{
G4ITReactionPtr reaction(G4ITReaction::New(time, trackA, trackB));
AddReaction(trackA, reaction);
AddReaction(trackB, reaction);
if(fSortByTime)
{
G4ITReactionPerTime::iterator it = fReactionPerTime.insert(reaction);
reaction->AddIterator(it);
}
}
void AddReactions(double time, G4Track* trackA, G4TrackVectorHandle reactants)
{
std::vector<G4Track*>::iterator it = reactants->begin();
for(;it != reactants->end() ; ++it)
{
AddReaction(time, trackA, *it);
}
}
void RemoveReactionSet(G4Track* track)
{
G4ITReactionPerTrackMap::iterator it = fReactionPerTrack.find(track);
if(it != fReactionPerTrack.end())
{
G4ITReactionPerTrackPtr backItUp = it->second->shared_from_this();
backItUp->RemoveMe();
//fReactionPerTrack.erase(it); // not needed : once empty ==> auto-erase
it = fReactionPerTrack.find(track);
if(it != fReactionPerTrack.end())
{
fReactionPerTrack.erase(it);
}
}
}
void SelectThisReaction(G4ITReactionPtr reaction)
{
reaction->RemoveMe();
RemoveReactionSet(reaction->GetReactants().first);
RemoveReactionSet(reaction->GetReactants().second);
}
G4ITReactionPerTrackMap& GetReactionMap()
{
return fReactionPerTrack;
}
void RemoveReactionPerTrack(G4ITReactionPerTrackPtr reactionPerTrack)
{
for(std::list<G4ITReactionPerTrackMap::iterator>::iterator it =
reactionPerTrack->GetListOfIterators().begin() ;
it != reactionPerTrack->GetListOfIterators().end() ;
++it)
{
fReactionPerTrack.erase(*it);
}
reactionPerTrack->GetListOfIterators().clear();
reactionPerTrack->GetReactionList().clear();
}
void CleanAllReaction()
{
for(G4ITReactionPerTrackMap::iterator it = fReactionPerTrack.begin();
it != fReactionPerTrack.end() ;
it = fReactionPerTrack.begin())
{
it->second->RemoveMe();
}
fReactionPerTrack.clear();
fReactionPerTime.clear();
}
bool Empty()
{
return fReactionPerTrack.empty();
}
G4ITReactionPerTime& GetReactionsPerTime()
{
return fReactionPerTime;
}
protected:
void AddReaction(G4Track* track, G4ITReactionPtr reaction)
{
G4ITReactionPerTrackMap::iterator it = fReactionPerTrack.find(track);
G4ITReactionPerTrackPtr reactionPerTrack;
if(it == fReactionPerTrack.end())
{
reactionPerTrack = G4ITReactionPerTrack::New();
std::pair< G4ITReactionPerTrackMap::iterator,bool> pos =
fReactionPerTrack.insert(std::make_pair(track, reactionPerTrack));
reactionPerTrack->AddIterator(pos.first);
}
else
{
reactionPerTrack = it->second;
}
reactionPerTrack->AddReaction(reaction);
}
G4ITReactionPerTrackMap fReactionPerTrack;
G4ITReactionPerTime fReactionPerTime;
bool fSortByTime;
static G4ThreadLocal G4ITReactionSet* fpInstance;
};
#endif /* G4ITREACTIONINFO_HH_ */
@@ -68,8 +68,8 @@ public:
//
// Return linear step for mass geometry
G4double ComputeSafety(const G4ThreeVector& pGlobalPoint, G4double maxRadius =
DBL_MAX); // Radius of interest
G4double ComputeSafety(const G4ThreeVector& pGlobalPoint,
G4double maxRadius = DBL_MAX); // Radius of interest
//
// Return safety for all geometries.
//
@@ -78,7 +78,7 @@ public:
// If the second argument is not given, this is the real isotropic safety
void Locate(const G4ThreeVector& pGlobalPoint,
const G4ThreeVector& direction);
const G4ThreeVector& direction);
//
// Locate the point for all geometries
@@ -142,7 +142,7 @@ public:
// End State (tracking)
};
RegisterTrackState(G4ITSafetyHelper, G4ITSafetyHelper::State)
RegisterTrackState(G4ITSafetyHelper, State)
// Inline definitions
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ITStepProcessor.hh 87375 2014-12-02 08:17:28Z gcosmo $
// $Id: G4ITStepProcessor.hh 94218 2015-11-09 08:24:48Z gcosmo $
//
// Author: Mathieu Karamitros, kara@cenbg.in2p3.fr
@@ -66,9 +66,9 @@
#include "G4TouchableHandle.hh" // Include from 'geometry'
#include "G4TouchableHistoryHandle.hh" // Include from 'geometry'
#include "G4TrackingInformation.hh"
#include "G4ITStepProcessorState_Lock.hh"
#include "G4ITLeadingTracks.hh"
//class G4Navigator;
class G4ITNavigator;
class G4ParticleDefinition;
class G4ITTrackingManager;
@@ -76,10 +76,75 @@ class G4IT;
class G4TrackingInformation;
class G4ITTransportation;
class G4VITProcess;
class G4VITSteppingVerbose;
class G4ITTrackHolder;
typedef class std::vector<int, std::allocator<int> > G4SelectedAtRestDoItVector;
typedef class std::vector<int, std::allocator<int> > G4SelectedAlongStepDoItVector;
typedef class std::vector<int, std::allocator<int> > G4SelectedPostStepDoItVector;
//________________________________________________
//
// Members related to ParticleDefinition and not
// proper to a track
//________________________________________________
struct ProcessGeneralInfo
{
G4ProcessVector* fpAtRestDoItVector;
G4ProcessVector* fpAlongStepDoItVector;
G4ProcessVector* fpPostStepDoItVector;
G4ProcessVector* fpAtRestGetPhysIntVector;
G4ProcessVector* fpAlongStepGetPhysIntVector;
G4ProcessVector* fpPostStepGetPhysIntVector;
//
// Note: DoItVector has inverse order against GetPhysIntVector
// and SelectedPostStepDoItVector.
//
// * Max number of processes
size_t MAXofAtRestLoops;
size_t MAXofAlongStepLoops;
size_t MAXofPostStepLoops;
// Maximum number of processes for each type of process
// These depend on the G4ParticleDefinition, so on the track
// * Transportation process
G4ITTransportation* fpTransportation;
};
//________________________________________________
//
// Members proper to a track
//________________________________________________
class G4ITStepProcessorState : public G4ITStepProcessorState_Lock
{
public:
G4ITStepProcessorState();
virtual ~G4ITStepProcessorState();
G4ITStepProcessorState(const G4ITStepProcessorState&);
G4ITStepProcessorState& operator=(const G4ITStepProcessorState&);
// * Max Number of Process
G4SelectedAtRestDoItVector fSelectedAtRestDoItVector;
G4SelectedPostStepDoItVector fSelectedPostStepDoItVector;
G4double fPhysicalStep;
G4double fPreviousStepSize;
G4double fSafety;
G4StepStatus fStepStatus;
// * Safety
G4double fProposedSafety;
// This keeps the minimum safety value proposed by AlongStepGPILs.
G4ThreeVector fEndpointSafOrigin;
G4double fEndpointSafety;
// To get the true safety value at the PostStepPoint, you have
// to subtract the distance to 'endpointSafOrigin' from this value.
G4TouchableHandle fTouchableHandle;
};
/**
* Its role is the same as G4StepManager :
* - Find the minimum physical length and corresponding time step
@@ -88,7 +153,7 @@ typedef class std::vector<int, std::allocator<int> > G4SelectedPostStepDoItVecto
class G4ITStepProcessor
{
friend class G4Scheduler;
public:
G4ITStepProcessor();
virtual ~G4ITStepProcessor();
@@ -112,7 +177,7 @@ public:
fpStep = val;
}
inline G4TrackVector* GetSecondaries()
inline G4TrackVector* GetSecondaries() const
{
return fpSecondary;
}
@@ -125,24 +190,108 @@ public:
return fpTrackingManager;
}
//___________________________________
virtual void Initialize();
void ForceReInitialization();
void ResetLeadingTracks();
void PrepareLeadingTracks();
//___________________________________
G4double ComputeInteractionLength(double previousTimeStep);
void DefinePhysicalStepLength(G4Track*);
G4double GetILTimeStep()
{
return fILTimeStep;
}
//___________________________________
// DoIt
void DoIt(double timeStep);
void ExtractDoItData();
void Stepping(G4Track*, const double&);
//void CalculateStep(G4Track*, const double&);
//void CalculateStep(G4Track*);
//void DoIt(G4Track*,double);
void FindTransportationStep();
// void UpdateTrack(G4Track*);
//___________________________________
inline double GetInteractionTime();
inline const G4Track* GetTrack() const;
inline void CleanProcessor();
size_t GetAtRestDoItProcTriggered() const
{
return fAtRestDoItProcTriggered;
}
G4GPILSelection GetGPILSelection() const
{
return fGPILSelection;
}
G4int GetN2ndariesAlongStepDoIt() const
{
return fN2ndariesAlongStepDoIt;
}
G4int GetN2ndariesAtRestDoIt() const
{
return fN2ndariesAtRestDoIt;
}
G4int GetN2ndariesPostStepDoIt() const
{
return fN2ndariesPostStepDoIt;
}
const G4VITProcess* GetCurrentProcess() const
{
return fpCurrentProcess;
}
G4double GetPhysIntLength() const
{
return fPhysIntLength;
}
size_t GetPostStepAtTimeDoItProcTriggered() const
{
return fPostStepAtTimeDoItProcTriggered;
}
size_t GetPostStepDoItProcTriggered() const
{
return fPostStepDoItProcTriggered;
}
const ProcessGeneralInfo* GetCurrentProcessInfo() const
{
return fpProcessInfo;
}
const G4ITStepProcessorState* GetProcessorState() const
{
return fpState;
}
const G4VParticleChange* GetParticleChange() const
{
return fpParticleChange;
}
const G4VPhysicalVolume* GetCurrentVolume() const
{
return fpCurrentVolume;
}
G4ForceCondition GetCondition() const
{
return fCondition;
}
protected:
void ExtractILData();
void SetupGeneralProcessInfo(G4ParticleDefinition*, G4ProcessManager*);
void ClearProcessInfo();
void SetTrack(G4Track*);
@@ -158,6 +307,7 @@ protected:
void GetAtRestIL();
void DoDefinePhysicalStepLength();
void DoStepping();
void PushSecondaries();
// void CalculateStep();
// void DoCalculateStep();
@@ -190,15 +340,16 @@ private:
G4bool fInitialized;
G4ITTrackingManager* fpTrackingManager;
// G4UserSteppingAction* fpUserSteppingAction;
G4double kCarTolerance;
// Cached geometrical tolerance on surface
G4ITNavigator* fpNavigator;
// G4Navigator* fpNavigator;
G4int fStoreTrajectory;
G4int verboseLevel;
G4VITSteppingVerbose* fpVerbose;
G4ITTrackHolder* fpTrackContainer;
G4ITLeadingTracks fLeadingTracks;
//________________________________________________
//
@@ -206,6 +357,8 @@ private:
//________________________________________________
G4double fTimeStep; // not proper to a track
G4double fILTimeStep; // proper to a track ensemble
G4double fPreviousTimeStep;
G4TrackVector* fpSecondary; // get from fpStep at every configuration setup
G4VParticleChange* fpParticleChange;
@@ -241,79 +394,22 @@ private:
// G4SteppingControl StepControlFlag;
// G4VSensitiveDetector* fpSensitive;
G4VPhysicalVolume* fpCurrentVolume; // Get from fpStep or touchable, keep as member for user interface
G4VPhysicalVolume* fpCurrentVolume;
// Get from fpStep or touchable, keep as member for user interface
//________________________________________________
//
// Members related to ParticleDefinition and not
// proper to a track
//________________________________________________
struct ProcessGeneralInfo
{
G4ProcessVector* fpAtRestDoItVector;
G4ProcessVector* fpAlongStepDoItVector;
G4ProcessVector* fpPostStepDoItVector;
G4ProcessVector* fpAtRestGetPhysIntVector;
G4ProcessVector* fpAlongStepGetPhysIntVector;
G4ProcessVector* fpPostStepGetPhysIntVector;
//
// Note: DoItVector has inverse order against GetPhysIntVector
// and SelectedPostStepDoItVector.
//
// * Max Number of Process
size_t MAXofAtRestLoops;
size_t MAXofAlongStepLoops;
size_t MAXofPostStepLoops;
// Maximum number of processes for each type of process
// These depend on the G4ParticleDefinition, so on the track
// * Transportation process
G4ITTransportation* fpTransportation;
};
std::map<const G4ParticleDefinition*, ProcessGeneralInfo*> fProcessGeneralInfoMap;
ProcessGeneralInfo* fpProcessInfo;
G4ITTransportation* fpTransportation;
//________________________________________________
//
// Members proper to a track
//________________________________________________
class G4ITStepProcessorState : public G4ITStepProcessorState_Lock
{
public:
G4ITStepProcessorState();
virtual ~G4ITStepProcessorState();
// * Max Number of Process
G4SelectedAtRestDoItVector fSelectedAtRestDoItVector;
G4SelectedPostStepDoItVector fSelectedPostStepDoItVector;
G4double fPhysicalStep;
G4double fPreviousStepSize;
G4double fSafety;
G4StepStatus fStepStatus;
// * Safety
G4double proposedSafety;
// This keeps the minimum safety value proposed by AlongStepGPILs.
G4ThreeVector endpointSafOrigin;
G4double endpointSafety;
// To get the true safety value at the PostStepPoint, you have
// to subtract the distance to 'endpointSafOrigin' from this value.
G4TouchableHandle fTouchableHandle;
private:
G4ITStepProcessorState(const G4ITStepProcessorState&);
G4ITStepProcessorState& operator=(const G4ITStepProcessorState&);
};
//________________________________________________
//
// Members used for configurating the processor
// Members used for setting up the processor
//________________________________________________
G4Track* fpTrack; // Set track
@@ -327,29 +423,38 @@ private:
G4StepPoint* fpPostStepPoint; // SetupMembers
};
//______________________________________________________________________________
inline void G4ITStepProcessor::SetPreviousStepTime(G4double previousTimeStep)
{
fPreviousTimeStep = previousTimeStep;
}
//______________________________________________________________________________
inline const G4Track* G4ITStepProcessor::GetTrack() const
{
return fpTrack;
}
//______________________________________________________________________________
inline G4double G4ITStepProcessor::CalculateSafety()
{
return std::max(
fpState->endpointSafety - (fpState->endpointSafOrigin
- fpPostStepPoint->GetPosition()).mag(),
kCarTolerance);
return std::max(fpState->fEndpointSafety - (fpState->fEndpointSafOrigin
- fpPostStepPoint->GetPosition()).mag(),
kCarTolerance);
}
//______________________________________________________________________________
inline void G4ITStepProcessor::SetNavigator(G4ITNavigator *value)
{
fpNavigator = value;
}
//______________________________________________________________________________
inline void G4ITStepProcessor::CleanProcessor()
{
fTimeStep = DBL_MAX;
@@ -383,6 +488,7 @@ inline void G4ITStepProcessor::CleanProcessor()
}
//______________________________________________________________________________
inline double G4ITStepProcessor::GetInteractionTime()
{
return fTimeStep;
@@ -0,0 +1,46 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/*
* G4ITStepProcessorState_Lock.hh
*
* Created on: Nov 6, 2015
* Author: mkaramit
*/
#ifndef SOURCE_PROCESSES_ELECTROMAGNETIC_DNA_MANAGEMENT_INCLUDE_G4ITSTEPPROCESSORSTATE_LOCK_HH_
#define SOURCE_PROCESSES_ELECTROMAGNETIC_DNA_MANAGEMENT_INCLUDE_G4ITSTEPPROCESSORSTATE_LOCK_HH_
class G4TrackingInformation;
class G4ITStepProcessorState_Lock
{
friend class G4TrackingInformation;
protected:
inline virtual ~G4ITStepProcessorState_Lock()
{;}
};
#endif /* SOURCE_PROCESSES_ELECTROMAGNETIC_DNA_MANAGEMENT_INCLUDE_G4ITSTEPPROCESSORSTATE_LOCK_HH_ */
@@ -0,0 +1,86 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id$
//
//---------------------------------------------------------------
//
// G4SteppingVerbose.hh
//
// class description:
// This class manages the verbose outputs in G4ITStepProcessor.
//
//---------------------------------------------------------------
class G4SteppingVerbose;
#ifndef G4SteppingVerose_h
#define G4SteppingVerose_h 1
#include "G4VITSteppingVerbose.hh"
class G4ITSteppingVerbose : public G4VITSteppingVerbose
{
public:
G4ITSteppingVerbose();
~G4ITSteppingVerbose();
// methods to be invoked in the SteppingManager
void NewStep();
void StepInfoForLeadingTrack();
void AtRestDoItInvoked();
void AtRestDoItOneByOne();
void AlongStepDoItAllDone();
void AlongStepDoItOneByOne();
void PostStepDoItAllDone();
void PostStepDoItOneByOne();
void StepInfo();
void TrackingStarted(G4Track*);
void TrackingEnded(G4Track*);
void DoItStarted();
void PreStepVerbose(G4Track* track);
void PostStepVerbose(G4Track* track);
void DPSLStarted();
void DPSLUserLimit();
void DPSLPostStep();
void DPSLAlongStep();
// void DPSLAlongStepDoItOneByOne();
// void DPSLPostStepDoItOneByOne();
void VerboseTrack();
void VerboseParticleChange();
void ShowStep() const;
//
};
#endif
@@ -33,7 +33,6 @@
#ifndef G4ITTRACKHOLDER_HH
#define G4ITTRACKHOLDER_HH
#include "G4IT.hh"
#include "G4TrackList.hh"
#include "G4VITTrackHolder.hh"
#include <iostream>
@@ -50,6 +49,7 @@ public:
};
PriorityList();
PriorityList(G4TrackManyList& allMainList);
PriorityList(const PriorityList& right);
virtual ~PriorityList();
@@ -130,6 +130,8 @@ class G4ITTrackHolder : public G4VITTrackHolder
static G4ThreadLocal G4ITTrackHolder* fgInstance;
static G4ITTrackHolder* fgMasterInstance;
friend class G4Scheduler;
friend class G4ITStepProcessor;
friend class G4ITModelProcessor;
public:
//----- typedefs -----
@@ -178,6 +180,9 @@ public:
G4TrackList::Watcher*,
PriorityList::Type = PriorityList::MainList);
void AddWatcherForMainList(G4TrackList::Watcher*);
void AddWatcherForKillList(G4TrackList::Watcher*);
// ----- Access track lists -----
inline MapOfPriorityLists& GetLists()
{ return fLists;}
@@ -222,6 +227,11 @@ public:
fVerbose = verbose;
}
inline G4TrackList* GetKillList()
{
return &fToBeKilledList;
}
protected:
void AddTrackID(G4Track* track);
void _PushTrack(G4Track* track);
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ITTrackingInteractivity.hh 85244 2014-10-27 08:24:13Z gcosmo $
// $Id: G4ITTrackingInteractivity.hh 91584 2015-07-27 13:01:48Z gcosmo $
//
// Author: Mathieu Karamitros, kara@cenbg.in2p3.fr
@@ -44,7 +44,6 @@
// J. Comput. Phys. 274 (2014) 841-882
// Prog. Nucl. Sci. Tec. 2 (2011) 503-508
#ifndef G4ITTRACKINGINTERACTIVITY_HH
#define G4ITTRACKINGINTERACTIVITY_HH
@@ -54,32 +53,75 @@ class G4Track;
class G4Step;
class G4UserTrackingAction;
class G4UserSteppingAction;
class G4VITSteppingVerbose;
class G4ITTrackingInteractivity
{
protected :
int fVerboseLevel;
protected:
int fVerboseLevel;
public:
G4ITTrackingInteractivity()
{
fVerboseLevel = 0;
}
virtual ~G4ITTrackingInteractivity(){;}
G4ITTrackingInteractivity(G4VITSteppingVerbose* verbose = 0);
virtual void Initialize(){;}
virtual void StartTracking(G4Track*){;}
virtual void AppendStep(G4Track* /*track*/, G4Step* /*step*/){;}
virtual void EndTracking(G4Track*){;}
virtual void Finalize(){;}
virtual ~G4ITTrackingInteractivity()
{
;
}
virtual void TrackBanner(G4Track* /*track*/, const G4String& message = "");
inline void SetVerbose(int);
virtual void Initialize()
{
;
}
virtual void StartTracking(G4Track* /*track*/)
{
}
virtual void AppendStep(G4Track* /*track*/,
G4Step* /*step*/)
{
;
}
virtual void EndTracking(G4Track* /*track*/)
{
}
virtual void Finalize()
{
;
}
virtual void TrackBanner(G4Track* /*track*/,
const G4String& message = "");
inline void SetVerbose(int flag)
{
fVerboseLevel = flag;
}
inline G4int GetVerboseLevel() const
{
return fVerboseLevel;
}
void SetSteppingVerboseLevel(G4int level);
G4int GetSteppingVerboseLevel() const;
inline G4VITSteppingVerbose* GetSteppingVerbose()
{
return fpVerbose;
}
inline void SetSteppingVerbose(G4VITSteppingVerbose* verbose)
{
fpVerbose = verbose;
}
private:
G4VITSteppingVerbose* fpVerbose;
};
inline void G4ITTrackingInteractivity::SetVerbose(int flag)
{
fVerboseLevel = flag;
}
#endif // G4ITTRACKINGINTERACTIVITY_HH
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ITTrackingManager.hh 85244 2014-10-27 08:24:13Z gcosmo $
// $Id: G4ITTrackingManager.hh 91584 2015-07-27 13:01:48Z gcosmo $
//
// Author: Mathieu Karamitros, kara@cenbg.in2p3.fr
@@ -60,19 +60,24 @@ class G4ITTrackingInteractivity;
class G4ITTrackingManager
{
protected:
G4ITTrackingInteractivity* fpTrackingInteractivity;
G4ITTrackingInteractivity* fpTrackingInteractivity;
public:
G4ITTrackingManager();
virtual ~G4ITTrackingManager();
G4ITTrackingManager();
~G4ITTrackingManager();
//void Initialize();
//void Initialize();
virtual void StartTracking(G4Track*);
virtual void AppendStep(G4Track* track, G4Step* step);
virtual void EndTracking(G4Track*);
void StartTracking(G4Track*);
void AppendStep(G4Track* track, G4Step* step);
void EndTracking(G4Track*);
void EndTrackingWOKill(G4Track*);
void SetInteractivity(G4ITTrackingInteractivity*);
void SetInteractivity(G4ITTrackingInteractivity*);
inline G4ITTrackingInteractivity* GetInteractivity()
{
return fpTrackingInteractivity;
}
};
#endif // G4ITTRACKINGMANAGER_HH
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ITTransportation.hh 87375 2014-12-02 08:17:28Z gcosmo $
// $Id: G4ITTransportation.hh 94218 2015-11-09 08:24:48Z gcosmo $
//
/// \brief This class is a slightly modified version of G4Transportation
/// initially written by John Apostolakis and colleagues (1997)
@@ -61,7 +61,6 @@
#include <CLHEP/Units/SystemOfUnits.h>
#include "G4IT.hh"
#include "G4VITProcess.hh"
#include "G4Track.hh"
#include "G4Step.hh"
@@ -96,6 +95,11 @@ public:
virtual void StartTracking(G4Track* aTrack);
// Give to the track a pointer to the transportation state
G4bool IsStepLimitedByGeometry()
{
return GetState<G4ITTransportationState>()->fGeometryLimitedStep;
}
//________________________________________________________
public:
// without description
@@ -0,0 +1,47 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#ifndef G4IosFlagsSaver_
#define G4IosFlagsSaver_
class G4IosFlagsSaver
{
public:
explicit G4IosFlagsSaver(std::ostream& _ios) :
fIO(_ios), fFlags(_ios.flags())
{
}
~G4IosFlagsSaver()
{
fIO.flags(fFlags);
}
private:
std::ostream& fIO;
std::ios::fmtflags fFlags;
};
#endif
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4KDNode.hh 85244 2014-10-27 08:24:13Z gcosmo $
// $Id: G4KDNode.hh 93883 2015-11-03 08:25:04Z gcosmo $
//
// Author: Mathieu Karamitros, kara@cenbg.in2p3.fr
@@ -44,12 +44,11 @@
// J. Comput. Phys. 274 (2014) 841-882
// Prog. Nucl. Sci. Tec. 2 (2011) 503-508
#ifndef G4KDNODE_HH
#define G4KDNODE_HH
#include <list>
#include <map>
//#include <map>
#include <vector>
#include <deque>
#include <G4ThreeVector.hh>
@@ -63,60 +62,65 @@ class G4KDMap;
class G4KDNode_Base
{
public :
//________________________
// For root node :
// parent = 0, axis = 0, side = 0
G4KDNode_Base(G4KDTree*, G4KDNode_Base* /*parent*/);
virtual ~G4KDNode_Base();
virtual double operator[](size_t) const = 0;
virtual void InactiveNode();
virtual bool IsValid() const{ return true; }
public:
//________________________
// For root node :
// parent = 0, axis = 0, side = 0
G4KDNode_Base(G4KDTree*, G4KDNode_Base* /*parent*/);
virtual ~G4KDNode_Base();
virtual double operator[](size_t) const = 0;
virtual void InactiveNode();
virtual bool IsValid() const{ return true; }
//________________________
inline G4KDTree* GetTree() const {return fTree;}
inline void SetTree(G4KDTree* tree) {fTree = tree;}
//________________________
inline G4KDTree* GetTree() const {return fTree;}
inline void SetTree(G4KDTree* tree) {fTree = tree;}
//________________________
int GetDim() const;
inline int GetAxis() const{return fAxis;}
inline G4KDNode_Base* GetParent(){return fParent;}
inline G4KDNode_Base* GetLeft(){return fLeft;}
inline G4KDNode_Base* GetRight(){return fRight;}
//________________________
int GetDim() const;
inline int GetAxis() const{return fAxis;}
inline G4KDNode_Base* GetParent(){return fParent;}
inline G4KDNode_Base* GetLeft(){return fLeft;}
inline G4KDNode_Base* GetRight(){return fRight;}
//________________________
template <typename Position> G4KDNode_Base* FindParent(const Position& x0);
template <typename PointT> G4KDNode_Base* Insert(PointT* point);
int Insert(G4KDNode_Base* newNode);
//________________________
template<typename Position>
G4KDNode_Base* FindParent(const Position& x0);
template<typename PointT>
G4KDNode_Base* Insert(PointT* point);
template<typename PointT>
G4KDNode_Base* Insert(const PointT& point);
int Insert(G4KDNode_Base* newNode);
void PullSubTree();
void RetrieveNodeList(std::list<G4KDNode_Base*>& node_list);
void PullSubTree();
void RetrieveNodeList(std::list<G4KDNode_Base*>& node_list);
void Print(std::ostream& out, int level = 0) const ;
void Print(std::ostream& out, int level = 0) const;
// std::vector<std::deque<G4KDNode_Base* >::iterator >* GetIteratorsForSortingAlgo(G4KDMap*);
// std::map<G4KDMap*, std::vector<std::deque<G4KDNode_Base* >::iterator > >* fpIteratorInSortingAlgo;
// std::vector<std::deque<G4KDNode_Base* >::iterator >* GetIteratorsForSortingAlgo(G4KDMap*);
// std::map<G4KDMap*, std::vector<std::deque<G4KDNode_Base* >::iterator > >* fpIteratorInSortingAlgo;
protected :
//°°°°°°°°°°°
// Members
//°°°°°°°°°°°
size_t fAxis; // axis : x, y, z ...
int fSide ; // left/right
/* fSide == 0 : Is the root node
* fSide == -1 : It is the left of the parent node
* fSide == 1 : It is the right of the parent node
*/
protected:
//°°°°°°°°°°°
// Members
//°°°°°°°°°°°
size_t fAxis; // axis : x, y, z ...
int fSide; // left/right
/* fSide == 0 : Is the root node
* fSide == -1 : It is the left of the parent node
* fSide == 1 : It is the right of the parent node
*/
G4KDTree* fTree ;
G4KDNode_Base *fLeft, *fRight, *fParent;
/* Left : fLeft->fPosition[axis] < this->fPosition[axis]
* Right : fRight->fPosition[axis] > this->fPosition[axis]
* Root node : fParent = 0
*/
private :
G4KDNode_Base(const G4KDNode_Base& right);
G4KDNode_Base& operator=(const G4KDNode_Base& right);
G4KDTree* fTree;
G4KDNode_Base *fLeft, *fRight, *fParent;
/* Left : fLeft->fPosition[axis] < this->fPosition[axis]
* Right : fRight->fPosition[axis] > this->fPosition[axis]
* Root node : fParent = 0
*/
private:
G4KDNode_Base(const G4KDNode_Base& right);
G4KDNode_Base& operator=(const G4KDNode_Base& right);
};
/**
@@ -124,67 +128,156 @@ private :
* This class is for internal use only
*/
template <typename PointT>
class G4KDNode : public G4KDNode_Base
{
public :
//________________________
// For root node :
// parent = 0, axis = 0, side = 0
G4KDNode(G4KDTree*, PointT* /*point*/,
G4KDNode_Base* /*parent*/);
virtual ~G4KDNode();
template<typename PointT>
class G4KDNode : public G4KDNode_Base
{
public:
//________________________
// For root node :
// parent = 0, axis = 0, side = 0
G4KDNode(G4KDTree*, PointT* /*point*/, G4KDNode_Base* /*parent*/);
virtual ~G4KDNode();
void *operator new(size_t);
void operator delete(void *);
inline PointT* GetPoint() {
return fPoint;
}
virtual double operator[](size_t i) const
{
if(fPoint == 0) abort();
return (*fPoint)[i];
}
inline PointT* GetPoint()
{
return fPoint;
}
virtual void InactiveNode()
{
fValid = false;
G4KDNode_Base::InactiveNode();
}
virtual double operator[](size_t i) const
{
if(fPoint == 0) abort();
return (*fPoint)[i];
}
virtual bool IsValid() const
{
return fValid;
}
virtual void InactiveNode()
{
fValid = false;
G4KDNode_Base::InactiveNode();
}
protected:
PointT* fPoint;
G4bool fValid;
virtual bool IsValid() const
{
return fValid;
}
private :
G4KDNode(const G4KDNode<PointT>& right);
G4KDNode& operator=(const G4KDNode<PointT>& right);
protected:
PointT* fPoint;
G4bool fValid;
static G4ThreadLocal G4Allocator<G4KDNode<PointT> >* fgAllocator;
};
private:
G4KDNode(const G4KDNode<PointT>& right);
G4KDNode& operator=(const G4KDNode<PointT>& right);
template <typename PointT>
G4ThreadLocal G4Allocator<G4KDNode<PointT> >* G4KDNode<PointT>::fgAllocator(0);
static G4ThreadLocal G4Allocator<G4KDNode<PointT> >* fgAllocator;
};
template<typename PointT>
void* G4KDNode<PointT>::operator new(size_t)
{
if (!fgAllocator) fgAllocator = new G4Allocator<G4KDNode<PointT> >;
G4ThreadLocal G4Allocator<G4KDNode<PointT> >* G4KDNode<PointT>::fgAllocator =
0;
template<typename PointT>
void* G4KDNode<PointT>::operator new(size_t)
{
if(!fgAllocator) fgAllocator = new G4Allocator<G4KDNode<PointT> >;
return (void *) fgAllocator->MallocSingle();
}
}
template<typename PointT>
void G4KDNode<PointT>::operator delete(void *aNode)
{
fgAllocator->FreeSingle((G4KDNode<PointT> *) aNode);
}
void G4KDNode<PointT>::operator delete(void *aNode)
{
fgAllocator->FreeSingle((G4KDNode<PointT> *) aNode);
}
/**
* G4KDNode stores one entity in G4KDTree
* This class is for internal use only
*/
template<typename PointCopyT>
class G4KDNodeCopy : public G4KDNode_Base
{
public:
//________________________
// For root node :
// parent = 0, axis = 0, side = 0
G4KDNodeCopy(G4KDTree* tree,
const PointCopyT& point,
G4KDNode_Base* parent) :
G4KDNode_Base(tree, parent)
{
fPoint = point;
fValid = true;
}
virtual ~G4KDNodeCopy(){}
void *operator new(size_t)
{
if(!fgAllocator) fgAllocator = new G4Allocator<G4KDNodeCopy<PointCopyT>>;
return (void *) fgAllocator->MallocSingle();
}
void operator delete(void* aNode)
{
fgAllocator->FreeSingle((G4KDNodeCopy<PointCopyT>*) aNode);
}
inline const PointCopyT& GetPoint()
{
return fPoint;
}
virtual double operator[](size_t i) const
{
return fPoint[i];
}
virtual void InactiveNode()
{
fValid = false;
G4KDNode_Base::InactiveNode();
}
virtual bool IsValid() const
{
return fValid;
}
protected:
PointCopyT fPoint;
G4bool fValid;
private:
G4KDNodeCopy(const G4KDNodeCopy<PointCopyT>& right) :
G4KDNode_Base(right), fPoint(0)
{
fValid = false;
}
G4KDNodeCopy<PointCopyT>&
operator=(const G4KDNodeCopy<PointCopyT>& right)
{
if(this == &right) return *this;
fPoint = right.fPoint;
fTree = right.fTree;
fLeft = right.fLeft;
fRight = right.fRight;
fParent = right.fParent;
fSide = right.fSide;
fAxis = right.fAxis;
return *this;
}
static G4ThreadLocal G4Allocator<G4KDNodeCopy<PointCopyT>>* fgAllocator;
};
template<typename PointT>
G4ThreadLocal G4Allocator<G4KDNodeCopy<PointT>>* G4KDNodeCopy<PointT>::fgAllocator =
0;
#include "G4KDNode.icc"
@@ -34,82 +34,105 @@
// -------------------------------------------------------------------
//______________________________________________________________________
template <typename PointT>
G4KDNode<PointT>::G4KDNode(G4KDTree* tree, PointT* point,
G4KDNode_Base* parent) : G4KDNode_Base(tree, parent)
{
fPoint = point;
fValid = true;
}
template<typename PointT>
G4KDNode<PointT>::G4KDNode(G4KDTree* tree,
PointT* point,
G4KDNode_Base* parent) :
G4KDNode_Base(tree, parent)
{
fPoint = point;
fValid = true;
}
// Copy constructor should not be used
template <typename PointT>
G4KDNode<PointT>::G4KDNode(const G4KDNode<PointT>& right): G4KDNode_Base(right),
fPoint(0)
{
fValid = false;
}
template<typename PointT>
G4KDNode<PointT>::G4KDNode(const G4KDNode<PointT>& right) :
G4KDNode_Base(right), fPoint(0)
{
fValid = false;
}
// Assignement should not be used
template <typename PointT>
G4KDNode<PointT>& G4KDNode<PointT>::operator=(const G4KDNode<PointT>& right)
{
if (this == &right) return *this;
fPoint = right.fPoint;
fTree = right.fTree;
fLeft = right.fLeft;
fRight = right.fRight;
fParent = right.fParent;
fSide = right.fSide;
fAxis = right.fAxis;
return *this;
}
template<typename PointT>
G4KDNode<PointT>& G4KDNode<PointT>::operator=(const G4KDNode<PointT>& right)
{
if(this == &right) return *this;
fPoint = right.fPoint;
fTree = right.fTree;
fLeft = right.fLeft;
fRight = right.fRight;
fParent = right.fParent;
fSide = right.fSide;
fAxis = right.fAxis;
return *this;
}
template <typename PointT>
G4KDNode<PointT>::~G4KDNode()
{
}
template<typename PointT>
G4KDNode<PointT>::~G4KDNode()
{
}
template <typename Position>
G4KDNode_Base* G4KDNode_Base::FindParent(const Position& x0)
{
G4KDNode_Base* aParent = 0 ;
G4KDNode_Base* next = this ;
int split = -1 ;
while(next)
{
split = next->fAxis ;
aParent = next ;
template<typename Position>
G4KDNode_Base* G4KDNode_Base::FindParent(const Position& x0)
{
G4KDNode_Base* aParent = 0;
G4KDNode_Base* next = this;
int split = -1;
while(next)
{
split = next->fAxis;
aParent = next;
// works if node called "next" is valid
if(x0[split] > (*next)[split])
next = next->fRight ;
else
next = next->fLeft ;
}
return aParent ;
}
// works if node called "next" is valid
if(x0[split] > (*next)[split]) next = next->fRight;
else next = next->fLeft;
}
return aParent;
}
template <typename PointT>
G4KDNode_Base* G4KDNode_Base::Insert(PointT* point)
{
G4KDNode_Base* aParent = FindParent(*point);
// TODO check p == aParent->pos
// Exception
template<typename PointT>
G4KDNode_Base* G4KDNode_Base::Insert(PointT* point)
{
G4KDNode_Base* aParent = FindParent(*point);
// TODO check p == aParent->pos
// Exception
G4KDNode_Base* newNode = new G4KDNode<PointT>(fTree, point, aParent);
G4KDNode_Base* newNode = new G4KDNode<PointT>(fTree, point, aParent);
if((*point)[aParent->fAxis] > (*aParent)[aParent->fAxis])
{
aParent->fRight = newNode ;
newNode->fSide = 1 ;
}
else
{
aParent->fLeft = newNode ;
newNode->fSide = -1 ;
}
if((*point)[aParent->fAxis] > (*aParent)[aParent->fAxis])
{
aParent->fRight = newNode;
newNode->fSide = 1;
}
else
{
aParent->fLeft = newNode;
newNode->fSide = -1;
}
return newNode ;
}
return newNode;
}
template<typename PointT>
G4KDNode_Base* G4KDNode_Base::Insert(const PointT& point)
{
G4KDNode_Base* aParent = FindParent(point);
// TODO check p == aParent->pos
// Exception
G4KDNode_Base* newNode = new G4KDNodeCopy<PointT>(fTree, point, aParent);
if(point[aParent->fAxis] > (*aParent)[aParent->fAxis])
{
aParent->fRight = newNode;
newNode->fSide = 1;
}
else
{
aParent->fLeft = newNode;
newNode->fSide = -1;
}
return newNode;
}
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4KDTree.hh 85244 2014-10-27 08:24:13Z gcosmo $
// $Id: G4KDTree.hh 93883 2015-11-03 08:25:04Z gcosmo $
//
// Author: Mathieu Karamitros, kara@cenbg.in2p3.fr
@@ -105,6 +105,8 @@ public:
// In return, it gives you the corresponding node
template<typename PointT> G4KDNode_Base* Insert(PointT* pos); // 3D
template<typename PointT> G4KDNode_Base* Insert(const PointT& pos); // 3D
/* Find one of the nearest nodes from the specified point.
*
* This function returns a pointer to a result set with at most one element.
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4KDTree.icc 87443 2014-12-04 12:26:31Z gunter $
// $Id: G4KDTree.icc 93883 2015-11-03 08:25:04Z gcosmo $
//
// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
//
@@ -108,6 +108,40 @@ template<typename PointT>
return node;
}
template<typename PointT>
G4KDNode_Base* G4KDTree::Insert(const PointT& pos)
{
G4KDNode_Base* node = 0;
if (!fRoot)
{
fRoot = new G4KDNodeCopy<PointT>(this, pos, 0);
node = fRoot;
fNbNodes = 0;
fNbNodes++;
fNbActiveNodes++;
}
else
{
if ((node = fRoot->Insert<PointT>(pos)))
{
fNbNodes++;
fNbActiveNodes++;
}
}
if (fRect == 0)
{
fRect = new HyperRect(fDim);
fRect->SetMinMax(pos, pos);
}
else
{
fRect->Extend(pos);
}
return node;
}
//__________________________________________________________________
template<typename Position>
int G4KDTree::__NearestInRange(G4KDNode_Base* node,
@@ -258,7 +292,7 @@ template<typename Position>
/* Duplicate the bounding hyperrectangle, we will work on the copy */
HyperRect* newrect = new HyperRect(*fRect);
/* Our first guesstimate is the root node */
/* Our first estimate is the root node */
/* Search for the nearest neighbour recursively */
__NearestToPosition(fRoot, pos, result, &dist_sq, newrect);
@@ -34,6 +34,7 @@
#define G4MANYFASTLISTS_HH_
#include "G4FastList.hh"
#include <set>
template<class OBJECT>
struct G4ManyFastLists_iterator;
@@ -49,11 +50,15 @@ template<class OBJECT>
ManyLists fAssociatedLists;
// TODO use "marked list" insted of vector
typedef std::set<typename G4FastList<OBJECT>::Watcher*,
sortWatcher<OBJECT>> WatcherSet;
WatcherSet* fMainListWatchers;
public:
typedef G4ManyFastLists_iterator<OBJECT> iterator;
G4ManyFastLists() : G4FastList<OBJECT>::Watcher(),
fAssociatedLists()
fAssociatedLists(), fMainListWatchers(0)
{
}
@@ -64,13 +69,74 @@ template<class OBJECT>
fAssociatedLists.pop(__list);
}
void AddGlobalWatcher(typename G4FastList<OBJECT>::Watcher* watcher)
{
if(fMainListWatchers == 0)
{
fMainListWatchers = new WatcherSet();
}
G4cout << watcher->GetWatcherName() << G4endl;
fMainListWatchers->insert(watcher);
typename ManyLists::iterator it = fAssociatedLists.begin();
typename ManyLists::iterator _end = fAssociatedLists.end();
for(;it != _end ;++it)
{
watcher->Watch(*it);
// (*it)->AddWatcher(watcher);
// (*it)->AddWatcher(watcher);
}
}
inline void Add(G4FastList<OBJECT>* __list)
{
if (__list == 0) return;
fAssociatedLists.push_back(__list); // TODO use the table doubling tech
__list->AddWatcher(this);
//__list->AddWatcher(this);
this->Watch(__list);
if(fMainListWatchers == 0) return;
typename WatcherSet::iterator it_watcher = fMainListWatchers->begin();
typename WatcherSet::iterator end_watcher = fMainListWatchers->end();
// G4cout << "G4ManyFastLists::Add -- N watchers ="
// << fMainListWatchers->size()
// << G4endl;
for(;it_watcher != end_watcher ;++it_watcher)
{
// G4cout << " *** *** *** WATCH --- "
// << (*it_watcher)->GetWatcherName()
// << G4endl;
(*it_watcher)->Watch(__list);
}
if(__list->empty() == false)
{
it_watcher = fMainListWatchers->begin();
for(;it_watcher != end_watcher ;++it_watcher)
{
typename G4FastList<OBJECT>::iterator it_obj = __list->begin();
for(;it_obj != __list->end() ;++it_obj)
{
// G4cout << " *** *** *** NOTIFY ADD OBJ --- "
// << (*it_watcher)->GetWatcherName()
// << G4endl;
(*it_watcher)->NotifyAddObject(*it_obj,__list);
}
}
}
// else
// {
// G4cout << "__list->empty() == true" << G4endl;
// }
/*
typename ManyLists::const_iterator __it = fAssociatedLists
.begin();
@@ -89,6 +155,15 @@ template<class OBJECT>
fAssociatedLists.pop(__list); // TODO use the table doubling tech
__list->RemoveWatcher(this);
this->StopWatching(__list);
typename WatcherSet::iterator it = fMainListWatchers->begin();
typename WatcherSet::iterator _end = fMainListWatchers->end();
for(;it != _end ;++it)
{
(*it)->StopWatching(__list);
}
// typename ManyLists::node* __node = __list->GetListNode();
// if(__node)
// {
@@ -44,6 +44,8 @@
// J. Comput. Phys. 274 (2014) 841-882
// Prog. Nucl. Sci. Tec. 2 (2011) 503-508
#ifndef G4Scheduler_h
#define G4Scheduler_h
@@ -58,6 +60,8 @@
#include "G4ITStepStatus.hh"
#include "G4ITTrackHolder.hh"
#include "G4VStateDependent.hh"
#include "G4ITReaction.hh"
class G4ITTrackingManager;
class G4ITModelProcessor;
@@ -68,6 +72,21 @@ class G4SchedulerMessenger;
class G4ITTrackingInteractivity;
class G4ITGun;
#ifndef compTrackPerID__
#define compTrackPerID__
struct compTrackPerID
{
bool operator()(G4Track* rhs, G4Track* lhs) const
{
return rhs->GetTrackID() < lhs->GetTrackID();
}
};
#endif
/**
* G4ITStepManager enables to synchronize in time
* the step of tracks.
@@ -95,10 +114,10 @@ public:
inline bool IsRunning(){return fRunning;}
void Reset();
void Process();
virtual void PushTrack(G4Track*);
void ClearList();
inline void SetGun(G4ITGun*);
inline G4ITGun* GetGun();
inline void Stop();
void Clear();
@@ -119,7 +138,9 @@ public:
inline void SetMaxZeroTimeAllowed(int);
inline int GetMaxZeroTimeAllowed() const;
//==
inline G4ITModelHandler* GetModelHandler();
inline void SetTimeSteps(std::map<double, double>*);
inline void AddTimeStep(double, double);
inline void SetDefaultTimeStep(double);
@@ -139,8 +160,6 @@ public:
inline void UseDefaultTimeSteps(G4bool);
inline G4bool AreDefaultTimeStepsUsed();
inline G4bool GetComputeTimeStepFlag() const;
inline G4ITStepStatus GetStatus() const;
inline void SetVerbose(int);
@@ -159,6 +178,24 @@ public:
void GetCollisionType(G4String& interactionType);
void AddWatchedTime(double time)
{
fWatchedTimes.insert(time);
}
double GetNextWatchedTime() const;
inline void SetMaxTimeStep(double maxTimeStep)
{
fMaxTimeStep = maxTimeStep;
}
inline double GetMaxTimeStep() const
{
return fMaxTimeStep;
}
protected:
void DoProcess();
@@ -166,26 +203,10 @@ protected:
void Stepping();
void FindUserPreDefinedTimeStep();
void CalculateMinTimeStep();
void ComputeInteractionLength();
void DoIt();
void ComputeTrackReaction();
// void MergeSecondariesWithMainList();
void PushSecondaries(G4ITStepProcessor*);
// void _PushTrack(G4Track*);
void PushDelayed(G4Track*, const G4double&);
bool CanICarryOn();
void EndTracking(G4Track*);
void KillTracks();
void ExtractTimeStepperData(G4ITModelProcessor*);
void ExtractILData(G4ITStepProcessor*);
void ExtractDoItData(G4ITStepProcessor*);
void AddTrackID(G4Track*);
void ResetLeadingTracks();
void PrintWhyDoYouStop();
private:
G4Scheduler();
@@ -193,37 +214,34 @@ private:
G4Scheduler(const G4Scheduler&);
G4Scheduler& operator=(const G4Scheduler&);
G4SchedulerMessenger* fSteppingMsg;
G4SchedulerMessenger* fpMessenger;
static G4ThreadLocal G4Scheduler* fgScheduler;
int fVerbose;
bool fWhyDoYouStop;
bool fInitialized;
bool fRunning;
G4bool fContinue;
int fNbTracks;
int fNbSteps;
int fMaxSteps;
G4ITStepStatus fITStepStatus;
// Time members
G4bool fUseDefaultTimeSteps;
double fTimeTolerance;
double fGlobalTime;
double fTmpGlobalTime;
double fStartTime;
double fStopTime;
double fEndTime;
double fTmpEndTime;
// fTmpEndTime : Stores the biggest end time here (for synchronizing tracks)
double fPreviousTimeStep;
int fZeroTimeCount;
int fMaxNZeroTimeStepsAllowed;
// Flags
bool fComputeTimeStep;
bool fComputeReaction;
double fTimeStep; // The selected minimum time step
double fMaxTimeStep;
// User steps
bool fUsePreDefinedTimeSteps;
@@ -235,33 +253,36 @@ private:
// selected user time step in respect to the global time
bool fReachedUserTimeLimit; // if fMinTimeStep == the user time step
std::set<double> fWatchedTimes;
G4UserTimeStepAction* fpUserTimeStepAction;
// ==========================================
// TO BE REMOVED
G4ITStepProcessor* fpStepProcessor;
G4ITModelProcessor* fpModelProcessor;
G4ITTrackingManager* fpTrackingManager;
G4ITTrackingInteractivity* fpTrackingInteractivity;
G4ITReactionSet* fReactionSet;
G4ITTrackHolder& fTrackContainer;
G4ITModelHandler* fpModelHandler;
// ==========================================
double fTSTimeStep;
// Time calculated by the time stepper in CalculateMinTimeStep()
double fILTimeStep;
// Time calculated by the interaction length methods
// in ComputeInteractionLength()
std::map<G4Track*, G4TrackVectorHandle> fReactingTracks;
std::vector<G4Track*> fLeadingTracks;
bool fInteractionStep;
// Flag : if the step is driven by the interaction with the matter and
// NOT by the reaction between tracks
G4ITTrackHolder& fTrackContainer;
G4ITStepProcessor* fpStepProcessor;
G4ITModelProcessor* fpModelProcessor;
G4ITModelHandler* fpModelHandler;
G4ITTrackingManager* fpTrackingManager;
G4UserTimeStepAction* fpUserTimeStepAction;
G4ITTrackingInteractivity* fpTrackingInteractivity;
G4ITGun* fpGun;
G4bool fContinue;
G4bool fUseDefaultTimeSteps;
// ==========================================
//
};
inline bool G4Scheduler::IsInitialized()
@@ -404,9 +425,9 @@ inline void G4Scheduler::SetGun(G4ITGun* gun)
fpGun = gun;
}
inline G4bool G4Scheduler::GetComputeTimeStepFlag() const
inline G4ITGun* G4Scheduler::GetGun()
{
return fComputeTimeStep;
return fpGun;
}
inline void G4Scheduler::WhyDoYouStop()
@@ -50,18 +50,9 @@
class G4VTrackStateID
{
public:
virtual int GetStateID() = 0;
protected:
G4VTrackStateID()
{
;
}
virtual ~G4VTrackStateID()
{
;
}
G4VTrackStateID(){;}
virtual ~G4VTrackStateID(){;}
static int fgLastID;
};
@@ -69,10 +60,7 @@ template<class T>
class G4TrackStateID : public G4VTrackStateID
{
public:
static int GetID()
{
return fID;
}
static int GetID(){ return fID; }
private:
static int Create()
@@ -82,13 +70,8 @@ template<class T>
return fID;
}
G4TrackStateID()
{
}
~G4TrackStateID()
{
;
}
G4TrackStateID(){}
~G4TrackStateID(){;}
static int fID;
};
@@ -98,24 +81,13 @@ template<class T>
class G4VTrackState
{
public:
G4VTrackState()
{
}
virtual ~G4VTrackState()
{
}
G4VTrackState(){}
virtual ~G4VTrackState(){}
virtual int GetID() = 0;
};
typedef G4shared_ptr<G4VTrackState> G4VTrackStateHandle;
//template<class TrackStateDependent>
//class RegisterState : public TrackStateDependent
//{
//public:
// typedef typename TrackStateDependent::State TrackState;
//};
#ifndef TYPE_WRAPPER
#define TYPE_WRAPPER
template < typename T>
@@ -132,24 +104,8 @@ template<class T>
template<class T>
class G4TrackStateBase : public G4VTrackState
{
//friend class type_wrapper<T>::type; // works with gcc
typedef type_wrapper<T> traits_type;
/*
#ifdef WIN32
friend typename traits_type::type;
#elif defined(__clang__)
friend T;
#else
// friend class traits_type::type;
friend class type_wrapper<T>::type;
#endif
*/
friend class G4TrackStateDependent<T> ; //!
public:
virtual ~G4TrackStateBase()
{
}
virtual ~G4TrackStateBase(){}
virtual int GetID()
{
@@ -161,49 +117,39 @@ template<class T>
return G4TrackStateID<T>::GetID();
}
G4TrackStateBase() :
G4VTrackState()
{
}
protected:
G4TrackStateBase() : G4VTrackState(){}
};
template<class T>
class G4TrackState : public G4TrackStateBase<T>
{
// friend class type_wrapper<T>::type; // works with gcc
/*
typedef type_wrapper<T> traits_type;
typedef type_wrapper<T> traits_type;
/*
#ifdef WIN32
friend typename traits_type::type;
#elif defined(__clang__)
friend T;
#else
friend class type_wrapper<T>::type;
friend class type_wrapper<T>::type; // works with gcc
//friend class traits_type::type;
#endif
*/
// friend T; // works in c++11
*/
friend class G4TrackStateDependent<T> ; //!
public:
virtual ~G4TrackState()
{
}
virtual int GetID()
{
return G4TrackStateID<T>::GetID();
}
static int ID()
{
return G4TrackStateID<T>::GetID();
}
G4TrackState() :
G4TrackStateBase<T>()
G4TrackState() : G4TrackStateBase<T>()
{
}
@@ -265,13 +211,9 @@ class G4VTrackStateDependent
{
public:
G4VTrackStateDependent()
{
;
}
{;}
virtual ~G4VTrackStateDependent()
{
;
}
{;}
virtual void NewTrackState() = 0;
virtual void LoadTrackState(G4TrackStateManager&) = 0;
@@ -287,7 +229,7 @@ template<class OriginalType>
G4shared_ptr<G4VTrackState> ConvertToAbstractTrackState(G4shared_ptr<G4TrackState<OriginalType> > state)
{
G4shared_ptr<G4VTrackState> output = CLHEP::dynamic_pointer_cast<G4VTrackState>(state);
G4shared_ptr<G4VTrackState> output = G4dynamic_pointer_cast<G4VTrackState>(state);
return output;
}
@@ -295,7 +237,7 @@ template<class FinalType>
G4shared_ptr<G4TrackState<FinalType> > ConvertToConcreteTrackState(G4VTrackStateHandle state)
{
G4shared_ptr<G4TrackState<FinalType> > output = CLHEP::dynamic_pointer_cast<G4TrackState<FinalType> >(state);
G4shared_ptr<G4TrackState<FinalType> > output = G4dynamic_pointer_cast<G4TrackState<FinalType> >(state);
return output;
}
@@ -310,21 +252,21 @@ template<class T>
virtual ~G4TrackStateDependent()
{ ;}
virtual void SetTrackState(CLHEP::shared_ptr<StateType> state)
virtual void SetTrackState(G4shared_ptr<StateType> state)
{
fpTrackState = state;
}
virtual G4VTrackStateHandle PopTrackState()
{
G4VTrackStateHandle output = CLHEP::dynamic_pointer_cast<G4VTrackState>(fpTrackState);
G4VTrackStateHandle output = G4dynamic_pointer_cast<G4VTrackState>(fpTrackState);
fpTrackState.reset();
return output;
}
virtual G4VTrackStateHandle GetTrackState() const
{
G4VTrackStateHandle output = CLHEP::dynamic_pointer_cast<G4VTrackState>(fpTrackState);
G4VTrackStateHandle output = G4dynamic_pointer_cast<G4VTrackState>(fpTrackState);
return output;
}
@@ -336,7 +278,7 @@ template<class T>
virtual void LoadTrackState(G4TrackStateManager& manager)
{
fpTrackState = ConvertToConcreteTrackState<ClassType>(manager.GetTrackState(this));
if(fpTrackState == 0)
if(fpTrackState == nullptr)
{
NewTrackState();
SaveTrackState(manager);
@@ -371,25 +313,49 @@ template<class T>
StateTypeHandle fpTrackState;
};
#if __cplusplus > 199711L
#define RegisterTrackState(CLASS,STATE) \
template<> \
class G4TrackState<CLASS> : public G4TrackStateBase<CLASS>, public STATE \
class G4TrackState<CLASS> : public G4TrackStateBase<CLASS>, \
public CLASS::STATE \
{ \
typedef STATE State; \
friend class G4TrackStateDependent<CLASS>; \
friend class G4TrackStateDependent<CLASS>; \
using CLASS::STATE::STATE; \
public: \
G4TrackState() : G4TrackStateBase<CLASS>(),STATE(){}\
virtual ~G4TrackState(){}\
virtual int GetID()\
{\
return G4TrackStateID<CLASS>::GetID();\
}\
static int ID()\
{\
return G4TrackStateID<CLASS>::GetID();\
}\
typedef CLASS::STATE State; \
G4TrackState() : G4TrackStateBase<CLASS>(), CLASS::STATE(){}\
virtual ~G4TrackState(){}\
virtual int GetID()\
{\
return G4TrackStateID<CLASS>::GetID();\
}\
static int ID()\
{\
return G4TrackStateID<CLASS>::GetID();\
}\
protected:\
};\
};
#else
#define RegisterTrackState(CLASS,STATE) \
template<> \
class G4TrackState<CLASS> : public G4TrackStateBase<CLASS>, \
public CLASS::STATE \
{ \
friend class G4TrackStateDependent<CLASS>; \
public: \
typedef CLASS::STATE State; \
G4TrackState() : G4TrackStateBase<CLASS>(), CLASS::STATE(){}\
virtual ~G4TrackState(){}\
virtual int GetID()\
{\
return G4TrackStateID<CLASS>::GetID();\
}\
static int ID()\
{\
return G4TrackStateID<CLASS>::GetID();\
}\
protected:\
};
#endif
#endif /* G4TRACKSTATE_HH_ */
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TrackingInformation.hh 85244 2014-10-27 08:24:13Z gcosmo $
// $Id: G4TrackingInformation.hh 94218 2015-11-09 08:24:48Z gcosmo $
//
// Author: Mathieu Karamitros, kara@cenbg.in2p3.fr
@@ -55,6 +55,7 @@
#include "G4TouchableHandle.hh"
#include "G4TrackState.hh"
#include "G4memory.hh"
#include "G4ITStepProcessorState_Lock.hh"
class G4ITStepProcessor;
@@ -70,16 +71,6 @@ class G4TrackingInformation;
class G4SaveNavigatorState_Lock;
struct G4ITNavigatorState_Lock;
class G4ITStepProcessorState_Lock
{
friend class G4TrackingInformation;
protected:
inline virtual ~G4ITStepProcessorState_Lock()
{
;
}
};
/** The class G4TrackingInformation (hold by G4IT)
* emcompasses processes informations computed
* at the PS/AS/AtRest/InteractionLength stage,
@@ -111,9 +102,9 @@ public:
* computed at the InteractionLegth stage in the track.
*/
G4::shared_ptr<G4ProcessState_Lock> GetProcessState(size_t index);
G4shared_ptr<G4ProcessState_Lock> GetProcessState(size_t index);
inline void RecordProcessState(G4::shared_ptr<G4ProcessState_Lock>,
inline void RecordProcessState(G4shared_ptr<G4ProcessState_Lock>,
size_t index);
//___________________________________________________
@@ -144,8 +135,6 @@ public:
}
*/
G4TrackStateManager fTrackStateManager;
G4TrackStateManager& GetTrackStateManager()
{
return fTrackStateManager;
@@ -183,6 +172,8 @@ protected:
//_______________________________________________________
G4Trajectory_Lock* fpTrajectory_Lock;
G4TrackStateManager fTrackStateManager;
//_______________________________________________________
G4ThreeVector fRecordedTrackPosition;
G4double fRecordedTrackLocalTime;
@@ -198,7 +189,7 @@ protected:
* (cf. G4ITStepProcessor header)
*/
// std::vector<G4ProcessState_Lock*> fProcessState;
std::vector<G4::shared_ptr<G4ProcessState_Lock> > fProcessState;
std::vector<G4shared_ptr<G4ProcessState_Lock> > fProcessState;
//_______________________________________________________
G4ITStepProcessorState_Lock* fpStepProcessorState;
@@ -235,7 +226,7 @@ inline G4ITStepProcessorState_Lock* G4TrackingInformation::GetStepProcessorState
}*/
inline
void G4TrackingInformation::RecordProcessState(G4::shared_ptr<G4ProcessState_Lock> state,
void G4TrackingInformation::RecordProcessState(G4shared_ptr<G4ProcessState_Lock> state,
size_t index)
{
// G4cout << "G4TrackingInformation::RecordProcessState" << G4endl;
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4UserTimeStepAction.hh 87375 2014-12-02 08:17:28Z gcosmo $
// $Id: G4UserTimeStepAction.hh 89187 2015-03-23 16:15:17Z gcosmo $
//
// WARNING : This class is released as a prototype.
// It might strongly evolve or even disapear in the next releases.
@@ -89,7 +89,7 @@ public:
*/
virtual void UserReactionAction(const G4Track& /*trackA*/,
const G4Track& /*trackB*/,
const std::vector<G4Track*>& /*products*/){;}
const std::vector<G4Track*>* /*products*/){;}
virtual void EndProcessing(){;}
protected:
@@ -0,0 +1,105 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/*
* G4VITDiscreteProcess.hh
*
* Created on: 9 août 2015
* Author: matkara
*/
#ifndef SOURCE_PROCESSES_ELECTROMAGNETIC_DNA_MANAGEMENT_INCLUDE_G4VITDISCRETEPROCESS_HH_
#define SOURCE_PROCESSES_ELECTROMAGNETIC_DNA_MANAGEMENT_INCLUDE_G4VITDISCRETEPROCESS_HH_
#include <G4VITProcess.hh>
#include "globals.hh"
#include "G4ios.hh"
class G4VITDiscreteProcess: public G4VITProcess
{
// Abstract class which defines the public behavior of
// discrete physics interactions.
public:
G4VITDiscreteProcess(const G4String&, G4ProcessType aType = fNotDefined);
G4VITDiscreteProcess(G4VITDiscreteProcess &);
virtual ~G4VITDiscreteProcess();
public:
// with description
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
virtual G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
// no operation in AtRestDoIt and AlongStepDoIt
virtual G4double AlongStepGetPhysicalInteractionLength(const G4Track&,
G4double,
G4double,
G4double&,
G4GPILSelection*)
{
return -1.0;
}
;
virtual G4double AtRestGetPhysicalInteractionLength(const G4Track&,
G4ForceCondition*)
{
return -1.0;
}
;
// no operation in AtRestDoIt and AlongStepDoIt
virtual G4VParticleChange* AtRestDoIt(const G4Track&, const G4Step&)
{
return 0;
}
;
virtual G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&)
{
return 0;
}
;
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.
private:
// hide default constructor and assignment operator as private
G4VITDiscreteProcess();
G4VITDiscreteProcess & operator=(const G4VITDiscreteProcess &right);
};
#endif /* SOURCE_PROCESSES_ELECTROMAGNETIC_DNA_MANAGEMENT_INCLUDE_G4VITDISCRETEPROCESS_HH_ */
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VITProcess.hh 87375 2014-12-02 08:17:28Z gcosmo $
// $Id: G4VITProcess.hh 88348 2015-02-16 08:43:34Z gcosmo $
//
// Author: Mathieu Karamitros, kara@cenbg.in2p3.fr
@@ -65,10 +65,10 @@ struct G4ProcessState_Lock
};
/*
class G4ProcessStateHandle_Lock : public G4::shared_ptr<G4ProcessState_Lock>
class G4ProcessStateHandle_Lock : public G4shared_ptr<G4ProcessState_Lock>
{
public:
G4ProcessStateHandle_Lock(G4ProcessState_Lock* plock) : G4::shared_ptr<G4ProcessState_Lock>(plock)
G4ProcessStateHandle_Lock(G4ProcessState_Lock* plock) : G4shared_ptr<G4ProcessState_Lock>(plock)
{}
virtual ~G4ProcessStateHandle_Lock(){}
};
@@ -78,16 +78,16 @@ struct G4ProcessState_Lock
reference_cast<destinationType>(source)
#define DowncastProcessState(destinationType) \
G4::dynamic_pointer_cast<destinationType>(G4VITProcess::fpState)
G4dynamic_pointer_cast<destinationType>(G4VITProcess::fpState)
#define UpcastProcessState(destinationType) \
G4::dynamic_pointer_cast<destinationType>(G4VITProcess::fpState)
G4dynamic_pointer_cast<destinationType>(G4VITProcess::fpState)
#define DowncastState(destinationType,source) \
G4::dynamic_pointer_cast<destinationType>(source)
G4dynamic_pointer_cast<destinationType>(source)
#define UpcastState(destinationType,source) \
G4::dynamic_pointer_cast<destinationType>(source)
G4dynamic_pointer_cast<destinationType>(source)
/**
* G4VITProcess inherits from G4VProcess.
@@ -128,12 +128,12 @@ public:
// fpState = (G4ProcessState*) aProcInfo;
// }
G4::shared_ptr<G4ProcessState_Lock> GetProcessState()
G4shared_ptr<G4ProcessState_Lock> GetProcessState()
{
return UpcastProcessState(G4ProcessState_Lock);
}
void SetProcessState(G4::shared_ptr<G4ProcessState_Lock> aProcInfo)
void SetProcessState(G4shared_ptr<G4ProcessState_Lock> aProcInfo)
{
fpState = DowncastState(G4ProcessState, aProcInfo);
}
@@ -225,7 +225,7 @@ protected:
return fpState->GetState<T>();
}
G4::shared_ptr<G4ProcessState> fpState;
G4shared_ptr<G4ProcessState> fpState;
void virtual SubtractNumberOfInteractionLengthLeft(G4double previousStepSize);
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VITRestDiscreteProcess.hh 85244 2014-10-27 08:24:13Z gcosmo $
// $Id: G4VITRestDiscreteProcess.hh 93883 2015-11-03 08:25:04Z gcosmo $
//
/// \brief Identical to G4VRestDiscreteProcess with dependency from G4VITProcess
//
@@ -49,7 +49,6 @@
// J. Comput. Phys. 274 (2014) 841-882
// Prog. Nucl. Sci. Tec. 2 (2011) 503-508
#ifndef G4VITRESTDISCRETEPROCESS_H
#define G4VITRESTDISCRETEPROCESS_H
@@ -58,97 +57,93 @@
#include "G4VITProcess.hh"
/**
* Identical to G4VRestDiscreteProcess with dependency from G4VITProcess
*/
* Identical to G4VRestDiscreteProcess with dependency from G4VITProcess
*/
class G4VITRestDiscreteProcess : public G4VITProcess
{
// Abstract class which defines the public behavior of
// rest + discrete physics interactions.
public:
public:
G4VITRestDiscreteProcess(const G4String& ,
G4ProcessType aType = fNotDefined );
G4VITRestDiscreteProcess(G4VITRestDiscreteProcess &);
G4VITRestDiscreteProcess(const G4String&, G4ProcessType aType = fNotDefined);
G4VITRestDiscreteProcess(const G4VITRestDiscreteProcess &);
virtual ~G4VITRestDiscreteProcess();
virtual ~G4VITRestDiscreteProcess();
public :// with description
virtual G4double PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition
);
public:
// with description
virtual G4double
PostStepGetPhysicalInteractionLength(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
virtual G4VParticleChange* PostStepDoIt(
const G4Track& ,
const G4Step&
);
virtual G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&);
virtual G4double AtRestGetPhysicalInteractionLength(
const G4Track& ,
G4ForceCondition*
);
virtual G4double AtRestGetPhysicalInteractionLength(const G4Track&,
G4ForceCondition*);
virtual G4VParticleChange* AtRestDoIt(
const G4Track& ,
const G4Step&
);
virtual G4VParticleChange* AtRestDoIt(const G4Track&, const G4Step&);
// no operation in AlongStepDoIt
virtual G4double AlongStepGetPhysicalInteractionLength(
const G4Track&,
G4double ,
G4double ,
G4double& ,
G4GPILSelection*
){ return -1.0; }
// no operation in AlongStepDoIt
virtual G4double AlongStepGetPhysicalInteractionLength(const G4Track&,
G4double,
G4double,
G4double&,
G4GPILSelection*)
{
return -1.0;
}
// no operation in AlongStepDoIt
virtual G4VParticleChange* AlongStepDoIt(
const G4Track& ,
const G4Step&
) {return 0;}
// no operation in AlongStepDoIt
virtual G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&)
{
return 0;
}
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.
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.
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.
private:
protected:
// hide default constructor and assignment operator as private
G4VITRestDiscreteProcess();
G4VITRestDiscreteProcess & operator=(const G4VITRestDiscreteProcess &right);
G4VITRestDiscreteProcess();
G4VITRestDiscreteProcess & operator=(const G4VITRestDiscreteProcess &right);
};
// -----------------------------------------
// inlined function members implementation
// -----------------------------------------
inline
G4double G4VITRestDiscreteProcess::PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition
)
inline G4double G4VITRestDiscreteProcess::PostStepGetPhysicalInteractionLength(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition)
{
if ( (previousStepSize < 0.0) || (fpState->theNumberOfInteractionLengthLeft<=0.0)) {
if((previousStepSize < 0.0) || (fpState->theNumberOfInteractionLengthLeft
<= 0.0))
{
// beggining of tracking (or just after DoIt of this process)
ResetNumberOfInteractionLengthLeft();
} else if ( previousStepSize > 0.0) {
}
else if(previousStepSize > 0.0)
{
// subtract NumberOfInteractionLengthLeft
SubtractNumberOfInteractionLengthLeft(previousStepSize);
} else {
}
else
{
// zero step
// DO NOTHING
}
@@ -157,41 +152,43 @@ inline
*condition = NotForced;
// get mean free path
fpState->currentInteractionLength = GetMeanFreePath(track, previousStepSize, condition);
fpState->currentInteractionLength = GetMeanFreePath(track,
previousStepSize,
condition);
G4double value;
if (fpState->currentInteractionLength <DBL_MAX) {
if(fpState->currentInteractionLength < DBL_MAX)
{
value = fpState->theNumberOfInteractionLengthLeft * (fpState->currentInteractionLength);
} else {
}
else
{
value = DBL_MAX;
}
#ifdef G4VERBOSE
if (verboseLevel>1){
if(verboseLevel > 1)
{
G4cout << "G4VITRestDiscreteProcess::PostStepGetPhysicalInteractionLength ";
G4cout << "[ " << GetProcessName() << "]" <<G4endl;
G4cout << "[ " << GetProcessName() << "]" << G4endl;
track.GetDynamicParticle()->DumpInfo();
G4cout << " in Material " << track.GetMaterial()->GetName() <<G4endl;
G4cout << "InteractionLength= " << value/CLHEP::cm <<"[cm] " <<G4endl;
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&
)
inline G4VParticleChange* G4VITRestDiscreteProcess::PostStepDoIt(const G4Track&,
const G4Step&)
{
// reset NumberOfInteractionLengthLeft
ClearNumberOfInteractionLengthLeft();
ClearNumberOfInteractionLengthLeft();
return pParticleChange;
return pParticleChange;
}
inline G4double G4VITRestDiscreteProcess::AtRestGetPhysicalInteractionLength(
const G4Track& track,
G4ForceCondition* condition
)
inline G4double G4VITRestDiscreteProcess::AtRestGetPhysicalInteractionLength(const G4Track& track,
G4ForceCondition* condition)
{
// beggining of tracking
ResetNumberOfInteractionLengthLeft();
@@ -203,32 +200,29 @@ inline G4double G4VITRestDiscreteProcess::AtRestGetPhysicalInteractionLength(
fpState->currentInteractionLength = GetMeanLifeTime(track, condition);
#ifdef G4VERBOSE
if ((fpState->currentInteractionLength <0.0) || (verboseLevel>2)){
if((fpState->currentInteractionLength < 0.0) || (verboseLevel > 2))
{
G4cout << "G4VITRestDiscreteProcess::AtRestGetPhysicalInteractionLength ";
G4cout << "[ " << GetProcessName() << "]" <<G4endl;
G4cout << "[ " << GetProcessName() << "]" << G4endl;
track.GetDynamicParticle()->DumpInfo();
G4cout << " in Material " << track.GetMaterial()->GetName() <<G4endl;
G4cout << "MeanLifeTime = " << fpState->currentInteractionLength/CLHEP::ns << "[ns]" <<G4endl;
G4cout << " in Material " << track.GetMaterial()->GetName() << G4endl;
G4cout << "MeanLifeTime = " << fpState->currentInteractionLength / CLHEP::ns
<< "[ns]" << G4endl;
}
#endif
return fpState->theNumberOfInteractionLengthLeft * (fpState->currentInteractionLength);
return fpState->theNumberOfInteractionLengthLeft
* (fpState->currentInteractionLength);
}
inline G4VParticleChange* G4VITRestDiscreteProcess::AtRestDoIt(
const G4Track&,
const G4Step&
)
inline G4VParticleChange* G4VITRestDiscreteProcess::AtRestDoIt(const G4Track&,
const G4Step&)
{
// clear NumberOfInteractionLengthLeft
ClearNumberOfInteractionLengthLeft();
ClearNumberOfInteractionLengthLeft();
return pParticleChange;
return pParticleChange;
}
#endif
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VITRestProcess.hh 85244 2014-10-27 08:24:13Z gcosmo $
// $Id: G4VITRestProcess.hh 91584 2015-07-27 13:01:48Z gcosmo $
//
/// \brief Identical to G4VRestProcess with dependency from G4VITProcess
//
@@ -49,8 +49,6 @@
// J. Comput. Phys. 274 (2014) 841-882
// Prog. Nucl. Sci. Tec. 2 (2011) 503-508
#ifndef G4VITRestProcess_h
#define G4VITRestProcess_h 1
@@ -59,80 +57,77 @@
#include "G4VITProcess.hh"
/**
* Identical to G4VRestProcess with dependency from G4VITProcess
*/
* Identical to G4VRestProcess with dependency from G4VITProcess
*/
class G4VITRestProcess : public G4VITProcess
{
// Abstract class which defines the public behavior of
// physics interactions at rest.
public:
G4VITRestProcess(const G4String& ,
G4ProcessType aType = fNotDefined );
G4VITRestProcess(const G4VITRestProcess& );
public:
G4VITRestProcess(const G4String&, G4ProcessType aType = fNotDefined);
G4VITRestProcess(const G4VITRestProcess&);
virtual ~G4VITRestProcess();
virtual ~G4VITRestProcess();
public: // with description
virtual G4double AtRestGetPhysicalInteractionLength(
const G4Track& track,
G4ForceCondition* condition
);
public:
// with description
virtual G4double AtRestGetPhysicalInteractionLength(const G4Track& track,
G4ForceCondition* condition);
virtual G4VParticleChange* AtRestDoIt(
const G4Track& ,
const G4Step&
);
virtual G4VParticleChange* AtRestDoIt(const G4Track&, const G4Step&);
// no operation in PostStepDoIt and AlongStepDoIt
virtual G4double AlongStepGetPhysicalInteractionLength(
const G4Track&,
G4double ,
G4double ,
G4double& ,
G4GPILSelection*
){ return -1.0; }
// no operation in PostStepDoIt and AlongStepDoIt
virtual G4double AlongStepGetPhysicalInteractionLength(const G4Track&,
G4double,
G4double,
G4double&,
G4GPILSelection*)
{
return -1.0;
}
virtual G4double PostStepGetPhysicalInteractionLength(
const G4Track& ,
G4double ,
G4ForceCondition*
) { return -1.0; }
virtual G4double PostStepGetPhysicalInteractionLength(const G4Track&,
G4double,
G4ForceCondition*)
{
return -1.0;
}
// no operation in PostStepDoIt and AlongStepDoIt
virtual G4VParticleChange* PostStepDoIt(
const G4Track& ,
const G4Step&
) {return 0;}
// no operation in PostStepDoIt and AlongStepDoIt
virtual G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&)
{
return 0;
}
virtual G4VParticleChange* AlongStepDoIt(
const G4Track& ,
const G4Step&
) {return 0;}
virtual G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&)
{
return 0;
}
protected: // with description
protected:
// with description
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.
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:
protected:
// hide default constructor and assignment operator as private
G4VITRestProcess();
G4VITRestProcess & operator=(const G4VITRestProcess &right);
G4VITRestProcess();
G4VITRestProcess & operator=(const G4VITRestProcess &right);
};
// -----------------------------------------
// inlined function members implementation
// -----------------------------------------
inline G4double G4VITRestProcess::AtRestGetPhysicalInteractionLength(
const G4Track& track,
G4ForceCondition* condition
)
inline G4double G4VITRestProcess::AtRestGetPhysicalInteractionLength(const G4Track& track,
G4ForceCondition* condition)
{
// beggining of tracking
ResetNumberOfInteractionLengthLeft();
@@ -144,33 +139,28 @@ inline G4double G4VITRestProcess::AtRestGetPhysicalInteractionLength(
fpState->currentInteractionLength = GetMeanLifeTime(track, condition);
#ifdef G4VERBOSE
if ((fpState->currentInteractionLength <0.0) || (verboseLevel>2)){
if((fpState->currentInteractionLength < 0.0) || (verboseLevel > 2))
{
G4cout << "G4VITRestProcess::AtRestGetPhysicalInteractionLength ";
G4cout << "[ " << GetProcessName() << "]" <<G4endl;
G4cout << "[ " << GetProcessName() << "]" << G4endl;
track.GetDynamicParticle()->DumpInfo();
G4cout << " in Material " << track.GetMaterial()->GetName() <<G4endl;
G4cout << "MeanLifeTime = " << fpState->currentInteractionLength/CLHEP::ns << "[ns]" <<G4endl;
G4cout << " in Material " << track.GetMaterial()->GetName() << G4endl;
G4cout << "MeanLifeTime = " << fpState->currentInteractionLength / CLHEP::ns
<< "[ns]" << G4endl;
}
#endif
return (fpState->theNumberOfInteractionLengthLeft) * (fpState->currentInteractionLength);
return (fpState->theNumberOfInteractionLengthLeft)
* (fpState->currentInteractionLength);
}
inline G4VParticleChange* G4VITRestProcess::AtRestDoIt(
const G4Track&,
const G4Step&
)
inline G4VParticleChange* G4VITRestProcess::AtRestDoIt(const G4Track&,
const G4Step&)
{
// clear NumberOfInteractionLengthLeft
ClearNumberOfInteractionLengthLeft();
return pParticleChange;
ClearNumberOfInteractionLengthLeft();
ClearInteractionTimeLeft();
return pParticleChange;
}
#endif
@@ -0,0 +1,203 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/*
* G4VITSteppingVerbose.hh
*
* Created on: Jun 22, 2015
* Author: mkaramit
*/
#ifndef SOURCE_PROCESSES_ELECTROMAGNETIC_DNA_MANAGEMENT_INCLUDE_G4VITSTEPPINGVERBOSE_HH_
#define SOURCE_PROCESSES_ELECTROMAGNETIC_DNA_MANAGEMENT_INCLUDE_G4VITSTEPPINGVERBOSE_HH_
#include "globals.hh" // Include from 'global'
#include <vector>
class G4Navigator;
class G4VPhysicalVolume;
class G4VSensitiveDetector;
#include "G4VProcess.hh"
class G4ProcessVector;
class G4Track;
//#include "G4TrackVector.hh" // Include from 'tracking'
#include "G4StepStatus.hh" // Include from 'track'
class G4UserSteppingAction;
class G4StepPoint;
#include "G4TouchableHandle.hh"
#include "G4ForceCondition.hh" //enum 'track'
#include "G4GPILSelection.hh" //enum 'track'
#include "G4ITStepProcessor.hh"
#include "G4VITProcess.hh"
class G4VParticleChange;
class G4ITStepProcessorState;
//class ProcessGeneralInfo;
//class G4VPhysicalVolume;
//class G4ProcessVector;
#include <G4UImessenger.hh>
class G4UIcmdWithAnInteger;
class G4VITSteppingVerbose : G4UImessenger
{
public:
G4VITSteppingVerbose();
virtual ~G4VITSteppingVerbose();
public:
virtual void TrackingStarted(G4Track* track);
virtual void TrackingEnded(G4Track* track);
virtual void DoItStarted() = 0;
virtual void PreStepVerbose(G4Track*) = 0;
virtual void PostStepVerbose(G4Track*) = 0;
// these methods are invoked in the SteppingManager
virtual void NewStep() = 0;
void CopyState();
virtual void StepInfoForLeadingTrack() = 0;
virtual void AtRestDoItInvoked() = 0;
virtual void AtRestDoItOneByOne() = 0;
virtual void PostStepDoItAllDone() = 0;
virtual void PostStepDoItOneByOne() = 0;
virtual void AlongStepDoItAllDone() = 0;
virtual void AlongStepDoItOneByOne() = 0;
virtual void StepInfo() = 0;
virtual void DPSLStarted() = 0;
virtual void DPSLUserLimit() = 0;
virtual void DPSLPostStep() = 0;
virtual void DPSLAlongStep() = 0;
virtual void VerboseTrack() = 0;
virtual void VerboseParticleChange() = 0;
//____________________________________________________________________________
inline void SetVerbose(int flag)
{
fVerboseLevel = flag;
}
inline G4int GetVerbose()
{
return fVerboseLevel;
}
//____________________________________________________________________________
virtual void SetNewValue(G4UIcommand * command,
G4String newValue);
virtual G4String GetCurrentValue(G4UIcommand * command);
//____________________________________________________________________________
void SetStepProcessor(const G4ITStepProcessor* stepProcessor)
{
this->fpStepProcessor = stepProcessor;
}
void TrackBanner(G4Track* track, const G4String& message);
protected:
const G4ITStepProcessor* fpStepProcessor;
G4UIcmdWithAnInteger* fpVerboseUI;
G4ITStepProcessorState* fpState;
const ProcessGeneralInfo* fpProcessGeneralInfo;
G4double PhysicalStep;
G4StepStatus fStepStatus;
const G4VParticleChange* fParticleChange;
const G4Track* fTrack;
const G4TrackVector* fSecondary;
const G4Step* fStep;
G4StepPoint* fPreStepPoint;
G4StepPoint* fPostStepPoint;
const G4VPhysicalVolume* fCurrentVolume;
// G4VSensitiveDetector* fSensitive;
const G4VITProcess* fCurrentProcess;
// The pointer to the process of which DoIt or
// GetPhysicalInteractionLength has been just executed.
G4ProcessVector* fAtRestDoItVector;
G4ProcessVector* fAlongStepDoItVector;
G4ProcessVector* fPostStepDoItVector;
G4ProcessVector* fAtRestGetPhysIntVector;
G4ProcessVector* fAlongStepGetPhysIntVector;
G4ProcessVector* fPostStepGetPhysIntVector;
size_t MAXofAtRestLoops;
size_t MAXofAlongStepLoops;
size_t MAXofPostStepLoops;
size_t fAtRestDoItProcTriggered;
size_t fPostStepDoItProcTriggered;
G4int fN2ndariesAtRestDoIt;
G4int fN2ndariesAlongStepDoIt;
G4int fN2ndariesPostStepDoIt;
// These are the numbers of secondaries generated by the process
// just executed.
// G4Navigator *fNavigator;
G4int fVerboseLevel;
typedef std::vector<G4int> G4SelectedAtRestDoItVector;
typedef std::vector<G4int> G4SelectedAlongStepDoItVector;
typedef std::vector<G4int> G4SelectedPostStepDoItVector;
G4SelectedAtRestDoItVector* fSelectedAtRestDoItVector;
G4SelectedPostStepDoItVector* fSelectedPostStepDoItVector;
G4double fPreviousStepSize;
G4TouchableHandle fTouchableHandle;
// G4SteppingControl StepControlFlag;
G4double physIntLength;
G4ForceCondition fCondition;
G4GPILSelection fGPILSelection;
// Above three variables are for the method
// DefinePhysicalStepLength(). To pass these information to
// the method Verbose, they are kept at here. Need a more
// elegant mechanism.
};
#endif /* SOURCE_PROCESSES_ELECTROMAGNETIC_DNA_MANAGEMENT_INCLUDE_G4VITSTEPPINGVERBOSE_HH_ */
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VITTimeStepComputer.hh 87375 2014-12-02 08:17:28Z gcosmo $
// $Id: G4VITTimeStepComputer.hh 88348 2015-02-16 08:43:34Z gcosmo $
////
// Author: Mathieu Karamitros, kara@cenbg.in2p3.fr
////
@@ -55,10 +55,10 @@
#include "G4ITReactionTable.hh"
#include "G4ReferenceCountedHandle.hh"
#include "AddClone_def.hh"
#include "CLHEP/Utility/memory.h"
#include "G4memory.hh"
//typedef G4ReferenceCountedHandle< std::vector<G4Track*> > G4TrackVectorHandle;
typedef CLHEP::shared_ptr< std::vector<G4Track*> > G4TrackVectorHandle;
typedef G4shared_ptr< std::vector<G4Track*> > G4TrackVectorHandle;
/**
* Before stepping all tracks G4Scheduler calls all the G4VITModel
@@ -26,6 +26,18 @@
#ifndef G4SHARED_PTR_HH_
#define G4SHARED_PTR_HH_
//#if __cplusplus >= 201103L
#include <memory>
#define G4shared_ptr std::shared_ptr
#define G4weak_ptr std::weak_ptr
#define G4static_pointer_cast std::static_pointer_cast
#define G4const_pointer_cast std::const_pointer_cast
#define G4dynamic_pointer_cast std::dynamic_pointer_cast
#define G4enable_shared_from_this std::enable_shared_from_this
#define G4enable_shared_from_this2 std::enable_shared_from_this
/*
#else
#include "CLHEP/Utility/memory.h"
#define G4shared_ptr G4::shared_ptr
@@ -72,7 +84,7 @@ public:
shared_from_this()
{
shared_ptr<T> p( weak_this_ );
assert( p.get() == this );
// assert( p.get() == this );
return p;
}
@@ -80,7 +92,7 @@ public:
shared_from_this() const
{
shared_ptr<T const> p( weak_this_ );
assert( p.get() == this );
// assert( p.get() == this );
return p;
}
@@ -218,5 +230,7 @@ namespace G4
using CLHEP::enable_shared_from_this;
using CLHEP::enable_shared_from_this2;
}
#endif
*/
#endif /* G4SHARED_PTR_HH_ */
@@ -11,7 +11,7 @@
#
# Generated on : 24/9/2010
#
# $Id: sources.cmake 87375 2014-12-02 08:17:28Z gcosmo $
# $Id: sources.cmake 94218 2015-11-09 08:24:48Z gcosmo $
#
#------------------------------------------------------------------------------
@@ -44,11 +44,13 @@ GEANT4_DEFINE_MODULE(NAME G4emdna-man
G4AllITFinder.hh
G4FastList.hh
G4FastList.icc
G4IosFlagsSaver.hh
G4ITBox.hh
G4IT.hh
G4ITGun.hh
G4ITFinder.hh
G4ITFinder.icc
G4ITLeadingTracks.hh
G4ITModelHandler.hh
G4ITModelManager.hh
G4ITModelProcessor.hh
@@ -59,11 +61,13 @@ GEANT4_DEFINE_MODULE(NAME G4emdna-man
G4ITNavigator2.hh
G4ITNavigator2.icc
G4ITPathFinder.hh
G4ITReaction.hh
G4ITReactionChange.hh
G4ITReactionTable.hh
G4ITSafetyHelper.hh
G4ITStepProcessor.hh
G4ITStepStatus.hh
G4ITSteppingVerbose.hh
G4ITTrackHolder.hh
G4ITTrackingInteractivity.hh
G4ITTrackingManager.hh
@@ -72,6 +76,7 @@ GEANT4_DEFINE_MODULE(NAME G4emdna-man
G4ITTransportationManager.hh
G4ITTransportationManager.icc
G4ITType.hh
G4ITStepProcessorState_Lock.hh
G4KDMap.hh
G4KDNode.hh
G4KDNode.icc
@@ -89,11 +94,13 @@ GEANT4_DEFINE_MODULE(NAME G4emdna-man
G4TrackList.hh
G4TrackState.hh
G4UserTimeStepAction.hh
G4VITDiscreteProcess.hh
G4VITProcess.hh
G4VITReactionProcess.hh
G4VITRestDiscreteProcess.hh
G4VITRestProcess.hh
G4VITStepModel.hh
G4VITSteppingVerbose.hh
G4VITTimeStepComputer.hh
G4VITTrackHolder.hh
G4VScheduler.hh
@@ -103,6 +110,7 @@ GEANT4_DEFINE_MODULE(NAME G4emdna-man
G4IT.cc
G4ITGun.cc
G4ITFinder.cc
G4ITLeadingTracks.cc
G4ITModelHandler.cc
G4ITModelManager.cc
G4ITModelProcessor.cc
@@ -111,11 +119,13 @@ GEANT4_DEFINE_MODULE(NAME G4emdna-man
G4ITNavigator2.cc
G4ITNavigatorState2.cc
G4ITPathFinder.cc
G4ITReaction.cc
G4ITReactionChange.cc
G4ITReactionTable.cc
G4ITSafetyHelper.cc
G4ITStepProcessor2.cc
G4ITStepProcessor.cc
G4ITSteppingVerbose.cc
G4ITTrackHolder.cc
G4ITTrackingInteractivity.cc
G4ITTrackingManager.cc
@@ -133,11 +143,13 @@ GEANT4_DEFINE_MODULE(NAME G4emdna-man
G4TrackList.cc
G4TrackState.cc
G4UserTimeStepAction.cc
G4VITDiscreteProcess.cc
G4VITProcess.cc
G4VITReactionProcess.cc
G4VITRestDiscreteProcess.cc
G4VITRestProcess.cc
G4VITStepModel.cc
G4VITSteppingVerbose.cc
G4VITTimeStepComputer.cc
G4VITTrackHolder.cc
G4VScheduler.cc
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4IT.cc 87061 2014-11-24 11:43:34Z gcosmo $
// $Id: G4IT.cc 94218 2015-11-09 08:24:48Z gcosmo $
//
// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
//
@@ -38,14 +38,14 @@
#include "G4ITBox.hh"
#include "G4Track.hh"
#include "G4TrackList.hh"
#include "G4TrackingInformation.hh"
using namespace std;
G4ThreadLocal G4Allocator<G4IT> *aITAllocator = 0;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
///
//------------------------------------------------------------------------------
//
// Static functions
///
//
G4IT* GetIT(const G4Track* track)
{
return (dynamic_cast<G4IT*>(track->GetUserInformation()));
@@ -55,19 +55,18 @@ G4IT* GetIT(const G4Track& track)
{
return (dynamic_cast<G4IT*>(track.GetUserInformation()));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
///
//------------------------------------------------------------------------------
//
// Constructors / Destructors
///
//
G4IT::G4IT() :
G4VUserTrackInformation("G4IT"),
fpTrack(0),
fpPreviousIT(0),
fpNextIT(0),
fTrackingInformation()
// fpTrackingInformation(new G4TrackingInformation())
fpTrackingInformation(new G4TrackingInformation())
{
if (!aITAllocator) aITAllocator = new G4Allocator<G4IT>;
fpITBox = 0;
fpKDNode = 0;
fpTrackNode = 0;
@@ -81,8 +80,7 @@ G4IT::G4IT(const G4IT& /*right*/) :
fpTrack(0),
fpPreviousIT(0),
fpNextIT(0),
fTrackingInformation()
// fpTrackingInformation(new G4TrackingInformation())
fpTrackingInformation(new G4TrackingInformation())
{
fpITBox = 0;
fpKDNode = 0;
@@ -96,9 +94,12 @@ G4IT& G4IT::operator=(const G4IT& right)
{
G4ExceptionDescription exceptionDescription;
exceptionDescription
<< "The assignment operator of G4IT should not be used, this feature is not supported."
<< "The assignment operator of G4IT should not be used, "
"this feature is not supported."
<< "If really needed, please contact the developers.";
G4Exception("G4IT::operator=(const G4IT& right)", "G4IT001", FatalException,
G4Exception("G4IT::operator=(const G4IT& right)",
"G4IT001",
FatalException,
exceptionDescription);
if (this == &right) return *this;
@@ -110,7 +111,7 @@ G4IT& G4IT::operator=(const G4IT& right)
fpKDNode = 0;
fParentID_A = 0;
fParentID_B = 0;
// fpTrackingInformation = 0;
fpTrackingInformation = 0;
fpTrackNode = 0;
return *this;
@@ -120,10 +121,8 @@ G4IT::G4IT(G4Track * aTrack) :
G4VUserTrackInformation("G4IT"),
fpPreviousIT(0),
fpNextIT(0),
fTrackingInformation()
// fpTrackingInformation(new G4TrackingInformation())
fpTrackingInformation(new G4TrackingInformation())
{
if (!aITAllocator) aITAllocator = new G4Allocator<G4IT>;
fpITBox = 0;
fpTrack = aTrack;
fpKDNode = 0;
@@ -157,27 +156,21 @@ G4IT::~G4IT()
{
TakeOutBox();
// if(fpTrackingInformation)
// {
// delete fpTrackingInformation;
// fpTrackingInformation = 0;
// }
if(fpTrackingInformation)
{
delete fpTrackingInformation;
fpTrackingInformation = 0;
}
// Note :
// G4ITTrackingManager will delete fTrackNode.
// fKDNode will be deleted when the KDTree is rebuilt
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//------------------------------------------------------------------------------
///
// Methods
///
void G4IT::RecordCurrentPositionNTime()
{
if (fpTrack)
{
fTrackingInformation.RecordCurrentPositionNTime(fpTrack);
}
}
G4bool G4IT::operator<(const G4IT& right) const
{
@@ -206,13 +199,41 @@ G4bool G4IT::operator!=(const G4IT& right) const
return !(this->operator==(right));
}
double G4IT::operator[](int i) const
{
return fpTrack->GetPosition()[i];
}
//------------------------------------------------------------------------------
const G4ThreeVector& G4IT::GetPosition() const
{
if (fpTrack) return GetTrack()->GetPosition();
return *(new G4ThreeVector());
}
const double& G4IT::operator[](int i) const
void G4IT::RecordCurrentPositionNTime()
{
return const_cast<G4ThreeVector&>(GetTrack()->GetPosition())[i];
if (fpTrack)
{
fpTrackingInformation->RecordCurrentPositionNTime(fpTrack);
}
}
G4double G4IT::GetPreStepGlobalTime() const
{
return fpTrackingInformation->GetPreStepGlobalTime();
}
G4double G4IT::GetPreStepLocalTime() const
{
return fpTrackingInformation->GetPreStepLocalTime();
}
const G4ThreeVector& G4IT::GetPreStepPosition() const
{
return fpTrackingInformation->GetPreStepPosition();
}
@@ -0,0 +1,89 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/*
* G4ITLeadingTracks.cc
*
* Created on: Jun 26, 2015
* Author: mkaramit
*/
#include <G4ITLeadingTracks.hh>
#include "G4TrackingInformation.hh"
#include <G4IT.hh>
G4ITLeadingTracks::G4ITLeadingTracks()
{
// TODO Auto-generated constructor stub
}
G4ITLeadingTracks::~G4ITLeadingTracks()
{
// TODO Auto-generated destructor stub
}
void G4ITLeadingTracks::Reset()
{
if (fLeadingTracks.empty() == false)
{
std::vector<G4Track*>::iterator fLeadingTracks_i = fLeadingTracks.begin();
while (fLeadingTracks_i != fLeadingTracks.end())
{
G4Track* track = *fLeadingTracks_i;
if (track)
{
G4IT* ITrack = GetIT(track);
if (ITrack)
{
ITrack->GetTrackingInfo()->SetLeadingStep(false);
}
}
++fLeadingTracks_i;
continue;
}
fLeadingTracks.clear();
}
}
void G4ITLeadingTracks::Push(G4Track* track)
{
fLeadingTracks.push_back(track);
}
void G4ITLeadingTracks::PrepareLeadingTracks()
{
for(size_t i = 0 ; i < fLeadingTracks.size() ; ++i)
{
G4Track* track = fLeadingTracks[i];
G4IT* ITrack = GetIT(track);
ITrack->GetTrackingInfo()->SetLeadingStep(true);
// ITrack->GetTrackingInfo()->SetLeadingStep(false);
}
}
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ITModelProcessor.cc 87375 2014-12-02 08:17:28Z gcosmo $
// $Id: G4ITModelProcessor.cc 94010 2015-11-05 10:08:33Z gcosmo $
//
// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
//
@@ -37,6 +37,14 @@
#include "G4VITTimeStepComputer.hh"
#include "G4VITReactionProcess.hh"
//#include "G4ITTimeStepper.hh"
#include "G4ITReaction.hh"
#include "G4ITTrackHolder.hh"
#include "G4ITTrackingManager.hh"
#include "G4UserTimeStepAction.hh"
#include "G4UnitsTable.hh"
#include <vector>
using namespace std;
//#define DEBUG_MEM
@@ -45,31 +53,32 @@
using namespace G4MemStat;
#endif
G4ThreadLocal std::map<const G4Track*, G4bool> *G4ITModelProcessor::fHasReacted =
0;
G4ITModelProcessor::G4ITModelProcessor()
{
//ctor
if (!fHasReacted) fHasReacted = new std::map<const G4Track*, G4bool>;
fpTrack = 0;
fpModelHandler = 0;
fpModel = 0;
fInitialized = false;
fpModelManager = 0;
fCurrentModel.assign(G4ITType::size(), std::vector<G4VITStepModel*>());
for (int i = 0; i < (int) G4ITType::size(); i++)
for(int i = 0; i < (int) G4ITType::size(); i++)
{
fCurrentModel[i].assign(G4ITType::size(), 0);
}
fUserMinTimeStep = -1.;
fTSTimeStep = DBL_MAX;
fpTrackingManager = 0;
fReactionSet = 0;
fpTrackContainer = 0;
fpModelHandler = 0;
fComputeTimeStep = false;
fComputeReaction = false;
}
G4ITModelProcessor::~G4ITModelProcessor()
{
//dtor
// if(fpModelHandler) delete fpModelHandler; deleted by G4Scheduler
// if(fpModelHandler) delete fpModelHandler; deleted by G4Scheduler
fCurrentModel.clear();
fReactionInfo.clear();
}
@@ -84,12 +93,23 @@ G4ITModelProcessor::G4ITModelProcessor(const G4ITModelProcessor& /*other*/)
fInitialized = false;
fpModelManager = 0;
fUserMinTimeStep = -1.;
fTSTimeStep = DBL_MAX;
fpTrackingManager = 0;
fReactionSet = 0;
fpTrackContainer = 0;
fComputeTimeStep = false;
fComputeReaction = false;
}
void G4ITModelProcessor::RegisterModel(double time, G4VITStepModel* model)
{
fpModelHandler->RegisterModel(model, time);
}
// Should not be used
G4ITModelProcessor& G4ITModelProcessor::operator=(const G4ITModelProcessor& rhs)
{
if (this == &rhs) return *this; // handle self assignment
if(this == &rhs) return *this; // handle self assignment
//assignment operator
return *this;
}
@@ -97,32 +117,227 @@ G4ITModelProcessor& G4ITModelProcessor::operator=(const G4ITModelProcessor& rhs)
void G4ITModelProcessor::Initialize()
{
fpModelHandler->Initialize();
fReactionSet = G4ITReactionSet::Instance();
fpTrackContainer = G4ITTrackHolder::Instance();
fInitialized = true;
fComputeTimeStep = false;
fComputeReaction = false;
if(fpModelHandler->GetTimeStepComputerFlag()) fComputeTimeStep = true;
if(fpModelHandler->GetReactionProcessFlag()) fComputeReaction = true;
}
//_________________________________________________________________________
G4double G4ITModelProcessor::CalculateMinTimeStep(G4double currentGlobalTime,
G4double definedMinTimeStep)
{
#if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
MemStat mem_first, mem_second, mem_diff;
#endif
#if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
mem_first = MemoryUsage();
#endif
fTSTimeStep = DBL_MAX;
InitializeStepper(currentGlobalTime, definedMinTimeStep);
// TODO
// fpMasterModelProcessor -> InitializeStepper(fGlobalTime, fDefinedMinTimeStep) ;
#if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
mem_second = MemoryUsage();
mem_diff = mem_second-mem_first;
G4cout << "\t || MEM || G4Scheduler::CalculateMinTimeStep || After "
"computing fpModelProcessor -> InitializeStepper, diff is : "
<< mem_diff
<< G4endl;
#endif
// G4TrackList::iterator fpMainList_i = fpMainList->begin();
G4TrackManyList* mainList = fpTrackContainer->GetMainList();
G4TrackManyList::iterator it = mainList->begin();
G4TrackManyList::iterator end = mainList->end();
for (; it != end; ++it)
{
G4Track * track = *it;
if (track == 0)
{
G4ExceptionDescription exceptionDescription;
exceptionDescription << "No track found.";
G4Exception("G4Scheduler::CalculateMinStep", "ITScheduler006",
FatalErrorInArgument, exceptionDescription);
return 0; // makes coverity happy
}
#ifdef DEBUG
G4cout << "*_* " << GetIT(track)->GetName()
<< " ID: " << track->GetTrackID()
<< " at time : " << track->GetGlobalTime()
<< G4endl;
#endif
G4TrackStatus trackStatus = track->GetTrackStatus();
if (trackStatus == fStopAndKill || trackStatus == fStopButAlive)
{
continue;
}
// This Extract... was thought for MT mode at the track level
//ExtractTimeStepperData(fpModelProcessor) ;
CalculateTimeStep(track, definedMinTimeStep);
// if MT mode at track level, this command should be displaced
ExtractTimeStepperData();
}
#if defined (DEBUG_MEM) && defined (DEBUG_MEM_DETAILED_STEPPING)
mem_second = MemoryUsage();
mem_diff = mem_second-mem_first;
G4cout << "\t || MEM || G4Scheduler::CalculateMinTimeStep || "
"After looping on tracks, diff is : " << mem_diff << G4endl;
#endif
return fTSTimeStep;
}
//_________________________________________________________________________
void G4ITModelProcessor::ExtractTimeStepperData()
{
if(fpTrack == 0)
{
CleanProcessor();
return;
}
const std::vector<std::vector<G4VITStepModel*> >* model = GetCurrentModel();
for(unsigned i = 0; i < model->size(); ++i)
{
for(unsigned j = 0; j < (*model)[i].size(); ++j)
{
G4VITStepModel* mod = (*model)[i][j];
if(mod == 0)
{
continue;
}
G4VITTimeStepComputer* stepper(mod->GetTimeStepper());
G4double sampledMinTimeStep(stepper->GetSampledMinTimeStep());
G4TrackVectorHandle reactants(stepper->GetReactants());
if(sampledMinTimeStep < fTSTimeStep)
{
/*
// DEBUG SPECIAL CASE
if(!reactants)
{
G4ExceptionDescription exceptionDescription ;
CalculateMinTimeStep(); // => at least N (N = nb of tracks) loops exceptionDescription << "No reactants were found by the time stepper.";
G4Exception("G4Scheduler::ExtractTimeStepperData","ITScheduler007",
FatalErrorInArgument,exceptionDescription);
continue ;
}
*/
fTSTimeStep = sampledMinTimeStep;
//fReactingTracks.clear();
fReactionSet->CleanAllReaction();
if(bool(reactants))
{
// G4cout << "*** (1) G4Scheduler::ExtractTimeStepperData insert
// reactants for " << GetIT(track)->GetName() << G4endl;
// G4cout << "bool(reactants) = " << bool(reactants) << G4endl;
// G4cout << reactants->size() << G4endl;
// G4cout << GetIT(reactants->operator[](0))->GetName() << G4endl;
// fReactingTracks.insert(make_pair(track, reactants));
fReactionSet->AddReactions(fTSTimeStep,
const_cast<G4Track*>(fpTrack),
reactants);
stepper->ResetReactants();
}
}
else if(fTSTimeStep == sampledMinTimeStep)
{
/*
// DEBUG SPECIAL CASE
if(!reactants)
{
G4ExceptionDescription exceptionDescription ;
exceptionDescription << "No reactants were found by the time stepper.";
G4Exception("G4Scheduler::ExtractTimeStepperData","ITScheduler008",
FatalErrorInArgument,exceptionDescription);
continue ;
}
*/
if(bool(reactants))
{
// G4cout << "*** (2) G4Scheduler::ExtractTimeStepperData insert
// reactants for " << GetIT(track)->GetName() << G4endl;
// G4cout << "bool(reactants) = " << bool(reactants) << G4endl;
// G4cout << "trackA : " << GetIT(track)->GetName()
// << " ("<< track->GetTrackID() << ")" << G4endl;
// G4cout << reactants->size() << G4endl;
// G4cout << GetIT(reactants->operator[](0))->GetName() << G4endl;
// fReactingTracks.insert(make_pair(track, reactants));
fReactionSet->AddReactions(fTSTimeStep,
const_cast<G4Track*>(fpTrack),
reactants);
stepper->ResetReactants();
}
}
else
{
if(bool(reactants))
{
stepper->ResetReactants();
}
}
}
}
CleanProcessor();
}
//______________________________________________________________________________
void G4ITModelProcessor::InitializeStepper(const G4double& currentGlobalTime,
const G4double& userMinTime)
void G4ITModelProcessor::InitializeStepper(G4double currentGlobalTime,
G4double userMinTime)
{
// G4cout << "G4ITModelProcessor::InitializeStepper" << G4endl;
if (fpModelHandler == 0)
if(fpModelHandler == 0)
{
G4ExceptionDescription exceptionDescription;
exceptionDescription
<< "No G4ITModelHandler was passed to the modelProcessor.";
G4Exception("G4ITModelProcessor::InitializeStepper", "ITModelProcessor002",
FatalErrorInArgument, exceptionDescription);
G4Exception("G4ITModelProcessor::InitializeStepper",
"ITModelProcessor002",
FatalErrorInArgument,
exceptionDescription);
}
const std::vector<std::vector<G4ITModelManager*> >* modelManager =
fpModelHandler->GetAllModelManager();
if (modelManager == 0)
if(modelManager == 0)
{
G4ExceptionDescription exceptionDescription;
exceptionDescription
<< "No G4ITModelManager was register to G4ITModelHandler.";
G4Exception("G4ITModelProcessor::InitializeStepper", "ITModelProcessor003",
FatalErrorInArgument, exceptionDescription);
G4Exception("G4ITModelProcessor::InitializeStepper",
"ITModelProcessor003",
FatalErrorInArgument,
exceptionDescription);
}
int nbModels1 = modelManager->size();
@@ -136,15 +351,15 @@ void G4ITModelProcessor::InitializeStepper(const G4double& currentGlobalTime,
G4VITStepModel* model = 0;
G4ITModelManager* modman = 0;
for (int i = 0; i < nbModels1; i++)
for(int i = 0; i < nbModels1; i++)
{
nbModels2 = (*modelManager)[i].size();
for (int j = 0; j <= i; j++)
for(int j = 0; j <= i; j++)
{
modman = (*modelManager)[i][j];
if (modman == 0) continue;
if(modman == 0) continue;
model = modman->GetModel(currentGlobalTime);
G4VITTimeStepComputer* stepper = model->GetTimeStepper();
@@ -157,7 +372,7 @@ void G4ITModelProcessor::InitializeStepper(const G4double& currentGlobalTime,
mem_first = MemoryUsage();
#endif
// stepper->PrepareForAllProcessors() ;
// stepper->PrepareForAllProcessors() ;
stepper->Prepare();
#if defined (DEBUG_MEM)
@@ -169,7 +384,7 @@ void G4ITModelProcessor::InitializeStepper(const G4double& currentGlobalTime,
}
}
if (nbModels1 == 1 && nbModels2 == 1)
if(nbModels1 == 1 && nbModels2 == 1)
{
fpModelManager = modman;
fpModel = model;
@@ -184,12 +399,14 @@ void G4ITModelProcessor::CalculateTimeStep(const G4Track* track,
{
// G4cout << "G4ITModelProcessor::CalculateStep" << G4endl;
CleanProcessor();
if (track == 0)
if(track == 0)
{
G4ExceptionDescription exceptionDescription;
exceptionDescription << "No track was passed to the method (track == 0).";
G4Exception("G4ITModelProcessor::CalculateStep", "ITModelProcessor004",
FatalErrorInArgument, exceptionDescription);
G4Exception("G4ITModelProcessor::CalculateStep",
"ITModelProcessor004",
FatalErrorInArgument,
exceptionDescription);
}
SetTrack(track);
fUserMinTimeStep = userMinTimeStep;
@@ -200,7 +417,7 @@ void G4ITModelProcessor::CalculateTimeStep(const G4Track* track,
//______________________________________________________________________________
void G4ITModelProcessor::DoCalculateStep()
{
if (fpModel) // ie only one model has been declared and will be used
if(fpModel) // ie only one model has been declared and will be used
{
fpModel->GetTimeStepper()->CalculateStep(*fpTrack, fUserMinTimeStep);
}
@@ -209,115 +426,300 @@ void G4ITModelProcessor::DoCalculateStep()
std::vector<G4VITStepModel*>& model = fCurrentModel[GetIT(fpTrack)
->GetITType()];
for (int i = 0; i < (int) model.size(); i++)
for(int i = 0; i < (int) model.size(); i++)
{
if (model[i] == 0) continue;
if(model[i] == 0) continue;
model[i]->GetTimeStepper()->CalculateStep(*fpTrack, fUserMinTimeStep);
}
}
}
//_________________________________________________________________________
void G4ITModelProcessor::ComputeTrackReaction(G4ITStepStatus fITStepStatus,
G4double fGlobalTime,
G4double currentTimeStep,
G4double previousTimeStep,
G4bool reachedUserTimeLimit,
G4double fTimeTolerance,
G4UserTimeStepAction* fpUserTimeStepAction,
G4int
#ifdef G4VERBOSE
fVerbose
#endif
)
{
// if (fReactingTracks.empty())
if(fReactionSet->Empty())
{
return;
}
if(fITStepStatus == eCollisionBetweenTracks)
// if(fInteractionStep == false)
{
// TODO
FindReaction(fReactionSet,
currentTimeStep,
previousTimeStep,
reachedUserTimeLimit);
// TODO
// A ne faire uniquement si le temps choisis est celui calculé par le time stepper
// Sinon utiliser quelque chose comme : fModelProcessor->FindReaction(&fMainList);
std::vector<G4ITReactionChange*> * reactionInfo_v = GetReactionInfo();
std::vector<G4ITReactionChange*>::iterator reactionInfo_i = reactionInfo_v
->begin();
for(; reactionInfo_i != reactionInfo_v->end(); ++reactionInfo_i)
{
G4ITReactionChange* changes = (*reactionInfo_i);
G4Track* trackA = const_cast<G4Track*>(changes->GetTrackA());
G4Track* trackB = const_cast<G4Track*>(changes->GetTrackB());
if(trackA == 0 || trackB == 0 || trackA->GetTrackStatus() == fStopAndKill
|| trackB->GetTrackStatus() == fStopAndKill) continue;
G4int nbSecondaries = changes->GetNumberOfSecondaries();
const vector<G4Track*>* productsVector = changes->GetfSecondary();
if(fpUserTimeStepAction)
{
fpUserTimeStepAction->UserReactionAction(*trackA,
*trackB,
productsVector);
}
#ifdef G4VERBOSE
if(fVerbose)
{
G4cout << "At time : " << setw(7) << G4BestUnit(fGlobalTime, "Time")
<< " Reaction : " << GetIT(trackA)->GetName() << " ("
<< trackA->GetTrackID() << ") + " << GetIT(trackB)->GetName() << " ("
<< trackB->GetTrackID() << ") -> ";
}
#endif
if(nbSecondaries > 0)
{
for(int i = 0; i < nbSecondaries; ++i)
{
#ifdef G4VERBOSE
if(fVerbose && i != 0) G4cout << " + ";
#endif
G4Track* secondary = (*productsVector)[i]; //changes->GetSecondary(i);
fpTrackContainer->_PushTrack(secondary);
GetIT(secondary)->SetParentID(trackA->GetTrackID(),
trackB->GetTrackID());
if(secondary->GetGlobalTime() - fGlobalTime > fTimeTolerance)
{
G4ExceptionDescription exceptionDescription;
exceptionDescription << "The time of the secondary should not be bigger than the"
" current global time."
<< " This may cause synchronization problem. If the process you"
" are using required "
<< "such feature please contact the developpers." << G4endl<< "The global time in the step manager : "
<< G4BestUnit(fGlobalTime,"Time")
<< G4endl
<< "The global time of the track : "
<< G4BestUnit(secondary->GetGlobalTime(),"Time")
<< G4endl;
G4Exception("G4Scheduler::ComputeInteractionBetweenTracks",
"ITScheduler010",
FatalErrorInArgument,
exceptionDescription);
}
#ifdef G4VERBOSE
if(fVerbose)
G4cout << GetIT(secondary)->GetName() << " ("
<< secondary->GetTrackID() << ")";
#endif
}
}
else
{
#ifdef G4VERBOSE
if(fVerbose) G4cout << "No product";
#endif
}
#ifdef G4VERBOSE
if(fVerbose) G4cout << G4endl;
#endif
if(trackA->GetTrackID() == 0 || trackB->GetTrackID() == 0)
{
G4Track* track = 0;
if(trackA->GetTrackID() == 0) track = trackA;
else track = trackB;
G4ExceptionDescription exceptionDescription;
exceptionDescription
<< "The problem was found for the reaction between tracks :"
<< trackA->GetParticleDefinition()->GetParticleName() << " ("
<< trackA->GetTrackID() << ") & "
<< trackB->GetParticleDefinition()->GetParticleName() << " ("
<< trackB->GetTrackID() << "). \n";
if(track->GetStep() == 0)
{
exceptionDescription << "Also no step was found"
<< " ie track->GetStep() == 0 \n";
}
exceptionDescription << "Parent ID of trackA : "
<< trackA->GetParentID() << "\n";
exceptionDescription << "Parent ID of trackB : "
<< trackB->GetParentID() << "\n";
exceptionDescription
<< "The ID of one of the reaction track was not setup.";
G4Exception("G4Scheduler::ComputeInteractionBetweenTracks",
"ITScheduler011",
FatalErrorInArgument,
exceptionDescription);
}
if(changes->WereParentsKilled())
{
// DEBUG
// G4cout << "Erasing tracks : "
// << "trackA at time : " << G4BestUnit(trackA->GetGlobalTime() , "Time")
// << "\t trackB at time : "<< G4BestUnit(trackB->GetGlobalTime(), "Time")
// << "\t GlobalTime : " << G4BestUnit(fGlobalTime, "Time")
// << G4endl;
trackA->SetTrackStatus(fStopAndKill);
trackB->SetTrackStatus(fStopAndKill);
// G4TrackList::Pop(trackA);
// G4TrackList::Pop(trackB);
fpTrackingManager->EndTracking(trackA);
fpTrackingManager->EndTracking(trackB);
}
delete changes;
}
reactionInfo_v->clear(); // never null because point to a non-pointer member of ModelProcessor
}
// DEBUG
//else
//{
// G4cout << "fInteractionStep == true" << G4endl ;
//}
// fReactingTracks.clear();
fReactionSet->CleanAllReaction();
fpTrackContainer->MergeSecondariesWithMainList();
fpTrackContainer->KillTracks();
}
//______________________________________________________________________________
void G4ITModelProcessor::FindReaction(std::map<G4Track*, G4TrackVectorHandle>* tracks,
void G4ITModelProcessor::FindReaction(G4ITReactionSet* reactionSet,
const double currentStepTime,
const double previousStepTime,
const bool reachedUserStepTimeLimit)
{
// DEBUG
// G4cout << "G4ITReactionManager::FindReaction" << G4endl;
if (tracks == 0) return;
//if (tracks == 0) return;
if(reactionSet == 0) return;
if(fpModelHandler->GetAllModelManager()->empty()) return;
if (fpModelHandler->GetAllModelManager()->empty()) return;
G4ITReactionPerTrackMap& reactionPerTrackMap = reactionSet->GetReactionMap();
std::map<G4Track*, G4TrackVectorHandle>::iterator tracks_i = tracks->begin();
std::map<G4Track*, G4ITReactionPerTrackPtr, compTrackPerID>::iterator tracks_i =
reactionPerTrackMap.begin();
// G4cout << "G4ITModelProcessor::FindReaction at step :" << G4ITTimeStepper::Instance()->GetNbSteps() << G4endl;
//std::map<G4Track*, G4TrackVectorHandle, compTrackPerID>::iterator tracks_i = tracks->begin();
for (tracks_i = tracks->begin(); tracks_i != tracks->end(); tracks_i++)
// G4cout << "G4ITModelProcessor::FindReaction at step :" << G4ITTimeStepper::Instance()->GetNbSteps() << G4endl;
// for (tracks_i = tracks->begin(); tracks_i != tracks->end(); tracks_i++)
for(tracks_i = reactionPerTrackMap.begin();
tracks_i != reactionPerTrackMap.end();
tracks_i = reactionPerTrackMap.begin())
{
/// Get track A
//G4cout << "here" << G4endl;
G4Track* trackA = tracks_i->first;
if(trackA->GetTrackStatus() == fStopAndKill)
{
//G4cout << "continue 1" << G4endl;
continue;
}
if (trackA == 0) continue;
// G4cout << "trackA is " << GetIT(trackA)->GetName() << G4endl;
std::map<const G4Track*, G4bool>::iterator it_hasReacted =
fHasReacted->find(trackA);
if (it_hasReacted != fHasReacted->end()) continue;
if (trackA->GetTrackStatus() == fStopAndKill) continue;
G4ITReactionPerTrackPtr reactionPerTrack = tracks_i->second;
G4ITReactionList& reactionList = reactionPerTrack->GetReactionList();
G4IT* ITA = GetIT(trackA);
G4ITType ITypeA = ITA->GetITType();
const std::vector<G4VITStepModel*> model = fCurrentModel[ITypeA];
G4TrackVectorHandle& trackB_vector = tracks_i->second;
std::vector<G4Track*>::iterator trackB_i = trackB_vector->begin();
G4Track* trackB = 0;
G4ITType ITypeB(-1);
G4VITReactionProcess* process = 0;
G4ITReactionChange* changes = 0;
for (; trackB_i != trackB_vector->end(); trackB_i++)
assert(reactionList.begin() != reactionList.end());
for(G4ITReactionList::iterator it = reactionList.begin();
it != reactionList.end(); it = reactionList.begin())
{
trackB = *trackB_i;
G4ITReactionPtr reaction(*it);
trackB = reaction->GetReactant(trackA);
if(trackB->GetTrackStatus() == fStopAndKill)
{
//G4cout << "continue 2" << G4endl;
continue;
}
if (trackB == 0) continue;
it_hasReacted = fHasReacted->find(trackB);
if (it_hasReacted != fHasReacted->end()) continue;
if (trackB->GetTrackStatus() == fStopAndKill) continue;
// DEBUG
// G4cout << "Couple : " << trackA->GetParticleDefinition->GetParticleName() << " ("
// << trackA->GetTrackID() << ") "
// << trackB->GetParticleDefinition->GetParticleName() << " ("
// << trackB->GetTrackID() << ")"
// << G4endl;
if (trackB == trackA)
if(trackB == trackA)
{
G4ExceptionDescription exceptionDescription;
exceptionDescription
<< "The IT reaction process sent back a reaction between trackA and trackB. ";
exceptionDescription << "The problem is trackA == trackB";
G4Exception("G4ITModelProcessor::FindReaction", "ITModelProcessor005",
FatalErrorInArgument, exceptionDescription);
G4Exception("G4ITModelProcessor::FindReaction",
"ITModelProcessor005",
FatalErrorInArgument,
exceptionDescription);
}
G4IT* ITB = GetIT(trackB);
G4ITType ITypeBtmp = ITB->GetITType();
if (ITypeB != ITypeBtmp)
if(ITypeB != ITypeBtmp)
{
ITypeB = ITypeBtmp;
if (model[ITypeB]) process = model[ITypeB]->GetReactionProcess();
if(model[ITypeB]) process = model[ITypeB]->GetReactionProcess();
}
if (process && process->TestReactibility(*trackA, *trackB,
currentStepTime,
previousStepTime,
reachedUserStepTimeLimit))
reactionSet->SelectThisReaction(reaction);
if(process && process->TestReactibility(*trackA,
*trackB,
currentStepTime,
previousStepTime,
reachedUserStepTimeLimit))
{
changes = process->MakeReaction(*trackA, *trackB);
}
if (changes)
if(changes)
{
(*fHasReacted)[trackA] = true;
(*fHasReacted)[trackB] = true;
changes->GetTrackA();
changes->GetTrackB();
fReactionInfo.push_back(changes);
// G4cout << "pushing reaction for trackA (" << trackA->GetTrackID() << ") and trackB ("
// << trackB->GetTrackID() << ")" << G4endl;
//
// G4cout << "nb of secondaries : " << changes->GetNumberOfSecondaries() << G4endl;
// G4cout << "with track 0 = " << changes->GetSecondary(0) << G4endl;
// G4cout << "pushing reaction for trackA (" << trackA->GetTrackID() << ") and trackB ("
// << trackB->GetTrackID() << ")" << G4endl;
//
// G4cout << "nb of secondaries : " << changes->GetNumberOfSecondaries() << G4endl;
// G4cout << "with track 0 = " << changes->GetSecondary(0) << G4endl;
process->ResetChanges();
changes = 0;
@@ -327,5 +729,5 @@ void G4ITModelProcessor::FindReaction(std::map<G4Track*, G4TrackVectorHandle>* t
}
}
fHasReacted->clear();
//assert(G4ITReaction::gAll->empty() == true);
}
@@ -52,6 +52,8 @@
//#define G4DEBUG_NAVIGATION 1
#include "G4VoxelSafety.hh"
#include "Randomize.hh"
#include "G4VoxelLimits.hh"
#define fHistory fpNavigatorState->fHistory
#define fLastTriedStepComputation fpNavigatorState->fLastTriedStepComputation
@@ -80,6 +82,17 @@
#define fPreviousSftOrigin fpNavigatorState->fPreviousSftOrigin
#define fPreviousSafety fpNavigatorState->fPreviousSafety
//------------------------------------------------------------------------------
namespace BoundingBox
{
enum Boundary
{
kMin,
kMax
};
}
// ********************************************************************
// Constructor
// ********************************************************************
@@ -90,8 +103,8 @@ G4ITNavigator2::G4ITNavigator2()
fWarnPush(true)
{
fActive= false;
fActionThreshold_NoZeroSteps = 10;
fAbandonThreshold_NoZeroSteps = 25;
fActionThreshold_NoZeroSteps = 1000;
fAbandonThreshold_NoZeroSteps = 2500;
kCarTolerance = G4GeometryTolerance::GetInstance()->GetSurfaceTolerance();
fregularNav.SetNormalNavigation( &fnormalNav );
@@ -1341,9 +1354,9 @@ G4double G4ITNavigator2::ComputeStep( const G4ThreeVector &pGlobalpoint,
// ********************************************************************
//
G4double G4ITNavigator2::CheckNextStep( const G4ThreeVector& pGlobalpoint,
const G4ThreeVector& pDirection,
const G4double pCurrentProposedStepLength,
G4double& pNewSafety)
const G4ThreeVector& pDirection,
const G4double pCurrentProposedStepLength,
G4double& pNewSafety)
{
CheckNavigatorStateIsValid();
G4double step;
@@ -1351,7 +1364,8 @@ G4double G4ITNavigator2::CheckNextStep( const G4ThreeVector& pGlobalpoint,
// Save the state, for this parasitic call
//
//SetSavedState();
G4SaveNavigatorState savedState(fpNavigatorState);
// G4SaveNavigatorState savedState(fpNavigatorState);
G4NavigatorState savedState(*fpNavigatorState);
step = ComputeStep ( pGlobalpoint,
pDirection,
@@ -2450,3 +2464,58 @@ std::ostream& operator << (std::ostream &os,const G4ITNavigator2 &n)
os.precision(oldcoutPrec);
return os;
}
//------------------------------------------------------------------------------
EInside
G4ITNavigator2::InsideCurrentVolume(const G4ThreeVector& globalPoint) const
{
const G4AffineTransform& transform = GetGlobalToLocalTransform();
G4ThreeVector localPoint(transform.TransformPoint(globalPoint));
G4VSolid* solid = fHistory.GetTopVolume()->GetLogicalVolume()->GetSolid();
return solid->Inside(localPoint);
}
//------------------------------------------------------------------------------
void G4ITNavigator2::GetRandomInCurrentVolume(G4ThreeVector& _rndmPoint) const
{
const G4AffineTransform& local2Global = GetLocalToGlobalTransform();
G4VSolid* solid = fHistory.GetTopVolume()->GetLogicalVolume()->GetSolid();
G4VoxelLimits voxelLimits; // Defaults to "infinite" limits.
G4double vmin, vmax;
G4AffineTransform dummy;
std::vector<std::vector<double> > fExtend;
solid->CalculateExtent(kXAxis,voxelLimits,dummy,vmin,vmax);
fExtend[kXAxis][BoundingBox::kMin] = vmin;
fExtend[kXAxis][BoundingBox::kMax] = vmax;
solid->CalculateExtent(kYAxis,voxelLimits,dummy,vmin,vmax);
fExtend[kYAxis][BoundingBox::kMin] = vmin;
fExtend[kYAxis][BoundingBox::kMax] = vmax;
solid->CalculateExtent(kZAxis,voxelLimits,dummy,vmin,vmax);
fExtend[kZAxis][BoundingBox::kMin] = vmin;
fExtend[kZAxis][BoundingBox::kMax] = vmax;
G4ThreeVector rndmPos;
while(1)
{
for(size_t i = 0 ; i < 3 ; ++i)
{
double min = fExtend[i][BoundingBox::kMin];
double max = fExtend[i][BoundingBox::kMax];
rndmPos[i] = G4UniformRand()*(max-min)+min;
}
if(solid->Inside(rndmPos) == kInside) break;
}
_rndmPoint = local2Global.TransformPoint(rndmPos);
}
@@ -0,0 +1,117 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/*
* G4ITReactionInfo.cc
*
* Created on: 1 févr. 2015
* Author: matkara
*/
#include <G4ITReaction.hh>
#include "globals.hh"
//G4ThreadLocal std::set<G4ITReaction*>* G4ITReaction::gAll(0);
G4ThreadLocal G4ITReactionSet* G4ITReactionSet::fpInstance(0);
bool compReactionPerTime::operator()(G4ITReactionPtr rhs,
G4ITReactionPtr lhs) const
{
double time1 = rhs->GetTime();
double time2 = lhs->GetTime();
if (time1 == time2)
{
return rhs->GetHash() < lhs->GetHash();
}
return rhs->GetTime() < lhs->GetTime();
}
template<class T>
inline void hash_combine(std::size_t& seed,
const T& v)
{
// std::hash<T> hasher;
seed ^= /*std::hash<T>(v)*/ v + 0x9e3779b9 + (seed << 6) + (seed >> 2);
}
std::size_t G4ITReaction::GetHash() const
{
std::size_t hash = 0;
hash_combine(hash, fReactants.first->GetTrackID());
hash_combine(hash, fReactants.first->GetTrackID());
return hash;
}
G4ITReaction::G4ITReaction(double time, G4Track* trackA, G4Track* trackB) :
G4enable_shared_from_this<G4ITReaction>(),
fTime(time),
fReactants(trackA,trackB)
{
//if(gAll == 0) gAll = new std::set<G4ITReaction*>();
//gAll->insert(this);
fReactionPerTimeIt = 0;
}
G4ITReaction::~G4ITReaction()
{
//gAll->erase(this);
if(fReactionPerTimeIt) delete fReactionPerTimeIt;
}
void G4ITReaction::RemoveMe()
{
G4ITReactionPtr backMeUp = this->shared_from_this();
for(G4ReactionPerTrackIt::iterator it = fReactionPerTrack.begin() ;
it != fReactionPerTrack.end() ; ++it)
{
// G4cout << it->first.get() << G4endl;
// assert(it->first.get() != 0);
it->first->RemoveThisReaction(it->second);
}
fReactionPerTrack.clear();
if(fReactionPerTimeIt)
{
G4ITReactionSet::Instance()->GetReactionsPerTime().erase(*fReactionPerTimeIt);
delete fReactionPerTimeIt;
fReactionPerTimeIt = 0;
}
}
bool G4ITReactionPerTrack::RemoveThisReaction(G4ITReactionList::iterator it)
{
// G4cout << "G4ITReactionPerTrack::RemoveReaction" << G4endl;
fReactions.erase(it);
if(fReactions.empty())
{
// G4cout << "G4ITReactionPerTrack is empty" << G4endl;
G4ITReactionSet::Instance()->RemoveReactionPerTrack(this->shared_from_this());
return true;
}
return false;
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -46,6 +46,12 @@ PriorityList::PriorityList() :
{
}
PriorityList::PriorityList(G4TrackManyList& allMainList):
G4TrackList::Watcher(), fpMainList(0), fpWaitingList(0)
{
NewMainList(allMainList);
}
PriorityList::PriorityList(const PriorityList& right) :
G4TrackList::Watcher(),
fpMainList(right.fpMainList),
@@ -71,13 +77,13 @@ void PriorityList::NotifyDeletingList(G4TrackList* __list)
{
if (__list == fpMainList)
{
// StopWatching(fpMainList);
fpMainList = 0;
StopWatching(fpMainList);
}
else if (__list == fpWaitingList)
{
// StopWatching(fpWaitingList);
fpWaitingList = 0;
StopWatching(fpWaitingList);
}
}
@@ -192,7 +198,7 @@ G4ITTrackHolder* G4ITTrackHolder::Instance()
if (fgInstance == 0)
{
fgInstance = new G4ITTrackHolder();
if(G4Threading::IsWorkerThread() == false ||
if(G4Threading::IsMasterThread() ||
G4Threading::IsMultithreadedApplication() == false
)
{
@@ -379,15 +385,15 @@ void G4ITTrackHolder::AddTrackID(G4Track* track)
void G4ITTrackHolder::Push(G4Track* track)
{
if (G4VScheduler::Instance()->IsRunning())
{
G4ExceptionDescription exceptionDescription;
exceptionDescription
<< "G4ITTrackHolder::PushTrack : You are trying to push tracks while the "
"ITStepManager is running";
G4Exception("G4ITTrackHolder::PushTrack", "ITStepManager012",
FatalErrorInArgument, exceptionDescription);
}
// if (G4VScheduler::Instance()->IsRunning())
// {
// G4ExceptionDescription exceptionDescription;
// exceptionDescription
// << "G4ITTrackHolder::PushTrack : You are trying to push tracks while the "
// "ITStepManager is running";
// G4Exception("G4ITTrackHolder::PushTrack", "ITStepManager012",
// FatalErrorInArgument, exceptionDescription);
// }
_PushTrack(track);
// G4MIConstituent::NotifyEntityAdded(track);
@@ -402,7 +408,7 @@ void G4ITTrackHolder::PushTo(G4Track* track, PriorityList::Type type)
if (it == fLists.end())
{
priorityList = new PriorityList();
priorityList = new PriorityList(fAllMainList);
fLists[moleculeID] = priorityList;
}
else
@@ -462,7 +468,7 @@ void G4ITTrackHolder::_PushTrack(G4Track* track)
double currentGlobalTime = G4Scheduler::Instance()->GetGlobalTime();
#ifdef G4VERBOSE
if (fVerbose > 5)
if (fVerbose)
{
G4cout << G4endl;
G4cout << "\t"<< ">> Pushing a track --> ";
@@ -508,10 +514,37 @@ void G4ITTrackHolder::_PushTrack(G4Track* track)
{
if (globalTime == currentGlobalTime)
{
#ifdef G4VERBOSE
if (fVerbose)
{
G4cout << G4endl;
G4cout << "\t"<< ">> Pushing to *main* list --> ";
G4cout << GetIT(track)->GetName() << " (" << track->GetTrackID() <<")"
<< " -- ";
G4cout << "Global current time: " << G4BestUnit(currentGlobalTime,"Time")
<< "\t";
G4cout << "Track's time: " << G4BestUnit(track->GetGlobalTime(),"Time")
<< G4endl;
}
#endif
PushTo(track, PriorityList::MainList);
}
else
{
// if(currentGlobalTime > 1*CLHEP::picosecond) abort();
#ifdef G4VERBOSE
if (fVerbose)
{
G4cout << G4endl;
G4cout << "\t"<< ">> Pushing to *delayed* list --> ";
G4cout << GetIT(track)->GetName() << " (" << track->GetTrackID() <<")"
<< " -- ";
G4cout << "Global current time: " << G4BestUnit(currentGlobalTime,"Time")
<< "\t";
G4cout << "Track's time: " << G4BestUnit(track->GetGlobalTime(),"Time")
<< G4endl;
}
#endif
PushDelayed(track);
}
}
@@ -548,6 +581,19 @@ void G4ITTrackHolder::_PushTrack(G4Track* track)
{
// G4cout << "Is pushing " << GetIT(track)->GetName() << G4endl;
#ifdef G4VERBOSE
if (fVerbose)
{
G4cout << G4endl;
G4cout << "\t"<< ">> Pushing to *secondary* list --> ";
G4cout << GetIT(track)->GetName() << " (" << track->GetTrackID() <<")"
<< " -- ";
G4cout << "Global current time: " << G4BestUnit(currentGlobalTime,"Time")
<< "\t";
G4cout << "Track's time: " << G4BestUnit(track->GetGlobalTime(),"Time")
<< G4endl;
}
#endif
PushTo(track, PriorityList::SecondariesList);
}
else // globalTime < fGlobalTime already taken into account above
@@ -575,7 +621,7 @@ void G4ITTrackHolder::_PushTrack(G4Track* track)
void G4ITTrackHolder::PushDelayed(G4Track* track)
{
#ifdef G4VERBOSE
if (fVerbose > 5)
if (fVerbose)
{
G4cout << "\t" << ">> Pushing a delayed track" << G4endl;
}
@@ -651,14 +697,14 @@ void G4ITTrackHolder::KillTracks()
{
if (fToBeKilledList.size() == 0) return;
#ifdef G4VERBOSE
if (fVerbose > 5)
if (fVerbose > 1)
{
G4cout << "*** G4ITTrackHolder::KillTracks , step #"
// << G4MIWorldEngine::Instance()->GetScheduler()->GetNbSteps()
<< G4VScheduler::Instance()->GetNbSteps() << " ***" << G4endl;
<< G4VScheduler::Instance()->GetNbSteps()
<< " ***" << G4endl;
G4cout << "Nb of tracks to kill "<< fToBeKilledList.size() << G4endl;
G4cout << setw(25) << left << "#Name"
<< setw(25) << "track ID"<< G4endl;
<< setw(25) << "track ID"<< G4endl;
G4TrackList::iterator it = fToBeKilledList.begin();
for(; it != fToBeKilledList.end();)
@@ -747,6 +793,16 @@ bool G4ITTrackHolder::AddWatcher(Key id,
return true;
}
void G4ITTrackHolder::AddWatcherForMainList(G4TrackList::Watcher* watcher)
{
fAllMainList.AddGlobalWatcher(watcher);
}
void G4ITTrackHolder::AddWatcherForKillList(G4TrackList::Watcher* watcher)
{
watcher->Watch(&fToBeKilledList);
}
void G4ITTrackHolder::PushToMaster(G4Track* track)
{
G4ITTrackHolder* trackHolder = MasterInstance();
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ITTrackingInteractivity.cc 85244 2014-10-27 08:24:13Z gcosmo $
// $Id: G4ITTrackingInteractivity.cc 91584 2015-07-27 13:01:48Z gcosmo $
//
// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
//
@@ -35,6 +35,7 @@
//
// -------------------------------------------------------------------
#include <G4ITSteppingVerbose.hh>
#include "G4ITTrackingInteractivity.hh"
#include "G4Track.hh"
#include "G4String.hh"
@@ -60,3 +61,35 @@ void G4ITTrackingInteractivity::TrackBanner(G4Track* track, const G4String& mess
G4cout << G4endl;
}
G4ITTrackingInteractivity::G4ITTrackingInteractivity(G4VITSteppingVerbose* verbose)
{
fVerboseLevel = 0;
if(verbose)
{
fpVerbose = verbose;
}
else
{
fpVerbose = new G4ITSteppingVerbose();
}
}
void G4ITTrackingInteractivity::SetSteppingVerboseLevel(G4int level)
{
fpVerbose->SetVerbose(level);
}
//void G4ITTrackingInteractivity::StartTracking(G4Track* track)
//{
// fpVerbose->TrackingStarted(track);
//}
//
//void G4ITTrackingInteractivity::EndTracking(G4Track* track)
//{
// fpVerbose->TrackingEnded(track);
//}
G4int G4ITTrackingInteractivity::GetSteppingVerboseLevel() const
{
return fpVerbose->GetVerbose();
}
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ITTrackingManager.cc 85244 2014-10-27 08:24:13Z gcosmo $
// $Id: G4ITTrackingManager.cc 91584 2015-07-27 13:01:48Z gcosmo $
//
// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
//
@@ -39,6 +39,8 @@
#include "G4IT.hh"
#include "G4TrackingInformation.hh"
#include "G4ITTrackingInteractivity.hh"
#include "G4VITSteppingVerbose.hh"
#include "G4ITTrackHolder.hh"
G4ITTrackingManager::G4ITTrackingManager()
{
@@ -57,7 +59,13 @@ G4ITTrackingManager::~G4ITTrackingManager()
//___________________________________________________
void G4ITTrackingManager::StartTracking(G4Track* track)
{
if (fpTrackingInteractivity) fpTrackingInteractivity->StartTracking(track);
if (fpTrackingInteractivity)
{
fpTrackingInteractivity->StartTracking(track);
#ifdef G4VERBOSE
fpTrackingInteractivity->GetSteppingVerbose()->TrackingStarted(track);
#endif
}
// Inform beginning of tracking to physics processes
track->GetDefinition()->GetProcessManager()->StartTracking(track);
@@ -81,5 +89,24 @@ void G4ITTrackingManager::SetInteractivity(G4ITTrackingInteractivity* iteractivi
//___________________________________________________
void G4ITTrackingManager::EndTracking(G4Track* track)
{
if (fpTrackingInteractivity) fpTrackingInteractivity->EndTracking(track);
if (fpTrackingInteractivity)
{
fpTrackingInteractivity->EndTracking(track);
#ifdef G4VERBOSE
fpTrackingInteractivity->GetSteppingVerbose()->TrackingEnded(track);
#endif
}
G4TrackList::Pop(track);
G4ITTrackHolder::Instance()->PushToKill(track);
}
void G4ITTrackingManager::EndTrackingWOKill(G4Track* track)
{
if (fpTrackingInteractivity)
{
fpTrackingInteractivity->EndTracking(track);
#ifdef G4VERBOSE
fpTrackingInteractivity->GetSteppingVerbose()->TrackingEnded(track);
#endif
}
}
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ITTransportation.cc 87375 2014-12-02 08:17:28Z gcosmo $
// $Id: G4ITTransportation.cc 94289 2015-11-11 08:33:40Z gcosmo $
//
/// \brief This class is a slightly modified version of G4Transportation
/// initially written by John Apostolakis and colleagues
@@ -56,6 +56,8 @@
// -------------------------------------------------------------------
#include "G4ITTransportation.hh"
#include "G4IT.hh"
#include "G4TrackingInformation.hh"
#include "G4SystemOfUnits.hh"
#include "G4TransportationManager.hh"
#include "G4ITTransportationManager.hh"
@@ -73,8 +75,12 @@
class G4VSensitiveDetector;
#ifndef PrepareState
#define PrepareState() G4ITTransportationState* __state = this->GetState<G4ITTransportationState>();
#endif
#ifndef State
#define State(theXInfo) (GetState<G4ITTransportationState>()->theXInfo)
#define State(theXInfo) (__state->theXInfo)
#endif
//#define DEBUG_MEM
@@ -167,9 +173,9 @@ G4ITTransportation::G4ITTransportation(const G4ITTransportation& right) :
fInstantiateProcessState = right.fInstantiateProcessState;
}
G4ITTransportation& G4ITTransportation::operator=(const G4ITTransportation& right)
G4ITTransportation& G4ITTransportation::operator=(const G4ITTransportation& /*right*/)
{
if (this == &right) return *this;
// if (this == &right) return *this;
return *this;
}
@@ -250,6 +256,7 @@ AlongStepGetPhysicalInteractionLength(const G4Track& track,
G4double& currentSafety,
G4GPILSelection* selection)
{
PrepareState()
G4double geometryStepLength(-1.0), newSafety(-1.0);
State(fParticleIsLooping) = false;
@@ -643,6 +650,7 @@ void G4ITTransportation::ComputeStep(const G4Track& track,
const double timeStep,
double& oPhysicalStep)
{
PrepareState()
const G4DynamicParticle* pParticle = track.GetDynamicParticle();
G4ThreeVector startMomentumDir = pParticle->GetMomentumDirection();
G4ThreeVector startPosition = track.GetPosition();
@@ -690,6 +698,8 @@ G4VParticleChange* G4ITTransportation::AlongStepDoIt(const G4Track& track,
mem_first = MemoryUsage();
#endif
PrepareState()
// G4cout << "G4ITTransportation::AlongStepDoIt" << G4endl;
// set pdefOpticalPhoton
// Andrea Dotti: the following statement should be in a single line:
@@ -862,6 +872,8 @@ G4VParticleChange* G4ITTransportation::PostStepDoIt(const G4Track& track,
const G4Step&)
{
// G4cout << "G4ITTransportation::PostStepDoIt" << G4endl;
PrepareState()
G4TouchableHandle retCurrentTouchable; // The one to return
G4bool isLastStep = false;
@@ -1073,9 +1085,11 @@ void G4ITTransportation::StartTracking(G4Track* track)
// Update the current touchable handle (from the track's)
//
PrepareState()
State(fCurrentTouchableHandle) = track->GetTouchableHandle();
G4VITProcess::StartTracking(track);
}
#undef State
#undef PrepareState
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4KDTreeResult.cc 80151 2014-04-03 09:42:22Z gcosmo $
// $Id: G4KDTreeResult.cc 91584 2015-07-27 13:01:48Z gcosmo $
//
// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
//
@@ -65,6 +65,8 @@ private:
ResNode& operator=(const ResNode& rhs)
{
if(this == &rhs) return *this;
fNode = rhs.fNode;
fDistanceSqr= rhs.fDistanceSqr;
return *this;
}
};
@@ -85,9 +87,9 @@ G4KDTreeResult::~G4KDTreeResult()
std::list<ResNode>::erase(begin(),end());
}
void G4KDTreeResult::Insert(double pos, G4KDNode_Base* node)
void G4KDTreeResult::Insert(double dis_sq, G4KDNode_Base* node)
{
std::list<ResNode>::push_back(ResNode(pos,node));
std::list<ResNode>::push_back(ResNode(dis_sq,node));
}
void G4KDTreeResult::Clear()
@@ -48,52 +48,53 @@
namespace G4MemStat
{
using std::ios_base;
using std::ifstream;
using std::string;
using std::ios_base;
using std::ifstream;
using std::string;
MemStat MemoryUsage()
{
MemStat output;
MemStat MemoryUsage()
{
MemStat output;
#if ( defined(__MACH__) && defined(__clang__) && defined(__x86_64__) ) || \
( defined(__MACH__) && defined(__GNUC__) && __GNUC__>=4 && __GNUC_MINOR__>=7 ) || \
defined(__linux__) || defined(_AIX)
// 'file' stat seems to give the most reliable results
//
ifstream stat_stream("/proc/self/stat",ios_base::in);
// 'file' stat seems to give the most reliable results
//
ifstream stat_stream("/proc/self/stat", ios_base::in);
// dummy vars for leading entries in stat that we don't care about
//
string pid, comm, state, ppid, pgrp, session, tty_nr;
string tpgid, flags, minflt, cminflt, majflt, cmajflt;
string utime, stime, cutime, cstime, priority, nice;
string O, itrealvalue, starttime;
// dummy vars for leading entries in stat that we don't care about
//
string pid, comm, state, ppid, pgrp, session, tty_nr;
string tpgid, flags, minflt, cminflt, majflt, cmajflt;
string utime, stime, cutime, cstime, priority, nice;
string O, itrealvalue, starttime;
// the two fields we want
//
unsigned long vsize;
long rss;
// the two fields we want
//
unsigned long vsize;
long rss;
stat_stream >> pid >> comm >> state >> ppid >> pgrp >> session >> tty_nr
>> tpgid >> flags >> minflt >> cminflt >> majflt >> cmajflt
>> utime >> stime >> cutime >> cstime >> priority >> nice
>> O >> itrealvalue >> starttime >> vsize >> rss; // don't care about the rest
stat_stream >> pid >> comm >> state >> ppid >> pgrp >> session >> tty_nr
>> tpgid >> flags >> minflt >> cminflt >> majflt >> cmajflt >> utime
>> stime >> cutime >> cstime >> priority >> nice >> O >> itrealvalue
>> starttime >> vsize >> rss; // don't care about the rest
stat_stream.close();
stat_stream.close();
long page_size_kb = sysconf(_SC_PAGE_SIZE) / 1024; // in case x86-64 is configured to use 2MB pages
output.vmz = vsize / 1024.0;
output.mem = rss * page_size_kb;
long page_size_kb = sysconf(_SC_PAGE_SIZE) / 1024; // in case x86-64 is configured to use 2MB pages
output.vmz = vsize / 1024.0;
output.mem = rss * page_size_kb;
#endif
return output;
}
return output;
}
std::ostream & operator<<(std::ostream &os, const MemStat& memStat)
{
return os << "( vmz: "<< memStat.vmz << ", " << "mem: " << memStat.mem << ")" ;
}
std::ostream & operator<<(std::ostream &os, const MemStat& memStat)
{
return os << "( vmz: " << memStat.vmz << ", " << "mem: " << memStat.mem
<< ")";
}
}
File diff suppressed because it is too large Load Diff
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TrackList.cc 87454 2014-12-04 14:54:12Z gcosmo $
// $Id: G4TrackList.cc 93616 2015-10-27 08:59:17Z gcosmo $
//
// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
//
@@ -180,7 +180,7 @@ G4FastList<G4Track>* G4FastList<G4Track>::GetList(G4Track* __track)
G4FastListNode<G4Track>* __trackListNode = __IT->GetListNode();
if(__trackListNode == 0) return 0;
if(__trackListNode->fListRef == 0) return 0;
if(__trackListNode->fListRef == nullptr) return 0;
return __trackListNode->fListRef->fpList;
}
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TrackingInformation.cc 80151 2014-04-03 09:42:22Z gcosmo $
// $Id: G4TrackingInformation.cc 88348 2015-02-16 08:43:34Z gcosmo $
//
// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
//
@@ -104,7 +104,7 @@ G4TrackingInformation& G4TrackingInformation::operator=(const G4TrackingInformat
// return fProcessState[index];
//}
G4::shared_ptr<G4ProcessState_Lock> G4TrackingInformation::GetProcessState(size_t index)
G4shared_ptr<G4ProcessState_Lock> G4TrackingInformation::GetProcessState(size_t index)
{
if(index> G4VITProcess::GetMaxProcessIndex())
{
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4UserTimeStepAction.cc 85244 2014-10-27 08:24:13Z gcosmo $
// $Id: G4UserTimeStepAction.cc 94289 2015-11-11 08:33:40Z gcosmo $
//
// Author: Mathieu Karamitros (kara@cenbg.in2p3.fr)
//
@@ -44,9 +44,9 @@ G4UserTimeStepAction::~G4UserTimeStepAction()
G4UserTimeStepAction::G4UserTimeStepAction(const G4UserTimeStepAction& /*other*/){;}
G4UserTimeStepAction& G4UserTimeStepAction::operator=(const G4UserTimeStepAction& rhs)
G4UserTimeStepAction& G4UserTimeStepAction::operator=(const G4UserTimeStepAction& /*rhs*/)
{
if (this == &rhs) return *this;
// if (this == &rhs) return *this;
return *this;
}
@@ -0,0 +1,141 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4VITDiscreteProcess.cc 71231 2013-06-12 13:06:28Z gcosmo $
//
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
//
// History: first implementation, based on object model of
// 2nd December 1995, G.Cosmo
// --------------------------------------------------------------
// New Physics scheme 8 Jan. 1997 H.Kurahige
// ------------------------------------------------------------
#include "G4VITDiscreteProcess.hh"
#include "G4SystemOfUnits.hh"
#include "G4Step.hh"
#include "G4Track.hh"
#include "G4MaterialTable.hh"
#include "G4VParticleChange.hh"
G4VITDiscreteProcess::G4VITDiscreteProcess() :
G4VITProcess("No Name Discrete Process")
{
G4Exception("G4VDiscreteProcess::G4VDiscreteProcess()",
"ProcMan102",
JustWarning,
"Default constructor is called");
}
//------------------------------------------------------------------------------
G4VITDiscreteProcess::G4VITDiscreteProcess(const G4String& aName,
G4ProcessType aType) :
G4VITProcess(aName, aType)
{
enableAtRestDoIt = false;
enableAlongStepDoIt = false;
}
//------------------------------------------------------------------------------
G4VITDiscreteProcess::~G4VITDiscreteProcess()
{
}
//------------------------------------------------------------------------------
G4VITDiscreteProcess::G4VITDiscreteProcess(G4VITDiscreteProcess& right) :
G4VITProcess(right)
{
}
//------------------------------------------------------------------------------
G4double
G4VITDiscreteProcess::
PostStepGetPhysicalInteractionLength(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition)
{
if((previousStepSize < 0.0)
|| (fpState->theNumberOfInteractionLengthLeft <= 0.0))
{
// beginning 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 << "G4VDiscreteProcess::PostStepGetPhysicalInteractionLength ";
G4cout << "[ " << GetProcessName() << "]" << G4endl;
track.GetDynamicParticle()->DumpInfo();
G4cout << " in Material " << track.GetMaterial()->GetName() << G4endl;
G4cout << "InteractionLength= " << value / cm << "[cm] " << G4endl;
}
#endif
return value;
}
//------------------------------------------------------------------------------
G4VParticleChange* G4VITDiscreteProcess::PostStepDoIt(const G4Track&,
const G4Step&)
{
// clear NumberOfInteractionLengthLeft
ClearNumberOfInteractionLengthLeft();
return pParticleChange;
}
@@ -23,35 +23,36 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VITProcess.cc 80151 2014-04-03 09:42:22Z gcosmo $
// $Id: G4VITProcess.cc 94218 2015-11-09 08:24:48Z gcosmo $
//
#include "G4VITProcess.hh"
#include "G4SystemOfUnits.hh"
#include "G4IT.hh"
#include "G4TrackingInformation.hh"
/*G4ThreadLocal*/ size_t *G4VITProcess::fNbProcess = 0;
/*G4ThreadLocal*/size_t *G4VITProcess::fNbProcess = 0;
G4VITProcess::G4VITProcess(const G4String& name, G4ProcessType type) :
G4VProcess( name, type )
G4VProcess(name, type)
// fpState (0)//,
//fProcessID(fNbProcess)
{
fpState.reset();
if (!fNbProcess) fNbProcess = new size_t (0);
fProcessID = *fNbProcess;
(*fNbProcess)++;
SetInstantiateProcessState(true);
currentInteractionLength = 0;
theInteractionTimeLeft = 0;
theNumberOfInteractionLengthLeft = 0;
fProposesTimeStep = false;
fpState.reset();
if(!fNbProcess) fNbProcess = new size_t(0);
fProcessID = *fNbProcess;
(*fNbProcess)++;
SetInstantiateProcessState(true);
currentInteractionLength = 0;
theInteractionTimeLeft = 0;
theNumberOfInteractionLengthLeft = 0;
fProposesTimeStep = false;
}
G4VITProcess::G4ProcessState::G4ProcessState()
{
theNumberOfInteractionLengthLeft = -1.0 ;
theInteractionTimeLeft = -1.0 ;
currentInteractionLength = -1.0 ;
theNumberOfInteractionLengthLeft = -1.0;
theInteractionTimeLeft = -1.0;
currentInteractionLength = -1.0;
}
G4VITProcess::G4ProcessState::~G4ProcessState()
@@ -59,42 +60,43 @@ G4VITProcess::G4ProcessState::~G4ProcessState()
G4VITProcess::~G4VITProcess()
{
//dtor
// As the owner, G4IT should delete fProcessState
//dtor
// As the owner, G4IT should delete fProcessState
}
G4VITProcess::G4VITProcess(const G4VITProcess& other) : G4VProcess(other), fProcessID(other.fProcessID)
G4VITProcess::G4VITProcess(const G4VITProcess& other) :
G4VProcess(other), fProcessID(other.fProcessID)
{
//copy ctor
//fpState = 0 ;
currentInteractionLength = 0;
theInteractionTimeLeft = 0;
theNumberOfInteractionLengthLeft = 0;
fInstantiateProcessState = other.fInstantiateProcessState;
fProposesTimeStep = other.fProposesTimeStep;
//copy ctor
//fpState = 0 ;
currentInteractionLength = 0;
theInteractionTimeLeft = 0;
theNumberOfInteractionLengthLeft = 0;
fInstantiateProcessState = other.fInstantiateProcessState;
fProposesTimeStep = other.fProposesTimeStep;
}
G4VITProcess& G4VITProcess::operator=(const G4VITProcess& rhs)
{
if (this == &rhs) return *this; // handle self assignment
//assignment operator
return *this;
if (this == &rhs) return *this; // handle self assignment
//assignment operator
return *this;
}
void G4VITProcess::StartTracking(G4Track* track)
{
G4TrackingInformation* trackingInfo = GetIT(track)->GetTrackingInfo();
if(InstantiateProcessState())
{
// fpState = new G4ProcessState();
fpState.reset(new G4ProcessState());
}
G4TrackingInformation* trackingInfo = GetIT(track)->GetTrackingInfo();
if(InstantiateProcessState())
{
// fpState = new G4ProcessState();
fpState.reset(new G4ProcessState());
}
theNumberOfInteractionLengthLeft = &(fpState->theNumberOfInteractionLengthLeft );
theInteractionTimeLeft = &(fpState->theInteractionTimeLeft );
currentInteractionLength = &(fpState->currentInteractionLength );
trackingInfo->RecordProcessState(fpState,fProcessID);
// fpState = 0;
fpState.reset();
theNumberOfInteractionLengthLeft = &(fpState->theNumberOfInteractionLengthLeft );
theInteractionTimeLeft = &(fpState->theInteractionTimeLeft );
currentInteractionLength = &(fpState->currentInteractionLength );
trackingInfo->RecordProcessState(fpState,fProcessID);
// fpState = 0;
fpState.reset();
}
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VITRestDiscreteProcess.cc 64057 2012-10-30 15:04:49Z gcosmo $
// $Id: G4VITRestDiscreteProcess.cc 93883 2015-11-03 08:25:04Z gcosmo $
//
// Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
//
@@ -52,7 +52,7 @@ G4VITRestDiscreteProcess::~G4VITRestDiscreteProcess()
{
}
G4VITRestDiscreteProcess::G4VITRestDiscreteProcess(G4VITRestDiscreteProcess& right)
G4VITRestDiscreteProcess::G4VITRestDiscreteProcess(const G4VITRestDiscreteProcess& right)
: G4VITProcess(right)
{
}
@@ -0,0 +1,240 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/*
* G4VITSteppingVerbose.cc
*
* Created on: Jun 22, 2015
* Author: mkaramit
*/
#include <G4VITSteppingVerbose.hh>
#include <G4UIcmdWithAnInteger.hh>
//______________________________________________________________________________
G4VITSteppingVerbose::G4VITSteppingVerbose()
{
fpStepProcessor = 0;
fpState = 0;
fpProcessGeneralInfo = 0;
PhysicalStep = -1;
fStepStatus = fUndefined;
fParticleChange = 0;
fTrack = 0;
fSecondary = 0;
fStep = 0;
fPreStepPoint = 0;
fPostStepPoint = 0;
fCurrentVolume = 0;
// fSensitive = fpStepProcessor->GetfSensitive();
fCurrentProcess = 0;
fAtRestDoItVector = 0;
fAlongStepDoItVector = 0;
fPostStepDoItVector = 0;
fAtRestGetPhysIntVector = 0;
fAlongStepGetPhysIntVector = 0;
fPostStepGetPhysIntVector = 0;
MAXofAtRestLoops = 0;
MAXofAlongStepLoops = 0;
MAXofPostStepLoops = 0;
fAtRestDoItProcTriggered = 0;
fPostStepDoItProcTriggered = 0;
fN2ndariesAtRestDoIt = 0;
fN2ndariesAlongStepDoIt = 0;
fN2ndariesPostStepDoIt = 0;
// fNavigator = fpStepProcessor->GetfNavigator();
fVerboseLevel = 0;
fpVerboseUI = new G4UIcmdWithAnInteger("/chem/tracking/verbose", this);
fSelectedAtRestDoItVector = 0;
fSelectedPostStepDoItVector = 0;
fPreviousStepSize = 0.;
fTouchableHandle = 0;
// StepControlFlag = fpStepProcessor->GetStepControlFlag();
physIntLength = 0;
fCondition = InActivated;
fGPILSelection = NotCandidateForSelection;
}
//______________________________________________________________________________
G4VITSteppingVerbose::~G4VITSteppingVerbose()
{
if(fpVerboseUI) delete fpVerboseUI;
}
//______________________________________________________________________________
void G4VITSteppingVerbose::CopyState()
{
if(fpState) *fpState = *(fpStepProcessor->GetProcessorState());
else
{
fpState = new G4ITStepProcessorState(*fpStepProcessor->GetProcessorState());
}
fpProcessGeneralInfo = fpStepProcessor->GetCurrentProcessInfo();
PhysicalStep = fpStepProcessor->GetPhysIntLength();
fStepStatus = fpState->fStepStatus;
fParticleChange = fpStepProcessor->GetParticleChange();
fTrack = fpStepProcessor->GetTrack();
fSecondary = fpStepProcessor->GetSecondaries();
fStep = fpStepProcessor->GetStep();
fPreStepPoint = fStep->GetPreStepPoint();
fPostStepPoint = fStep->GetPostStepPoint();
fCurrentVolume = fpStepProcessor->GetCurrentVolume();
// fSensitive = fpStepProcessor->GetfSensitive();
fCurrentProcess = fpStepProcessor->GetCurrentProcess();
fAtRestDoItVector = fpProcessGeneralInfo->fpAtRestDoItVector;
fAlongStepDoItVector = fpProcessGeneralInfo->fpAlongStepDoItVector;
fPostStepDoItVector = fpProcessGeneralInfo->fpPostStepDoItVector;
fAtRestGetPhysIntVector = fpProcessGeneralInfo->fpAtRestGetPhysIntVector;
fAlongStepGetPhysIntVector =
fpProcessGeneralInfo->fpAlongStepGetPhysIntVector;
fPostStepGetPhysIntVector = fpProcessGeneralInfo->fpPostStepGetPhysIntVector;
MAXofAtRestLoops = fpProcessGeneralInfo->MAXofAtRestLoops;
MAXofAlongStepLoops = fpProcessGeneralInfo->MAXofAlongStepLoops;
MAXofPostStepLoops = fpProcessGeneralInfo->MAXofPostStepLoops;
fAtRestDoItProcTriggered = fpStepProcessor->GetAtRestDoItProcTriggered();
fPostStepDoItProcTriggered = fpStepProcessor->GetPostStepDoItProcTriggered();
fN2ndariesAtRestDoIt = fpStepProcessor->GetN2ndariesAtRestDoIt();
fN2ndariesAlongStepDoIt = fpStepProcessor->GetN2ndariesAlongStepDoIt();
fN2ndariesPostStepDoIt = fpStepProcessor->GetN2ndariesPostStepDoIt();
// fNavigator = fpStepProcessor->GetfNavigator();
fSelectedAtRestDoItVector = &(fpState->fSelectedAtRestDoItVector);
fSelectedPostStepDoItVector = &(fpState->fSelectedPostStepDoItVector);
fPreviousStepSize = fpState->fPreviousStepSize;
fTouchableHandle = fpState->fTouchableHandle;
// StepControlFlag = fpStepProcessor->GetStepControlFlag();
physIntLength = fpStepProcessor->GetPhysIntLength();
fCondition = fpStepProcessor->GetCondition();
fGPILSelection = fpStepProcessor->GetGPILSelection();
}
//______________________________________________________________________________
void G4VITSteppingVerbose::SetNewValue(G4UIcommand* command, G4String newValue)
{
if(command == fpVerboseUI)
{
fVerboseLevel = fpVerboseUI->GetNewIntValue(newValue);
}
}
//______________________________________________________________________________
G4String G4VITSteppingVerbose::GetCurrentValue(G4UIcommand* command)
{
return command->ConvertToString(fVerboseLevel);
}
//______________________________________________________________________________
void G4VITSteppingVerbose::TrackingStarted(G4Track*
#ifdef G4VERBOSE
track
#endif
)
{
#ifdef G4VERBOSE
if(fVerboseLevel > 0)
{
TrackBanner(track, "G4ITTrackingManager::StartTracking : ");
}
#endif
}
//______________________________________________________________________________
void G4VITSteppingVerbose::TrackingEnded(G4Track*
#ifdef G4VERBOSE
track
#endif
)
{
#ifdef G4VERBOSE
if(fVerboseLevel > 0)
{
TrackBanner(track, "G4ITTrackingManager::EndTracking : ");
}
#endif
}
//______________________________________________________________________________
void G4VITSteppingVerbose::TrackBanner(G4Track* track, const G4String& message)
{
G4cout << G4endl;
G4cout << "*******************************************************"
<< "**************************************************"
<< G4endl;
if(message != "")
{
G4cout << message;
}
G4cout << " * G4Track Information: "
<< " Particle : " << track->GetDefinition()->GetParticleName()
<< ","
<< " Track ID : " << track->GetTrackID()
<< ","
<< " Parent ID : " << track->GetParentID()
<< G4endl;
G4cout << "*******************************************************"
<< "**************************************************"
<< G4endl;
G4cout << G4endl;
}
@@ -1,4 +1,4 @@
# $Id: GNUmakefile 66892 2013-01-17 10:57:59Z gunter $
# $Id: GNUmakefile 93938 2015-11-04 10:39:24Z gcosmo $
# --------------------------------------------------------------------
# GNUmakefile for electromagnetic sub-library. John Allison, 25/6/98.
# --------------------------------------------------------------------
@@ -17,6 +17,8 @@ CPPFLAGS += -I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPNumerics/include \
-I$(G4BASE)/global/HEPGeometry/include \
-I$(G4BASE)/geometry/management/include \
-I$(G4BASE)/geometry/navigation/include \
-I$(G4BASE)/geometry/volumes/include \
-I$(G4BASE)/track/include \
-I$(G4BASE)/processes/management/include \
-I$(G4BASE)/processes/cuts/include \
@@ -23,85 +23,22 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNABornExcitationModel.hh 70171 2013-05-24 13:34:18Z gcosmo $
//
/*
* G4DNABornExcitationModel.hh
*
* Created on: 12 mai 2015
* Author: matkara
*/
#ifndef G4DNABornExcitationModel_h
#define G4DNABornExcitationModel_h 1
#ifndef SOURCE_PROCESSES_ELECTROMAGNETIC_DNA_MODELS_INCLUDE_G4DNABORNEXCITATIONMODEL_HH_
#define SOURCE_PROCESSES_ELECTROMAGNETIC_DNA_MODELS_INCLUDE_G4DNABORNEXCITATIONMODEL_HH_
#include "G4VEmModel.hh"
#include "G4ParticleChangeForGamma.hh"
#include "G4ProductionCutsTable.hh"
#include "G4DNACrossSectionDataSet.hh"
#include "G4LogLogInterpolation.hh"
#include "G4Electron.hh"
#include "G4Proton.hh"
#include "G4DNAWaterExcitationStructure.hh"
#include "G4NistManager.hh"
class G4DNABornExcitationModel : public G4VEmModel
{
public:
G4DNABornExcitationModel(const G4ParticleDefinition* p = 0,
const G4String& nam = "DNABornExcitationModel");
virtual ~G4DNABornExcitationModel();
virtual void Initialise(const G4ParticleDefinition*, const G4DataVector& = *(new G4DataVector()) );
virtual G4double CrossSectionPerVolume(const G4Material* material,
const G4ParticleDefinition* p,
G4double ekin,
G4double emin,
G4double emax);
virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double maxEnergy);
protected:
G4ParticleChangeForGamma* fParticleChangeForGamma;
private:
// Water density table
const std::vector<G4double>* fpMolWaterDensity;
std::map<G4String,G4double,std::less<G4String> > lowEnergyLimit;
std::map<G4String,G4double,std::less<G4String> > highEnergyLimit;
G4bool isInitialised;
G4int verboseLevel;
// Cross section
typedef std::map<G4String,G4String,std::less<G4String> > MapFile;
MapFile tableFile;
typedef std::map<G4String,G4DNACrossSectionDataSet*,std::less<G4String> > MapData;
MapData tableData;
// Partial cross section
G4int RandomSelect(G4double energy,const G4String& particle );
// Final state
G4DNAWaterExcitationStructure waterStructure;
//
G4DNABornExcitationModel & operator=(const G4DNABornExcitationModel &right);
G4DNABornExcitationModel(const G4DNABornExcitationModel&);
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4DNABornExcitationModel1.hh"
#include "G4DNABornExcitationModel2.hh"
#ifndef G4DNABornExcitationModel
typedef G4DNABornExcitationModel1 G4DNABornExcitationModel;
//typedef G4DNABornExcitationModel2 G4DNABornExcitationModel;
#endif
#endif /* SOURCE_PROCESSES_ELECTROMAGNETIC_DNA_MODELS_INCLUDE_G4DNABORNEXCITATIONMODEL_HH_ */
@@ -0,0 +1,112 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNABornExcitationModel1.hh 90057 2015-05-11 22:25:50Z matkara $
//
#ifndef G4DNABornExcitationModel1_h
#define G4DNABornExcitationModel1_h 1
#include "G4VEmModel.hh"
#include "G4ParticleChangeForGamma.hh"
#include "G4ProductionCutsTable.hh"
#include "G4DNACrossSectionDataSet.hh"
#include "G4LogLogInterpolation.hh"
#include "G4Electron.hh"
#include "G4Proton.hh"
#include "G4DNAWaterExcitationStructure.hh"
#include "G4NistManager.hh"
class G4DNABornExcitationModel1: public G4VEmModel
{
public:
G4DNABornExcitationModel1(const G4ParticleDefinition* p = 0,
const G4String& nam = "DNABornExcitationModel");
virtual ~G4DNABornExcitationModel1();
virtual void Initialise(const G4ParticleDefinition*,
const G4DataVector& = *(new G4DataVector()));
virtual G4double CrossSectionPerVolume(const G4Material* material,
const G4ParticleDefinition* p,
G4double ekin,
G4double emin,
G4double emax);
virtual G4double GetPartialCrossSection(const G4Material*,
G4int level,
const G4ParticleDefinition*,
G4double kineticEnergy);
virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double maxEnergy);
inline void SelectStationary(G4bool input);
protected:
G4ParticleChangeForGamma* fParticleChangeForGamma;
private:
G4bool statCode;
// Water density table
const std::vector<G4double>* fpMolWaterDensity;
G4bool isInitialised;
G4int verboseLevel;
const G4ParticleDefinition* fParticleDefinition;
double fLowEnergy;
double fHighEnergy;
G4String fTableFile;
G4DNACrossSectionDataSet* fTableData;
// Partial cross section
G4int RandomSelect(G4double energy);
G4DNAWaterExcitationStructure waterStructure;
//
G4DNABornExcitationModel1 & operator=(const G4DNABornExcitationModel1 &right);
G4DNABornExcitationModel1(const G4DNABornExcitationModel1&);
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4DNABornExcitationModel1::SelectStationary (G4bool input)
{
statCode = input;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -0,0 +1,116 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNABornExcitationModel2.hh 90057 2015-05-11 22:25:50Z matkara $
//
#ifndef G4DNABornExcitationModel2_h
#define G4DNABornExcitationModel2_h 1
#include "G4VEmModel.hh"
#include "G4ParticleChangeForGamma.hh"
#include "G4ProductionCutsTable.hh"
//#include "G4DNACrossSectionDataSet.hh"
#include "G4LogLogInterpolation.hh"
#include "G4Electron.hh"
#include "G4Proton.hh"
#include "G4DNAWaterExcitationStructure.hh"
#include "G4NistManager.hh"
class G4PhysicsVector;
class G4DNABornExcitationModel2: public G4VEmModel
{
public:
G4DNABornExcitationModel2(const G4ParticleDefinition* p = 0,
const G4String& nam = "DNABornExcitationModel");
virtual ~G4DNABornExcitationModel2();
virtual void Initialise(const G4ParticleDefinition*,
const G4DataVector& = *(new G4DataVector()));
virtual G4double CrossSectionPerVolume(const G4Material* material,
const G4ParticleDefinition* p,
G4double ekin,
G4double emin,
G4double emax);
virtual G4double GetPartialCrossSection(const G4Material*,
G4int level,
const G4ParticleDefinition*,
G4double kineticEnergy);
virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double maxEnergy);
inline void SelectStationary(G4bool input);
protected:
G4ParticleChangeForGamma* fParticleChangeForGamma;
private:
G4bool statCode;
// Water density table
const std::vector<G4double>* fpMolWaterDensity;
G4bool isInitialised;
G4int verboseLevel;
const G4ParticleDefinition* fParticleDefinition;
double fLowEnergy;
double fHighEnergy;
G4PhysicsTable* fTableData;
G4PhysicsVector* fTotalXS;
size_t fLastBinCallForFinalXS;
// Partial cross section
G4int RandomSelect(G4double energy);
G4DNAWaterExcitationStructure waterStructure;
//
G4DNABornExcitationModel2 & operator=(const G4DNABornExcitationModel2 &right);
G4DNABornExcitationModel2(const G4DNABornExcitationModel2&);
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4DNABornExcitationModel2::SelectStationary (G4bool input)
{
statCode = input;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -23,148 +23,22 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNABornIonisationModel.hh 81552 2014-06-03 08:28:18Z gcosmo $
//
/*
* G4DNABornIonisationModel.hh
*
* Created on: 13 mai 2015
* Author: matkara
*/
#ifndef G4DNABornIonisationModel_h
#define G4DNABornIonisationModel_h 1
#ifndef SOURCE_PROCESSES_ELECTROMAGNETIC_DNA_MODELS_INCLUDE_G4DNABORNIONISATIONMODEL_HH_
#define SOURCE_PROCESSES_ELECTROMAGNETIC_DNA_MODELS_INCLUDE_G4DNABORNIONISATIONMODEL_HH_
#include "G4VEmModel.hh"
#include "G4ParticleChangeForGamma.hh"
#include "G4ProductionCutsTable.hh"
#include "G4DNACrossSectionDataSet.hh"
#include "G4Electron.hh"
#include "G4Proton.hh"
#include "G4DNAGenericIonsManager.hh"
#include "G4LogLogInterpolation.hh"
#include "G4DNAWaterIonisationStructure.hh"
#include "G4VAtomDeexcitation.hh"
#include "G4NistManager.hh"
class G4DNABornIonisationModel : public G4VEmModel
{
public:
G4DNABornIonisationModel(const G4ParticleDefinition* p = 0,
const G4String& nam = "DNABornIonisationModel");
virtual ~G4DNABornIonisationModel();
virtual void Initialise(const G4ParticleDefinition*, const G4DataVector& = *(new G4DataVector()));
virtual G4double CrossSectionPerVolume( const G4Material* material,
const G4ParticleDefinition* p,
G4double ekin,
G4double emin,
G4double emax);
virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double maxEnergy);
double DifferentialCrossSection(G4ParticleDefinition * aParticleDefinition, G4double k, G4double energyTransfer, G4int shell);
inline void SelectFasterComputation(G4bool input);
protected:
G4ParticleChangeForGamma* fParticleChangeForGamma;
private:
G4bool fasterCode;
// Water density table
const std::vector<G4double>* fpMolWaterDensity;
// Deexcitation manager to produce fluo photons and e-
G4VAtomDeexcitation* fAtomDeexcitation;
std::map<G4String,G4double,std::less<G4String> > lowEnergyLimit;
std::map<G4String,G4double,std::less<G4String> > highEnergyLimit;
// TODO :
// std::map<const G4ParticleDefinition*,std::pair<G4double,G4double> > fEnergyLimits;
G4bool isInitialised;
G4int verboseLevel;
// Cross section
typedef std::map<G4String,G4String,std::less<G4String> > MapFile;
MapFile tableFile; // useful ?
typedef std::map<G4String,G4DNACrossSectionDataSet*,std::less<G4String> > MapData;
MapData tableData;
// Final state
G4DNAWaterIonisationStructure waterStructure;
G4double RandomizeEjectedElectronEnergy(G4ParticleDefinition * aParticleDefinition, G4double incomingParticleEnergy, G4int shell) ;
G4double RandomizeEjectedElectronEnergyFromCumulatedDcs(G4ParticleDefinition * aParticleDefinition, G4double incomingParticleEnergy, G4int shell) ;
G4double RandomTransferedEnergy(G4ParticleDefinition * aParticleDefinition, G4double incomingParticleEnergy, G4int shell) ;
G4double Interpolate(G4double e1, G4double e2, G4double e, G4double xs1, G4double xs2);
G4double QuadInterpolator( G4double e11,
G4double e12,
G4double e21,
G4double e22,
G4double x11,
G4double x12,
G4double x21,
G4double x22,
G4double t1,
G4double t2,
G4double t,
G4double e);
typedef std::map<double, std::map<double, double> > TriDimensionMap;
TriDimensionMap eDiffCrossSectionData[6];
TriDimensionMap eNrjTransfData[6]; // for cumulated dcs
TriDimensionMap pDiffCrossSectionData[6];
TriDimensionMap pNrjTransfData[6]; // for cumulated dcs
std::vector<double> eTdummyVec;
std::vector<double> pTdummyVec;
typedef std::map<double, std::vector<double> > VecMap;
VecMap eVecm;
VecMap pVecm;
VecMap eProbaShellMap[6]; // for cumulated dcs
VecMap pProbaShellMap[6]; // for cumulated dcs
// Partial cross section
G4int RandomSelect(G4double energy,const G4String& particle );
//
G4DNABornIonisationModel & operator=(const G4DNABornIonisationModel &right);
G4DNABornIonisationModel(const G4DNABornIonisationModel&);
};
inline void G4DNABornIonisationModel::SelectFasterComputation (G4bool input)
{
fasterCode = input;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4DNABornIonisationModel1.hh"
#include "G4DNABornIonisationModel2.hh"
#ifndef G4DNABornIonisationModel
#define G4DNABornIonisationModel G4DNABornIonisationModel1
//#define G4DNABornIonisationModel G4DNABornIonisationModel2
#endif
#endif /* SOURCE_PROCESSES_ELECTROMAGNETIC_DNA_MODELS_INCLUDE_G4DNABORNIONISATIONMODEL_HH_ */
@@ -0,0 +1,196 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNABornIonisationModel1.hh 81398 2014-05-28 09:53:02Z vnivanch $
//
#ifndef G4DNABornIonisationModel1_h
#define G4DNABornIonisationModel1_h 1
#include "G4VEmModel.hh"
#include "G4ParticleChangeForGamma.hh"
#include "G4ProductionCutsTable.hh"
#include "G4DNACrossSectionDataSet.hh"
#include "G4Electron.hh"
#include "G4Proton.hh"
#include "G4DNAGenericIonsManager.hh"
#include "G4LogLogInterpolation.hh"
#include "G4DNAWaterIonisationStructure.hh"
#include "G4VAtomDeexcitation.hh"
#include "G4NistManager.hh"
class G4DNABornIonisationModel1 : public G4VEmModel
{
public:
G4DNABornIonisationModel1(const G4ParticleDefinition* p = 0,
const G4String& nam = "DNABornIonisationModel");
virtual ~G4DNABornIonisationModel1();
virtual void Initialise(const G4ParticleDefinition*, const G4DataVector& = *(new G4DataVector()));
virtual G4double CrossSectionPerVolume( const G4Material* material,
const G4ParticleDefinition* p,
G4double ekin,
G4double emin,
G4double emax);
virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double maxEnergy);
virtual G4double GetPartialCrossSection(const G4Material*,
G4int /*level*/,
const G4ParticleDefinition*,
G4double /*kineticEnergy*/);
double DifferentialCrossSection(G4ParticleDefinition * aParticleDefinition, G4double k, G4double energyTransfer, G4int shell);
G4double TransferedEnergy(G4ParticleDefinition * aParticleDefinition,
G4double incomingParticleEnergy, G4int shell, G4double random) ;
inline void SelectFasterComputation(G4bool input);
inline void SelectStationary(G4bool input);
inline void SelectSPScaling(G4bool input);
protected:
G4ParticleChangeForGamma* fParticleChangeForGamma;
private:
G4bool fasterCode;
G4bool statCode;
G4bool spScaling;
// Water density table
const std::vector<G4double>* fpMolWaterDensity;
// Deexcitation manager to produce fluo photons and e-
G4VAtomDeexcitation* fAtomDeexcitation;
std::map<G4String,G4double,std::less<G4String> > lowEnergyLimit;
std::map<G4String,G4double,std::less<G4String> > highEnergyLimit;
// TODO :
// std::map<const G4ParticleDefinition*,std::pair<G4double,G4double> > fEnergyLimits;
G4bool isInitialised;
G4int verboseLevel;
// Cross section
typedef std::map<G4String,G4String,std::less<G4String> > MapFile;
MapFile tableFile; // useful ?
typedef std::map<G4String,G4DNACrossSectionDataSet*,std::less<G4String> > MapData;
MapData tableData;
// Final state
G4DNAWaterIonisationStructure waterStructure;
G4double RandomizeEjectedElectronEnergy(G4ParticleDefinition * aParticleDefinition, G4double incomingParticleEnergy, G4int shell) ;
G4double RandomizeEjectedElectronEnergyFromCumulatedDcs(G4ParticleDefinition * aParticleDefinition, G4double incomingParticleEnergy, G4int shell) ;
G4double Interpolate(G4double e1, G4double e2, G4double e, G4double xs1, G4double xs2);
G4double QuadInterpolator( G4double e11,
G4double e12,
G4double e21,
G4double e22,
G4double x11,
G4double x12,
G4double x21,
G4double x22,
G4double t1,
G4double t2,
G4double t,
G4double e);
typedef std::map<double, std::map<double, double> > TriDimensionMap;
TriDimensionMap eDiffCrossSectionData[6];
TriDimensionMap eNrjTransfData[6]; // for cumulated dcs
TriDimensionMap pDiffCrossSectionData[6];
TriDimensionMap pNrjTransfData[6]; // for cumulated dcs
std::vector<double> eTdummyVec;
std::vector<double> pTdummyVec;
typedef std::map<double, std::vector<double> > VecMap;
VecMap eVecm;
VecMap pVecm;
VecMap eProbaShellMap[6]; // for cumulated dcs
VecMap pProbaShellMap[6]; // for cumulated dcs
// Partial cross section
G4int RandomSelect(G4double energy,const G4String& particle );
//
G4DNABornIonisationModel1 & operator=(const G4DNABornIonisationModel1 &right);
G4DNABornIonisationModel1(const G4DNABornIonisationModel1&);
};
inline void G4DNABornIonisationModel1::SelectFasterComputation (G4bool input)
{
fasterCode = input;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4DNABornIonisationModel1::SelectStationary (G4bool input)
{
statCode = input;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4DNABornIonisationModel1::SelectSPScaling (G4bool input)
{
spScaling = input;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -0,0 +1,184 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNABornIonisationModel2.hh 81398 2014-05-28 09:53:02Z vnivanch $
//
#ifndef G4DNABornIonisationModel2_h
#define G4DNABornIonisationModel2_h 1
#include "G4VEmModel.hh"
#include "G4ParticleChangeForGamma.hh"
#include "G4ProductionCutsTable.hh"
#include "G4DNACrossSectionDataSet.hh"
#include "G4Electron.hh"
#include "G4Proton.hh"
#include "G4DNAGenericIonsManager.hh"
#include "G4LogLogInterpolation.hh"
#include "G4DNAWaterIonisationStructure.hh"
#include "G4VAtomDeexcitation.hh"
#include "G4NistManager.hh"
class G4DNABornIonisationModel2 : public G4VEmModel
{
public:
G4DNABornIonisationModel2(const G4ParticleDefinition* p = 0,
const G4String& nam = "DNABornIonisationModel");
virtual ~G4DNABornIonisationModel2();
virtual void Initialise(const G4ParticleDefinition*, const G4DataVector& = *(new G4DataVector()));
virtual G4double CrossSectionPerVolume( const G4Material* material,
const G4ParticleDefinition* p,
G4double ekin,
G4double emin,
G4double emax);
virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double maxEnergy);
virtual G4double GetPartialCrossSection(const G4Material*,
G4int /*level*/,
const G4ParticleDefinition*,
G4double /*kineticEnergy*/);
double DifferentialCrossSection(G4ParticleDefinition * aParticleDefinition, G4double k, G4double energyTransfer, G4int shell);
G4double TransferedEnergy(G4ParticleDefinition * aParticleDefinition, G4double incomingParticleEnergy, G4int shell, G4double random) ;
inline void SelectFasterComputation(G4bool input);
inline void SelectStationary(G4bool input);
inline void SelectSPScaling(G4bool input);
protected:
G4ParticleChangeForGamma* fParticleChangeForGamma;
private:
G4bool fasterCode;
G4bool statCode;
G4bool spScaling;
// Water density table
const std::vector<G4double>* fpMolWaterDensity;
// Deexcitation manager to produce fluo photons and e-
G4VAtomDeexcitation* fAtomDeexcitation;
G4double fLowEnergyLimit;
G4double fHighEnergyLimit;
const G4ParticleDefinition* fParticleDef;
G4bool isInitialised;
G4int verboseLevel;
// Cross section
G4String fTableFile;
G4DNACrossSectionDataSet* fTableData;
// Final state
G4DNAWaterIonisationStructure waterStructure;
G4double RandomizeEjectedElectronEnergy(G4ParticleDefinition * aParticleDefinition, G4double incomingParticleEnergy, G4int shell) ;
G4double RandomizeEjectedElectronEnergyFromCumulatedDcs(G4ParticleDefinition * aParticleDefinition, G4double incomingParticleEnergy, G4int shell) ;
G4double Interpolate(G4double e1, G4double e2, G4double e, G4double xs1, G4double xs2);
G4double QuadInterpolator( G4double e11,
G4double e12,
G4double e21,
G4double e22,
G4double x11,
G4double x12,
G4double x21,
G4double x22,
G4double t1,
G4double t2,
G4double t,
G4double e);
typedef std::map<double, std::map<double, double> > TriDimensionMap;
TriDimensionMap fDiffCrossSectionData[6];
TriDimensionMap fNrjTransfData[6]; // for cumulated dcs
std::vector<double> fTdummyVec;
typedef std::map<double, std::vector<double> > VecMap;
VecMap fVecm;
VecMap fProbaShellMap[6]; // for cumulated dcs
// Partial cross section
G4int RandomSelect(G4double energy);
//
G4DNABornIonisationModel2 & operator=(const G4DNABornIonisationModel2 &right);
G4DNABornIonisationModel2(const G4DNABornIonisationModel2&);
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4DNABornIonisationModel2::SelectFasterComputation (G4bool input)
{
fasterCode = input;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4DNABornIonisationModel2::SelectStationary (G4bool input)
{
statCode = input;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4DNABornIonisationModel2::SelectSPScaling (G4bool input)
{
spScaling = input;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNADingfelderChargeDecreaseModel.hh 70171 2013-05-24 13:34:18Z gcosmo $
// $Id: G4DNADingfelderChargeDecreaseModel.hh 92859 2015-09-18 07:58:30Z gcosmo $
//
#ifndef G4DNADingfelderChargeDecreaseModel_h
@@ -61,11 +61,16 @@ public:
G4double tmin,
G4double maxEnergy);
inline void SelectStationary(G4bool input);
protected:
G4ParticleChangeForGamma* fParticleChangeForGamma;
private:
G4bool statCode;
// Water density table
const std::vector<G4double>* fpMolWaterDensity;
@@ -114,4 +119,11 @@ private:
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4DNADingfelderChargeDecreaseModel::SelectStationary (G4bool input)
{
statCode = input;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNADingfelderChargeIncreaseModel.hh 70171 2013-05-24 13:34:18Z gcosmo $
// $Id: G4DNADingfelderChargeIncreaseModel.hh 92859 2015-09-18 07:58:30Z gcosmo $
//
#ifndef G4DNADingfelderChargeIncreaseModel_h
@@ -62,18 +62,21 @@ public:
G4double tmin,
G4double maxEnergy);
inline void SelectStationary(G4bool input);
protected:
G4ParticleChangeForGamma* fParticleChangeForGamma;
private:
// Water density table
const std::vector<G4double>* fpMolWaterDensity;
std::map<G4String,G4double,std::less<G4String> > lowEnergyLimit;
std::map<G4String,G4double,std::less<G4String> > highEnergyLimit;
G4bool isInitialised;
G4bool isInitialised, statCode;
G4int verboseLevel;
// Partial cross section
@@ -114,7 +117,14 @@ private:
G4DNADingfelderChargeIncreaseModel(const G4DNADingfelderChargeIncreaseModel&);
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4DNADingfelderChargeIncreaseModel::SelectStationary (G4bool input)
{
statCode = input;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -0,0 +1,127 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// Based on the work described in
// Rad Res 163, 98-111 (2005)
// D. Emfietzoglou, H. Nikjoo
//
// Authors of the class (2014):
// I. Kyriakou (kyriak@cc.uoi.gr)
// D. Emfietzoglou (demfietz@cc.uoi.gr)
// S. Incerti (incerti@cenbg.in2p3.fr)
//
#ifndef G4DNAEmfietzoglouExcitationModel_h
#define G4DNAEmfietzoglouExcitationModel_h 1
#include "G4VEmModel.hh"
#include "G4ParticleChangeForGamma.hh"
#include "G4ProductionCutsTable.hh"
#include "G4DNACrossSectionDataSet.hh"
#include "G4LogLogInterpolation.hh"
#include "G4Electron.hh"
#include "G4Proton.hh"
#include "G4DNAEmfietzoglouWaterExcitationStructure.hh"
#include "G4NistManager.hh"
class G4DNAEmfietzoglouExcitationModel : public G4VEmModel
{
public:
G4DNAEmfietzoglouExcitationModel(const G4ParticleDefinition* p = 0,
const G4String& nam =
"DNAEmfietzoglouExcitationModel");
virtual ~G4DNAEmfietzoglouExcitationModel();
virtual void Initialise(const G4ParticleDefinition*,
const G4DataVector& = *(new G4DataVector()));
virtual G4double CrossSectionPerVolume(const G4Material* material,
const G4ParticleDefinition* p,
G4double ekin,
G4double emin,
G4double emax);
virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double maxEnergy);
inline void SelectStationary(G4bool input);
protected:
G4ParticleChangeForGamma* fParticleChangeForGamma;
private:
G4bool statCode;
// Water density table
const std::vector<G4double>* fpMolWaterDensity;
std::map<G4String, G4double, std::less<G4String> > lowEnergyLimit;
std::map<G4String, G4double, std::less<G4String> > highEnergyLimit;
G4bool isInitialised;
G4int verboseLevel;
// Cross section
typedef std::map<G4String, G4String, std::less<G4String> > MapFile;
MapFile tableFile;
typedef std::map<G4String, G4DNACrossSectionDataSet*, std::less<G4String> > MapData;
MapData tableData;
// Partial cross section
G4int RandomSelect(G4double energy, const G4String& particle);
// Final state
G4DNAEmfietzoglouWaterExcitationStructure waterStructure;
//
G4DNAEmfietzoglouExcitationModel & operator=(const G4DNAEmfietzoglouExcitationModel &right);
G4DNAEmfietzoglouExcitationModel(const G4DNAEmfietzoglouExcitationModel&);
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4DNAEmfietzoglouExcitationModel::SelectStationary (G4bool input)
{
statCode = input;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -0,0 +1,197 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// Based on the work described in
// Rad Res 163, 98-111 (2005)
// D. Emfietzoglou, H. Nikjoo
//
// Authors of the class (2014):
// I. Kyriakou (kyriak@cc.uoi.gr)
// D. Emfietzoglou (demfietz@cc.uoi.gr)
// S. Incerti (incerti@cenbg.in2p3.fr)
//
#ifndef G4DNAEmfietzoglouIonisationModel_h
#define G4DNAEmfietzoglouIonisationModel_h 1
#include "G4VEmModel.hh"
#include "G4ParticleChangeForGamma.hh"
#include "G4ProductionCutsTable.hh"
#include "G4DNACrossSectionDataSet.hh"
#include "G4Electron.hh"
#include "G4Proton.hh"
#include "G4DNAGenericIonsManager.hh"
#include "G4LogLogInterpolation.hh"
#include "G4DNAEmfietzoglouWaterIonisationStructure.hh"
#include "G4VAtomDeexcitation.hh"
#include "G4NistManager.hh"
class G4DNAEmfietzoglouIonisationModel : public G4VEmModel
{
public:
G4DNAEmfietzoglouIonisationModel(const G4ParticleDefinition* p = 0,
const G4String& nam =
"DNAEmfietzoglouIonisationModel");
virtual ~G4DNAEmfietzoglouIonisationModel();
virtual void Initialise(const G4ParticleDefinition*,
const G4DataVector& = *(new G4DataVector()));
virtual G4double CrossSectionPerVolume(const G4Material* material,
const G4ParticleDefinition* p,
G4double ekin,
G4double emin,
G4double emax);
virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double maxEnergy);
double DifferentialCrossSection(G4ParticleDefinition * aParticleDefinition,
G4double k,
G4double energyTransfer,
G4int shell);
inline void SelectFasterComputation(G4bool input);
inline void SelectStationary(G4bool input);
protected:
G4ParticleChangeForGamma* fParticleChangeForGamma;
private:
G4bool fasterCode;
G4bool statCode;
// Water density table
const std::vector<G4double>* fpMolWaterDensity;
// Deexcitation manager to produce fluo photons and e-
G4VAtomDeexcitation* fAtomDeexcitation;
std::map<G4String, G4double, std::less<G4String> > lowEnergyLimit;
std::map<G4String, G4double, std::less<G4String> > highEnergyLimit;
// TODO :
// std::map<const G4ParticleDefinition*,std::pair<G4double,G4double> > fEnergyLimits;
G4bool isInitialised;
G4int verboseLevel;
// Cross section
typedef std::map<G4String, G4String, std::less<G4String> > MapFile;
MapFile tableFile; // useful ?
typedef std::map<G4String, G4DNACrossSectionDataSet*, std::less<G4String> > MapData;
MapData tableData;
// Final state
G4DNAEmfietzoglouWaterIonisationStructure waterStructure;
G4double RandomizeEjectedElectronEnergy(G4ParticleDefinition * aParticleDefinition,
G4double incomingParticleEnergy,
G4int shell);
G4double RandomizeEjectedElectronEnergyFromCumulatedDcs(G4ParticleDefinition * aParticleDefinition,
G4double incomingParticleEnergy,
G4int shell);
G4double RandomTransferedEnergy(G4ParticleDefinition * aParticleDefinition,
G4double incomingParticleEnergy,
G4int shell);
G4double Interpolate(G4double e1,
G4double e2,
G4double e,
G4double xs1,
G4double xs2);
G4double QuadInterpolator(G4double e11,
G4double e12,
G4double e21,
G4double e22,
G4double x11,
G4double x12,
G4double x21,
G4double x22,
G4double t1,
G4double t2,
G4double t,
G4double e);
typedef std::map<double, std::map<double, double> > TriDimensionMap;
TriDimensionMap eDiffCrossSectionData[6];
TriDimensionMap eNrjTransfData[6]; // for cumulated dcs
TriDimensionMap pDiffCrossSectionData[6];
std::vector<double> eTdummyVec;
typedef std::map<double, std::vector<double> > VecMap;
VecMap eVecm;
VecMap eProbaShellMap[6]; // for cumulated dcs
// Partial cross section
G4int RandomSelect(G4double energy, const G4String& particle);
//
G4DNAEmfietzoglouIonisationModel & operator=(const G4DNAEmfietzoglouIonisationModel &right);
G4DNAEmfietzoglouIonisationModel(const G4DNAEmfietzoglouIonisationModel&);
};
inline void G4DNAEmfietzoglouIonisationModel::SelectFasterComputation(G4bool input)
{
fasterCode = input;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4DNAEmfietzoglouIonisationModel::SelectStationary (G4bool input)
{
statCode = input;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -0,0 +1,154 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// Author: H. N. Tran (Ton Duc Thang University)
// p, H, He, He+ and He++ models are assumed identical
// NIMB 343, 132-137 (2015)
//
// The Geant4-DNA web site is available at http://geant4-dna.org
//
#ifndef G4DNAIonElasticModel_h
#define G4DNAIonElasticModel_h 1
#include <map>
#include "G4DNACrossSectionDataSet.hh"
#include "G4VEmModel.hh"
#include "G4Proton.hh"
#include "G4DNAGenericIonsManager.hh"
#include "G4ParticleChangeForGamma.hh"
#include "G4LogLogInterpolation.hh"
#include "G4ProductionCutsTable.hh"
#include "G4NistManager.hh"
class G4DNAIonElasticModel : public G4VEmModel
{
public:
G4DNAIonElasticModel (const G4ParticleDefinition* p = 0,
const G4String& nam ="DNAIonElasticModel");
virtual
~G4DNAIonElasticModel ();
virtual void
Initialise (const G4ParticleDefinition* particuleDefinition,
const G4DataVector&);
virtual G4double
CrossSectionPerVolume (const G4Material* material,
const G4ParticleDefinition* p, G4double ekin,
G4double emin, G4double emax);
virtual void
SampleSecondaries (std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*, const G4DynamicParticle*,
G4double tmin, G4double maxEnergy);
void
SetKillBelowThreshold (G4double threshold);
G4double
GetKillBelowThreshold ()
{
return killBelowEnergy;
}
inline void SelectStationary(G4bool input);
protected:
G4ParticleChangeForGamma* fParticleChangeForGamma;
private:
G4bool statCode;
// Water density table
const std::vector<G4double>* fpMolWaterDensity;
G4double killBelowEnergy;
G4double lowEnergyLimit;
G4double highEnergyLimit;
G4bool isInitialised;
G4int verboseLevel;
G4double fParticle_Mass;
// Cross section
G4DNACrossSectionDataSet* fpTableData;
// Final state
G4double
Theta (G4ParticleDefinition * aParticleDefinition, G4double k,
G4double integrDiff);
G4double
LinLogInterpolate (G4double e1, G4double e2, G4double e, G4double xs1,
G4double xs2);
G4double
LogLogInterpolate (G4double e1, G4double e2, G4double e, G4double xs1,
G4double xs2);
G4double
QuadInterpolator (G4double e11, G4double e12, G4double e21, G4double e22,
G4double x11, G4double x12, G4double x21, G4double x22,
G4double t1, G4double t2, G4double t, G4double e);
G4double
LinLinInterpolate (G4double e1, G4double e2, G4double e, G4double xs1,
G4double xs2);
typedef std::map<double, std::map<double, double> > TriDimensionMap;
TriDimensionMap fDiffCrossSectionData;
std::vector<double> eTdummyVec;
typedef std::map<double, std::vector<double> > VecMap;
VecMap eVecm;
G4double
RandomizeThetaCM (G4double k, G4ParticleDefinition * aParticleDefinition);
//
G4DNAIonElasticModel &
operator= (const G4DNAIonElasticModel &right);
G4DNAIonElasticModel (const G4DNAIonElasticModel&);
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4DNAIonElasticModel::SelectStationary (G4bool input)
{
statCode = input;
}
#endif
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNAMillerGreenExcitationModel.hh 82852 2014-07-14 09:05:25Z gcosmo $
// $Id: G4DNAMillerGreenExcitationModel.hh 92859 2015-09-18 07:58:30Z gcosmo $
//
#ifndef G4DNAMillerGreenExcitationModel_h
@@ -59,17 +59,27 @@ public:
G4double emin,
G4double emax);
virtual G4double GetPartialCrossSection(const G4Material*,
G4int /*level*/,
const G4ParticleDefinition*,
G4double /*kineticEnergy*/);
virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double maxEnergy);
inline void SelectStationary(G4bool input);
protected:
G4ParticleChangeForGamma* fParticleChangeForGamma;
private:
G4bool statCode;
// Water density table
const std::vector<G4double>* fpMolWaterDensity;
@@ -126,4 +136,11 @@ private:
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4DNAMillerGreenExcitationModel::SelectStationary (G4bool input)
{
statCode = input;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNAMolecularStepByStepModel.hh 85244 2014-10-27 08:24:13Z gcosmo $
// $Id: G4DNAMolecularStepByStepModel.hh 94218 2015-11-09 08:24:48Z gcosmo $
//
// Author: Mathieu Karamitros, kara@cenbg.in2p3.fr
@@ -48,11 +48,13 @@
#ifndef G4MOLECULARSTEPBYSTEPMODEL_H
#define G4MOLECULARSTEPBYSTEPMODEL_H
#include "AddClone_def.hh"
#include "G4VITStepModel.hh"
#include "G4DNAMoleculeEncounterStepper.hh"
#include "G4DNAMolecularReaction.hh"
#include "G4DNAMolecularReactionTable.hh"
#include <AddClone_def.hh>
#include <G4String.hh>
#include <G4VITStepModel.hh>
class G4DNAMolecularReactionTable;
class G4VDNAReactionModel;
/**
* G4DNAMolecularStepByStepModel :
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNAMoleculeEncounterStepper.hh 85244 2014-10-27 08:24:13Z gcosmo $
// $Id: G4DNAMoleculeEncounterStepper.hh 91584 2015-07-27 13:01:48Z gcosmo $
//
// Author: Mathieu Karamitros, kara@cenbg.in2p3.fr
@@ -52,6 +52,7 @@
class G4VDNAReactionModel;
class G4DNAMolecularReactionTable;
class G4MolecularConfiguration;
class G4Molecule;
@@ -105,7 +106,7 @@ private:
class Utils
{
public:
Utils(const G4Track& tA, const G4Molecule* mB);
Utils(const G4Track& tA, G4MolecularConfiguration* mB);
~Utils(){;}
G4double GetConstant() const
@@ -114,7 +115,7 @@ private:
}
const G4Track& trackA;
const G4Molecule* moleculeB;
G4MolecularConfiguration* moleculeB;
const G4Molecule* moleculeA;
G4double DA;
G4double DB;
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNAOneStepSolvatationModel.hh 85244 2014-10-27 08:24:13Z gcosmo $
// $Id: G4DNAOneStepThermalizationModel.hh 94218 2015-11-09 08:24:48Z gcosmo $
//
// Author: Mathieu Karamitros, kara@cenbg.in2p3.fr
@@ -44,63 +44,67 @@
// J. Comput. Phys. 274 (2014) 841-882
// Prog. Nucl. Sci. Tec. 2 (2011) 503-508
#ifndef G4DNAOneStepSolvatationModel_
#define G4DNAOneStepSolvatationModel_
#ifndef G4DNAOneStepThermalizationModel_
#define G4DNAOneStepThermalizationModel_
#include "G4VEmModel.hh"
class G4ITNavigator;
/**
* When an electron reaches the highest energy domain of G4DNAOneStepSolvatationModel,
* it is then automatically converted into a solvated electron and displace from its original
* position using a published thermalization statistic.
*
* Article: Jintana Meesungnoen, Jean-Paul Jay-Gerin, Abdelali Filali-Mouhim, and Samlee Mankhetkorn (2002)
* Low-Energy Electron Penetration Range in Liquid Water.
* Radiation Research: November 2002, Vol. 158, No. 5, pp. 657-660.
*/
* When an electron reaches the highest energy domain of G4DNAOneStepThermalizationModel,
* it is then automatically converted into a solvated electron and displace from its original
* position using a published thermalization statistic.
*
* Article: Jintana Meesungnoen, Jean-Paul Jay-Gerin,
* Abdelali Filali-Mouhim, and Samlee Mankhetkorn (2002)
* Low-Energy Electron Penetration Range in Liquid Water.
* Radiation Research: November 2002, Vol. 158, No. 5, pp. 657-660.
*/
class G4DNAOneStepSolvatationModel : public G4VEmModel
class G4DNAOneStepThermalizationModel : public G4VEmModel
{
public :
G4DNAOneStepSolvatationModel(const G4ParticleDefinition* p = 0,
const G4String& nam = "DNASancheSolvatationModel");
virtual ~G4DNAOneStepSolvatationModel();
public:
G4DNAOneStepThermalizationModel(const G4ParticleDefinition* p = 0,
const G4String& nam =
"DNASancheSolvatationModel");
virtual ~G4DNAOneStepThermalizationModel();
virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
virtual G4double CrossSectionPerVolume( const G4Material* material,
const G4ParticleDefinition* p,
G4double ekin,
G4double emin,
G4double emax);
virtual G4double CrossSectionPerVolume(const G4Material* material,
const G4ParticleDefinition* p,
G4double ekin,
G4double emin,
G4double emax);
virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double maxEnergy);
virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double maxEnergy);
inline void SetVerbose(int);
inline void SetVerbose(int);
protected:
// Water density table
const std::vector<G4double>* fpWaterDensity;
const std::vector<G4double>* fpWaterDensity;
G4ThreeVector RadialDistributionOfProducts(G4double Rrms) const ;
G4ParticleChangeForGamma* fParticleChangeForGamma;
G4ThreeVector RadialDistributionOfProducts(G4double Rrms) const;
G4ParticleChangeForGamma* fParticleChangeForGamma;
G4bool fIsInitialised;
G4int fVerboseLevel;
G4bool fIsInitialised;
G4int fVerboseLevel;
G4ITNavigator* fNavigator;
private :
G4DNAOneStepSolvatationModel & operator=(const G4DNAOneStepSolvatationModel &right);
G4DNAOneStepSolvatationModel(const G4DNAOneStepSolvatationModel&);
private:
G4DNAOneStepThermalizationModel&
operator=(const G4DNAOneStepThermalizationModel &right);
G4DNAOneStepThermalizationModel(const G4DNAOneStepThermalizationModel&);
};
inline void G4DNAOneStepSolvatationModel::SetVerbose(int flag)
inline void G4DNAOneStepThermalizationModel::SetVerbose(int flag)
{
fVerboseLevel = flag;
fVerboseLevel = flag;
}
#endif
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNARuddIonisationExtendedModel.hh 81941 2014-06-06 15:50:50Z gcosmo $
// $Id: G4DNARuddIonisationExtendedModel.hh 92859 2015-09-18 07:58:30Z gcosmo $
//
#ifndef G4DNARuddIonisationExtendedModel_h
@@ -67,11 +67,16 @@ public:
G4double tmin,
G4double maxEnergy);
inline void SelectStationary(G4bool input);
protected:
G4ParticleChangeForGamma* fParticleChangeForGamma;
private:
G4bool statCode;
// Water density table
const std::vector<G4double>* fpWaterDensity;
@@ -164,4 +169,11 @@ private:
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4DNARuddIonisationExtendedModel::SelectStationary (G4bool input)
{
statCode = input;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNARuddIonisationModel.hh 81552 2014-06-03 08:28:18Z gcosmo $
// $Id: G4DNARuddIonisationModel.hh 92859 2015-09-18 07:58:30Z gcosmo $
//
#ifndef G4DNARuddIonisationModel_h
@@ -67,11 +67,16 @@ public:
G4double tmin,
G4double maxEnergy);
inline void SelectStationary(G4bool input);
protected:
G4ParticleChangeForGamma* fParticleChangeForGamma;
private:
G4bool statCode;
// Water density table
const std::vector<G4double>* fpWaterDensity;
@@ -155,4 +160,11 @@ private:
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4DNARuddIonisationModel::SelectStationary (G4bool input)
{
statCode = input;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNASancheExcitationModel.hh 70171 2013-05-24 13:34:18Z gcosmo $
// $Id: G4DNASancheExcitationModel.hh 93616 2015-10-27 08:59:17Z gcosmo $
// GEANT4 tag $Name: $
//
@@ -47,32 +47,36 @@ class G4DNASancheExcitationModel : public G4VEmModel
public:
G4DNASancheExcitationModel(const G4ParticleDefinition* p = 0,
const G4String& nam = "DNASancheExcitationModel");
G4DNASancheExcitationModel(const G4ParticleDefinition* p = 0,
const G4String& nam = "DNASancheExcitationModel");
virtual ~G4DNASancheExcitationModel();
virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
virtual G4double CrossSectionPerVolume(const G4Material* material,
const G4ParticleDefinition* p,
G4double ekin,
G4double emin,
G4double emax);
const G4ParticleDefinition* p,
G4double ekin,
G4double emin,
G4double emax);
virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double maxEnergy);
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double maxEnergy);
// Cross section
G4double PartialCrossSection(G4double energy,G4int level);
G4double PartialCrossSection(G4double energy, G4int level);
G4double TotalCrossSection(G4double t);
inline void ExtendLowEnergyLimit (G4double /*threshold*/);
inline void ExtendLowEnergyLimit(G4double /*threshold*/);
inline void SetVerboseLevel(int verbose){verboseLevel = verbose;}
inline void SetVerboseLevel(int verbose)
{
verboseLevel = verbose;
}
protected:
@@ -82,41 +86,47 @@ private:
// Water density table
const std::vector<G4double>* fpWaterDensity;
G4double lowEnergyLimit;
G4double highEnergyLimit;
G4double lowEnergyLimit;
G4double highEnergyLimit;
G4bool isInitialised;
G4int verboseLevel;
// Cross section
G4int RandomSelect(G4double energy);
G4int nLevels;
G4double VibrationEnergy(G4int level);
G4double Sum(G4double k);
G4double LinInterpolate(G4double e1,
G4double e2,
G4double e,
G4double xs1,
G4double xs2);
G4double LinInterpolate(G4double e1,
G4double e2,
G4double e,
G4double xs1,
G4double xs2);
//
typedef std::map<double, std::map<double, double> > TriDimensionMap;
TriDimensionMap map1;
// typedef std::map<double, std::map<double, double> > TriDimensionMap;
// TriDimensionMap map1;
std::vector<double> tdummyVec;
std::vector<std::vector<double>> fEnergyLevelXS;
std::vector<double> fEnergyTotalXS;
//
G4DNASancheExcitationModel & operator=(const G4DNASancheExcitationModel &right);
G4DNASancheExcitationModel(const G4DNASancheExcitationModel&);
G4DNASancheExcitationModel & operator=(const G4DNASancheExcitationModel &right);
G4DNASancheExcitationModel(const G4DNASancheExcitationModel&);
};
inline void G4DNASancheExcitationModel::ExtendLowEnergyLimit (G4double threshold)
{
lowEnergyLimit = threshold;
if (lowEnergyLimit < 2*CLHEP::eV)
G4Exception ("*** WARNING : the G4DNASancheExcitationModel class is not validated below 2 eV !","",JustWarning,"") ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void G4DNASancheExcitationModel::ExtendLowEnergyLimit(G4double threshold)
{
lowEnergyLimit = threshold;
if(lowEnergyLimit < 2 * CLHEP::eV)
G4Exception("*** WARNING : the G4DNASancheExcitationModel class is not "
"validated below 2 eV !",
"", JustWarning, "");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNAScreenedRutherfordElasticModel.hh 70171 2013-05-24 13:34:18Z gcosmo $
// $Id: G4DNAScreenedRutherfordElasticModel.hh 92074 2015-08-17 07:03:46Z gcosmo $
//
#ifndef G4DNAScreenedRutherfordElasticModel_h
@@ -63,11 +63,16 @@ public:
inline void SetKillBelowThreshold (G4double threshold);
G4double GetKillBelowThreshold () { return killBelowEnergy; }
inline void SelectFasterComputation(G4bool input);
protected:
G4ParticleChangeForGamma* fParticleChangeForGamma;
private:
G4bool fasterCode;
// Water density table
const std::vector<G4double>* fpWaterDensity;
@@ -112,6 +117,11 @@ inline void G4DNAScreenedRutherfordElasticModel::SetKillBelowThreshold (G4double
G4Exception ("*** WARNING : the G4DNAScreenedRutherfordElasticModel class is not validated below 9 eV !","",JustWarning,"") ;
}
inline void G4DNAScreenedRutherfordElasticModel::SelectFasterComputation (G4bool input)
{
fasterCode = input;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -0,0 +1,373 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/*
* G4DNASmoluchowskiDiffusion.hh
*
* Created on: 2 févr. 2015
* Author: matkara
*/
#ifndef G4DNASMOLUCHOWSKIDIFFUSION_HH_
#define G4DNASMOLUCHOWSKIDIFFUSION_HH_
//#if __cplusplus >= 201103L
#include <cstdlib>
#include <cmath>
#include <vector>
#include <iostream>
#include <algorithm>
//#define DNADEV_TEST
#ifdef DNADEV_TEST
#include <TF1.h>
#endif
#include <cassert>
#ifndef DNADEV_TEST
#include "globals.hh"
#include "Randomize.hh"
#endif
#ifdef DNADEV_TEST
#include "TRandom.h"
TRandom root_random;
double G4UniformRand()
{
return root_random.Rndm();
}
#define G4cout std::cout
#define G4endl std::endl
#endif
class G4DNASmoluchowskiDiffusion
{
public:
G4DNASmoluchowskiDiffusion(double epsilon = 1e-5);
virtual ~G4DNASmoluchowskiDiffusion();
static double ComputeS(double r, double D, double t)
{
double sTransform = r / (2. * std::sqrt(D * t));
return sTransform;
}
static double ComputeDistance(double sTransform, double D, double t)
{
return sTransform * 2. * std::sqrt(D * t);
}
static double ComputeTime(double sTransform, double D, double r)
{
return std::pow(r / sTransform, 2.) / (4. * D);
}
//====================================================
double GetRandomDistance(double _time, double D)
{
double proba = G4UniformRand();
// G4cout << "proba = " << proba << G4endl;
double sTransform = GetInverseProbability(proba);
// G4cout << "sTransform = " << sTransform << G4endl;
return ComputeDistance(sTransform, D, _time);
}
double GetRandomTime(double distance, double D)
{
double proba = G4UniformRand();
double sTransform = GetInverseProbability(proba);
return ComputeTime(sTransform, D, distance);
}
double EstimateCrossingTime(double proba,
double distance,
double D)
{
double sTransform = GetInverseProbability(proba);
return ComputeTime(sTransform, D, distance);
}
//====================================================
// 1-value transformation
// WARNING : this is NOT the differential probability
// this is the derivative of the function GetCumulativeProbability
static double GetDifferential(double sTransform)
{
static double constant = -4./std::sqrt(3.141592653589793);
return sTransform*sTransform*std::exp(-sTransform*sTransform)*constant; // -4*sTransform*sTransform*exp(-sTransform*sTransform)/sqrt(3.141592653589793)
}
static double GetDensityProbability(double r, double _time, double D)
{
static double my_pi = 3.141592653589793;
static double constant = 4.*my_pi/std::pow(4.*my_pi, 1.5);
return r*r/std::pow(D * _time,1.5)*std::exp(-r*r/(4. * D * _time))*constant;
}
//====================================================
// BOUNDING BOX
struct BoundingBox
{
double fXmax;
double fXmin;
double fXmaxDef;
double fXminDef;
double fToleranceY;
double fSum;
double fIncreasingCumulativeFunction;
enum PreviousAction
{
IncreaseProba,
DecreaseProba,
Undefined
};
PreviousAction fPreviousAction;
BoundingBox(double xmin,
double xmax,
double toleranceY) :
fXmax(xmax), fXmin(xmin),
fToleranceY(toleranceY),
fSum(0)
{
if(fXmax < fXmin)
{
double tmp = fXmin;
fXmin = fXmax;
fXmax = tmp;
}
fXminDef = fXmin;
fXmaxDef = fXmax;
fPreviousAction = BoundingBox::Undefined;
fIncreasingCumulativeFunction = (GetCumulativeProbability(fXmax) - GetCumulativeProbability(fXmin))/(fXmax-fXmin);
}
void Print()
{
G4cout << "fXmin: " << fXmin << " | fXmax: " << fXmax << G4endl;
}
bool Propose(double proposedXValue,
double proposedProba,
double nextProba,
double& returnedValue)
{
// G4cout << "---------------------------" << G4endl;
// G4cout << "Proposed x value: " << proposedXValue
// << "| proposedProba: " << proposedProba
// << "| nextProba: " << nextProba
// << " | fXmin: " << fXmin << " (" << G4DNASmoluchowskiDiffusion::GetCumulativeProbability(fXmin) <<")"
// << " | fXmax: " << fXmax << " (" << G4DNASmoluchowskiDiffusion::GetCumulativeProbability(fXmax) <<")"
// << G4endl;
bool returnFlag = false;
if(proposedProba < nextProba-fToleranceY) // proba trop petite ==> augmente
{
// G4cout << "proposedProba < nextProba-fToleranceY" << G4endl;
if(fIncreasingCumulativeFunction > 0) // croissant
{
if(proposedXValue > fXmin)
fXmin = proposedXValue;
}
else if(fIncreasingCumulativeFunction < 0) // decroissant
{
if(proposedXValue < fXmax)
fXmax = proposedXValue;
}
returnedValue = (fXmax + fXmin)/2;
returnFlag = false;
fPreviousAction = BoundingBox::IncreaseProba;
}
else if(proposedProba > nextProba+fToleranceY) // proba trop grande
{
// G4cout << "proposedProba > nextProba+fToleranceY" << G4endl;
if(fIncreasingCumulativeFunction>0)
{
if(proposedXValue < fXmax)
fXmax = proposedXValue;
}
else if(fIncreasingCumulativeFunction<0)
{
if(proposedXValue > fXmin)
{
fXmin = proposedXValue;
}
}
returnedValue = (fXmax + fXmin)/2;
returnFlag = false;
fPreviousAction = BoundingBox::DecreaseProba;
}
else
{
// G4cout << "IN THE INTERVAL !! : " << nextProba << G4endl;
fSum = proposedProba;
// Assuming search for next proba is increasing
if(fIncreasingCumulativeFunction<0)
{
fXmin = fXminDef;
fXmax = proposedXValue;
}
else if(fIncreasingCumulativeFunction>0)
{
fXmin = proposedXValue;
fXmax = fXmaxDef;
}
returnFlag = true;
fPreviousAction = BoundingBox::Undefined;
}
return returnFlag;
}
};
// END OF BOUNDING BOX
//==============================
void PrepareReverseTable(double xmin, double xmax)
{
double x = xmax;
int index = 0;
double nextProba = fEpsilon;
double proposedX;
BoundingBox boundingBox(xmin, xmax, fEpsilon*1e-5);
while(index <= fNbins)
// in case GetCumulativeProbability is exact (digitally speaking), replace with:
// while(index <= fNbins+1)
{
nextProba = fEpsilon*index;
double newProba = GetCumulativeProbability(x);
if(boundingBox.Propose(x, newProba, nextProba, proposedX))
{
fInverse[index] = x;
index++;
}
else
{
if(x == proposedX)
{
G4cout << "BREAK : x= " << x << G4endl;
G4cout << "index= " << index << G4endl;
G4cout << "nextProba= " << nextProba << G4endl;
G4cout << "newProba= " << newProba << G4endl;
abort();
}
x = proposedX;
}
}
fInverse[fNbins+1] = 0; // P(1) = 0, because we want it exact !
// Tips to improve the exactness: get an better value of pi, get better approximation of erf and exp, use long double instead of double
// boundingBox.Print();
}
static double GetCumulativeProbability(double sTransform)
{
static double constant = 2./std::sqrt(3.141592653589793);
return erfc(sTransform) + constant*sTransform*std::exp(-sTransform*sTransform);
}
double GetInverseProbability(double proba) // returns sTransform
{
size_t index_low = (size_t) trunc(proba/fEpsilon);
if(index_low == 0) // assymptote en 0
{
index_low = 1;
size_t index_up = 2;
double low_y = fInverse[index_low];
double up_y = fInverse[index_up];
double low_x = index_low*fEpsilon;
double up_x = proba+fEpsilon;
double tangente = (low_y-up_y)/(low_x - up_x); // ou utiliser GetDifferential(proba) ?
// double tangente = GetDifferential(proba);
return low_y + tangente*(proba-low_x);
}
size_t index_up = index_low+1;
if(index_low > fInverse.size()) return fInverse.back();
double low_y = fInverse[index_low];
double up_y = fInverse[index_up];
double low_x = index_low*fEpsilon;
double up_x = low_x+fEpsilon;
if(up_x > 1) // P(1) = 0
{
up_x = 1;
up_y = 0; // more general : fInverse.back()
}
double tangente = (low_y-up_y)/(low_x - up_x);
return low_y + tangente*(proba-low_x);
}
double PlotInverse(double* x, double* )
{
return GetInverseProbability(x[0]);
}
double Plot(double* x, double* )
{
return GetDifferential(x[0]);
}
void InitialiseInverseProbability(double xmax = 3e28)
{
// x > x'
// P'(x) = p(x') = lim(x->x') (P(x') - P(x))/(x'-x)
// x'-x = (P(x') - P(x))/p(x')
// x = x' - (P(x') - P(x))/p(x')
// fInverse initialized in the constructor
assert(fNbins !=0);
PrepareReverseTable(0,xmax);
}
std::vector<double> fInverse;
int fNbins;
double fEpsilon;
};
#endif /* SOURCE_PROCESSES_ELECTROMAGNETIC_DNA_MODELS_G4DNASMOLUCHOWSKIDIFFUSION_HH_ */
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNASmoluchowskiReactionModel.hh 85244 2014-10-27 08:24:13Z gcosmo $
// $Id: G4DNASmoluchowskiReactionModel.hh 91584 2015-07-27 13:01:48Z gcosmo $
//
// Author: Mathieu Karamitros, kara@cenbg.in2p3.fr
@@ -74,9 +74,10 @@ public :
G4IT_ADD_CLONE(G4VDNAReactionModel, G4DNASmoluchowskiReactionModel)
virtual void Initialise(const G4Molecule*, const G4Track&) ;
virtual void InitialiseToPrint(const G4Molecule*) ;
virtual G4double GetReactionRadius(const G4Molecule*, const G4Molecule*);
virtual void Initialise(G4MolecularConfiguration*, const G4Track&) ;
virtual void InitialiseToPrint(G4MolecularConfiguration*) ;
virtual G4double GetReactionRadius(G4MolecularConfiguration*,
G4MolecularConfiguration*);
virtual G4double GetReactionRadius(const G4int);
virtual G4bool FindReaction(const G4Track&,
@@ -0,0 +1,124 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
#ifndef G4DNAUeharaScreenedRutherfordElasticModel_h
#define G4DNAUeharaScreenedRutherfordElasticModel_h 1
#include <CLHEP/Units/SystemOfUnits.h>
#include "G4VEmModel.hh"
#include "G4ParticleChangeForGamma.hh"
#include "G4ProductionCutsTable.hh"
#include "G4NistManager.hh"
class G4DNAUeharaScreenedRutherfordElasticModel : public G4VEmModel
{
public:
G4DNAUeharaScreenedRutherfordElasticModel(const G4ParticleDefinition* p = 0,
const G4String& nam = "DNAUeharaScreenedRutherfordElasticModel");
virtual ~G4DNAUeharaScreenedRutherfordElasticModel();
virtual void Initialise(const G4ParticleDefinition*, const G4DataVector&);
virtual G4double CrossSectionPerVolume(const G4Material* material,
const G4ParticleDefinition* p,
G4double ekin,
G4double emin,
G4double emax);
virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin,
G4double maxEnergy);
inline void SetKillBelowThreshold (G4double threshold);
G4double GetKillBelowThreshold () { return killBelowEnergy; }
inline void SelectFasterComputation(G4bool input);
protected:
G4ParticleChangeForGamma* fParticleChangeForGamma;
private:
G4bool fasterCode;
// Water density table
const std::vector<G4double>* fpWaterDensity;
G4double killBelowEnergy;
G4double lowEnergyLimit;
G4double intermediateEnergyLimit;
G4double highEnergyLimit;
G4bool isInitialised;
G4int verboseLevel;
// Cross section
G4double RutherfordCrossSection(G4double energy, G4double z);
G4double ScreeningFactor(G4double energy, G4double z);
// Final state according to Brenner & Zaider
G4double BrennerZaiderRandomizeCosTheta(G4double k);
G4double CalculatePolynomial(G4double k, std::vector<G4double>& vec);
std::vector<G4double> betaCoeff;
std::vector<G4double> deltaCoeff;
std::vector<G4double> gamma035_10Coeff;
std::vector<G4double> gamma10_100Coeff;
std::vector<G4double> gamma100_200Coeff;
// Final state according to Screened Rutherford
G4double ScreenedRutherfordRandomizeCosTheta(G4double k, G4double z);
//
G4DNAUeharaScreenedRutherfordElasticModel & operator=(const G4DNAUeharaScreenedRutherfordElasticModel &right);
G4DNAUeharaScreenedRutherfordElasticModel(const G4DNAUeharaScreenedRutherfordElasticModel&);
};
inline void G4DNAUeharaScreenedRutherfordElasticModel::SetKillBelowThreshold (G4double threshold)
{
killBelowEnergy = threshold;
if (threshold < 9*CLHEP::eV)
G4Exception ("*** WARNING : the G4DNAUeharaScreenedRutherfordElasticModel class is not validated below 9 eV !","",JustWarning,"") ;
}
inline void G4DNAUeharaScreenedRutherfordElasticModel::SelectFasterComputation (G4bool input)
{
fasterCode = input;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -28,13 +28,12 @@
#include <string>
using namespace std;
class G4LEPTSDiffXS {
public:
G4LEPTSDiffXS( string); // Constructor
G4LEPTSDiffXS(std::string); // Constructor
void readDXS(); // Read file
void BuildCDXS();
@@ -51,7 +50,7 @@ public:
}
private:
string fileName;
std::string fileName;
int NumAng;
int INumAng;
int NumEn;
@@ -32,8 +32,6 @@
#include <stdio.h>
#include <string>
#include <iostream>
using namespace std;
class G4LEPTSDistribution {
@@ -33,7 +33,7 @@
#include <string>
#include <iostream>
#include <map>
using namespace std;
class G4LEPTSDistribution;
typedef std::map<G4double, G4LEPTSDistribution*> mddist;
typedef std::map<G4double, mddist > mdmddist;
@@ -43,7 +43,7 @@ class G4LEPTSElossDistr {
public:
G4LEPTSElossDistr( string); // Constructor
G4LEPTSElossDistr(std::string); // Constructor
void ReadFile(); // Read file
G4double Sample( G4double, G4double);
@@ -54,7 +54,7 @@ public:
private:
mdmddist theDistributions; // Energy , angle , distribution
G4int theNDistributions;
string fileName;
std::string fileName;
int NoBins;
#define NMAX 20000
G4bool bFileFound;
@@ -0,0 +1,161 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#ifndef G4VDNAPTBMODEL_HH
#define G4VDNAPTBMODEL_HH
#include "G4VEmModel.hh"
#include "G4DNACrossSectionDataSet.hh"
#include "G4DNAMolecularMaterial.hh"
#include "G4LogLogInterpolation.hh"
#include "G4ParticleTable.hh"
class G4VDNAPTBModel : public G4VEmModel
{
public:
G4VDNAPTBModel(const G4String& nam, const G4String& applyToMaterial);
virtual ~G4VDNAPTBModel();
// ***********************
// Initialisation
// ***********************
virtual void Initialise(const G4ParticleDefinition* particle,
const G4DataVector& cuts) =0;
G4bool IsMaterialDefine(const G4String& materialName);
G4bool IsParticleExistingInModel(const G4String& particleName);
G4bool IsMaterialExistingInModelForParticle(const G4String& particleName, const G4String& materialName);
void SetHighELimit(const G4String& material, const G4String& particle, G4double lim) {fHighEnergyLimits[particle][material]=lim;}
void SetLowELimit(const G4String& material, const G4String& particle, G4double lim) {fLowEnergyLimits[particle][material]=lim;}
G4double GetHighELimit(const G4String& material, const G4String& particle) {return fHighEnergyLimits[particle][material];}
G4double GetLowELimit(const G4String& material, const G4String& particle) {return fLowEnergyLimits[particle][material];}
// ***********************
// Runtime
// ***********************
virtual G4double CrossSectionPerVolume(const G4Material* material,
const G4ParticleDefinition* p,
G4double ekin,
G4double emin,
G4double emax) = 0;
virtual void SampleSecondaries(std::vector<G4DynamicParticle*>*,
const G4MaterialCutsCouple*,
const G4DynamicParticle*,
G4double tmin = 0,
G4double tmax = DBL_MAX) = 0;
G4double GetHighELimit(const G4Material* material) {return fHighEnergyLimitsRuntime.at(material->GetIndex() );}
G4double GetLowELimit(const G4Material* material) {return fLowEnergyLimitsRuntime.at(material->GetIndex() );}
void SetHighELimit(const G4Material* material, G4double lim) {fHighEnergyLimitsRuntime[material->GetIndex()]=lim;}
void SetLowELimit(const G4Material* material, G4double lim) {fLowEnergyLimitsRuntime[material->GetIndex()]=lim;}
protected:
// ***********************
// Initialisation variables
// ***********************
typedef std::map<G4String, std::map<G4String,G4DNACrossSectionDataSet*, std::less<G4String> > > TableMapData;
const G4String fStringOfMaterials;
TableMapData fTableData;
struct MaterialData
{
MaterialData(const G4String& mat, const G4String& particule, const G4String& CSFile,
const G4String& diffCSFile, G4double scaleFactor) :
fMaterial(mat),
fParticle(particule),
fCSFile(CSFile),
fDiffCSFile(diffCSFile),
fScaleFactor(scaleFactor)
{
}
G4String fMaterial; // materials that can be activated (and will be by default) within the model
G4String fParticle; // particles that can be activated within the model
G4String fCSFile; // cross section data files
G4String fDiffCSFile; // differential corss section data files
G4double fScaleFactor; // model scale factors (they could change with material)
};
std::vector<MaterialData> fModelMaterialData;
// Initisation energy limits
std::map<G4String, std::map<G4String, G4double> > fLowEnergyLimits; // List the low energy limits
std::map<G4String, std::map<G4String, G4double> > fHighEnergyLimits; // List the high energy limits
// ***********************
// Runtime variables
// ***********************
// This vector has the same index as G4MaterialTable. If a material is within G4MaterialTable but not declared in the current model, then
// this vector registered a nullptr.
std::map<G4int, G4DNACrossSectionDataSet*> fTableDataRuntime;
// We do not need the particule id since every model instance is associated to one particle
std::map<G4int, G4double> fLowEnergyLimitsRuntime;
std::map<G4int, G4double> fHighEnergyLimitsRuntime;
// ***********************
// Methods
// ***********************
TableMapData* GetTableData(){return &fTableData;}
G4DNACrossSectionDataSet* GetSigmaData(const G4Material* material) {return fTableDataRuntime.at(material->GetIndex() );}
std::vector<G4String> BuildApplyToMatVect(const G4String& materials);
void ReadAndSaveCSFile(const G4String& materialName, const G4String& particleName, const G4String& file, G4double scaleFactor);
G4int RandomSelectShell(G4double k, const G4Material* material);
void AddCrossSectionData(const G4String& materialName, const G4String& particleName, const G4String& fileCS, const G4String& fileDiffCS, G4double scaleFactor);
void AddCrossSectionData(const G4String& materialName, const G4String& particleName, const G4String& fileCS, G4double scaleFactor);
void LoadCrossSectionData(const G4String& particleName);
virtual void ReadDiffCSFile(const G4String& materialName,
const G4String& particleName,
const G4String& path,
const G4double scaleFactor);
void EnableForMaterialAndParticle(const G4String& materialName, const G4String& particleName);
};
#endif // G4VDNAPTBMODEL_HH
@@ -41,8 +41,6 @@
#include "G4EnergyLossTables.hh"
#include "G4UnitsTable.hh"
#include <iostream>
using namespace std;
#include "G4LEPTSDiffXS.hh"
#include "G4LEPTSDistribution.hh"
@@ -11,7 +11,7 @@
#
# Generated on : 24/9/2010
#
# $Id: sources.cmake 85423 2014-10-29 08:22:38Z gcosmo $
# $Id: sources.cmake 93936 2015-11-04 09:37:59Z gcosmo $
#
#------------------------------------------------------------------------------
@@ -51,11 +51,19 @@ GEANT4_DEFINE_MODULE(NAME G4emdna-models
HEADERS
G4DNABornAngle.hh
G4DNABornExcitationModel.hh
G4DNABornExcitationModel1.hh
G4DNABornExcitationModel2.hh
G4DNABornIonisationModel.hh
G4DNABornIonisationModel1.hh
G4DNABornIonisationModel2.hh
G4DNAChampionElasticModel.hh
G4DNASmoluchowskiDiffusion.hh
G4DNASmoluchowskiReactionModel.hh
G4DNADingfelderChargeDecreaseModel.hh
G4DNADingfelderChargeIncreaseModel.hh
G4DNAEmfietzoglouExcitationModel.hh
G4DNAEmfietzoglouIonisationModel.hh
G4DNAIonElasticModel.hh
G4DNAMeltonAttachmentModel.hh
G4DNAMillerGreenExcitationModel.hh
G4DNAMolecularReaction.hh
@@ -65,9 +73,10 @@ GEANT4_DEFINE_MODULE(NAME G4emdna-models
G4DNARuddIonisationExtendedModel.hh
G4DNARuddIonisationModel.hh
G4DNASancheExcitationModel.hh
G4DNAOneStepSolvatationModel.hh
G4DNAOneStepThermalizationModel.hh
G4DNAScreenedRutherfordElasticModel.hh
G4DNATransformElectronModel.hh
G4DNAUeharaScreenedRutherfordElasticModel.hh
G4LEPTSAttachmentModel.hh
G4LEPTSDissociationModel.hh
G4LEPTSElasticModel.hh
@@ -80,14 +89,21 @@ GEANT4_DEFINE_MODULE(NAME G4emdna-models
G4LEPTSDistribution.hh
G4LEPTSElossDistr.hh
G4LEPTSExcitationModel.hh
G4VDNAPTBModel.hh
SOURCES
G4DNABornAngle.cc
G4DNABornExcitationModel.cc
G4DNABornIonisationModel.cc
G4DNABornExcitationModel1.cc
G4DNABornExcitationModel2.cc
G4DNABornIonisationModel1.cc
G4DNABornIonisationModel2.cc
G4DNAChampionElasticModel.cc
G4DNASmoluchowskiDiffusion.cc
G4DNASmoluchowskiReactionModel.cc
G4DNADingfelderChargeDecreaseModel.cc
G4DNADingfelderChargeIncreaseModel.cc
G4DNAEmfietzoglouExcitationModel.cc
G4DNAEmfietzoglouIonisationModel.cc
G4DNAIonElasticModel.cc
G4DNAMeltonAttachmentModel.cc
G4DNAMillerGreenExcitationModel.cc
G4DNAMolecularReaction.cc
@@ -97,9 +113,10 @@ GEANT4_DEFINE_MODULE(NAME G4emdna-models
G4DNARuddIonisationExtendedModel.cc
G4DNARuddIonisationModel.cc
G4DNASancheExcitationModel.cc
G4DNAOneStepSolvatationModel.cc
G4DNAOneStepThermalizationModel.cc
G4DNAScreenedRutherfordElasticModel.cc
G4DNATransformElectronModel.cc
G4DNAUeharaScreenedRutherfordElasticModel.cc
G4LEPTSElossDistr.cc
G4LEPTSAttachmentModel.cc
G4LEPTSDissociationModel.cc
@@ -112,7 +129,7 @@ GEANT4_DEFINE_MODULE(NAME G4emdna-models
G4VLEPTSModel.cc
G4LEPTSExcitationModel.cc
G4LEPTSDiffXS.cc
G4VDNAPTBModel.cc
GRANULAR_DEPENDENCIES
G4baryons
G4bosons
@@ -1,334 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNABornExcitationModel.cc 87137 2014-11-25 09:12:48Z gcosmo $
//
#include "G4DNABornExcitationModel.hh"
#include "G4SystemOfUnits.hh"
#include "G4DNAChemistryManager.hh"
#include "G4DNAMolecularMaterial.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
using namespace std;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4DNABornExcitationModel::G4DNABornExcitationModel(const G4ParticleDefinition*,
const G4String& nam) :
G4VEmModel(nam), isInitialised(false)
{
// nistwater = G4NistManager::Instance()->FindOrBuildMaterial("G4_WATER");
fpMolWaterDensity = 0;
verboseLevel = 0;
// Verbosity scale:
// 0 = nothing
// 1 = warning for energy non-conservation
// 2 = details of energy budget
// 3 = calculation of cross sections, file openings, sampling of atoms
// 4 = entering in methods
if (verboseLevel > 0)
{
G4cout << "Born excitation model is constructed " << G4endl;
}
fParticleChangeForGamma = 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4DNABornExcitationModel::~G4DNABornExcitationModel()
{
// Cross section
std::map<G4String, G4DNACrossSectionDataSet*, std::less<G4String> >::iterator pos;
for (pos = tableData.begin(); pos != tableData.end(); ++pos)
{
G4DNACrossSectionDataSet* table = pos->second;
delete table;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4DNABornExcitationModel::Initialise(const G4ParticleDefinition* particle,
const G4DataVector& /*cuts*/)
{
if (verboseLevel > 3)
G4cout << "Calling G4DNABornExcitationModel::Initialise()" << G4endl;
G4String fileElectron("dna/sigma_excitation_e_born");
G4String fileProton("dna/sigma_excitation_p_born");
G4ParticleDefinition* electronDef = G4Electron::ElectronDefinition();
G4ParticleDefinition* protonDef = G4Proton::ProtonDefinition();
G4String electron;
G4String proton;
G4double scaleFactor = (1.e-22 / 3.343) * m*m;
// *** ELECTRON
electron = electronDef->GetParticleName();
tableFile[electron] = fileElectron;
lowEnergyLimit[electron] = 9. * eV;
highEnergyLimit[electron] = 1. * MeV;
// Cross section
G4DNACrossSectionDataSet* tableE = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor );
tableE->LoadData(fileElectron);
tableData[electron] = tableE;
// *** PROTON
proton = protonDef->GetParticleName();
tableFile[proton] = fileProton;
lowEnergyLimit[proton] = 500. * keV;
highEnergyLimit[proton] = 100. * MeV;
// Cross section
G4DNACrossSectionDataSet* tableP = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor );
tableP->LoadData(fileProton);
tableData[proton] = tableP;
//
if (particle==electronDef)
{
SetLowEnergyLimit(lowEnergyLimit[electron]);
SetHighEnergyLimit(highEnergyLimit[electron]);
}
if (particle==protonDef)
{
SetLowEnergyLimit(lowEnergyLimit[proton]);
SetHighEnergyLimit(highEnergyLimit[proton]);
}
if( verboseLevel>0 )
{
G4cout << "Born excitation model is initialized " << G4endl
<< "Energy range: "
<< LowEnergyLimit() / eV << " eV - "
<< HighEnergyLimit() / keV << " keV for "
<< particle->GetParticleName()
<< G4endl;
}
// Initialize water density pointer
fpMolWaterDensity = G4DNAMolecularMaterial::Instance()->GetNumMolPerVolTableFor(G4Material::GetMaterial("G4_WATER"));
if (isInitialised)
{ return;}
fParticleChangeForGamma = GetParticleChangeForGamma();
isInitialised = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4DNABornExcitationModel::CrossSectionPerVolume(const G4Material* material,
const G4ParticleDefinition* particleDefinition,
G4double ekin,
G4double,
G4double)
{
if (verboseLevel > 3)
G4cout << "Calling CrossSectionPerVolume() of G4DNABornExcitationModel"
<< G4endl;
if (
particleDefinition != G4Proton::ProtonDefinition()
&&
particleDefinition != G4Electron::ElectronDefinition()
)
return 0;
// Calculate total cross section for model
G4double lowLim = 0;
G4double highLim = 0;
G4double sigma=0;
G4double waterDensity = (*fpMolWaterDensity)[material->GetIndex()];
if(waterDensity!= 0.0)
// if (material == nistwater || material->GetBaseMaterial() == nistwater)
{
const G4String& particleName = particleDefinition->GetParticleName();
std::map< G4String,G4double,std::less<G4String> >::iterator pos1;
pos1 = lowEnergyLimit.find(particleName);
if (pos1 != lowEnergyLimit.end())
{
lowLim = pos1->second;
}
std::map< G4String,G4double,std::less<G4String> >::iterator pos2;
pos2 = highEnergyLimit.find(particleName);
if (pos2 != highEnergyLimit.end())
{
highLim = pos2->second;
}
if (ekin >= lowLim && ekin < highLim)
{
std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos;
pos = tableData.find(particleName);
if (pos != tableData.end())
{
G4DNACrossSectionDataSet* table = pos->second;
if (table != 0)
{
sigma = table->FindValue(ekin);
}
}
else
{
G4Exception("G4DNABornExcitationModel::CrossSectionPerVolume","em0002",
FatalException,"Model not applicable to particle type.");
}
}
if (verboseLevel > 2)
{
G4cout << "__________________________________" << G4endl;
G4cout << "=== G4DNABornExcitationModel - XS INFO START" << G4endl;
G4cout << "=== Kinetic energy(eV)=" << ekin/eV << " particle : " << particleName << G4endl;
G4cout << "=== Cross section per water molecule (cm^2)=" << sigma/cm/cm << G4endl;
G4cout << "=== Cross section per water molecule (cm^-1)=" << sigma*waterDensity/(1./cm) << G4endl;
// G4cout << " - Cross section per water molecule (cm^-1)=" << sigma*material->GetAtomicNumDensityVector()[1]/(1./cm) << G4endl;
G4cout << "=== G4DNABornExcitationModel - XS INFO END" << G4endl;
}
} // if (waterMaterial)
return sigma*waterDensity;
// return sigma*material->GetAtomicNumDensityVector()[1];
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4DNABornExcitationModel::SampleSecondaries(std::vector<G4DynamicParticle*>* /*fvect*/,
const G4MaterialCutsCouple* /*couple*/,
const G4DynamicParticle* aDynamicParticle,
G4double,
G4double)
{
if (verboseLevel > 3)
G4cout << "Calling SampleSecondaries() of G4DNABornExcitationModel" << G4endl;
G4double k = aDynamicParticle->GetKineticEnergy();
const G4String& particleName = aDynamicParticle->GetDefinition()->GetParticleName();
G4int level = RandomSelect(k,particleName);
G4double excitationEnergy = waterStructure.ExcitationEnergy(level);
G4double newEnergy = k - excitationEnergy;
if (newEnergy > 0)
{
fParticleChangeForGamma->ProposeMomentumDirection(aDynamicParticle->GetMomentumDirection());
fParticleChangeForGamma->SetProposedKineticEnergy(newEnergy);
fParticleChangeForGamma->ProposeLocalEnergyDeposit(excitationEnergy);
}
const G4Track * theIncomingTrack = fParticleChangeForGamma->GetCurrentTrack();
G4DNAChemistryManager::Instance()->CreateWaterMolecule(eExcitedMolecule,
level,
theIncomingTrack);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4int G4DNABornExcitationModel::RandomSelect(G4double k,
const G4String& particle)
{
G4int level = 0;
std::map<G4String, G4DNACrossSectionDataSet*, std::less<G4String> >::iterator pos;
pos = tableData.find(particle);
if (pos != tableData.end())
{
G4DNACrossSectionDataSet* table = pos->second;
if (table != 0)
{
G4double* valuesBuffer = new G4double[table->NumberOfComponents()];
const size_t n(table->NumberOfComponents());
size_t i(n);
G4double value = 0.;
while (i > 0)
{
i--;
valuesBuffer[i] = table->GetComponent(i)->FindValue(k);
value += valuesBuffer[i];
}
value *= G4UniformRand();
i = n;
while (i > 0)
{
i--;
if (valuesBuffer[i] > value)
{
delete[] valuesBuffer;
return i;
}
value -= valuesBuffer[i];
}
if (valuesBuffer) delete[] valuesBuffer;
}
}
else
{
G4Exception("G4DNABornExcitationModel::RandomSelect", "em0002",
FatalException, "Model not applicable to particle type.");
}
return level;
}
@@ -0,0 +1,272 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNABornExcitationModel1.cc 90054 2015-05-11 18:47:32Z matkara $
//
#include "G4DNABornExcitationModel1.hh"
#include "G4SystemOfUnits.hh"
#include "G4DNAChemistryManager.hh"
#include "G4DNAMolecularMaterial.hh"
#include <map>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
using namespace std;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4DNABornExcitationModel1::G4DNABornExcitationModel1(const G4ParticleDefinition*,
const G4String& nam) :
G4VEmModel(nam), isInitialised(false), fTableData(0)
{
fpMolWaterDensity = 0;
fHighEnergy = 0;
fLowEnergy = 0;
fParticleDefinition = 0;
verboseLevel = 0;
// Verbosity scale:
// 0 = nothing
// 1 = warning for energy non-conservation
// 2 = details of energy budget
// 3 = calculation of cross sections, file openings, sampling of atoms
// 4 = entering in methods
if (verboseLevel > 0)
{
G4cout << "Born excitation model is constructed " << G4endl;
}
fParticleChangeForGamma = 0;
// Selection of stationary mode
statCode = false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4DNABornExcitationModel1::~G4DNABornExcitationModel1()
{
// Cross section
if (fTableData)
delete fTableData;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4DNABornExcitationModel1::Initialise(const G4ParticleDefinition* particle,
const G4DataVector& /*cuts*/)
{
if (verboseLevel > 3)
{
G4cout << "Calling G4DNABornExcitationModel1::Initialise()" << G4endl;
}
if(fParticleDefinition != 0 && fParticleDefinition != particle)
{
G4Exception("G4DNABornExcitationModel1::Initialise","em0001",
FatalException,"Model already initialized for another particle type.");
}
fParticleDefinition = particle;
if(particle->GetParticleName() == "e-")
{
fTableFile = "dna/sigma_excitation_e_born";
fLowEnergy = 9*eV;
fHighEnergy = 1*MeV;
}
else if(particle->GetParticleName() == "proton")
{
fTableFile = "dna/sigma_excitation_p_born";
fLowEnergy = 500. * keV;
fHighEnergy = 100. * MeV;
}
SetLowEnergyLimit(fLowEnergy);
SetHighEnergyLimit(fHighEnergy);
G4double scaleFactor = (1.e-22 / 3.343) * m*m;
fTableData = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor );
fTableData->LoadData(fTableFile);
if( verboseLevel>0 )
{
G4cout << "Born excitation model is initialized " << G4endl
<< "Energy range: "
<< LowEnergyLimit() / eV << " eV - "
<< HighEnergyLimit() / keV << " keV for "
<< particle->GetParticleName()
<< G4endl;
}
// Initialize water density pointer
fpMolWaterDensity = G4DNAMolecularMaterial::Instance()->GetNumMolPerVolTableFor(G4Material::GetMaterial("G4_WATER"));
if (isInitialised)
{ return;}
fParticleChangeForGamma = GetParticleChangeForGamma();
isInitialised = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4DNABornExcitationModel1::CrossSectionPerVolume(const G4Material* material,
const G4ParticleDefinition* particleDefinition,
G4double ekin,
G4double,
G4double)
{
if (verboseLevel > 3)
{
G4cout << "Calling CrossSectionPerVolume() of G4DNABornExcitationModel1"
<< G4endl;
}
if(particleDefinition != fParticleDefinition) return 0;
// Calculate total cross section for model
G4double sigma=0;
G4double waterDensity = (*fpMolWaterDensity)[material->GetIndex()];
if(waterDensity!= 0.0)
{
if (ekin >= fLowEnergy && ekin < fHighEnergy)
{
sigma = fTableData->FindValue(ekin);
}
if (verboseLevel > 2)
{
G4cout << "__________________________________" << G4endl;
G4cout << "G4DNABornExcitationModel1 - XS INFO START" << G4endl;
G4cout << "Kinetic energy(eV)=" << ekin/eV << " particle : " << particleDefinition->GetParticleName() << G4endl;
G4cout << "Cross section per water molecule (cm^2)=" << sigma/cm/cm << G4endl;
G4cout << "Cross section per water molecule (cm^-1)=" << sigma*waterDensity/(1./cm) << G4endl;
G4cout << "G4DNABornExcitationModel1 - XS INFO END" << G4endl;
}
} // if (waterMaterial)
return sigma*waterDensity;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4DNABornExcitationModel1::SampleSecondaries(std::vector<G4DynamicParticle*>* /*fvect*/,
const G4MaterialCutsCouple* /*couple*/,
const G4DynamicParticle* aDynamicParticle,
G4double,
G4double)
{
if (verboseLevel > 3)
{
G4cout << "Calling SampleSecondaries() of G4DNABornExcitationModel1"
<< G4endl;
}
G4double k = aDynamicParticle->GetKineticEnergy();
G4int level = RandomSelect(k);
G4double excitationEnergy = waterStructure.ExcitationEnergy(level);
G4double newEnergy = k - excitationEnergy;
if (newEnergy > 0)
{
fParticleChangeForGamma->ProposeMomentumDirection(aDynamicParticle->GetMomentumDirection());
if (!statCode) fParticleChangeForGamma->SetProposedKineticEnergy(newEnergy);
else fParticleChangeForGamma->SetProposedKineticEnergy(k);
fParticleChangeForGamma->ProposeLocalEnergyDeposit(excitationEnergy);
}
const G4Track * theIncomingTrack = fParticleChangeForGamma->GetCurrentTrack();
G4DNAChemistryManager::Instance()->CreateWaterMolecule(eExcitedMolecule,
level,
theIncomingTrack);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4DNABornExcitationModel1::GetPartialCrossSection(const G4Material*,
G4int level,
const G4ParticleDefinition* particle,
G4double kineticEnergy)
{
if (fParticleDefinition != particle)
{
G4Exception("G4DNABornExcitationModel1::GetPartialCrossSection",
"bornParticleType",
FatalException,
"Model initialized for another particle type.");
}
return fTableData->GetComponent(level)->FindValue(kineticEnergy);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4int G4DNABornExcitationModel1::RandomSelect(G4double k)
{
G4int level = 0;
G4double* valuesBuffer = new G4double[fTableData->NumberOfComponents()];
const size_t n(fTableData->NumberOfComponents());
size_t i(n);
G4double value = 0.;
while (i > 0)
{
i--;
valuesBuffer[i] = fTableData->GetComponent(i)->FindValue(k);
value += valuesBuffer[i];
}
value *= G4UniformRand();
i = n;
while (i > 0)
{
i--;
if (valuesBuffer[i] > value)
{
delete[] valuesBuffer;
return i;
}
value -= valuesBuffer[i];
}
if (valuesBuffer)
delete[] valuesBuffer;
return level;
}
@@ -0,0 +1,324 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNABornExcitationModel2.cc 90054 2015-05-11 18:47:32Z matkara $
//
#include "G4DNABornExcitationModel2.hh"
#include "G4SystemOfUnits.hh"
#include "G4DNAChemistryManager.hh"
#include "G4DNAMolecularMaterial.hh"
#include "G4PhysicsTable.hh"
#include "G4PhysicsVector.hh"
#include "G4UnitsTable.hh"
#include <map>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
using namespace std;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4DNABornExcitationModel2::G4DNABornExcitationModel2(const G4ParticleDefinition*,
const G4String& nam) :
G4VEmModel(nam), isInitialised(false), fTableData(0)
{
fpMolWaterDensity = 0;
fHighEnergy = 0;
fLowEnergy = 0;
fParticleDefinition = 0;
verboseLevel = 0;
// Verbosity scale:
// 0 = nothing
// 1 = warning for energy non-conservation
// 2 = details of energy budget
// 3 = calculation of cross sections, file openings, sampling of atoms
// 4 = entering in methods
if (verboseLevel > 0)
{
G4cout << "Born excitation model is constructed " << G4endl;
}
fParticleChangeForGamma = 0;
fLastBinCallForFinalXS = 0;
fTotalXS = 0;
fTableData = 0;
// Selection of stationary mode
statCode = false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4DNABornExcitationModel2::~G4DNABornExcitationModel2()
{
// Cross section
if (fTableData)
delete fTableData;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4DNABornExcitationModel2::Initialise(const G4ParticleDefinition* particle,
const G4DataVector& /*cuts*/)
{
if (verboseLevel > 3)
{
G4cout << "Calling G4DNABornExcitationModel2::Initialise()" << G4endl;
}
if(fParticleDefinition != 0 && fParticleDefinition != particle)
{
G4Exception("G4DNABornExcitationModel2::Initialise","em0001",
FatalException,"Model already initialized for another particle type.");
}
fParticleDefinition = particle;
std::ostringstream fullFileName;
char *path = getenv("G4LEDATA");
if(G4String(path) == "")
{
G4Exception("G4DNABornExcitationModel2::Initialise","G4LEDATA-CHECK",
FatalException, "G4LEDATA not defined in environment variables");
}
fullFileName << path;
if(particle->GetParticleName() == "e-")
{
fullFileName << "/dna/bornExcitation-e.dat";
fLowEnergy = 9*eV;
fHighEnergy = 1*MeV;
}
else if(particle->GetParticleName() == "proton")
{
fullFileName << "/dna/bornExcitation-p.dat";
fLowEnergy = 500. * keV;
fHighEnergy = 100. * MeV;
}
SetLowEnergyLimit(fLowEnergy);
SetHighEnergyLimit(fHighEnergy);
// G4double scaleFactor = (1.e-22 / 3.343) * m*m;
fTableData = new G4PhysicsTable();
fTableData->RetrievePhysicsTable(fullFileName.str().c_str(), true);
for(size_t level = 0; level<fTableData->size(); ++level)
{
// (*fTableData)(level)->ScaleVector(1,scaleFactor);
(*fTableData)(level)->SetSpline(true);
}
size_t finalBin_i = 2000;
G4double E_min = fLowEnergy;
G4double E_max = fHighEnergy;
fTotalXS = new G4PhysicsLogVector(E_min, E_max, finalBin_i);
fTotalXS->SetSpline(true);
G4double energy;
G4double finalXS;
for(size_t energy_i = 0; energy_i < finalBin_i; ++energy_i)
{
energy = fTotalXS->Energy(energy_i);
finalXS = 0;
for(size_t level = 0; level<fTableData->size(); ++level)
{
finalXS += (*fTableData)(level)->Value(energy);
}
fTotalXS->PutValue(energy_i, finalXS);
// G4cout << "energy = " << energy << " " << fTotalXS->Value(energy)
// << " " << energy_i << " " << finalXS << G4endl;
}
// for(energy = LowEnergyLimit() ; energy < HighEnergyLimit() ; energy += 1*pow(10,log10(energy)))
// {
// G4cout << "energy = " << energy << " " << fTotalXS->Value(energy) << G4endl;
// }
if( verboseLevel>0 )
{
G4cout << "Born excitation model is initialized " << G4endl
<< "Energy range: "
<< LowEnergyLimit() / eV << " eV - "
<< HighEnergyLimit() / keV << " keV for "
<< particle->GetParticleName()
<< G4endl;
}
// Initialize water density pointer
fpMolWaterDensity = G4DNAMolecularMaterial::Instance()->GetNumMolPerVolTableFor(G4Material::GetMaterial("G4_WATER"));
if (isInitialised)
{ return;}
fParticleChangeForGamma = GetParticleChangeForGamma();
isInitialised = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4DNABornExcitationModel2::CrossSectionPerVolume(const G4Material* material,
const G4ParticleDefinition* particleDefinition,
G4double ekin,
G4double,
G4double)
{
if (verboseLevel > 3)
{
G4cout << "Calling CrossSectionPerVolume() of G4DNABornExcitationModel2"
<< G4endl;
}
if(particleDefinition != fParticleDefinition) return 0;
// Calculate total cross section for model
G4double sigma=0;
G4double waterDensity = (*fpMolWaterDensity)[material->GetIndex()];
if(waterDensity!= 0.0)
{
if (ekin >= fLowEnergy && ekin < fHighEnergy)
{
sigma = fTotalXS->Value(ekin, fLastBinCallForFinalXS);
// for(size_t i = 0; i < 5; ++i)
// sigma += (*fTableData)[i]->Value(ekin);
if(sigma == 0)
{
G4cerr << "PROBLEM SIGMA = 0 at " << G4BestUnit(ekin, "Energy")<< G4endl;
}
}
if (verboseLevel > 2)
{
G4cout << "__________________________________" << G4endl;
G4cout << "G4DNABornExcitationModel2 - XS INFO START" << G4endl;
G4cout << "Kinetic energy(eV)=" << ekin/eV << " particle : " << particleDefinition->GetParticleName() << G4endl;
G4cout << "Cross section per water molecule (cm^2)=" << sigma/cm/cm << G4endl;
G4cout << "Cross section per water molecule (cm^-1)=" << sigma*waterDensity/(1./cm) << G4endl;
G4cout << "G4DNABornExcitationModel2 - XS INFO END" << G4endl;
}
} // if (waterMaterial)
else
{
G4cerr << "PROBLEM NO WATER MATERIAL ?" << G4endl;
}
return sigma*waterDensity;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4DNABornExcitationModel2::SampleSecondaries(std::vector<G4DynamicParticle*>* /*fvect*/,
const G4MaterialCutsCouple* /*couple*/,
const G4DynamicParticle* aDynamicParticle,
G4double,
G4double)
{
if (verboseLevel > 3)
{
G4cout << "Calling SampleSecondaries() of G4DNABornExcitationModel2"
<< G4endl;
}
G4double k = aDynamicParticle->GetKineticEnergy();
G4int level = RandomSelect(k);
G4double excitationEnergy = waterStructure.ExcitationEnergy(level);
G4double newEnergy = k - excitationEnergy;
if (newEnergy > 0)
{
fParticleChangeForGamma->ProposeMomentumDirection(aDynamicParticle->GetMomentumDirection());
if (!statCode) fParticleChangeForGamma->SetProposedKineticEnergy(newEnergy);
else fParticleChangeForGamma->SetProposedKineticEnergy(k);
fParticleChangeForGamma->ProposeLocalEnergyDeposit(excitationEnergy);
}
const G4Track * theIncomingTrack = fParticleChangeForGamma->GetCurrentTrack();
G4DNAChemistryManager::Instance()->CreateWaterMolecule(eExcitedMolecule,
level,
theIncomingTrack);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4DNABornExcitationModel2::GetPartialCrossSection(const G4Material*,
G4int level,
const G4ParticleDefinition* particle,
G4double kineticEnergy)
{
if (fParticleDefinition != particle)
{
G4Exception("G4DNABornExcitationModel2::GetPartialCrossSection",
"bornParticleType",
FatalException,
"Model initialized for another particle type.");
}
return (*fTableData)(level)->Value(kineticEnergy);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4int G4DNABornExcitationModel2::RandomSelect(G4double k)
{
const size_t n(fTableData->size());
size_t i(n);
G4double value = fTotalXS->Value(k, fLastBinCallForFinalXS);
value *= G4UniformRand();
i = n;
G4double partialXS;
while (i > 0)
{
i--;
partialXS = (*fTableData)(i)->Value(k);
if (partialXS > value)
{
return i;
}
value -= partialXS;
}
return 0;
}
@@ -0,0 +1,997 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNABornIonisationModel2.cc 87631 2014-12-14 12:42:05Z matkara $
//
#include "G4DNABornIonisationModel2.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4UAtomicDeexcitation.hh"
#include "G4LossTableManager.hh"
#include "G4DNAChemistryManager.hh"
#include "G4DNAMolecularMaterial.hh"
#include "G4DNABornAngle.hh"
#include "G4DeltaAngle.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
using namespace std;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4DNABornIonisationModel2::G4DNABornIonisationModel2(const G4ParticleDefinition*,
const G4String& nam) :
G4VEmModel(nam), isInitialised(false)
{
verboseLevel = 0;
// Verbosity scale:
// 0 = nothing
// 1 = warning for energy non-conservation
// 2 = details of energy budget
// 3 = calculation of cross sections, file openings, sampling of atoms
// 4 = entering in methods
if (verboseLevel > 0)
{
G4cout << "Born ionisation model is constructed " << G4endl;
}
//Mark this model as "applicable" for atomic deexcitation
SetDeexcitationFlag(true);
fAtomDeexcitation = 0;
fParticleChangeForGamma = 0;
fpMolWaterDensity = 0;
fTableData = 0;
fLowEnergyLimit = 0;
fHighEnergyLimit = 0;
fParticleDef = 0;
// define default angular generator
SetAngularDistribution(new G4DNABornAngle());
// Selection of computation method
fasterCode = false;
// Selection of stationary mode
statCode = false;
// Selection of SP scaling
spScaling = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4DNABornIonisationModel2::~G4DNABornIonisationModel2()
{
// Cross section
if (fTableData)
delete fTableData;
// Final state
fVecm.clear();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4DNABornIonisationModel2::Initialise(const G4ParticleDefinition* particle,
const G4DataVector& /*cuts*/)
{
if (verboseLevel > 3)
{
G4cout << "Calling G4DNABornIonisationModel2::Initialise()" << G4endl;
}
if(fParticleDef != 0 && particle != fParticleDef)
{
G4ExceptionDescription description;
description << "You are trying to initialized G4DNABornIonisationModel2 "
"for particle "
<< particle->GetParticleName()
<< G4endl;
description << "G4DNABornIonisationModel2 was already initiliased "
"for particle:" << fParticleDef->GetParticleName() << G4endl;
G4Exception("G4DNABornIonisationModel2::Initialise","bornIonInit",
FatalException,description);
}
fParticleDef = particle;
// Energy limits
char *path = getenv("G4LEDATA");
// ***
G4String particleName = particle->GetParticleName();
std::ostringstream fullFileName;
fullFileName << path;
if(particleName == "e-")
{
fTableFile = "dna/sigma_ionisation_e_born";
fLowEnergyLimit = 11.*eV;
fHighEnergyLimit = 1.*MeV;
if (fasterCode)
{
fullFileName << "/dna/sigmadiff_cumulated_ionisation_e_born_hp.dat";
}
else
{
fullFileName << "/dna/sigmadiff_ionisation_e_born.dat";
}
}
else if(particleName == "proton")
{
fTableFile = "dna/sigma_ionisation_p_born";
fLowEnergyLimit = 500. * keV;
fHighEnergyLimit = 100. * MeV;
if (fasterCode)
{
fullFileName << "/dna/sigmadiff_cumulated_ionisation_p_born_hp.dat";
}
else
{
fullFileName << "/dna/sigmadiff_ionisation_p_born.dat";
}
}
// Cross section
G4double scaleFactor = (1.e-22 / 3.343) * m*m;
fTableData = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor );
fTableData->LoadData(fTableFile);
// Final state
std::ifstream diffCrossSection(fullFileName.str().c_str());
if (!diffCrossSection)
{
G4ExceptionDescription description;
description << "Missing data file:" << G4endl << fullFileName.str() << G4endl;
G4Exception("G4DNABornIonisationModel2::Initialise","em0003",
FatalException,description);
}
//
// Clear the arrays for re-initialization case (MT mode)
// March 25th, 2014 - Vaclav Stepan, Sebastien Incerti
fTdummyVec.clear();
fVecm.clear();
for (int j=0; j<5; j++)
{
fProbaShellMap[j].clear();
fDiffCrossSectionData[j].clear();
fNrjTransfData[j].clear();
}
//
fTdummyVec.push_back(0.);
while(!diffCrossSection.eof())
{
double tDummy;
double eDummy;
diffCrossSection>>tDummy>>eDummy;
if (tDummy != fTdummyVec.back()) fTdummyVec.push_back(tDummy);
double tmp;
for (int j=0; j<5; j++)
{
diffCrossSection>> tmp;
fDiffCrossSectionData[j][tDummy][eDummy] = tmp;
if (fasterCode)
{
fNrjTransfData[j][tDummy][fDiffCrossSectionData[j][tDummy][eDummy]]=eDummy;
fProbaShellMap[j][tDummy].push_back(fDiffCrossSectionData[j][tDummy][eDummy]);
}
// SI - only if eof is not reached
if (!diffCrossSection.eof() && !fasterCode) fDiffCrossSectionData[j][tDummy][eDummy]*=scaleFactor;
if (!fasterCode) fVecm[tDummy].push_back(eDummy);
}
}
//
SetLowEnergyLimit(fLowEnergyLimit);
SetHighEnergyLimit(fHighEnergyLimit);
if( verboseLevel>0 )
{
G4cout << "Born ionisation model is initialized " << G4endl
<< "Energy range: "
<< LowEnergyLimit() / eV << " eV - "
<< HighEnergyLimit() / keV << " keV for "
<< particle->GetParticleName()
<< G4endl;
}
// Initialize water density pointer
fpMolWaterDensity = G4DNAMolecularMaterial::Instance()->
GetNumMolPerVolTableFor(G4Material::GetMaterial("G4_WATER"));
//
fAtomDeexcitation = G4LossTableManager::Instance()->AtomDeexcitation();
if (isInitialised)
{ return;}
fParticleChangeForGamma = GetParticleChangeForGamma();
isInitialised = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4DNABornIonisationModel2::CrossSectionPerVolume(const G4Material* material,
const G4ParticleDefinition* particleDefinition,
G4double ekin,
G4double,
G4double)
{
if (verboseLevel > 3)
{
G4cout << "Calling CrossSectionPerVolume() of G4DNABornIonisationModel2"
<< G4endl;
}
if (particleDefinition != fParticleDef) return 0;
// Calculate total cross section for model
G4double sigma=0;
G4double waterDensity = (*fpMolWaterDensity)[material->GetIndex()];
if(waterDensity!= 0.0)
{
if (ekin >= fLowEnergyLimit && ekin < fHighEnergyLimit)
{
sigma = fTableData->FindValue(ekin);
// ICRU49 electronic SP scaling - ZF, SI
if (particleDefinition == G4Proton::ProtonDefinition() && ekin < 70*MeV && spScaling)
{
G4double A = 1.39241700556072800000E-009 ;
G4double B = -8.52610412942622630000E-002 ;
sigma = sigma * std::exp(A*(ekin/eV)+B);
}
//
}
if (verboseLevel > 2)
{
G4cout << "__________________________________" << G4endl;
G4cout << "G4DNABornIonisationModel2 - XS INFO START" << G4endl;
G4cout << "Kinetic energy(eV)=" << ekin/eV << " particle : " << particleDefinition->GetParticleName() << G4endl;
G4cout << "Cross section per water molecule (cm^2)=" << sigma/cm/cm << G4endl;
G4cout << "Cross section per water molecule (cm^-1)=" << sigma*waterDensity/(1./cm) << G4endl;
G4cout << "G4DNABornIonisationModel2 - XS INFO END" << G4endl;
}
} // if (waterMaterial)
return sigma*waterDensity;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4DNABornIonisationModel2::SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
const G4MaterialCutsCouple* couple,
const G4DynamicParticle* particle,
G4double,
G4double)
{
if (verboseLevel > 3)
{
G4cout << "Calling SampleSecondaries() of G4DNABornIonisationModel2"
<< G4endl;
}
G4double k = particle->GetKineticEnergy();
if (k >= fLowEnergyLimit && k < fHighEnergyLimit)
{
G4ParticleMomentum primaryDirection = particle->GetMomentumDirection();
G4double particleMass = particle->GetDefinition()->GetPDGMass();
G4double totalEnergy = k + particleMass;
G4double pSquare = k * (totalEnergy + particleMass);
G4double totalMomentum = std::sqrt(pSquare);
G4int ionizationShell = 0;
if (!fasterCode) ionizationShell = RandomSelect(k);
// SI: The following protection is necessary to avoid infinite loops :
// sigmadiff_ionisation_e_born.dat has non zero partial xs at 18 eV for shell 3 (ionizationShell ==2)
// sigmadiff_cumulated_ionisation_e_born.dat has zero cumulated partial xs at 18 eV for shell 3 (ionizationShell ==2)
// this is due to the fact that the max allowed transfered energy is (18+10.79)/2=17.025 eV and only transfered energies
// strictly above this value have non zero partial xs in sigmadiff_ionisation_e_born.dat (starting at trans = 17.12 eV)
if (fasterCode)
do
{
ionizationShell = RandomSelect(k);
}while (k<19*eV && ionizationShell==2 && particle->GetDefinition()==G4Electron::ElectronDefinition());
// AM: sample deexcitation
// here we assume that H_{2}O electronic levels are the same as Oxygen.
// this can be considered true with a rough 10% error in energy on K-shell,
G4int secNumberInit = 0;// need to know at a certain point the energy of secondaries
G4int secNumberFinal = 0;// So I'll make the diference and then sum the energies
G4double bindingEnergy = 0;
bindingEnergy = waterStructure.IonisationEnergy(ionizationShell);
G4int Z = 8;
if(fAtomDeexcitation)
{
G4AtomicShellEnumerator as = fKShell;
if (ionizationShell <5 && ionizationShell >1)
{
as = G4AtomicShellEnumerator(4-ionizationShell);
}
else if (ionizationShell <2)
{
as = G4AtomicShellEnumerator(3);
}
// FOR DEBUG ONLY
// if (ionizationShell == 4) {
//
// G4cout << "Z: " << Z << " as: " << as
// << " ionizationShell: " << ionizationShell << " bindingEnergy: "<< bindingEnergy/eV << G4endl;
// G4cout << "Press <Enter> key to continue..." << G4endl;
// G4cin.ignore();
// }
const G4AtomicShell* shell = fAtomDeexcitation->GetAtomicShell(Z, as);
secNumberInit = fvect->size();
fAtomDeexcitation->GenerateParticles(fvect, shell, Z, 0, 0);
secNumberFinal = fvect->size();
}
G4double secondaryKinetic=-1000*eV;
if (fasterCode == false)
{
secondaryKinetic = RandomizeEjectedElectronEnergy(particle->GetDefinition(),k,ionizationShell);
}
// SI - 01/04/2014
else
{
secondaryKinetic = RandomizeEjectedElectronEnergyFromCumulatedDcs(particle->GetDefinition(),k,ionizationShell);
}
//
G4ThreeVector deltaDirection =
GetAngularDistribution()->SampleDirectionForShell(particle, secondaryKinetic,
Z, ionizationShell,
couple->GetMaterial());
if (particle->GetDefinition() == G4Electron::ElectronDefinition())
{
G4double deltaTotalMomentum = std::sqrt(secondaryKinetic*(secondaryKinetic + 2.*electron_mass_c2 ));
G4double finalPx = totalMomentum*primaryDirection.x() - deltaTotalMomentum*deltaDirection.x();
G4double finalPy = totalMomentum*primaryDirection.y() - deltaTotalMomentum*deltaDirection.y();
G4double finalPz = totalMomentum*primaryDirection.z() - deltaTotalMomentum*deltaDirection.z();
G4double finalMomentum = std::sqrt(finalPx*finalPx + finalPy*finalPy + finalPz*finalPz);
finalPx /= finalMomentum;
finalPy /= finalMomentum;
finalPz /= finalMomentum;
G4ThreeVector direction;
direction.set(finalPx,finalPy,finalPz);
fParticleChangeForGamma->ProposeMomentumDirection(direction.unit());
}
else fParticleChangeForGamma->ProposeMomentumDirection(primaryDirection);
// note that secondaryKinetic is the energy of the delta ray, not of all secondaries.
G4double scatteredEnergy = k-bindingEnergy-secondaryKinetic;
G4double deexSecEnergy = 0;
for (G4int j=secNumberInit; j < secNumberFinal; j++)
{
deexSecEnergy = deexSecEnergy + (*fvect)[j]->GetKineticEnergy();
}
if (!statCode)
{
fParticleChangeForGamma->SetProposedKineticEnergy(scatteredEnergy);
fParticleChangeForGamma->ProposeLocalEnergyDeposit(k-scatteredEnergy-secondaryKinetic-deexSecEnergy);
}
else
{
fParticleChangeForGamma->SetProposedKineticEnergy(k);
fParticleChangeForGamma->ProposeLocalEnergyDeposit(k-scatteredEnergy);
}
// SI - 01/04/2014
if (secondaryKinetic>0)
{
G4DynamicParticle* dp = new G4DynamicParticle (G4Electron::Electron(),deltaDirection,secondaryKinetic);
fvect->push_back(dp);
}
//
const G4Track * theIncomingTrack = fParticleChangeForGamma->GetCurrentTrack();
G4DNAChemistryManager::Instance()->CreateWaterMolecule(eIonizedMolecule,
ionizationShell,
theIncomingTrack);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4DNABornIonisationModel2::RandomizeEjectedElectronEnergy(G4ParticleDefinition* particleDefinition,
G4double k,
G4int shell)
{
// G4cout << "*** SLOW computation for " << " " << particleDefinition->GetParticleName() << G4endl;
if (particleDefinition == G4Electron::ElectronDefinition())
{
G4double maximumEnergyTransfer = 0.;
if ((k + waterStructure.IonisationEnergy(shell)) / 2. > k)
maximumEnergyTransfer = k;
else
maximumEnergyTransfer = (k + waterStructure.IonisationEnergy(shell)) / 2.;
// SI : original method
/*
G4double crossSectionMaximum = 0.;
for(G4double value=waterStructure.IonisationEnergy(shell); value<=maximumEnergyTransfer; value+=0.1*eV)
{
G4double differentialCrossSection = DifferentialCrossSection(particleDefinition, k/eV, value/eV, shell);
if(differentialCrossSection >= crossSectionMaximum) crossSectionMaximum = differentialCrossSection;
}
*/
// SI : alternative method
G4double crossSectionMaximum = 0.;
G4double minEnergy = waterStructure.IonisationEnergy(shell);
G4double maxEnergy = maximumEnergyTransfer;
G4int nEnergySteps = 50;
G4double value(minEnergy);
G4double stpEnergy(std::pow(maxEnergy / value,
1. / static_cast<G4double>(nEnergySteps - 1)));
G4int step(nEnergySteps);
while (step > 0)
{
step--;
G4double differentialCrossSection =
DifferentialCrossSection(particleDefinition,
k / eV,
value / eV,
shell);
if (differentialCrossSection >= crossSectionMaximum)
crossSectionMaximum = differentialCrossSection;
value *= stpEnergy;
}
//
G4double secondaryElectronKineticEnergy = 0.;
do
{
secondaryElectronKineticEnergy = G4UniformRand()* (maximumEnergyTransfer-waterStructure.IonisationEnergy(shell));
}while(G4UniformRand()*crossSectionMaximum >
DifferentialCrossSection(particleDefinition, k/eV,
(secondaryElectronKineticEnergy+waterStructure.IonisationEnergy(shell))/eV,shell));
return secondaryElectronKineticEnergy;
}
else if (particleDefinition == G4Proton::ProtonDefinition())
{
G4double maximumKineticEnergyTransfer = 4.
* (electron_mass_c2 / proton_mass_c2) * k;
G4double crossSectionMaximum = 0.;
for (G4double value = waterStructure.IonisationEnergy(shell);
value <= 4. * waterStructure.IonisationEnergy(shell); value += 0.1 * eV)
{
G4double differentialCrossSection =
DifferentialCrossSection(particleDefinition,
k / eV,
value / eV,
shell);
if (differentialCrossSection >= crossSectionMaximum)
crossSectionMaximum = differentialCrossSection;
}
G4double secondaryElectronKineticEnergy = 0.;
do
{
secondaryElectronKineticEnergy = G4UniformRand()* maximumKineticEnergyTransfer;
}while(G4UniformRand()*crossSectionMaximum >=
DifferentialCrossSection(particleDefinition, k/eV,
(secondaryElectronKineticEnergy+waterStructure.IonisationEnergy(shell))/eV,shell));
return secondaryElectronKineticEnergy;
}
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
// The following section is not used anymore but is kept for memory
// GetAngularDistribution()->SampleDirectionForShell is used instead
/*
void G4DNABornIonisationModel2::RandomizeEjectedElectronDirection(G4ParticleDefinition* particleDefinition,
G4double k,
G4double secKinetic,
G4double & cosTheta,
G4double & phi )
{
if (particleDefinition == G4Electron::ElectronDefinition())
{
phi = twopi * G4UniformRand();
if (secKinetic < 50.*eV) cosTheta = (2.*G4UniformRand())-1.;
else if (secKinetic <= 200.*eV)
{
if (G4UniformRand() <= 0.1) cosTheta = (2.*G4UniformRand())-1.;
else cosTheta = G4UniformRand()*(std::sqrt(2.)/2);
}
else
{
G4double sin2O = (1.-secKinetic/k) / (1.+secKinetic/(2.*electron_mass_c2));
cosTheta = std::sqrt(1.-sin2O);
}
}
else if (particleDefinition == G4Proton::ProtonDefinition())
{
G4double maxSecKinetic = 4.* (electron_mass_c2 / proton_mass_c2) * k;
phi = twopi * G4UniformRand();
// cosTheta = std::sqrt(secKinetic / maxSecKinetic);
// Restriction below 100 eV from Emfietzoglou (2000)
if (secKinetic>100*eV) cosTheta = std::sqrt(secKinetic / maxSecKinetic);
else cosTheta = (2.*G4UniformRand())-1.;
}
}
*/
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
double G4DNABornIonisationModel2::DifferentialCrossSection(G4ParticleDefinition * /*particleDefinition*/,
G4double k,
G4double energyTransfer,
G4int ionizationLevelIndex)
{
G4double sigma = 0.;
if (energyTransfer >= waterStructure.IonisationEnergy(ionizationLevelIndex))
{
G4double valueT1 = 0;
G4double valueT2 = 0;
G4double valueE21 = 0;
G4double valueE22 = 0;
G4double valueE12 = 0;
G4double valueE11 = 0;
G4double xs11 = 0;
G4double xs12 = 0;
G4double xs21 = 0;
G4double xs22 = 0;
// k should be in eV and energy transfer eV also
std::vector<double>::iterator t2 = std::upper_bound(fTdummyVec.begin(),
fTdummyVec.end(),
k);
std::vector<double>::iterator t1 = t2 - 1;
// SI : the following condition avoids situations where energyTransfer >last vector element
if (energyTransfer <= fVecm[(*t1)].back()
&& energyTransfer <= fVecm[(*t2)].back())
{
std::vector<double>::iterator e12 = std::upper_bound(fVecm[(*t1)].begin(),
fVecm[(*t1)].end(),
energyTransfer);
std::vector<double>::iterator e11 = e12 - 1;
std::vector<double>::iterator e22 = std::upper_bound(fVecm[(*t2)].begin(),
fVecm[(*t2)].end(),
energyTransfer);
std::vector<double>::iterator e21 = e22 - 1;
valueT1 = *t1;
valueT2 = *t2;
valueE21 = *e21;
valueE22 = *e22;
valueE12 = *e12;
valueE11 = *e11;
xs11 = fDiffCrossSectionData[ionizationLevelIndex][valueT1][valueE11];
xs12 = fDiffCrossSectionData[ionizationLevelIndex][valueT1][valueE12];
xs21 = fDiffCrossSectionData[ionizationLevelIndex][valueT2][valueE21];
xs22 = fDiffCrossSectionData[ionizationLevelIndex][valueT2][valueE22];
}
G4double xsProduct = xs11 * xs12 * xs21 * xs22;
if (xsProduct != 0.)
{
sigma = QuadInterpolator(valueE11,
valueE12,
valueE21,
valueE22,
xs11,
xs12,
xs21,
xs22,
valueT1,
valueT2,
k,
energyTransfer);
}
}
return sigma;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4DNABornIonisationModel2::Interpolate(G4double e1,
G4double e2,
G4double e,
G4double xs1,
G4double xs2)
{
G4double value = 0.;
// Log-log interpolation by default
if (e1 != 0 && e2 != 0 && (std::log10(e2) - std::log10(e1)) != 0
&& !fasterCode)
{
G4double a = (std::log10(xs2) - std::log10(xs1))
/ (std::log10(e2) - std::log10(e1));
G4double b = std::log10(xs2) - a * std::log10(e2);
G4double sigma = a * std::log10(e) + b;
value = (std::pow(10., sigma));
}
// Switch to lin-lin interpolation
/*
if ((e2-e1)!=0)
{
G4double d1 = xs1;
G4double d2 = xs2;
value = (d1 + (d2 - d1)*(e - e1)/ (e2 - e1));
}
*/
// Switch to log-lin interpolation for faster code
if ((e2 - e1) != 0 && xs1 != 0 && xs2 != 0 && fasterCode)
{
G4double d1 = std::log10(xs1);
G4double d2 = std::log10(xs2);
value = std::pow(10., (d1 + (d2 - d1) * (e - e1) / (e2 - e1)));
}
// Switch to lin-lin interpolation for faster code
// in case one of xs1 or xs2 (=cum proba) value is zero
if ((e2 - e1) != 0 && (xs1 == 0 || xs2 == 0) && fasterCode)
{
G4double d1 = xs1;
G4double d2 = xs2;
value = (d1 + (d2 - d1) * (e - e1) / (e2 - e1));
}
/*
G4cout
<< e1 << " "
<< e2 << " "
<< e << " "
<< xs1 << " "
<< xs2 << " "
<< value
<< G4endl;
*/
return value;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4DNABornIonisationModel2::QuadInterpolator(G4double e11,
G4double e12,
G4double e21,
G4double e22,
G4double xs11,
G4double xs12,
G4double xs21,
G4double xs22,
G4double t1,
G4double t2,
G4double t,
G4double e)
{
G4double interpolatedvalue1 = Interpolate(e11, e12, e, xs11, xs12);
G4double interpolatedvalue2 = Interpolate(e21, e22, e, xs21, xs22);
G4double value = Interpolate(t1,
t2,
t,
interpolatedvalue1,
interpolatedvalue2);
return value;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4DNABornIonisationModel2::GetPartialCrossSection(const G4Material*,
G4int level,
const G4ParticleDefinition* /*particle*/,
G4double kineticEnergy)
{
return fTableData->GetComponent(level)->FindValue(kineticEnergy);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4int G4DNABornIonisationModel2::RandomSelect(G4double k)
{
G4int level = 0;
G4double* valuesBuffer = new G4double[fTableData->NumberOfComponents()];
const size_t n(fTableData->NumberOfComponents());
size_t i(n);
G4double value = 0.;
while (i > 0)
{
i--;
valuesBuffer[i] = fTableData->GetComponent(i)->FindValue(k);
value += valuesBuffer[i];
}
value *= G4UniformRand();
i = n;
while (i > 0)
{
i--;
if (valuesBuffer[i] > value)
{
delete[] valuesBuffer;
return i;
}
value -= valuesBuffer[i];
}
if (valuesBuffer)
delete[] valuesBuffer;
return level;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4DNABornIonisationModel2::RandomizeEjectedElectronEnergyFromCumulatedDcs(G4ParticleDefinition* particleDefinition,
G4double k,
G4int shell)
{
//G4cout << "*** FAST computation for " << " " << particleDefinition->GetParticleName() << G4endl;
G4double secondaryElectronKineticEnergy = 0.;
G4double random = G4UniformRand();
secondaryElectronKineticEnergy = TransferedEnergy(particleDefinition,
k / eV,
shell,
random) * eV
- waterStructure.IonisationEnergy(shell);
//G4cout << TransferedEnergy(particleDefinition, k/eV, shell, random) << G4endl;
// SI - 01/04/2014
if (secondaryElectronKineticEnergy < 0.)
return 0.;
//
return secondaryElectronKineticEnergy;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4DNABornIonisationModel2::TransferedEnergy(G4ParticleDefinition* /*particleDefinition*/,
G4double k,
G4int ionizationLevelIndex,
G4double random)
{
G4double nrj = 0.;
G4double valueK1 = 0;
G4double valueK2 = 0;
G4double valuePROB21 = 0;
G4double valuePROB22 = 0;
G4double valuePROB12 = 0;
G4double valuePROB11 = 0;
G4double nrjTransf11 = 0;
G4double nrjTransf12 = 0;
G4double nrjTransf21 = 0;
G4double nrjTransf22 = 0;
// k should be in eV
std::vector<double>::iterator k2 = std::upper_bound(fTdummyVec.begin(),
fTdummyVec.end(),
k);
std::vector<double>::iterator k1 = k2 - 1;
/*
G4cout << "----> k=" << k
<< " " << *k1
<< " " << *k2
<< " " << random
<< " " << ionizationLevelIndex
<< " " << eProbaShellMap[ionizationLevelIndex][(*k1)].back()
<< " " << eProbaShellMap[ionizationLevelIndex][(*k2)].back()
<< G4endl;
*/
// SI : the following condition avoids situations where random >last vector element
if (random <= fProbaShellMap[ionizationLevelIndex][(*k1)].back()
&& random <= fProbaShellMap[ionizationLevelIndex][(*k2)].back())
{
std::vector<double>::iterator prob12 =
std::upper_bound(fProbaShellMap[ionizationLevelIndex][(*k1)].begin(),
fProbaShellMap[ionizationLevelIndex][(*k1)].end(),
random);
std::vector<double>::iterator prob11 = prob12 - 1;
std::vector<double>::iterator prob22 =
std::upper_bound(fProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
fProbaShellMap[ionizationLevelIndex][(*k2)].end(),
random);
std::vector<double>::iterator prob21 = prob22 - 1;
valueK1 = *k1;
valueK2 = *k2;
valuePROB21 = *prob21;
valuePROB22 = *prob22;
valuePROB12 = *prob12;
valuePROB11 = *prob11;
/*
G4cout << " " << random << " " << valuePROB11 << " "
<< valuePROB12 << " " << valuePROB21 << " " << valuePROB22 << G4endl;
*/
nrjTransf11 = fNrjTransfData[ionizationLevelIndex][valueK1][valuePROB11];
nrjTransf12 = fNrjTransfData[ionizationLevelIndex][valueK1][valuePROB12];
nrjTransf21 = fNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
nrjTransf22 = fNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
/*
G4cout << " " << ionizationLevelIndex << " "
<< random << " " <<valueK1 << " " << valueK2 << G4endl;
G4cout << " " << random << " " << nrjTransf11 << " "
<< nrjTransf12 << " " << nrjTransf21 << " " <<nrjTransf22 << G4endl;
*/
}
// Avoids cases where cum xs is zero for k1 and is not for k2 (with always k1<k2)
if (random > fProbaShellMap[ionizationLevelIndex][(*k1)].back())
{
std::vector<double>::iterator prob22 =
std::upper_bound(fProbaShellMap[ionizationLevelIndex][(*k2)].begin(),
fProbaShellMap[ionizationLevelIndex][(*k2)].end(),
random);
std::vector<double>::iterator prob21 = prob22 - 1;
valueK1 = *k1;
valueK2 = *k2;
valuePROB21 = *prob21;
valuePROB22 = *prob22;
//G4cout << " " << random << " " << valuePROB21 << " " << valuePROB22 << G4endl;
nrjTransf21 = fNrjTransfData[ionizationLevelIndex][valueK2][valuePROB21];
nrjTransf22 = fNrjTransfData[ionizationLevelIndex][valueK2][valuePROB22];
G4double interpolatedvalue2 = Interpolate(valuePROB21,
valuePROB22,
random,
nrjTransf21,
nrjTransf22);
// zeros are explicitly set
G4double value = Interpolate(valueK1, valueK2, k, 0., interpolatedvalue2);
/*
G4cout << " " << ionizationLevelIndex << " "
<< random << " " <<valueK1 << " " << valueK2 << G4endl;
G4cout << " " << random << " " << nrjTransf11 << " "
<< nrjTransf12 << " " << nrjTransf21 << " " <<nrjTransf22 << G4endl;
G4cout << "ici" << " " << value << G4endl;
*/
return value;
}
// End electron and proton cases
G4double nrjTransfProduct = nrjTransf11 * nrjTransf12 * nrjTransf21
* nrjTransf22;
//G4cout << "nrjTransfProduct=" << nrjTransfProduct << G4endl;
if (nrjTransfProduct != 0.)
{
nrj = QuadInterpolator(valuePROB11,
valuePROB12,
valuePROB21,
valuePROB22,
nrjTransf11,
nrjTransf12,
nrjTransf21,
nrjTransf22,
valueK1,
valueK2,
k,
random);
}
//G4cout << nrj << endl;
return nrj;
}
@@ -23,13 +23,14 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNADingfelderChargeDecreaseModel.cc 70171 2013-05-24 13:34:18Z gcosmo $
// $Id: G4DNADingfelderChargeDecreaseModel.cc 92859 2015-09-18 07:58:30Z gcosmo $
//
#include "G4DNADingfelderChargeDecreaseModel.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4DNAMolecularMaterial.hh"
#include "G4DNAChemistryManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -38,34 +39,39 @@ using namespace std;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4DNADingfelderChargeDecreaseModel::G4DNADingfelderChargeDecreaseModel(const G4ParticleDefinition*,
const G4String& nam)
:G4VEmModel(nam),isInitialised(false)
const G4String& nam) :
G4VEmModel(nam), isInitialised(false)
{
// nistwater = G4NistManager::Instance()->FindOrBuildMaterial("G4_WATER");
fpMolWaterDensity = 0;
numberOfPartialCrossSections[0] = 0;
numberOfPartialCrossSections[1] = 0;
numberOfPartialCrossSections[2] = 0;
// nistwater = G4NistManager::Instance()->FindOrBuildMaterial("G4_WATER");
fpMolWaterDensity = 0;
numberOfPartialCrossSections[0] = 0;
numberOfPartialCrossSections[1] = 0;
numberOfPartialCrossSections[2] = 0;
verboseLevel= 0;
// Verbosity scale:
// 0 = nothing
// 1 = warning for energy non-conservation
// 2 = details of energy budget
// 3 = calculation of cross sections, file openings, sampling of atoms
// 4 = entering in methods
verboseLevel = 0;
// Verbosity scale:
// 0 = nothing
// 1 = warning for energy non-conservation
// 2 = details of energy budget
// 3 = calculation of cross sections, file openings, sampling of atoms
// 4 = entering in methods
if( verboseLevel>0 )
{
G4cout << "Dingfelder charge decrease model is constructed " << G4endl;
}
fParticleChangeForGamma = 0;
if (verboseLevel > 0)
{
G4cout << "Dingfelder charge decrease model is constructed " << G4endl;
}
fParticleChangeForGamma = 0;
// Selection of stationary mode
statCode = false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4DNADingfelderChargeDecreaseModel::~G4DNADingfelderChargeDecreaseModel()
{}
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -73,126 +79,130 @@ void G4DNADingfelderChargeDecreaseModel::Initialise(const G4ParticleDefinition*
const G4DataVector& /*cuts*/)
{
if (verboseLevel > 3)
G4cout << "Calling G4DNADingfelderChargeDecreaseModel::Initialise()" << G4endl;
if (verboseLevel > 3)
{
G4cout << "Calling G4DNADingfelderChargeDecreaseModel::Initialise()"
<< G4endl;
}
// Energy limits
// Energy limits
G4DNAGenericIonsManager *instance;
instance = G4DNAGenericIonsManager::Instance();
G4ParticleDefinition* protonDef = G4Proton::ProtonDefinition();
G4ParticleDefinition* alphaPlusPlusDef = instance->GetIon("alpha++");
G4ParticleDefinition* alphaPlusDef = instance->GetIon("alpha+");
G4DNAGenericIonsManager *instance;
instance = G4DNAGenericIonsManager::Instance();
G4ParticleDefinition* protonDef = G4Proton::ProtonDefinition();
G4ParticleDefinition* alphaPlusPlusDef = instance->GetIon("alpha++");
G4ParticleDefinition* alphaPlusDef = instance->GetIon("alpha+");
G4String proton;
G4String alphaPlusPlus;
G4String alphaPlus;
G4String proton;
G4String alphaPlusPlus;
G4String alphaPlus;
// LIMITS
// LIMITS
proton = protonDef->GetParticleName();
lowEnergyLimit[proton] = 100. * eV;
highEnergyLimit[proton] = 100. * MeV;
proton = protonDef->GetParticleName();
lowEnergyLimit[proton] = 100. * eV;
highEnergyLimit[proton] = 100. * MeV;
alphaPlusPlus = alphaPlusPlusDef->GetParticleName();
lowEnergyLimit[alphaPlusPlus] = 1. * keV;
highEnergyLimit[alphaPlusPlus] = 400. * MeV;
alphaPlusPlus = alphaPlusPlusDef->GetParticleName();
lowEnergyLimit[alphaPlusPlus] = 1. * keV;
highEnergyLimit[alphaPlusPlus] = 400. * MeV;
alphaPlus = alphaPlusDef->GetParticleName();
lowEnergyLimit[alphaPlus] = 1. * keV;
highEnergyLimit[alphaPlus] = 400. * MeV;
alphaPlus = alphaPlusDef->GetParticleName();
lowEnergyLimit[alphaPlus] = 1. * keV;
highEnergyLimit[alphaPlus] = 400. * MeV;
//
//
if (particle==protonDef)
{
SetLowEnergyLimit(lowEnergyLimit[proton]);
SetHighEnergyLimit(highEnergyLimit[proton]);
}
if (particle==protonDef)
{
SetLowEnergyLimit(lowEnergyLimit[proton]);
SetHighEnergyLimit(highEnergyLimit[proton]);
}
if (particle==alphaPlusPlusDef)
{
SetLowEnergyLimit(lowEnergyLimit[alphaPlusPlus]);
SetHighEnergyLimit(highEnergyLimit[alphaPlusPlus]);
}
if (particle==alphaPlusPlusDef)
{
SetLowEnergyLimit(lowEnergyLimit[alphaPlusPlus]);
SetHighEnergyLimit(highEnergyLimit[alphaPlusPlus]);
}
if (particle==alphaPlusDef)
{
SetLowEnergyLimit(lowEnergyLimit[alphaPlus]);
SetHighEnergyLimit(highEnergyLimit[alphaPlus]);
}
if (particle==alphaPlusDef)
{
SetLowEnergyLimit(lowEnergyLimit[alphaPlus]);
SetHighEnergyLimit(highEnergyLimit[alphaPlus]);
}
// Final state
// Final state
//PROTON
f0[0][0]=1.;
a0[0][0]=-0.180;
a1[0][0]=-3.600;
b0[0][0]=-18.22;
b1[0][0]=-1.997;
c0[0][0]=0.215;
d0[0][0]=3.550;
x0[0][0]=3.450;
x1[0][0]=5.251;
//PROTON
f0[0][0]=1.;
a0[0][0]=-0.180;
a1[0][0]=-3.600;
b0[0][0]=-18.22;
b1[0][0]=-1.997;
c0[0][0]=0.215;
d0[0][0]=3.550;
x0[0][0]=3.450;
x1[0][0]=5.251;
numberOfPartialCrossSections[0] = 1;
numberOfPartialCrossSections[0] = 1;
//ALPHA++
f0[0][1]=1.; a0[0][1]=0.95;
a1[0][1]=-2.75;
b0[0][1]=-23.00;
c0[0][1]=0.215;
d0[0][1]=2.95;
x0[0][1]=3.50;
//ALPHA++
f0[0][1]=1.; a0[0][1]=0.95;
a1[0][1]=-2.75;
b0[0][1]=-23.00;
c0[0][1]=0.215;
d0[0][1]=2.95;
x0[0][1]=3.50;
f0[1][1]=1.;
a0[1][1]=0.95;
a1[1][1]=-2.75;
b0[1][1]=-23.73;
c0[1][1]=0.250;
d0[1][1]=3.55;
x0[1][1]=3.72;
f0[1][1]=1.;
a0[1][1]=0.95;
a1[1][1]=-2.75;
b0[1][1]=-23.73;
c0[1][1]=0.250;
d0[1][1]=3.55;
x0[1][1]=3.72;
x1[0][1]=-1.;
b1[0][1]=-1.;
x1[0][1]=-1.;
b1[0][1]=-1.;
x1[1][1]=-1.;
b1[1][1]=-1.;
x1[1][1]=-1.;
b1[1][1]=-1.;
numberOfPartialCrossSections[1] = 2;
numberOfPartialCrossSections[1] = 2;
// ALPHA+
f0[0][2]=1.;
a0[0][2]=0.65;
a1[0][2]=-2.75;
b0[0][2]=-21.81;
c0[0][2]=0.232;
d0[0][2]=2.95;
x0[0][2]=3.53;
// ALPHA+
f0[0][2]=1.;
a0[0][2]=0.65;
a1[0][2]=-2.75;
b0[0][2]=-21.81;
c0[0][2]=0.232;
d0[0][2]=2.95;
x0[0][2]=3.53;
x1[0][2]=-1.;
b1[0][2]=-1.;
x1[0][2]=-1.;
b1[0][2]=-1.;
numberOfPartialCrossSections[2] = 1;
numberOfPartialCrossSections[2] = 1;
//
//
if( verboseLevel>0 )
{
G4cout << "Dingfelder charge decrease model is initialized " << G4endl
<< "Energy range: "
<< LowEnergyLimit() / keV << " keV - "
<< HighEnergyLimit() / MeV << " MeV for "
<< particle->GetParticleName()
<< G4endl;
}
if( verboseLevel>0 )
{
G4cout << "Dingfelder charge decrease model is initialized " << G4endl
<< "Energy range: "
<< LowEnergyLimit() / keV << " keV - "
<< HighEnergyLimit() / MeV << " MeV for "
<< particle->GetParticleName()
<< G4endl;
}
// Initialize water density pointer
fpMolWaterDensity = G4DNAMolecularMaterial::Instance()->GetNumMolPerVolTableFor(G4Material::GetMaterial("G4_WATER"));
// Initialize water density pointer
fpMolWaterDensity = G4DNAMolecularMaterial::Instance()->GetNumMolPerVolTableFor(G4Material::GetMaterial("G4_WATER"));
if (isInitialised) { return; }
fParticleChangeForGamma = GetParticleChangeForGamma();
isInitialised = true;
if (isInitialised)
{ return;}
fParticleChangeForGamma = GetParticleChangeForGamma();
isInitialised = true;
}
@@ -204,352 +214,418 @@ G4double G4DNADingfelderChargeDecreaseModel::CrossSectionPerVolume(const G4Mater
G4double,
G4double)
{
if (verboseLevel > 3)
G4cout << "Calling CrossSectionPerVolume() of G4DNADingfelderChargeDecreaseModel" << G4endl;
if (verboseLevel > 3)
{
G4cout
<< "Calling CrossSectionPerVolume() of G4DNADingfelderChargeDecreaseModel"
<< G4endl;
}
// Calculate total cross section for model
// Calculate total cross section for model
G4DNAGenericIonsManager *instance;
instance = G4DNAGenericIonsManager::Instance();
G4DNAGenericIonsManager *instance;
instance = G4DNAGenericIonsManager::Instance();
if (
particleDefinition != G4Proton::ProtonDefinition()
&&
particleDefinition != instance->GetIon("alpha++")
&&
particleDefinition != instance->GetIon("alpha+")
)
if (
particleDefinition != G4Proton::ProtonDefinition()
&&
particleDefinition != instance->GetIon("alpha++")
&&
particleDefinition != instance->GetIon("alpha+")
)
return 0;
return 0;
G4double lowLim = 0;
G4double highLim = 0;
G4double crossSection = 0.;
G4double lowLim = 0;
G4double highLim = 0;
G4double crossSection = 0.;
G4double waterDensity = (*fpMolWaterDensity)[material->GetIndex()];
G4double waterDensity = (*fpMolWaterDensity)[material->GetIndex()];
if(waterDensity!= 0.0)
if(waterDensity!= 0.0)
// if (material == nistwater || material->GetBaseMaterial() == nistwater)
{
const G4String& particleName = particleDefinition->GetParticleName();
std::map< G4String,G4double,std::less<G4String> >::iterator pos1;
pos1 = lowEnergyLimit.find(particleName);
if (pos1 != lowEnergyLimit.end())
{
const G4String& particleName = particleDefinition->GetParticleName();
std::map< G4String,G4double,std::less<G4String> >::iterator pos1;
pos1 = lowEnergyLimit.find(particleName);
if (pos1 != lowEnergyLimit.end())
{
lowLim = pos1->second;
}
std::map< G4String,G4double,std::less<G4String> >::iterator pos2;
pos2 = highEnergyLimit.find(particleName);
if (pos2 != highEnergyLimit.end())
{
highLim = pos2->second;
}
if (k >= lowLim && k < highLim)
{
crossSection = Sum(k,particleDefinition);
}
if (verboseLevel > 2)
{
G4cout << "_______________________________________" << G4endl;
G4cout << "°°° G4DNADingfelderChargeDecreaeModel" << G4endl;
G4cout << "---> Kinetic energy(eV)=" << k/eV << "particle :" << particleName << G4endl;
G4cout << " - Cross section per water molecule (cm^2)=" << crossSection/cm/cm << G4endl;
G4cout << " - Cross section per water molecule (cm^-1)=" << crossSection*
waterDensity/(1./cm) << G4endl;
// material->GetAtomicNumDensityVector()[1]/(1./cm) << G4endl;
}
lowLim = pos1->second;
}
return crossSection*waterDensity;
std::map< G4String,G4double,std::less<G4String> >::iterator pos2;
pos2 = highEnergyLimit.find(particleName);
if (pos2 != highEnergyLimit.end())
{
highLim = pos2->second;
}
if (k >= lowLim && k < highLim)
{
crossSection = Sum(k,particleDefinition);
}
if (verboseLevel > 2)
{
G4cout << "_______________________________________" << G4endl;
G4cout << "G4DNADingfelderChargeDecreaeModel" << G4endl;
G4cout << "Kinetic energy(eV)=" << k/eV << "particle :" << particleName << G4endl;
G4cout << "Cross section per water molecule (cm^2)=" << crossSection/cm/cm << G4endl;
G4cout << "Cross section per water molecule (cm^-1)=" << crossSection*
waterDensity/(1./cm) << G4endl;
// material->GetAtomicNumDensityVector()[1]/(1./cm) << G4endl;
}
}
return crossSection*waterDensity;
// return crossSection*material->GetAtomicNumDensityVector()[1];
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4DNADingfelderChargeDecreaseModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
void G4DNADingfelderChargeDecreaseModel::SampleSecondaries(std::vector<
G4DynamicParticle*>* fvect,
const G4MaterialCutsCouple* /*couple*/,
const G4DynamicParticle* aDynamicParticle,
G4double,
G4double)
{
if (verboseLevel > 3)
G4cout << "Calling SampleSecondaries() of G4DNADingfelderChargeDecreaseModel" << G4endl;
if (verboseLevel > 3)
{
G4cout
<< "Calling SampleSecondaries() of G4DNADingfelderChargeDecreaseModel"
<< G4endl;
}
G4double inK = aDynamicParticle->GetKineticEnergy();
G4double inK = aDynamicParticle->GetKineticEnergy();
G4ParticleDefinition* definition = aDynamicParticle->GetDefinition();
G4ParticleDefinition* definition = aDynamicParticle->GetDefinition();
G4double particleMass = definition->GetPDGMass();
G4double particleMass = definition->GetPDGMass();
G4int finalStateIndex = RandomSelect(inK,definition);
G4int finalStateIndex = RandomSelect(inK,definition);
G4int n = NumberOfFinalStates(definition, finalStateIndex);
G4double waterBindingEnergy = WaterBindingEnergyConstant(definition, finalStateIndex);
G4double outgoingParticleBindingEnergy = OutgoingParticleBindingEnergyConstant(definition, finalStateIndex);
G4int n = NumberOfFinalStates(definition, finalStateIndex);
G4double waterBindingEnergy = WaterBindingEnergyConstant(definition, finalStateIndex);
G4double outgoingParticleBindingEnergy = OutgoingParticleBindingEnergyConstant(definition, finalStateIndex);
G4double outK = 0.;
if (definition==G4Proton::Proton())
outK = inK - n*(inK*electron_mass_c2/proton_mass_c2) - waterBindingEnergy + outgoingParticleBindingEnergy;
else
outK = inK - n*(inK*electron_mass_c2/particleMass) - waterBindingEnergy + outgoingParticleBindingEnergy;
G4double outK = 0.;
if (definition==G4Proton::Proton())
{
if (!statCode) outK = inK - n*(inK*electron_mass_c2/proton_mass_c2)
- waterBindingEnergy + outgoingParticleBindingEnergy;
else outK = inK;
}
else
{
if (!statCode) outK = inK - n*(inK*electron_mass_c2/particleMass)
- waterBindingEnergy + outgoingParticleBindingEnergy;
else outK = inK;
}
if (outK<0)
{
G4Exception("G4DNADingfelderChargeDecreaseModel::SampleSecondaries","em0004",
FatalException,"Final kinetic energy is negative.");
}
if (outK<0)
{
G4Exception("G4DNADingfelderChargeDecreaseModel::SampleSecondaries","em0004",
FatalException,"Final kinetic energy is negative.");
}
fParticleChangeForGamma->ProposeTrackStatus(fStopAndKill);
fParticleChangeForGamma->ProposeTrackStatus(fStopAndKill);
fParticleChangeForGamma->ProposeLocalEnergyDeposit(waterBindingEnergy);
if (!statCode) fParticleChangeForGamma->ProposeLocalEnergyDeposit(waterBindingEnergy);
else
{
if (definition==G4Proton::Proton())
fParticleChangeForGamma->ProposeLocalEnergyDeposit(n*(inK*electron_mass_c2/proton_mass_c2)
+ waterBindingEnergy - outgoingParticleBindingEnergy);
else
fParticleChangeForGamma->ProposeLocalEnergyDeposit(n*(inK*electron_mass_c2/particleMass)
+ waterBindingEnergy - outgoingParticleBindingEnergy);
}
G4DynamicParticle* dp = new G4DynamicParticle (OutgoingParticleDefinition(definition, finalStateIndex),
aDynamicParticle->GetMomentumDirection(),
outK) ;
fvect->push_back(dp);
G4DynamicParticle* dp = new G4DynamicParticle (OutgoingParticleDefinition(definition, finalStateIndex),
aDynamicParticle->GetMomentumDirection(),
outK);
fvect->push_back(dp);
const G4Track * theIncomingTrack = fParticleChangeForGamma->GetCurrentTrack();
G4DNAChemistryManager::Instance()->CreateWaterMolecule(eIonizedMolecule,
1,
theIncomingTrack);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4int G4DNADingfelderChargeDecreaseModel::NumberOfFinalStates(G4ParticleDefinition* particleDefinition,
G4int finalStateIndex )
G4int G4DNADingfelderChargeDecreaseModel::NumberOfFinalStates(G4ParticleDefinition* particleDefinition,
G4int finalStateIndex)
{
if (particleDefinition == G4Proton::Proton()) return 1;
if (particleDefinition == G4Proton::Proton())
return 1;
G4DNAGenericIonsManager*instance;
instance = G4DNAGenericIonsManager::Instance();
G4DNAGenericIonsManager*instance;
instance = G4DNAGenericIonsManager::Instance();
if (particleDefinition == instance->GetIon("alpha++") )
{
if (finalStateIndex==0) return 1;
return 2;
}
if (particleDefinition == instance->GetIon("alpha++"))
{
if (finalStateIndex == 0)
return 1;
return 2;
}
if (particleDefinition == instance->GetIon("alpha+") ) return 1;
if (particleDefinition == instance->GetIon("alpha+"))
return 1;
return 0;
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ParticleDefinition* G4DNADingfelderChargeDecreaseModel::OutgoingParticleDefinition (G4ParticleDefinition* particleDefinition,
G4int finalStateIndex)
G4ParticleDefinition* G4DNADingfelderChargeDecreaseModel::OutgoingParticleDefinition(G4ParticleDefinition* particleDefinition,
G4int finalStateIndex)
{
G4DNAGenericIonsManager * instance(G4DNAGenericIonsManager::Instance());
G4DNAGenericIonsManager * instance(G4DNAGenericIonsManager::Instance());
if (particleDefinition == G4Proton::Proton()) return instance->GetIon("hydrogen");
if (particleDefinition == G4Proton::Proton())
return instance->GetIon("hydrogen");
if (particleDefinition == instance->GetIon("alpha++") )
{
if (finalStateIndex == 0) return instance->GetIon("alpha+");
return instance->GetIon("helium");
}
if (particleDefinition == instance->GetIon("alpha++"))
{
if (finalStateIndex == 0)
return instance->GetIon("alpha+");
return instance->GetIon("helium");
}
if (particleDefinition == instance->GetIon("alpha+") ) return instance->GetIon("helium");
if (particleDefinition == instance->GetIon("alpha+"))
return instance->GetIon("helium");
return 0;
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4DNADingfelderChargeDecreaseModel::WaterBindingEnergyConstant(G4ParticleDefinition* particleDefinition,
G4int finalStateIndex )
G4double G4DNADingfelderChargeDecreaseModel::WaterBindingEnergyConstant(G4ParticleDefinition* particleDefinition,
G4int finalStateIndex)
{
// Ionization energy of first water shell
// Rad. Phys. Chem. 59 p.267 by Dingf. et al.
// W + 10.79 eV -> W+ + e-
G4DNAGenericIonsManager * instance(G4DNAGenericIonsManager::Instance());
if (particleDefinition == G4Proton::Proton())
return 10.79 * eV;
if (particleDefinition == instance->GetIon("alpha++"))
{
// Binding energy for W+ -> W++ + e- 10.79 eV
// Binding energy for W -> W+ + e- 10.79 eV
//
// Ionization energy of first water shell
// Rad. Phys. Chem. 59 p.267 by Dingf. et al.
// W + 10.79 eV -> W+ + e-
G4DNAGenericIonsManager * instance(G4DNAGenericIonsManager::Instance());
if (finalStateIndex == 0)
return 10.79 * eV;
if(particleDefinition == G4Proton::Proton()) return 10.79*eV;
return 10.79 * 2 * eV;
}
if (particleDefinition == instance->GetIon("alpha++") )
{
// Binding energy for W+ -> W++ + e- 10.79 eV
// Binding energy for W -> W+ + e- 10.79 eV
//
// Ionization energy of first water shell
// Rad. Phys. Chem. 59 p.267 by Dingf. et al.
if (particleDefinition == instance->GetIon("alpha+"))
{
// Binding energy for W+ -> W++ + e- 10.79 eV
// Binding energy for W -> W+ + e- 10.79 eV
//
// Ionization energy of first water shell
// Rad. Phys. Chem. 59 p.267 by Dingf. et al.
if (finalStateIndex == 0) return 10.79*eV;
return 10.79 * eV;
}
return 10.79*2*eV;
}
if (particleDefinition == instance->GetIon("alpha+") )
{
// Binding energy for W+ -> W++ + e- 10.79 eV
// Binding energy for W -> W+ + e- 10.79 eV
//
// Ionization energy of first water shell
// Rad. Phys. Chem. 59 p.267 by Dingf. et al.
return 10.79*eV;
}
return 0;
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4DNADingfelderChargeDecreaseModel::OutgoingParticleBindingEnergyConstant(G4ParticleDefinition* particleDefinition,
G4double G4DNADingfelderChargeDecreaseModel::OutgoingParticleBindingEnergyConstant(G4ParticleDefinition* particleDefinition,
G4int finalStateIndex)
{
G4DNAGenericIonsManager * instance(G4DNAGenericIonsManager::Instance());
G4DNAGenericIonsManager * instance(G4DNAGenericIonsManager::Instance());
if(particleDefinition == G4Proton::Proton()) return 13.6*eV;
if (particleDefinition == G4Proton::Proton())
return 13.6 * eV;
if (particleDefinition == instance->GetIon("alpha++") )
{
// Binding energy for He+ -> He++ + e- 54.509 eV
// Binding energy for He -> He+ + e- 24.587 eV
if (particleDefinition == instance->GetIon("alpha++"))
{
// Binding energy for He+ -> He++ + e- 54.509 eV
// Binding energy for He -> He+ + e- 24.587 eV
if (finalStateIndex==0) return 54.509*eV;
if (finalStateIndex == 0)
return 54.509 * eV;
return (54.509 + 24.587)*eV;
}
return (54.509 + 24.587) * eV;
}
if (particleDefinition == instance->GetIon("alpha+") )
{
// Binding energy for He+ -> He++ + e- 54.509 eV
// Binding energy for He -> He+ + e- 24.587 eV
if (particleDefinition == instance->GetIon("alpha+"))
{
// Binding energy for He+ -> He++ + e- 54.509 eV
// Binding energy for He -> He+ + e- 24.587 eV
return 24.587*eV;
}
return 24.587 * eV;
}
return 0;
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4DNADingfelderChargeDecreaseModel::PartialCrossSection(G4double k, G4int index,
G4double G4DNADingfelderChargeDecreaseModel::PartialCrossSection(G4double k,
G4int index,
const G4ParticleDefinition* particleDefinition)
{
G4int particleTypeIndex = 0;
G4DNAGenericIonsManager* instance;
instance = G4DNAGenericIonsManager::Instance();
G4int particleTypeIndex = 0;
G4DNAGenericIonsManager* instance;
instance = G4DNAGenericIonsManager::Instance();
if (particleDefinition == G4Proton::ProtonDefinition()) particleTypeIndex=0;
if (particleDefinition == instance->GetIon("alpha++")) particleTypeIndex=1;
if (particleDefinition == instance->GetIon("alpha+")) particleTypeIndex=2;
if (particleDefinition == G4Proton::ProtonDefinition())
particleTypeIndex = 0;
if (particleDefinition == instance->GetIon("alpha++"))
particleTypeIndex = 1;
if (particleDefinition == instance->GetIon("alpha+"))
particleTypeIndex = 2;
//
// sigma(T) = f0 10 ^ y(log10(T/eV))
//
// / a0 x + b0 x < x0
// |
// y(x) = < a0 x + b0 - c0 (x - x0)^d0 x0 <= x < x1
// |
// \ a1 x + b1 x >= x1
//
//
// f0, a0, a1, b0, b1, c0, d0, x0, x1 are parameters that change for protons and helium (0, +, ++)
//
// f0 has been added to the code in order to manage partial (shell-dependent) cross sections (if no shell dependence is present. f0=1. Sum of f0 over the considered shells should give 1)
//
// From Rad. Phys. and Chem. 59 (2000) 255-275, M. Dingfelder et al.
// Inelastic-collision cross sections of liquid water for interactions of energetic proton
//
if (x1[index][particleTypeIndex] < x0[index][particleTypeIndex])
{
//
// sigma(T) = f0 10 ^ y(log10(T/eV))
// if x1 < x0 means that x1 and b1 will be calculated with the following formula (this piece of code is run on all alphas and not on protons)
//
// / a0 x + b0 x < x0
// |
// y(x) = < a0 x + b0 - c0 (x - x0)^d0 x0 <= x < x1
// |
// \ a1 x + b1 x >= x1
// x1 = x0 + ((a0 - a1)/(c0 * d0)) ^ (1 / (d0 - 1))
//
//
// f0, a0, a1, b0, b1, c0, d0, x0, x1 are parameters that change for protons and helium (0, +, ++)
//
// f0 has been added to the code in order to manage partial (shell-dependent) cross sections (if no shell dependence is present. f0=1. Sum of f0 over the considered shells should give 1)
//
// From Rad. Phys. and Chem. 59 (2000) 255-275, M. Dingfelder et al.
// Inelastic-collision cross sections of liquid water for interactions of energetic proton
// b1 = (a0 - a1) * x1 + b0 - c0 * (x1 - x0) ^ d0
//
if (x1[index][particleTypeIndex]<x0[index][particleTypeIndex])
{
//
// if x1 < x0 means that x1 and b1 will be calculated with the following formula (this piece of code is run on all alphas and not on protons)
//
// x1 = x0 + ((a0 - a1)/(c0 * d0)) ^ (1 / (d0 - 1))
//
// b1 = (a0 - a1) * x1 + b0 - c0 * (x1 - x0) ^ d0
//
x1[index][particleTypeIndex] = x0[index][particleTypeIndex]
+ std::pow((a0[index][particleTypeIndex] - a1[index][particleTypeIndex])
/ (c0[index][particleTypeIndex]
* d0[index][particleTypeIndex]),
1. / (d0[index][particleTypeIndex] - 1.));
b1[index][particleTypeIndex] = (a0[index][particleTypeIndex]
- a1[index][particleTypeIndex]) * x1[index][particleTypeIndex]
+ b0[index][particleTypeIndex]
- c0[index][particleTypeIndex]
* std::pow(x1[index][particleTypeIndex]
- x0[index][particleTypeIndex],
d0[index][particleTypeIndex]);
}
x1[index][particleTypeIndex]=x0[index][particleTypeIndex] + std::pow((a0[index][particleTypeIndex] - a1[index][particleTypeIndex])
/ (c0[index][particleTypeIndex] * d0[index][particleTypeIndex]), 1. / (d0[index][particleTypeIndex] - 1.));
b1[index][particleTypeIndex]=(a0[index][particleTypeIndex] - a1[index][particleTypeIndex]) * x1[index][particleTypeIndex]
+ b0[index][particleTypeIndex] - c0[index][particleTypeIndex] * std::pow(x1[index][particleTypeIndex]
- x0[index][particleTypeIndex], d0[index][particleTypeIndex]);
}
G4double x(std::log10(k / eV));
G4double y;
G4double x(std::log10(k/eV));
G4double y;
if (x < x0[index][particleTypeIndex])
y = a0[index][particleTypeIndex] * x + b0[index][particleTypeIndex];
else if (x < x1[index][particleTypeIndex])
y = a0[index][particleTypeIndex] * x + b0[index][particleTypeIndex]
- c0[index][particleTypeIndex]
* std::pow(x - x0[index][particleTypeIndex],
d0[index][particleTypeIndex]);
else
y = a1[index][particleTypeIndex] * x + b1[index][particleTypeIndex];
if (x<x0[index][particleTypeIndex])
y=a0[index][particleTypeIndex] * x + b0[index][particleTypeIndex];
else if (x<x1[index][particleTypeIndex])
y=a0[index][particleTypeIndex] * x + b0[index][particleTypeIndex] - c0[index][particleTypeIndex]
* std::pow(x - x0[index][particleTypeIndex], d0[index][particleTypeIndex]);
else
y=a1[index][particleTypeIndex] * x + b1[index][particleTypeIndex];
return f0[index][particleTypeIndex] * std::pow(10., y)*m*m;
return f0[index][particleTypeIndex] * std::pow(10., y) * m * m;
}
G4int G4DNADingfelderChargeDecreaseModel::RandomSelect(G4double k,
G4int G4DNADingfelderChargeDecreaseModel::RandomSelect(G4double k,
const G4ParticleDefinition* particleDefinition)
{
G4int particleTypeIndex = 0;
G4DNAGenericIonsManager *instance;
instance = G4DNAGenericIonsManager::Instance();
G4int particleTypeIndex = 0;
G4DNAGenericIonsManager *instance;
instance = G4DNAGenericIonsManager::Instance();
if (particleDefinition == G4Proton::ProtonDefinition()) particleTypeIndex = 0;
if (particleDefinition == instance->GetIon("alpha++")) particleTypeIndex = 1;
if (particleDefinition == instance->GetIon("alpha+")) particleTypeIndex = 2;
if (particleDefinition == G4Proton::ProtonDefinition())
particleTypeIndex = 0;
if (particleDefinition == instance->GetIon("alpha++"))
particleTypeIndex = 1;
if (particleDefinition == instance->GetIon("alpha+"))
particleTypeIndex = 2;
const G4int n = numberOfPartialCrossSections[particleTypeIndex];
G4double* values(new G4double[n]);
G4double value(0);
G4int i = n;
const G4int n = numberOfPartialCrossSections[particleTypeIndex];
G4double* values(new G4double[n]);
G4double value(0);
G4int i = n;
while (i>0)
{
i--;
values[i]=PartialCrossSection(k, i, particleDefinition);
value+=values[i];
}
while (i > 0)
{
i--;
values[i] = PartialCrossSection(k, i, particleDefinition);
value += values[i];
}
value*=G4UniformRand();
value *= G4UniformRand();
i=n;
while (i>0)
{
i--;
i = n;
while (i > 0)
{
i--;
if (values[i]>value)
break;
if (values[i] > value)
break;
value-=values[i];
}
value -= values[i];
}
delete[] values;
delete[] values;
return i;
return i;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4DNADingfelderChargeDecreaseModel::Sum(G4double k, const G4ParticleDefinition* particleDefinition)
G4double G4DNADingfelderChargeDecreaseModel::Sum(G4double k,
const G4ParticleDefinition* particleDefinition)
{
G4int particleTypeIndex = 0;
G4DNAGenericIonsManager* instance;
instance = G4DNAGenericIonsManager::Instance();
G4int particleTypeIndex = 0;
G4DNAGenericIonsManager* instance;
instance = G4DNAGenericIonsManager::Instance();
if (particleDefinition == G4Proton::ProtonDefinition()) particleTypeIndex=0;
if (particleDefinition == instance->GetIon("alpha++")) particleTypeIndex=1;
if (particleDefinition == instance->GetIon("alpha+")) particleTypeIndex=2;
if (particleDefinition == G4Proton::ProtonDefinition())
particleTypeIndex = 0;
if (particleDefinition == instance->GetIon("alpha++"))
particleTypeIndex = 1;
if (particleDefinition == instance->GetIon("alpha+"))
particleTypeIndex = 2;
G4double totalCrossSection = 0.;
G4double totalCrossSection = 0.;
for (G4int i=0; i<numberOfPartialCrossSections[particleTypeIndex]; i++)
{
totalCrossSection += PartialCrossSection(k,i,particleDefinition);
}
return totalCrossSection;
for (G4int i = 0; i < numberOfPartialCrossSections[particleTypeIndex]; i++)
{
totalCrossSection += PartialCrossSection(k, i, particleDefinition);
}
return totalCrossSection;
}
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNADingfelderChargeIncreaseModel.cc 70171 2013-05-24 13:34:18Z gcosmo $
// $Id: G4DNADingfelderChargeIncreaseModel.cc 92859 2015-09-18 07:58:30Z gcosmo $
//
#include "G4DNADingfelderChargeIncreaseModel.hh"
@@ -38,28 +38,32 @@ using namespace std;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4DNADingfelderChargeIncreaseModel::G4DNADingfelderChargeIncreaseModel(const G4ParticleDefinition*,
const G4String& nam)
:G4VEmModel(nam),isInitialised(false)
const G4String& nam) :
G4VEmModel(nam), isInitialised(false)
{
// nistwater = G4NistManager::Instance()->FindOrBuildMaterial("G4_WATER");
fpMolWaterDensity = 0;
// nistwater = G4NistManager::Instance()->FindOrBuildMaterial("G4_WATER");
fpMolWaterDensity = 0;
numberOfPartialCrossSections[0]=0;
numberOfPartialCrossSections[1]=0;
numberOfPartialCrossSections[0] = 0;
numberOfPartialCrossSections[1] = 0;
verboseLevel= 0;
// Verbosity scale:
// 0 = nothing
// 1 = warning for energy non-conservation
// 2 = details of energy budget
// 3 = calculation of cross sections, file openings, sampling of atoms
// 4 = entering in methods
verboseLevel = 0;
// Verbosity scale:
// 0 = nothing
// 1 = warning for energy non-conservation
// 2 = details of energy budget
// 3 = calculation of cross sections, file openings, sampling of atoms
// 4 = entering in methods
if( verboseLevel>0 )
{
G4cout << "Dingfelder charge increase model is constructed " << G4endl;
}
fParticleChangeForGamma = 0;
if (verboseLevel > 0)
{
G4cout << "Dingfelder charge increase model is constructed " << G4endl;
}
fParticleChangeForGamma = 0;
// Selection of stationary mode
statCode = false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -73,116 +77,120 @@ void G4DNADingfelderChargeIncreaseModel::Initialise(const G4ParticleDefinition*
const G4DataVector& /*cuts*/)
{
if (verboseLevel > 3)
G4cout << "Calling G4DNADingfelderChargeIncreaseModel::Initialise()" << G4endl;
if (verboseLevel > 3)
{
G4cout << "Calling G4DNADingfelderChargeIncreaseModel::Initialise()"
<< G4endl;
}
// Energy limits
// Energy limits
G4DNAGenericIonsManager *instance;
instance = G4DNAGenericIonsManager::Instance();
G4ParticleDefinition* hydrogenDef = instance->GetIon("hydrogen");
G4ParticleDefinition* alphaPlusDef = instance->GetIon("alpha+");
G4ParticleDefinition* heliumDef = instance->GetIon("helium");
G4DNAGenericIonsManager *instance;
instance = G4DNAGenericIonsManager::Instance();
G4ParticleDefinition* hydrogenDef = instance->GetIon("hydrogen");
G4ParticleDefinition* alphaPlusDef = instance->GetIon("alpha+");
G4ParticleDefinition* heliumDef = instance->GetIon("helium");
G4String hydrogen;
G4String alphaPlus;
G4String helium;
G4String hydrogen;
G4String alphaPlus;
G4String helium;
// LIMITS
// LIMITS
hydrogen = hydrogenDef->GetParticleName();
lowEnergyLimit[hydrogen] = 100. * eV;
highEnergyLimit[hydrogen] = 100. * MeV;
hydrogen = hydrogenDef->GetParticleName();
lowEnergyLimit[hydrogen] = 100. * eV;
highEnergyLimit[hydrogen] = 100. * MeV;
alphaPlus = alphaPlusDef->GetParticleName();
lowEnergyLimit[alphaPlus] = 1. * keV;
highEnergyLimit[alphaPlus] = 400. * MeV;
alphaPlus = alphaPlusDef->GetParticleName();
lowEnergyLimit[alphaPlus] = 1. * keV;
highEnergyLimit[alphaPlus] = 400. * MeV;
helium = heliumDef->GetParticleName();
lowEnergyLimit[helium] = 1. * keV;
highEnergyLimit[helium] = 400. * MeV;
helium = heliumDef->GetParticleName();
lowEnergyLimit[helium] = 1. * keV;
highEnergyLimit[helium] = 400. * MeV;
//
if (particle==hydrogenDef)
{
SetLowEnergyLimit(lowEnergyLimit[hydrogen]);
SetHighEnergyLimit(highEnergyLimit[hydrogen]);
}
//
if (particle==alphaPlusDef)
{
SetLowEnergyLimit(lowEnergyLimit[alphaPlus]);
SetHighEnergyLimit(highEnergyLimit[alphaPlus]);
}
if (particle==hydrogenDef)
{
SetLowEnergyLimit(lowEnergyLimit[hydrogen]);
SetHighEnergyLimit(highEnergyLimit[hydrogen]);
}
if (particle==heliumDef)
{
SetLowEnergyLimit(lowEnergyLimit[helium]);
SetHighEnergyLimit(highEnergyLimit[helium]);
}
if (particle==alphaPlusDef)
{
SetLowEnergyLimit(lowEnergyLimit[alphaPlus]);
SetHighEnergyLimit(highEnergyLimit[alphaPlus]);
}
// Final state
if (particle==heliumDef)
{
SetLowEnergyLimit(lowEnergyLimit[helium]);
SetHighEnergyLimit(highEnergyLimit[helium]);
}
//ALPHA+
// Final state
f0[0][0]=1.;
a0[0][0]=2.25;
a1[0][0]=-0.75;
b0[0][0]=-32.10;
c0[0][0]=0.600;
d0[0][0]=2.40;
x0[0][0]=4.60;
//ALPHA+
x1[0][0]=-1.;
b1[0][0]=-1.;
f0[0][0]=1.;
a0[0][0]=2.25;
a1[0][0]=-0.75;
b0[0][0]=-32.10;
c0[0][0]=0.600;
d0[0][0]=2.40;
x0[0][0]=4.60;
numberOfPartialCrossSections[0]=1;
x1[0][0]=-1.;
b1[0][0]=-1.;
//HELIUM
numberOfPartialCrossSections[0]=1;
f0[0][1]=1.;
a0[0][1]=2.25;
a1[0][1]=-0.75;
b0[0][1]=-30.93;
c0[0][1]=0.590;
d0[0][1]=2.35;
x0[0][1]=4.29;
//HELIUM
f0[1][1]=1.;
a0[1][1]=2.25;
a1[1][1]=-0.75;
b0[1][1]=-32.61;
c0[1][1]=0.435;
d0[1][1]=2.70;
x0[1][1]=4.45;
f0[0][1]=1.;
a0[0][1]=2.25;
a1[0][1]=-0.75;
b0[0][1]=-30.93;
c0[0][1]=0.590;
d0[0][1]=2.35;
x0[0][1]=4.29;
x1[0][1]=-1.;
b1[0][1]=-1.;
f0[1][1]=1.;
a0[1][1]=2.25;
a1[1][1]=-0.75;
b0[1][1]=-32.61;
c0[1][1]=0.435;
d0[1][1]=2.70;
x0[1][1]=4.45;
x1[1][1]=-1.;
b1[1][1]=-1.;
x1[0][1]=-1.;
b1[0][1]=-1.;
numberOfPartialCrossSections[1]=2;
x1[1][1]=-1.;
b1[1][1]=-1.;
//
numberOfPartialCrossSections[1]=2;
if( verboseLevel>0 )
{
G4cout << "Dingfelder charge increase model is initialized " << G4endl
<< "Energy range: "
<< LowEnergyLimit() / keV << " keV - "
<< HighEnergyLimit() / MeV << " MeV for "
<< particle->GetParticleName()
<< G4endl;
}
//
// Initialize water density pointer
fpMolWaterDensity = G4DNAMolecularMaterial::Instance()->GetNumMolPerVolTableFor(G4Material::GetMaterial("G4_WATER"));
if( verboseLevel>0 )
{
G4cout << "Dingfelder charge increase model is initialized " << G4endl
<< "Energy range: "
<< LowEnergyLimit() / keV << " keV - "
<< HighEnergyLimit() / MeV << " MeV for "
<< particle->GetParticleName()
<< G4endl;
}
if (isInitialised) { return; }
fParticleChangeForGamma = GetParticleChangeForGamma();
isInitialised = true;
// Initialize water density pointer
fpMolWaterDensity = G4DNAMolecularMaterial::Instance()->GetNumMolPerVolTableFor(G4Material::GetMaterial("G4_WATER"));
if (isInitialised)
{ return;}
fParticleChangeForGamma = GetParticleChangeForGamma();
isInitialised = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -193,335 +201,378 @@ G4double G4DNADingfelderChargeIncreaseModel::CrossSectionPerVolume(const G4Mater
G4double,
G4double)
{
if (verboseLevel > 3)
G4cout << "Calling CrossSectionPerVolume() of G4DNADingfelderChargeIncreaseModel" << G4endl;
if (verboseLevel > 3)
{
G4cout
<< "Calling CrossSectionPerVolume() of G4DNADingfelderChargeIncreaseModel"
<< G4endl;
}
// Calculate total cross section for model
// Calculate total cross section for model
G4DNAGenericIonsManager *instance;
instance = G4DNAGenericIonsManager::Instance();
G4DNAGenericIonsManager *instance;
instance = G4DNAGenericIonsManager::Instance();
if (
particleDefinition != instance->GetIon("hydrogen")
&&
particleDefinition != instance->GetIon("alpha+")
&&
particleDefinition != instance->GetIon("helium")
)
if (
particleDefinition != instance->GetIon("hydrogen")
&&
particleDefinition != instance->GetIon("alpha+")
&&
particleDefinition != instance->GetIon("helium")
)
return 0;
return 0;
G4double lowLim = 0;
G4double highLim = 0;
G4double totalCrossSection = 0.;
G4double lowLim = 0;
G4double highLim = 0;
G4double totalCrossSection = 0.;
G4double waterDensity = (*fpMolWaterDensity)[material->GetIndex()];
G4double waterDensity = (*fpMolWaterDensity)[material->GetIndex()];
if(waterDensity!= 0.0)
if(waterDensity!= 0.0)
// if (material == nistwater || material->GetBaseMaterial() == nistwater)
{
const G4String& particleName = particleDefinition->GetParticleName();
std::map< G4String,G4double,std::less<G4String> >::iterator pos1;
pos1 = lowEnergyLimit.find(particleName);
if (pos1 != lowEnergyLimit.end())
{
const G4String& particleName = particleDefinition->GetParticleName();
std::map< G4String,G4double,std::less<G4String> >::iterator pos1;
pos1 = lowEnergyLimit.find(particleName);
if (pos1 != lowEnergyLimit.end())
{
lowLim = pos1->second;
}
std::map< G4String,G4double,std::less<G4String> >::iterator pos2;
pos2 = highEnergyLimit.find(particleName);
if (pos2 != highEnergyLimit.end())
{
highLim = pos2->second;
}
if (k >= lowLim && k < highLim)
{
//HYDROGEN
if (particleDefinition == instance->GetIon("hydrogen"))
{
const G4double aa = 2.835;
const G4double bb = 0.310;
const G4double cc = 2.100;
const G4double dd = 0.760;
const G4double fac = 1.0e-18;
const G4double rr = 13.606 * eV;
G4double t = k / (proton_mass_c2/electron_mass_c2);
G4double x = t / rr;
G4double temp = 4.0 * pi * Bohr_radius/nm * Bohr_radius/nm * fac;
G4double sigmal = temp * cc * (std::pow(x,dd));
G4double sigmah = temp * (aa * std::log(1.0 + x) + bb) / x;
totalCrossSection = 1.0/(1.0/sigmal + 1.0/sigmah) *m*m;
}
else
{
totalCrossSection = Sum(k,particleDefinition);
}
}
if (verboseLevel > 2)
{
G4cout << "__________________________________" << G4endl;
G4cout << "°°° G4DNADingfelderChargeIncreaseModel - XS INFO START" << G4endl;
G4cout << "°°° Kinetic energy(eV)=" << k/eV << " particle : " << particleName << G4endl;
G4cout << "°°° Cross section per water molecule (cm^2)=" << totalCrossSection/cm/cm << G4endl;
G4cout << "°°° Cross section per water molecule (cm^-1)=" << totalCrossSection*waterDensity/(1./cm) << G4endl;
// G4cout << " - Cross section per water molecule (cm^-1)=" << sigma*material->GetAtomicNumDensityVector()[1]/(1./cm) << G4endl;
G4cout << "°°° G4DNADingfelderChargeIncreaseModel - XS INFO END" << G4endl;
}
lowLim = pos1->second;
}
return totalCrossSection*waterDensity;
std::map< G4String,G4double,std::less<G4String> >::iterator pos2;
pos2 = highEnergyLimit.find(particleName);
if (pos2 != highEnergyLimit.end())
{
highLim = pos2->second;
}
if (k >= lowLim && k < highLim)
{
//HYDROGEN
if (particleDefinition == instance->GetIon("hydrogen"))
{
const G4double aa = 2.835;
const G4double bb = 0.310;
const G4double cc = 2.100;
const G4double dd = 0.760;
const G4double fac = 1.0e-18;
const G4double rr = 13.606 * eV;
G4double t = k / (proton_mass_c2/electron_mass_c2);
G4double x = t / rr;
G4double temp = 4.0 * pi * Bohr_radius/nm * Bohr_radius/nm * fac;
G4double sigmal = temp * cc * (std::pow(x,dd));
G4double sigmah = temp * (aa * std::log(1.0 + x) + bb) / x;
totalCrossSection = 1.0/(1.0/sigmal + 1.0/sigmah) *m*m;
}
else
{
totalCrossSection = Sum(k,particleDefinition);
}
}
if (verboseLevel > 2)
{
G4cout << "__________________________________" << G4endl;
G4cout << "G4DNADingfelderChargeIncreaseModel - XS INFO START" << G4endl;
G4cout << "Kinetic energy(eV)=" << k/eV << " particle : " << particleName << G4endl;
G4cout << "Cross section per water molecule (cm^2)=" << totalCrossSection/cm/cm << G4endl;
G4cout << "Cross section per water molecule (cm^-1)=" << totalCrossSection*waterDensity/(1./cm) << G4endl;
// G4cout << " - Cross section per water molecule (cm^-1)=" << sigma*material->GetAtomicNumDensityVector()[1]/(1./cm) << G4endl;
G4cout << "G4DNADingfelderChargeIncreaseModel - XS INFO END" << G4endl;
}
}
return totalCrossSection*waterDensity;
// return totalCrossSection*material->GetAtomicNumDensityVector()[1];
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4DNADingfelderChargeIncreaseModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
void G4DNADingfelderChargeIncreaseModel::SampleSecondaries(std::vector<
G4DynamicParticle*>* fvect,
const G4MaterialCutsCouple* /*couple*/,
const G4DynamicParticle* aDynamicParticle,
G4double,
G4double)
{
if (verboseLevel > 3)
G4cout << "Calling SampleSecondaries() of G4DNADingfelderChargeIncreaseModel" << G4endl;
if (verboseLevel > 3)
{
G4cout
<< "Calling SampleSecondaries() of G4DNADingfelderChargeIncreaseModel"
<< G4endl;
}
if (!statCode) fParticleChangeForGamma->ProposeLocalEnergyDeposit(0.);
G4ParticleDefinition* definition = aDynamicParticle->GetDefinition();
fParticleChangeForGamma->ProposeTrackStatus(fStopAndKill);
fParticleChangeForGamma->ProposeLocalEnergyDeposit(0.);
G4double particleMass = definition->GetPDGMass();
G4ParticleDefinition* definition = aDynamicParticle->GetDefinition();
G4double inK = aDynamicParticle->GetKineticEnergy();
G4double particleMass = definition->GetPDGMass();
G4int finalStateIndex = RandomSelect(inK,definition);
G4double inK = aDynamicParticle->GetKineticEnergy();
G4int n = NumberOfFinalStates(definition,finalStateIndex);
G4int finalStateIndex = RandomSelect(inK,definition);
G4double outK = 0.;
if (!statCode) outK = inK - IncomingParticleBindingEnergyConstant(definition,finalStateIndex);
G4int n = NumberOfFinalStates(definition,finalStateIndex);
else outK = inK;
if (statCode)
fParticleChangeForGamma->ProposeLocalEnergyDeposit(IncomingParticleBindingEnergyConstant(definition,finalStateIndex));
G4double outK = inK - IncomingParticleBindingEnergyConstant(definition,finalStateIndex);
fParticleChangeForGamma->ProposeTrackStatus(fStopAndKill);
G4DNAGenericIonsManager* instance;
instance = G4DNAGenericIonsManager::Instance();
G4DNAGenericIonsManager* instance;
instance = G4DNAGenericIonsManager::Instance();
G4double electronK;
if (definition == instance->GetIon("hydrogen")) electronK = inK*electron_mass_c2/proton_mass_c2;
else electronK = inK*electron_mass_c2/(particleMass);
G4double electronK;
if (definition == instance->GetIon("hydrogen")) electronK = inK*electron_mass_c2/proton_mass_c2;
else electronK = inK*electron_mass_c2/(particleMass);
if (outK<0)
{
G4Exception("G4DNADingfelderChargeIncreaseModel::SampleSecondaries","em0004",
FatalException,"Final kinetic energy is negative.");
}
if (outK<0)
{
G4Exception("G4DNADingfelderChargeIncreaseModel::SampleSecondaries","em0004",
FatalException,"Final kinetic energy is negative.");
}
G4DynamicParticle* dp = new G4DynamicParticle
G4DynamicParticle* dp = new G4DynamicParticle(OutgoingParticleDefinition(definition,finalStateIndex),
aDynamicParticle->GetMomentumDirection(),
outK);
(OutgoingParticleDefinition(definition,finalStateIndex),
aDynamicParticle->GetMomentumDirection(),
outK) ;
fvect->push_back(dp);
fvect->push_back(dp);
n = n - 1;
while (n>0)
{
n--;
fvect->push_back(new G4DynamicParticle
(G4Electron::Electron(), aDynamicParticle->GetMomentumDirection(), electronK) );
}
n = n - 1;
while (n>0)
{
n--;
fvect->push_back(new G4DynamicParticle
(G4Electron::Electron(), aDynamicParticle->GetMomentumDirection(), electronK) );
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4int G4DNADingfelderChargeIncreaseModel::NumberOfFinalStates(G4ParticleDefinition* particleDefinition,
G4int finalStateIndex )
G4int G4DNADingfelderChargeIncreaseModel::NumberOfFinalStates(G4ParticleDefinition* particleDefinition,
G4int finalStateIndex)
{
G4DNAGenericIonsManager* instance;
instance = G4DNAGenericIonsManager::Instance();
if (particleDefinition == instance->GetIon("hydrogen")) return 2;
if (particleDefinition == instance->GetIon("alpha+")) return 2;
instance = G4DNAGenericIonsManager::Instance();
if (particleDefinition == instance->GetIon("hydrogen"))
return 2;
if (particleDefinition == instance->GetIon("alpha+"))
return 2;
if (particleDefinition == instance->GetIon("helium"))
{ if (finalStateIndex==0) return 2;
return 3;
}
return 0;
if (particleDefinition == instance->GetIon("helium"))
{
if (finalStateIndex == 0)
return 2;
return 3;
}
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ParticleDefinition* G4DNADingfelderChargeIncreaseModel::OutgoingParticleDefinition (G4ParticleDefinition* particleDefinition,
G4int finalStateIndex)
G4ParticleDefinition* G4DNADingfelderChargeIncreaseModel::OutgoingParticleDefinition(G4ParticleDefinition* particleDefinition,
G4int finalStateIndex)
{
G4DNAGenericIonsManager * instance(G4DNAGenericIonsManager::Instance());
if (particleDefinition == instance->GetIon("hydrogen")) return G4Proton::Proton();
if (particleDefinition == instance->GetIon("alpha+")) return instance->GetIon("alpha++");
G4DNAGenericIonsManager * instance(G4DNAGenericIonsManager::Instance());
if (particleDefinition == instance->GetIon("hydrogen"))
return G4Proton::Proton();
if (particleDefinition == instance->GetIon("alpha+"))
return instance->GetIon("alpha++");
if (particleDefinition == instance->GetIon("helium"))
{
if (finalStateIndex==0) return instance->GetIon("alpha+");
return instance->GetIon("alpha++");
}
return 0;
if (particleDefinition == instance->GetIon("helium"))
{
if (finalStateIndex == 0)
return instance->GetIon("alpha+");
return instance->GetIon("alpha++");
}
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4DNADingfelderChargeIncreaseModel::IncomingParticleBindingEnergyConstant(G4ParticleDefinition* particleDefinition,
G4int finalStateIndex )
G4double G4DNADingfelderChargeIncreaseModel::IncomingParticleBindingEnergyConstant(G4ParticleDefinition* particleDefinition,
G4int finalStateIndex)
{
G4DNAGenericIonsManager * instance(G4DNAGenericIonsManager::Instance());
if(particleDefinition == instance->GetIon("hydrogen")) return 13.6*eV;
G4DNAGenericIonsManager * instance(G4DNAGenericIonsManager::Instance());
if (particleDefinition == instance->GetIon("hydrogen"))
return 13.6 * eV;
if(particleDefinition == instance->GetIon("alpha+"))
{
// Binding energy for He+ -> He++ + e- 54.509 eV
// Binding energy for He -> He+ + e- 24.587 eV
return 54.509*eV;
}
if (particleDefinition == instance->GetIon("alpha+"))
{
// Binding energy for He+ -> He++ + e- 54.509 eV
// Binding energy for He -> He+ + e- 24.587 eV
return 54.509 * eV;
}
if(particleDefinition == instance->GetIon("helium"))
{
// Binding energy for He+ -> He++ + e- 54.509 eV
// Binding energy for He -> He+ + e- 24.587 eV
if (particleDefinition == instance->GetIon("helium"))
{
// Binding energy for He+ -> He++ + e- 54.509 eV
// Binding energy for He -> He+ + e- 24.587 eV
if (finalStateIndex==0) return 24.587*eV;
return (54.509 + 24.587)*eV;
}
if (finalStateIndex == 0)
return 24.587 * eV;
return (54.509 + 24.587) * eV;
}
return 0;
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4DNADingfelderChargeIncreaseModel::PartialCrossSection(G4double k, G4int index,
G4double G4DNADingfelderChargeIncreaseModel::PartialCrossSection(G4double k,
G4int index,
const G4ParticleDefinition* particleDefinition)
{
G4int particleTypeIndex = 0;
G4DNAGenericIonsManager *instance;
instance = G4DNAGenericIonsManager::Instance();
G4int particleTypeIndex = 0;
G4DNAGenericIonsManager *instance;
instance = G4DNAGenericIonsManager::Instance();
if (particleDefinition == instance->GetIon("alpha+"))
particleTypeIndex = 0;
if (particleDefinition == instance->GetIon("helium"))
particleTypeIndex = 1;
if (particleDefinition == instance->GetIon("alpha+")) particleTypeIndex=0;
if (particleDefinition == instance->GetIon("helium")) particleTypeIndex=1;
//
// sigma(T) = f0 10 ^ y(log10(T/eV))
//
// / a0 x + b0 x < x0
// |
// y(x) = < a0 x + b0 - c0 (x - x0)^d0 x0 <= x < x1
// |
// \ a1 x + b1 x >= x1
//
//
// f0, a0, a1, b0, b1, c0, d0, x0, x1 are parameters that change for protons and helium (0, +, ++)
//
// f0 has been added to the code in order to manage partial (shell-dependent) cross sections (if no shell dependence is present. f0=1. Sum of f0 over the considered shells should give 1)
//
// From Rad. Phys. and Chem. 59 (2000) 255-275, M. Dingfelder et al.
// Inelastic-collision cross sections of liquid water for interactions of energetic proton
//
if (x1[index][particleTypeIndex] < x0[index][particleTypeIndex])
{
//
// sigma(T) = f0 10 ^ y(log10(T/eV))
// if x1 < x0 means that x1 and b1 will be calculated with the following formula (this piece of code is run on all alphas and not on protons)
//
// / a0 x + b0 x < x0
// |
// y(x) = < a0 x + b0 - c0 (x - x0)^d0 x0 <= x < x1
// |
// \ a1 x + b1 x >= x1
// x1 = x0 + ((a0 - a1)/(c0 * d0)) ^ (1 / (d0 - 1))
//
//
// f0, a0, a1, b0, b1, c0, d0, x0, x1 are parameters that change for protons and helium (0, +, ++)
//
// f0 has been added to the code in order to manage partial (shell-dependent) cross sections (if no shell dependence is present. f0=1. Sum of f0 over the considered shells should give 1)
//
// From Rad. Phys. and Chem. 59 (2000) 255-275, M. Dingfelder et al.
// Inelastic-collision cross sections of liquid water for interactions of energetic proton
// b1 = (a0 - a1) * x1 + b0 - c0 * (x1 - x0) ^ d0
//
if (x1[index][particleTypeIndex]<x0[index][particleTypeIndex])
{
//
// if x1 < x0 means that x1 and b1 will be calculated with the following formula (this piece of code is run on all alphas and not on protons)
//
// x1 = x0 + ((a0 - a1)/(c0 * d0)) ^ (1 / (d0 - 1))
//
// b1 = (a0 - a1) * x1 + b0 - c0 * (x1 - x0) ^ d0
//
x1[index][particleTypeIndex] = x0[index][particleTypeIndex]
+ std::pow((a0[index][particleTypeIndex] - a1[index][particleTypeIndex])
/ (c0[index][particleTypeIndex]
* d0[index][particleTypeIndex]),
1. / (d0[index][particleTypeIndex] - 1.));
b1[index][particleTypeIndex] = (a0[index][particleTypeIndex]
- a1[index][particleTypeIndex]) * x1[index][particleTypeIndex]
+ b0[index][particleTypeIndex]
- c0[index][particleTypeIndex]
* std::pow(x1[index][particleTypeIndex]
- x0[index][particleTypeIndex],
d0[index][particleTypeIndex]);
}
x1[index][particleTypeIndex]=x0[index][particleTypeIndex] + std::pow((a0[index][particleTypeIndex] - a1[index][particleTypeIndex]) / (c0[index][particleTypeIndex] * d0[index][particleTypeIndex]), 1. / (d0[index][particleTypeIndex] - 1.));
b1[index][particleTypeIndex]=(a0[index][particleTypeIndex] - a1[index][particleTypeIndex]) * x1[index][particleTypeIndex] + b0[index][particleTypeIndex] - c0[index][particleTypeIndex] * std::pow(x1[index][particleTypeIndex] - x0[index][particleTypeIndex], d0[index][particleTypeIndex]);
}
G4double x(std::log10(k / eV));
G4double y;
G4double x(std::log10(k/eV));
G4double y;
if (x < x0[index][particleTypeIndex])
y = a0[index][particleTypeIndex] * x + b0[index][particleTypeIndex];
else if (x < x1[index][particleTypeIndex])
y = a0[index][particleTypeIndex] * x + b0[index][particleTypeIndex]
- c0[index][particleTypeIndex]
* std::pow(x - x0[index][particleTypeIndex],
d0[index][particleTypeIndex]);
else
y = a1[index][particleTypeIndex] * x + b1[index][particleTypeIndex];
if (x<x0[index][particleTypeIndex])
y=a0[index][particleTypeIndex] * x + b0[index][particleTypeIndex];
else if (x<x1[index][particleTypeIndex])
y=a0[index][particleTypeIndex] * x + b0[index][particleTypeIndex] - c0[index][particleTypeIndex] * std::pow(x - x0[index][particleTypeIndex], d0[index][particleTypeIndex]);
else
y=a1[index][particleTypeIndex] * x + b1[index][particleTypeIndex];
return f0[index][particleTypeIndex] * std::pow(10., y)*m*m;
return f0[index][particleTypeIndex] * std::pow(10., y) * m * m;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4int G4DNADingfelderChargeIncreaseModel::RandomSelect(G4double k,
G4int G4DNADingfelderChargeIncreaseModel::RandomSelect(G4double k,
const G4ParticleDefinition* particleDefinition)
{
G4int particleTypeIndex = 0;
G4DNAGenericIonsManager *instance;
instance = G4DNAGenericIonsManager::Instance();
G4int particleTypeIndex = 0;
G4DNAGenericIonsManager *instance;
instance = G4DNAGenericIonsManager::Instance();
if (particleDefinition == instance->GetIon("hydrogen"))
return 0;
if (particleDefinition == instance->GetIon("alpha+"))
particleTypeIndex = 0;
if (particleDefinition == instance->GetIon("helium"))
particleTypeIndex = 1;
if (particleDefinition == instance->GetIon("hydrogen")) return 0;
if (particleDefinition == instance->GetIon("alpha+")) particleTypeIndex=0;
if (particleDefinition == instance->GetIon("helium")) particleTypeIndex=1;
const G4int n = numberOfPartialCrossSections[particleTypeIndex];
G4double* values(new G4double[n]);
G4double value = 0;
G4int i = n;
const G4int n = numberOfPartialCrossSections[particleTypeIndex];
G4double* values(new G4double[n]);
G4double value = 0;
G4int i = n;
while (i > 0)
{
i--;
values[i] = PartialCrossSection(k, i, particleDefinition);
value += values[i];
}
while (i>0)
{
i--;
values[i]=PartialCrossSection(k, i, particleDefinition);
value+=values[i];
}
value *= G4UniformRand();
value*=G4UniformRand();
i = n;
while (i > 0)
{
i--;
i=n;
while (i>0)
{
i--;
if (values[i] > value)
break;
if (values[i]>value)
break;
value -= values[i];
}
value-=values[i];
}
delete[] values;
delete[] values;
return i;
return i;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4DNADingfelderChargeIncreaseModel::Sum(G4double k, const G4ParticleDefinition* particleDefinition)
G4double G4DNADingfelderChargeIncreaseModel::Sum(G4double k,
const G4ParticleDefinition* particleDefinition)
{
G4int particleTypeIndex = 0;
G4DNAGenericIonsManager *instance;
instance = G4DNAGenericIonsManager::Instance();
G4int particleTypeIndex = 0;
G4DNAGenericIonsManager *instance;
instance = G4DNAGenericIonsManager::Instance();
if (particleDefinition == instance->GetIon("alpha+")) particleTypeIndex=0;
if (particleDefinition == instance->GetIon("helium")) particleTypeIndex=1;
if (particleDefinition == instance->GetIon("alpha+"))
particleTypeIndex = 0;
if (particleDefinition == instance->GetIon("helium"))
particleTypeIndex = 1;
G4double totalCrossSection = 0.;
G4double totalCrossSection = 0.;
for (G4int i=0; i<numberOfPartialCrossSections[particleTypeIndex]; i++)
{
totalCrossSection += PartialCrossSection(k,i,particleDefinition);
}
return totalCrossSection;
for (G4int i = 0; i < numberOfPartialCrossSections[particleTypeIndex]; i++)
{
totalCrossSection += PartialCrossSection(k, i, particleDefinition);
}
return totalCrossSection;
}
@@ -0,0 +1,325 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// Based on the work described in
// Rad Res 163, 98-111 (2005)
// D. Emfietzoglou, H. Nikjoo
//
// Authors of the class (2014):
// I. Kyriakou (kyriak@cc.uoi.gr)
// D. Emfietzoglou (demfietz@cc.uoi.gr)
// S. Incerti (incerti@cenbg.in2p3.fr)
//
#include "G4DNAEmfietzoglouExcitationModel.hh"
#include "G4SystemOfUnits.hh"
#include "G4DNAChemistryManager.hh"
#include "G4DNAMolecularMaterial.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
using namespace std;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4DNAEmfietzoglouExcitationModel::G4DNAEmfietzoglouExcitationModel(const G4ParticleDefinition*,
const G4String& nam)
:G4VEmModel(nam),isInitialised(false)
{
// nistwater = G4NistManager::Instance()->FindOrBuildMaterial("G4_WATER");
fpMolWaterDensity = 0;
verboseLevel= 0;
// Verbosity scale:
// 0 = nothing
// 1 = warning for energy non-conservation
// 2 = details of energy budget
// 3 = calculation of cross sections, file openings, sampling of atoms
// 4 = entering in methods
if( verboseLevel>0 )
{
G4cout << "Emfietzoglou excitation model is constructed " << G4endl;
}
fParticleChangeForGamma = 0;
SetLowEnergyLimit(8. * eV);
SetHighEnergyLimit(10. * keV);
// Selection of stationary mode
statCode = false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4DNAEmfietzoglouExcitationModel::~G4DNAEmfietzoglouExcitationModel()
{
// Cross section
std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos;
for (pos = tableData.begin(); pos != tableData.end(); ++pos)
{
G4DNACrossSectionDataSet* table = pos->second;
delete table;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4DNAEmfietzoglouExcitationModel::Initialise(const G4ParticleDefinition* particle,
const G4DataVector& /*cuts*/)
{
if (verboseLevel > 3)
G4cout << "Calling G4DNAEmfietzoglouExcitationModel::Initialise()" << G4endl;
G4String fileElectron("dna/sigma_excitation_e_emfietzoglou");
G4ParticleDefinition* electronDef = G4Electron::ElectronDefinition();
G4String electron;
G4double scaleFactor = (1.e-22 / 3.343) * m*m;
// *** ELECTRON
electron = electronDef->GetParticleName();
tableFile[electron] = fileElectron;
lowEnergyLimit[electron] = 8. * eV;
highEnergyLimit[electron] = 10. * keV;
// Cross section
G4DNACrossSectionDataSet* tableE = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor );
tableE->LoadData(fileElectron);
tableData[electron] = tableE;
//
if (particle==electronDef)
{
SetLowEnergyLimit(lowEnergyLimit[electron]);
SetHighEnergyLimit(highEnergyLimit[electron]);
}
if( verboseLevel>0 )
{
G4cout << "Emfietzoglou excitation model is initialized " << G4endl
<< "Energy range: "
<< LowEnergyLimit() / eV << " eV - "
<< HighEnergyLimit() / keV << " keV for "
<< particle->GetParticleName()
<< G4endl;
}
// Initialize water density pointer
fpMolWaterDensity = G4DNAMolecularMaterial::Instance()->GetNumMolPerVolTableFor(G4Material::GetMaterial("G4_WATER"));
if (isInitialised) { return; }
fParticleChangeForGamma = GetParticleChangeForGamma();
isInitialised = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4DNAEmfietzoglouExcitationModel::CrossSectionPerVolume(const G4Material* material,
const G4ParticleDefinition* particleDefinition,
G4double ekin,
G4double,
G4double)
{
if (verboseLevel > 3)
G4cout << "Calling CrossSectionPerVolume() of G4DNAEmfietzoglouExcitationModel" << G4endl;
if (particleDefinition != G4Electron::ElectronDefinition()) return 0;
// Calculate total cross section for model
G4double lowLim = 0;
G4double highLim = 0;
G4double sigma=0;
G4double waterDensity = (*fpMolWaterDensity)[material->GetIndex()];
if(waterDensity!= 0.0)
{
const G4String& particleName = particleDefinition->GetParticleName();
std::map< G4String,G4double,std::less<G4String> >::iterator pos1;
pos1 = lowEnergyLimit.find(particleName);
if (pos1 != lowEnergyLimit.end())
{
lowLim = pos1->second;
}
std::map< G4String,G4double,std::less<G4String> >::iterator pos2;
pos2 = highEnergyLimit.find(particleName);
if (pos2 != highEnergyLimit.end())
{
highLim = pos2->second;
}
if (ekin >= lowLim && ekin < highLim)
{
std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos;
pos = tableData.find(particleName);
if (pos != tableData.end())
{
G4DNACrossSectionDataSet* table = pos->second;
if (table != 0)
{
sigma = table->FindValue(ekin);
}
}
else
{
G4Exception("G4DNAEmfietzoglouExcitationModel::CrossSectionPerVolume","em0002",
FatalException,"Model not applicable to particle type.");
}
}
if (verboseLevel > 2)
{
G4cout << "__________________________________" << G4endl;
G4cout << "G4DNAEmfietzoglouExcitationModel - XS INFO START" << G4endl;
G4cout << "Kinetic energy(eV)=" << ekin/eV << " particle : " << particleName << G4endl;
G4cout << "Cross section per water molecule (cm^2)=" << sigma/cm/cm << G4endl;
G4cout << "Cross section per water molecule (cm^-1)=" << sigma*waterDensity/(1./cm) << G4endl;
// G4cout << " Cross section per water molecule (cm^-1)=" << sigma*material->GetAtomicNumDensityVector()[1]/(1./cm) << G4endl;
G4cout << "G4DNAEmfietzoglouExcitationModel - XS INFO END" << G4endl;
}
} // if (waterMaterial)
return sigma*waterDensity;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4DNAEmfietzoglouExcitationModel::SampleSecondaries(std::vector<G4DynamicParticle*>* /*fvect*/,
const G4MaterialCutsCouple* /*couple*/,
const G4DynamicParticle* aDynamicParticle,
G4double,
G4double)
{
if (verboseLevel > 3)
G4cout << "Calling SampleSecondaries() of G4DNAEmfietzoglouExcitationModel" << G4endl;
G4double k = aDynamicParticle->GetKineticEnergy();
const G4String& particleName = aDynamicParticle->GetDefinition()->GetParticleName();
G4int level = RandomSelect(k,particleName);
G4double excitationEnergy = waterStructure.ExcitationEnergy(level);
G4double newEnergy = k - excitationEnergy;
if (newEnergy > 0)
{
fParticleChangeForGamma->ProposeMomentumDirection(aDynamicParticle->GetMomentumDirection());
if (!statCode) fParticleChangeForGamma->SetProposedKineticEnergy(newEnergy);
else fParticleChangeForGamma->SetProposedKineticEnergy(k);
fParticleChangeForGamma->ProposeLocalEnergyDeposit(excitationEnergy);
}
const G4Track * theIncomingTrack = fParticleChangeForGamma->GetCurrentTrack();
G4DNAChemistryManager::Instance()->CreateWaterMolecule(eExcitedMolecule,
level,
theIncomingTrack);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4int G4DNAEmfietzoglouExcitationModel::RandomSelect(G4double k, const G4String& particle)
{
G4int level = 0;
std::map< G4String,G4DNACrossSectionDataSet*,std::less<G4String> >::iterator pos;
pos = tableData.find(particle);
if (pos != tableData.end())
{
G4DNACrossSectionDataSet* table = pos->second;
if (table != 0)
{
G4double* valuesBuffer = new G4double[table->NumberOfComponents()];
const size_t n(table->NumberOfComponents());
size_t i(n);
G4double value = 0.;
//Check reading of initial xs file
//G4cout << table->GetComponent(0)->FindValue(k)/ ((1.e-22 / 3.343) * m*m) << G4endl;
//G4cout << table->GetComponent(1)->FindValue(k)/ ((1.e-22 / 3.343) * m*m) << G4endl;
//G4cout << table->GetComponent(2)->FindValue(k)/ ((1.e-22 / 3.343) * m*m) << G4endl;
//G4cout << table->GetComponent(3)->FindValue(k)/ ((1.e-22 / 3.343) * m*m) << G4endl;
//G4cout << table->GetComponent(4)->FindValue(k)/ ((1.e-22 / 3.343) * m*m) << G4endl;
//G4cout << table->GetComponent(5)->FindValue(k)/ ((1.e-22 / 3.343) * m*m) << G4endl;
//G4cout << table->GetComponent(6)->FindValue(k)/ ((1.e-22 / 3.343) * m*m) << G4endl;
//abort();
while (i>0)
{
i--;
valuesBuffer[i] = table->GetComponent(i)->FindValue(k);
value += valuesBuffer[i];
}
value *= G4UniformRand();
i = n;
while (i > 0)
{
i--;
if (valuesBuffer[i] > value)
{
delete[] valuesBuffer;
return i;
}
value -= valuesBuffer[i];
}
if (valuesBuffer) delete[] valuesBuffer;
}
}
else
{
G4Exception("G4DNAEmfietzoglouExcitationModel::RandomSelect","em0002",
FatalException,"Model not applicable to particle type.");
}
return level;
}
@@ -0,0 +1,515 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// Author: H. N. Tran (Ton Duc Thang University)
// p, H, He, He+ and He++ models are assumed identical
// NIMB 343, 132-137 (2015)
//
// The Geant4-DNA web site is available at http://geant4-dna.org
//
#include "G4DNAIonElasticModel.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4DNAMolecularMaterial.hh"
#include "G4ParticleTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
using namespace std;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4DNAIonElasticModel::G4DNAIonElasticModel (const G4ParticleDefinition*,
const G4String& nam) :
G4VEmModel(nam), isInitialised(false)
{
//nistwater = G4NistManager::Instance()->FindOrBuildMaterial("G4_WATER");
killBelowEnergy = 100 * eV;
lowEnergyLimit = 0 * eV;
highEnergyLimit = 1 * MeV;
SetLowEnergyLimit(lowEnergyLimit);
SetHighEnergyLimit(highEnergyLimit);
verboseLevel = 0;
// Verbosity scale:
// 0 = nothing
// 1 = warning for energy non-conservation
// 2 = details of energy budget
// 3 = calculation of cross sections, file openings, sampling of atoms
// 4 = entering in methods
if(verboseLevel > 0)
{
G4cout << "Ion elastic model is constructed " << G4endl<< "Energy range: "
<< lowEnergyLimit / eV << " eV - "
<< highEnergyLimit / MeV << " MeV"
<< G4endl;
}
fParticleChangeForGamma = 0;
fpMolWaterDensity = 0;
fpTableData = 0;
fParticle_Mass = -1;
// Selection of stationary mode
statCode = false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4DNAIonElasticModel::~G4DNAIonElasticModel ()
{
// For total cross section
if(fpTableData) delete fpTableData;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void
G4DNAIonElasticModel::Initialise (
const G4ParticleDefinition* particleDefinition,
const G4DataVector& /*cuts*/)
{
if(verboseLevel > 3)
{
G4cout << "Calling G4DNAIonElasticModel::Initialise()" << G4endl;
}
// Energy limits
if (LowEnergyLimit() < lowEnergyLimit)
{
G4cout << "G4DNAIonElasticModel: low energy limit increased from " <<
LowEnergyLimit()/eV << " eV to " << lowEnergyLimit/eV << " eV" << G4endl;
SetLowEnergyLimit(lowEnergyLimit);
}
if (HighEnergyLimit() > highEnergyLimit)
{
G4cout << "G4DNAIonElasticModel: high energy limit decreased from " <<
HighEnergyLimit()/MeV << " MeV to " << highEnergyLimit/MeV << " MeV" << G4endl;
SetHighEnergyLimit(highEnergyLimit);
}
// Reading of data files
G4double scaleFactor = 1e-16*cm*cm;
char *path = getenv("G4LEDATA");
if (!path)
{
G4Exception("G4IonElasticModel::Initialise","em0006",
FatalException,"G4LEDATA environment variable not set.");
return;
}
G4String totalXSFile;
std::ostringstream fullFileName;
G4DNAGenericIonsManager *instance;
instance = G4DNAGenericIonsManager::Instance();
G4ParticleDefinition* protonDef =
G4ParticleTable::GetParticleTable()->FindParticle("proton");
G4ParticleDefinition* hydrogenDef = instance->GetIon("hydrogen");
G4ParticleDefinition* heliumDef = instance->GetIon("helium");
G4ParticleDefinition* alphaplusDef = instance->GetIon("alpha+");
G4ParticleDefinition* alphaplusplusDef = instance->GetIon("alpha++");
G4String proton, hydrogen, helium, alphaplus, alphaplusplus;
if (
(particleDefinition == protonDef && protonDef != 0)
||
(particleDefinition == hydrogenDef && hydrogenDef != 0)
)
{
// For total cross section of p,h
fParticle_Mass = 1.;
totalXSFile = "dna/sigma_elastic_proton_HTran";
// For final state
fullFileName << path << "/dna/sigmadiff_cumulated_elastic_proton_HTran.dat";
}
if (
(particleDefinition == instance->GetIon("helium") && heliumDef)
||
(particleDefinition == instance->GetIon("alpha+") && alphaplusDef)
||
(particleDefinition == instance->GetIon("alpha++") && alphaplusplusDef)
)
{
fParticle_Mass = 4.;
// For total cross section of he,he+,he++
totalXSFile = "dna/sigma_elastic_alpha_HTran";
// For final state
fullFileName << path << "/dna/sigmadiff_cumulated_elastic_alpha_HTran.dat";
}
fpTableData = new G4DNACrossSectionDataSet(new G4LogLogInterpolation, eV,scaleFactor );
fpTableData->LoadData(totalXSFile);
std::ifstream diffCrossSection(fullFileName.str().c_str());
if (!diffCrossSection)
{
G4ExceptionDescription description;
description << "Missing data file:"
<<fullFileName.str().c_str()<< G4endl;
G4Exception("G4IonElasticModel::Initialise","em0003",
FatalException,
description);
}
// Added clear for MT
eTdummyVec.clear();
eVecm.clear();
fDiffCrossSectionData.clear();
//
eTdummyVec.push_back(0.);
while(!diffCrossSection.eof())
{
double tDummy;
double eDummy;
diffCrossSection>>tDummy>>eDummy;
// SI : mandatory eVecm initialization
if (tDummy != eTdummyVec.back())
{
eTdummyVec.push_back(tDummy);
eVecm[tDummy].push_back(0.);
}
diffCrossSection>>fDiffCrossSectionData[tDummy][eDummy];
if (eDummy != eVecm[tDummy].back()) eVecm[tDummy].push_back(eDummy);
}
// End final state
if( verboseLevel>0 )
{
if (verboseLevel > 2)
{
G4cout << "Loaded cross section files for ion elastic model" << G4endl;
}
G4cout << "Ion elastic model is initialized " << G4endl
<< "Energy range: "
<< LowEnergyLimit() / eV << " eV - "
<< HighEnergyLimit() / MeV << " MeV"
<< G4endl;
}
// Initialize water density pointer
G4DNAMolecularMaterial::Instance()->Initialize();
fpMolWaterDensity = G4DNAMolecularMaterial::Instance()->
GetNumMolPerVolTableFor(G4Material::GetMaterial("G4_WATER"));
if (isInitialised)
{ return;}
fParticleChangeForGamma = GetParticleChangeForGamma();
isInitialised = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double
G4DNAIonElasticModel::CrossSectionPerVolume (const G4Material* material,
const G4ParticleDefinition* p,
G4double ekin, G4double, G4double)
{
if(verboseLevel > 3)
{
G4cout << "Calling CrossSectionPerVolume() of G4DNAIonElasticModel"
<< G4endl;
}
// Calculate total cross section for model
G4double sigma=0;
G4double waterDensity = (*fpMolWaterDensity)[material->GetIndex()];
if(waterDensity!= 0.0)
{
const G4String& particleName = p->GetParticleName();
if (ekin < highEnergyLimit)
{
//SI : XS must not be zero otherwise sampling of secondaries method ignored
if (ekin < killBelowEnergy) return DBL_MAX;
//
if (fpTableData != 0) // MK: is this check necessary?
{
sigma = fpTableData->FindValue(ekin);
}
else
{
G4Exception("G4DNAIonElasticModel::ComputeCrossSectionPerVolume","em0002",
FatalException,"Model not applicable to particle type.");
}
}
if (verboseLevel > 2)
{
G4cout << "__________________________________" << G4endl;
G4cout << "G4DNAIonElasticModel - XS INFO START" << G4endl;
G4cout << "Kinetic energy(eV)=" << ekin/eV << " particle : " << particleName << G4endl;
G4cout << "Cross section per water molecule (cm^2)=" << sigma/cm/cm << G4endl;
G4cout << "Cross section per water molecule (cm^-1)=" << sigma*waterDensity/(1./cm) << G4endl;
G4cout << "G4DNAIonElasticModel - XS INFO END" << G4endl;
}
}
return sigma*waterDensity;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void
G4DNAIonElasticModel::SampleSecondaries (
std::vector<G4DynamicParticle*>* /*fvect*/,
const G4MaterialCutsCouple* /*couple*/,
const G4DynamicParticle* aDynamicParticle, G4double, G4double)
{
if(verboseLevel > 3)
{
G4cout << "Calling SampleSecondaries() of G4DNAIonElasticModel" << G4endl;
}
G4double particleEnergy0 = aDynamicParticle->GetKineticEnergy();
if (particleEnergy0 < killBelowEnergy)
{
fParticleChangeForGamma->SetProposedKineticEnergy(0.);
fParticleChangeForGamma->ProposeTrackStatus(fStopAndKill);
fParticleChangeForGamma->ProposeLocalEnergyDeposit(particleEnergy0);
return;
}
if (particleEnergy0>= killBelowEnergy && particleEnergy0 < highEnergyLimit)
{
G4double water_mass = 18.;
G4double thetaCM = RandomizeThetaCM(particleEnergy0, aDynamicParticle->GetDefinition());
//HT:convert to laboratory system
G4double theta = std::atan(std::sin(thetaCM*CLHEP::pi/180)
/(fParticle_Mass/water_mass+std::cos(thetaCM*CLHEP::pi/180)));
G4double cosTheta= std::cos(theta);
//
G4double phi = 2. * CLHEP::pi * G4UniformRand();
G4ThreeVector zVers = aDynamicParticle->GetMomentumDirection();
G4ThreeVector xVers = zVers.orthogonal();
G4ThreeVector yVers = zVers.cross(xVers);
G4double xDir = std::sqrt(1. - cosTheta*cosTheta);
G4double yDir = xDir;
xDir *= std::cos(phi);
yDir *= std::sin(phi);
G4ThreeVector zPrimeVers((xDir*xVers + yDir*yVers + cosTheta*zVers));
fParticleChangeForGamma->ProposeMomentumDirection(zPrimeVers.unit());
G4double depositEnergyCM = 0;
//HT: deposited energy
depositEnergyCM = 4. * particleEnergy0 * fParticle_Mass * water_mass *
(1-std::cos(thetaCM*CLHEP::pi/180))
/ (2 * std::pow((fParticle_Mass+water_mass),2));
if (!statCode) fParticleChangeForGamma->SetProposedKineticEnergy(particleEnergy0 - depositEnergyCM);
else fParticleChangeForGamma->SetProposedKineticEnergy(particleEnergy0);
fParticleChangeForGamma->ProposeLocalEnergyDeposit(depositEnergyCM);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double
G4DNAIonElasticModel::Theta (G4ParticleDefinition * /*particleDefinition*/,
G4double k, G4double integrDiff)
{
G4double theta = 0.;
G4double valueT1 = 0;
G4double valueT2 = 0;
G4double valueE21 = 0;
G4double valueE22 = 0;
G4double valueE12 = 0;
G4double valueE11 = 0;
G4double xs11 = 0;
G4double xs12 = 0;
G4double xs21 = 0;
G4double xs22 = 0;
std::vector<double>::iterator t2 = std::upper_bound(eTdummyVec.begin(),
eTdummyVec.end(), k);
std::vector<double>::iterator t1 = t2 - 1;
std::vector<double>::iterator e12 = std::upper_bound(eVecm[(*t1)].begin(),
eVecm[(*t1)].end(),
integrDiff);
std::vector<double>::iterator e11 = e12 - 1;
std::vector<double>::iterator e22 = std::upper_bound(eVecm[(*t2)].begin(),
eVecm[(*t2)].end(),
integrDiff);
std::vector<double>::iterator e21 = e22 - 1;
valueT1 = *t1;
valueT2 = *t2;
valueE21 = *e21;
valueE22 = *e22;
valueE12 = *e12;
valueE11 = *e11;
xs11 = fDiffCrossSectionData[valueT1][valueE11];
xs12 = fDiffCrossSectionData[valueT1][valueE12];
xs21 = fDiffCrossSectionData[valueT2][valueE21];
xs22 = fDiffCrossSectionData[valueT2][valueE22];
if(xs11 == 0 && xs12 == 0 && xs21 == 0 && xs22 == 0) return (0.);
theta = QuadInterpolator(valueE11, valueE12, valueE21, valueE22, xs11, xs12,
xs21, xs22, valueT1, valueT2, k, integrDiff);
return theta;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double
G4DNAIonElasticModel::LinLinInterpolate (G4double e1, G4double e2, G4double e,
G4double xs1, G4double xs2)
{
G4double d1 = xs1;
G4double d2 = xs2;
G4double value = (d1 + (d2 - d1) * (e - e1) / (e2 - e1));
return value;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double
G4DNAIonElasticModel::LinLogInterpolate (G4double e1, G4double e2, G4double e,
G4double xs1, G4double xs2)
{
G4double d1 = std::log(xs1);
G4double d2 = std::log(xs2);
G4double value = std::exp(d1 + (d2 - d1) * (e - e1) / (e2 - e1));
return value;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double
G4DNAIonElasticModel::LogLogInterpolate (G4double e1, G4double e2, G4double e,
G4double xs1, G4double xs2)
{
G4double a = (std::log10(xs2) - std::log10(xs1))
/ (std::log10(e2) - std::log10(e1));
G4double b = std::log10(xs2) - a * std::log10(e2);
G4double sigma = a * std::log10(e) + b;
G4double value = (std::pow(10., sigma));
return value;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double
G4DNAIonElasticModel::QuadInterpolator (G4double e11, G4double e12,
G4double e21, G4double e22,
G4double xs11, G4double xs12,
G4double xs21, G4double xs22,
G4double t1, G4double t2, G4double t,
G4double e)
{
// Log-Log
/*
G4double interpolatedvalue1 = LogLogInterpolate(e11, e12, e, xs11, xs12);
G4double interpolatedvalue2 = LogLogInterpolate(e21, e22, e, xs21, xs22);
G4double value = LogLogInterpolate(t1, t2, t, interpolatedvalue1, interpolatedvalue2);
*/
// Lin-Log
/*
G4double interpolatedvalue1 = LinLogInterpolate(e11, e12, e, xs11, xs12);
G4double interpolatedvalue2 = LinLogInterpolate(e21, e22, e, xs21, xs22);
G4double value = LinLogInterpolate(t1, t2, t, interpolatedvalue1, interpolatedvalue2);
*/
// Lin-Lin
G4double interpolatedvalue1 = LinLinInterpolate(e11, e12, e, xs11, xs12);
G4double interpolatedvalue2 = LinLinInterpolate(e21, e22, e, xs21, xs22);
G4double value = LinLinInterpolate(t1, t2, t, interpolatedvalue1,
interpolatedvalue2);
return value;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double
G4DNAIonElasticModel::RandomizeThetaCM (
G4double k, G4ParticleDefinition * particleDefinition)
{
G4double integrdiff = G4UniformRand();
return Theta(particleDefinition, k / eV, integrdiff);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void
G4DNAIonElasticModel::SetKillBelowThreshold (G4double threshold)
{
killBelowEnergy = threshold;
if(killBelowEnergy < 100 * eV)
{
G4cout << "*** WARNING : the G4DNAIonElasticModel class is not "
"activated below 100 eV !"
<< G4endl;
}
}
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4DNAMillerGreenExcitationModel.cc 70171 2013-05-24 13:34:18Z gcosmo $
// $Id: G4DNAMillerGreenExcitationModel.cc 92859 2015-09-18 07:58:30Z gcosmo $
// GEANT4 tag $Name: $
//
@@ -64,6 +64,10 @@ G4DNAMillerGreenExcitationModel::G4DNAMillerGreenExcitationModel(const G4Particl
G4cout << "Miller & Green excitation model is constructed " << G4endl;
}
fParticleChangeForGamma = 0;
// Selection of stationary mode
statCode = false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -334,12 +338,12 @@ G4double G4DNAMillerGreenExcitationModel::CrossSectionPerVolume(const G4Material
if (verboseLevel > 2)
{
G4cout << "__________________________________" << G4endl;
G4cout << "°°° G4DNAMillerGreenExcitationModel - XS INFO START" << G4endl;
G4cout << "°°° Kinetic energy(eV)=" << k/eV << " particle : " << particleDefinition->GetParticleName() << G4endl;
G4cout << "°°° Cross section per water molecule (cm^2)=" << crossSection/cm/cm << G4endl;
G4cout << "°°° Cross section per water molecule (cm^-1)=" << crossSection*waterDensity/(1./cm) << G4endl;
G4cout << "G4DNAMillerGreenExcitationModel - XS INFO START" << G4endl;
G4cout << "Kinetic energy(eV)=" << k/eV << " particle : " << particleDefinition->GetParticleName() << G4endl;
G4cout << "Cross section per water molecule (cm^2)=" << crossSection/cm/cm << G4endl;
G4cout << "Cross section per water molecule (cm^-1)=" << crossSection*waterDensity/(1./cm) << G4endl;
// G4cout << " - Cross section per water molecule (cm^-1)=" << sigma*material->GetAtomicNumDensityVector()[1]/(1./cm) << G4endl;
G4cout << "°°° G4DNAMillerGreenExcitationModel - XS INFO END" << G4endl;
G4cout << "G4DNAMillerGreenExcitationModel - XS INFO END" << G4endl;
}
}
else
@@ -377,8 +381,12 @@ void G4DNAMillerGreenExcitationModel::SampleSecondaries(std::vector<G4DynamicPar
const G4double excitation[]={ 8.17*eV, 10.13*eV, 11.31*eV, 12.91*eV, 14.50*eV};
G4double excitationEnergy = excitation[level];
G4double newEnergy = particleEnergy0 - excitationEnergy;
G4double newEnergy = 0.;
if (!statCode) newEnergy = particleEnergy0 - excitationEnergy;
else newEnergy = particleEnergy0;
if (newEnergy>0)
{
fParticleChangeForGamma->ProposeMomentumDirection(aDynamicParticle->GetMomentumDirection());
@@ -396,6 +404,16 @@ void G4DNAMillerGreenExcitationModel::SampleSecondaries(std::vector<G4DynamicPar
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4DNAMillerGreenExcitationModel::GetPartialCrossSection(const G4Material*,
G4int level,
const G4ParticleDefinition* particleDefinition,
G4double kineticEnergy)
{
return PartialCrossSection(kineticEnergy, level, particleDefinition);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4DNAMillerGreenExcitationModel::PartialCrossSection(G4double k, G4int excitationLevel,
const G4ParticleDefinition* particleDefinition)
{

Some files were not shown because too many files have changed in this diff Show More