Import Geant4 10.3.0 source tree
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4AdjointPrimaryGeneratorAction.hh 86968 2014-11-21 11:52:04Z gcosmo $
|
||||
// $Id: G4AdjointPrimaryGeneratorAction.hh 98735 2016-08-09 10:54:06Z gcosmo $
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
// Class Name: G4AdjointPrimaryGeneratorAction
|
||||
@@ -101,6 +101,9 @@ class G4AdjointPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
|
||||
return &ListOfPrimaryFwdParticles;}
|
||||
inline const G4String& GetPrimaryIonName(){return ion_name;}
|
||||
inline void SetNbPrimaryFwdGammasPerEvent(G4int nb) {nb_fwd_gammas_per_event=nb;}
|
||||
inline void SetNbAdjointPrimaryGammasPerEvent(G4int nb) {nb_adj_primary_gammas_per_event=nb;}
|
||||
inline void SetNbAdjointPrimaryElectronsPerEvent(G4int nb) {nb_adj_primary_electrons_per_event=nb;}
|
||||
inline G4ParticleDefinition* GetLastGeneratedFwdPrimaryParticle(){return ListOfPrimaryFwdParticles[index_particle];}
|
||||
|
||||
private: //private methods
|
||||
|
||||
@@ -135,6 +138,8 @@ class G4AdjointPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
|
||||
G4double radius_spherical_source;
|
||||
G4ThreeVector center_spherical_source;
|
||||
G4int nb_fwd_gammas_per_event;
|
||||
G4int nb_adj_primary_gammas_per_event;
|
||||
G4int nb_adj_primary_electrons_per_event;
|
||||
|
||||
//For simulation with ions
|
||||
//--------------------------
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4AdjointSimManager.hh 81773 2014-06-05 08:35:38Z gcosmo $
|
||||
// $Id: G4AdjointSimManager.hh 98735 2016-08-09 10:54:06Z gcosmo $
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
// Class Name: G4AdjointSimManager.hh
|
||||
@@ -170,15 +170,21 @@ class G4AdjointSimManager: public G4UserRunAction
|
||||
void RegisterAdjointPrimaryWeight(G4double aWeight);
|
||||
//to continue here
|
||||
inline G4int GetIDOfLastAdjParticleReachingExtSource(){return ID_of_last_particle_that_reach_the_ext_source;};
|
||||
G4ThreeVector GetPositionAtEndOfLastAdjointTrack();
|
||||
G4ThreeVector GetDirectionAtEndOfLastAdjointTrack();
|
||||
G4double GetEkinAtEndOfLastAdjointTrack();
|
||||
G4double GetEkinNucAtEndOfLastAdjointTrack();
|
||||
G4double GetWeightAtEndOfLastAdjointTrack();
|
||||
G4double GetCosthAtEndOfLastAdjointTrack();
|
||||
G4ThreeVector GetPositionAtEndOfLastAdjointTrack(size_t i=0);
|
||||
G4ThreeVector GetDirectionAtEndOfLastAdjointTrack(size_t i=0);
|
||||
G4double GetEkinAtEndOfLastAdjointTrack(size_t i=0);
|
||||
G4double GetEkinNucAtEndOfLastAdjointTrack(size_t i=0);
|
||||
G4double GetWeightAtEndOfLastAdjointTrack(size_t i=0);
|
||||
G4double GetCosthAtEndOfLastAdjointTrack(size_t i=0);
|
||||
const G4String& GetFwdParticleNameAtEndOfLastAdjointTrack();
|
||||
G4int GetFwdParticlePDGEncodingAtEndOfLastAdjointTrack();
|
||||
G4int GetFwdParticleIndexAtEndOfLastAdjointTrack();
|
||||
G4int GetFwdParticlePDGEncodingAtEndOfLastAdjointTrack(size_t i=0);
|
||||
G4int GetFwdParticleIndexAtEndOfLastAdjointTrack(size_t i=0);
|
||||
size_t GetNbOfAdointTracksReachingTheExternalSurface();
|
||||
void ClearEndOfAdjointTrackInfoVectors();
|
||||
G4ParticleDefinition* GetLastGeneratedFwdPrimaryParticle();
|
||||
|
||||
|
||||
|
||||
|
||||
std::vector<G4ParticleDefinition*>* GetListOfPrimaryFwdParticles();
|
||||
size_t GetNbOfPrimaryFwdParticles();
|
||||
@@ -223,6 +229,12 @@ class G4AdjointSimManager: public G4UserRunAction
|
||||
//---------------------------
|
||||
void SetNbOfPrimaryFwdGammasPerEvent(G4int);
|
||||
|
||||
|
||||
//Set nb of adjoint primaries for reverse splitting
|
||||
//-------------------------------------------------
|
||||
void SetNbAdjointPrimaryGammasPerEvent(G4int);
|
||||
void SetNbAdjointPrimaryElectronsPerEvent(G4int);
|
||||
|
||||
//Convergence test
|
||||
//-----------------------
|
||||
/*
|
||||
@@ -289,6 +301,19 @@ class G4AdjointSimManager: public G4UserRunAction
|
||||
|
||||
//adjoint particle information on the external surface
|
||||
//-----------------------------
|
||||
std::vector<G4ThreeVector> last_pos_vec;
|
||||
std::vector<G4ThreeVector> last_direction_vec;
|
||||
std::vector<G4double> last_ekin_vec;
|
||||
std::vector<G4double> last_ekin_nuc_vec;
|
||||
std::vector<G4double> last_cos_th_vec;
|
||||
std::vector<G4double> last_weight_vec;
|
||||
std::vector<G4int> last_fwd_part_PDGEncoding_vec;
|
||||
std::vector<G4int> last_fwd_part_index_vec;
|
||||
std::vector<G4int> ID_of_last_particle_that_reach_the_ext_source_vec;
|
||||
|
||||
|
||||
|
||||
|
||||
G4ThreeVector last_pos;
|
||||
G4ThreeVector last_direction;
|
||||
G4double last_ekin,last_ekin_nuc; //last_ekin_nuc=last_ekin/nuc, nuc is 1 if not a nucleus
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4AdjointSimMessenger.hh 81773 2014-06-05 08:35:38Z gcosmo $
|
||||
// $Id: G4AdjointSimMessenger.hh 98735 2016-08-09 10:54:06Z gcosmo $
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
// Class Name: G4AdjointSimMessenger.hh
|
||||
@@ -167,6 +167,8 @@ class G4AdjointSimMessenger: public G4UImessenger
|
||||
G4UIcmdWithAString* NeglectParticleAsPrimaryCmd;
|
||||
|
||||
G4UIcmdWithAnInteger* setNbOfPrimaryFwdGammasPerEventCmd;
|
||||
G4UIcmdWithAnInteger* setNbOfPrimaryAdjGammasPerEventCmd;
|
||||
G4UIcmdWithAnInteger* setNbOfPrimaryAdjElectronsPerEventCmd;
|
||||
|
||||
};
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -102,7 +102,10 @@ public:
|
||||
//collect from UI managere the list of commands that threads
|
||||
//will execute.
|
||||
size_t GetNumberActiveThreads() const { return threads.size(); }
|
||||
//Returns number of currently active threads
|
||||
//Returns number of currently active threads.
|
||||
//This number may be different from the number of threads currently
|
||||
//in running state (e.g. the number returned by:
|
||||
//G4Threading::GetNumberOfActiveWorkerThreads() method).
|
||||
private:
|
||||
// Number of worker threads. To be set by SetNumberOfThreads() method.
|
||||
G4int nworkers;
|
||||
|
||||
@@ -44,72 +44,57 @@
|
||||
#include "globals.hh"
|
||||
|
||||
template <class T>
|
||||
class G4TemplateRNGHelper {
|
||||
private:
|
||||
static G4TemplateRNGHelper* instance;
|
||||
public:
|
||||
class G4TemplateRNGHelper
|
||||
{
|
||||
public:
|
||||
// The container is modeled as a (shared) singleton
|
||||
static G4TemplateRNGHelper* GetInstance() {
|
||||
if (!instance)
|
||||
{
|
||||
instance = new G4TemplateRNGHelper();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
static G4TemplateRNGHelper<T>* GetInstance();
|
||||
typedef std::vector<T> SeedsQueue;
|
||||
typedef typename SeedsQueue::size_type SeedsQueueSize_type;
|
||||
|
||||
private:
|
||||
G4TemplateRNGHelper()
|
||||
virtual ~G4TemplateRNGHelper()
|
||||
{
|
||||
offset=0;
|
||||
nev_filled=0;
|
||||
nev_total=0;
|
||||
nRandParEvent=0;
|
||||
}
|
||||
|
||||
public:
|
||||
virtual ~G4TemplateRNGHelper() {
|
||||
Clear();
|
||||
instance = 0;
|
||||
Clear();
|
||||
instance = 0;
|
||||
}
|
||||
|
||||
//Returns seed given id
|
||||
virtual const T GetSeed(const G4int& sdId ) {
|
||||
G4int seedId = sdId - 2*offset;
|
||||
if ( seedId < static_cast<G4int>(seeds.size()) )
|
||||
{
|
||||
T& seed = seeds[seedId];
|
||||
return seed;
|
||||
}
|
||||
G4ExceptionDescription msg;
|
||||
msg << "No seed number "<<seedId<<"("<<seeds.size()<<" available)\n"
|
||||
<< " Original seed number "<<sdId<<" filled so far "<<offset;
|
||||
G4Exception("G4RNGHelper::GetSeed","Run0115", FatalException,msg);
|
||||
return T();
|
||||
virtual const T GetSeed(const G4int& sdId )
|
||||
{
|
||||
G4int seedId = sdId - 2*offset;
|
||||
if ( seedId < static_cast<G4int>(seeds.size()) )
|
||||
{
|
||||
T& seed = seeds[seedId];
|
||||
return seed;
|
||||
}
|
||||
G4ExceptionDescription msg;
|
||||
msg << "No seed number "<<seedId<<"("<<seeds.size()<<" available)\n"
|
||||
<< " Original seed number "<<sdId<<" filled so far "<<offset;
|
||||
G4Exception("G4RNGHelper::GetSeed","Run0115", FatalException,msg);
|
||||
return T();
|
||||
}
|
||||
|
||||
//Adds one seed to the collection
|
||||
void AddOneSeed( const T& seed ) { seeds.push_back(seed); }
|
||||
|
||||
//Fills N primary seed pairs
|
||||
void Fill(double* dbl,int nev,int nev_tot,int nrpe)
|
||||
void Fill(G4double* dbl,G4int nev,G4int nev_tot,G4int nrpe)
|
||||
{
|
||||
seeds.clear();
|
||||
for(int i=0;i<nrpe*nev;i++)
|
||||
{ seeds.push_back((long)(100000000L*dbl[i])); }
|
||||
for(G4int i=0;i<nrpe*nev;i++)
|
||||
{ seeds.push_back((G4long)(100000000L*dbl[i])); }
|
||||
offset = 0;
|
||||
nev_filled = nev;
|
||||
nev_total = nev_tot;
|
||||
nRandParEvent = nrpe;
|
||||
}
|
||||
|
||||
void Refill(double* dbl, int nev)
|
||||
void Refill(G4double* dbl, G4int nev)
|
||||
{
|
||||
if(nev==0) return;
|
||||
seeds.clear();
|
||||
for(int i=0;i<nRandParEvent*nev;i++)
|
||||
{ seeds.push_back((long)(100000000L*dbl[i])); }
|
||||
for(G4int i=0;i<nRandParEvent*nev;i++)
|
||||
{ seeds.push_back((G4long)(100000000L*dbl[i])); }
|
||||
offset += nev_filled;
|
||||
nev_filled = nev;
|
||||
}
|
||||
@@ -119,18 +104,31 @@ public:
|
||||
|
||||
//Empty the seeds container
|
||||
virtual void Clear() { seeds.clear(); }
|
||||
protected:
|
||||
|
||||
protected:
|
||||
SeedsQueue seeds;
|
||||
// Note: following numbers are number of events.
|
||||
// seeds are generated for nRandParEvent times n_event
|
||||
int offset;
|
||||
int nev_filled;
|
||||
int nev_total;
|
||||
int nRandParEvent;
|
||||
G4int offset;
|
||||
G4int nev_filled;
|
||||
G4int nev_total;
|
||||
G4int nRandParEvent;
|
||||
|
||||
private:
|
||||
G4TemplateRNGHelper()
|
||||
{
|
||||
offset=0;
|
||||
nev_filled=0;
|
||||
nev_total=0;
|
||||
nRandParEvent=0;
|
||||
}
|
||||
|
||||
private:
|
||||
static G4TemplateRNGHelper<T>* instance;
|
||||
};
|
||||
|
||||
typedef G4TemplateRNGHelper<long> G4RNGHelper;
|
||||
typedef G4TemplateRNGHelper<G4long> G4RNGHelper;
|
||||
typedef G4TemplateRNGHelper<G4String> G4StringRNGHelper;
|
||||
typedef std::queue<long> G4SeedsQueue;
|
||||
typedef std::queue<G4long> G4SeedsQueue;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VPhysicsConstructor.hh 68802 2013-04-05 13:54:41Z gcosmo $
|
||||
// $Id: G4VPhysicsConstructor.hh 101155 2016-11-08 08:21:41Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
@@ -116,7 +116,7 @@ typedef G4VPCManager G4VPhyscicsConstructorManager;
|
||||
// this base class (all examples). However one should note comment
|
||||
// on JIRA task: http://jira-geant4.kek.jp/browse/DEV-27
|
||||
|
||||
#define aParticleIterator ((subInstanceManager.offset[g4vpcInstanceID])._aParticleIterator)
|
||||
//#define aParticleIterator ((subInstanceManager.offset[g4vpcInstanceID])._aParticleIterator)
|
||||
|
||||
class G4VPhysicsConstructor
|
||||
{
|
||||
@@ -165,6 +165,7 @@ class G4VPhysicsConstructor
|
||||
G4ParticleTable* theParticleTable;
|
||||
G4int g4vpcInstanceID;
|
||||
G4RUN_DLL static G4VPCManager subInstanceManager;
|
||||
G4ParticleTable::G4PTblDicIterator* GetParticleIterator() const;
|
||||
public:
|
||||
inline G4int GetInstanceID() const;
|
||||
static const G4VPCManager& GetSubInstanceManager();
|
||||
|
||||
@@ -73,7 +73,8 @@ class G4VUPLSplitter
|
||||
{
|
||||
public:
|
||||
|
||||
G4VUPLSplitter() : totalobj(0),totalspace(0),sharedOffset(0) {
|
||||
G4VUPLSplitter() : totalobj(0),totalspace(0),sharedOffset(0)
|
||||
{
|
||||
G4MUTEXINIT(mutex);
|
||||
}
|
||||
|
||||
@@ -88,7 +89,8 @@ class G4VUPLSplitter
|
||||
totalobj++;
|
||||
//If the number of objects is larger than the available spaces,
|
||||
//a re-allocation is needed
|
||||
if (totalobj > workertotalspace) {
|
||||
if (totalobj > workertotalspace)
|
||||
{
|
||||
l.unlock();
|
||||
NewSubInstances();
|
||||
l.lock();
|
||||
@@ -140,18 +142,9 @@ class G4VUPLSplitter
|
||||
// Use recycled work area - which was created previously
|
||||
if( offset && offset!=newOffset )
|
||||
{
|
||||
if( newOffset != offset )
|
||||
{
|
||||
G4Exception("G4VUPLSplitter::UseWorkspace()",
|
||||
"TwoWorkspaces", FatalException,
|
||||
"Thread already has workspace - cannot use another.");
|
||||
}
|
||||
else
|
||||
{
|
||||
G4Exception("G4VUPLSplitter::UseWorkspace()",
|
||||
"TwoWorkspaces", JustWarning,
|
||||
"Thread already has a workspace - trying to set the same again.");
|
||||
}
|
||||
G4Exception("G4VUPLSplitter::UseWorkspace()",
|
||||
"TwoWorkspaces", FatalException,
|
||||
"Thread already has workspace - cannot use another.");
|
||||
}
|
||||
offset= newOffset;
|
||||
// totalobj= numObjects;
|
||||
@@ -201,4 +194,7 @@ class G4VUPLSplitter
|
||||
G4Mutex mutex;
|
||||
};
|
||||
|
||||
template<typename T> G4ThreadLocal G4int G4VUPLSplitter<T>::workertotalspace=0;
|
||||
template<typename T> G4ThreadLocal T* G4VUPLSplitter<T>::offset=0;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VUserPhysicsList.hh 73123 2013-08-19 07:52:00Z gcosmo $
|
||||
// $Id: G4VUserPhysicsList.hh 101155 2016-11-08 08:21:41Z gcosmo $
|
||||
//
|
||||
//
|
||||
// ------------------------------------------------------------
|
||||
@@ -150,11 +150,7 @@ typedef G4VUPLManager G4VUserPhysicsListSubInstanceManager;
|
||||
// we need to change its use in all classes that inherits from
|
||||
// this base class (all examples). However one should note comment
|
||||
// on JIRA task: http://jira-geant4.kek.jp/browse/DEV-27
|
||||
#define theParticleIterator ((this->subInstanceManager.offset[this->g4vuplInstanceID])._theParticleIterator)
|
||||
#define G4MT_theMessenger ((this->subInstanceManager.offset[this->g4vuplInstanceID])._theMessenger)
|
||||
#define G4MT_thePLHelper ((this->subInstanceManager.offset[this->g4vuplInstanceID])._thePLHelper)
|
||||
#define fIsPhysicsTableBuilt ((this->subInstanceManager.offset[this->g4vuplInstanceID])._fIsPhysicsTableBuilt)
|
||||
#define fDisplayThreshold ((this->subInstanceManager.offset[this->g4vuplInstanceID])._fDisplayThreshold)
|
||||
//#define theParticleIterator ((this->subInstanceManager.offset[this->g4vuplInstanceID])._theParticleIterator)
|
||||
|
||||
class G4VUserPhysicsList
|
||||
{
|
||||
@@ -191,6 +187,7 @@ class G4VUserPhysicsList
|
||||
G4bool RegisterProcess(G4VProcess* process,
|
||||
G4ParticleDefinition* particle);
|
||||
|
||||
|
||||
public:
|
||||
void UseCoupledTransportation(G4bool vl=true);
|
||||
|
||||
@@ -394,6 +391,7 @@ class G4VUserPhysicsList
|
||||
protected:
|
||||
G4int g4vuplInstanceID;
|
||||
G4RUN_DLL static G4VUPLManager subInstanceManager;
|
||||
G4ParticleTable::G4PTblDicIterator* GetParticleIterator() const;
|
||||
public:
|
||||
inline G4int GetInstanceID() const;
|
||||
static const G4VUPLManager& GetSubInstanceManager();
|
||||
|
||||
Reference in New Issue
Block a user