Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4FastSimulationPhysics Class Reference

#include <G4FastSimulationPhysics.hh>

+ Inheritance diagram for G4FastSimulationPhysics:

Public Member Functions

 G4FastSimulationPhysics (const G4String &name="FastSimP")
 
virtual ~G4FastSimulationPhysics ()
 
void ActivateFastSimulation (const G4String particleName, const G4String parallelGeometryName="")
 
void BeVerbose ()
 
virtual void ConstructParticle ()
 
virtual void ConstructProcess ()
 
- Public Member Functions inherited from G4VPhysicsConstructor
 G4VPhysicsConstructor (const G4String &="")
 
 G4VPhysicsConstructor (const G4String &name, G4int physics_type)
 
virtual ~G4VPhysicsConstructor ()
 
void SetPhysicsName (const G4String &="")
 
const G4StringGetPhysicsName () const
 
void SetPhysicsType (G4int)
 
G4int GetPhysicsType () const
 
G4int GetInstanceID () const
 
virtual void TerminateWorker ()
 
void SetVerboseLevel (G4int value)
 
G4int GetVerboseLevel () const
 

Additional Inherited Members

- Static Public Member Functions inherited from G4VPhysicsConstructor
static const G4VPCManagerGetSubInstanceManager ()
 
- Protected Types inherited from G4VPhysicsConstructor
using PhysicsBuilder_V = G4VPCData::PhysicsBuilders_V
 
- Protected Member Functions inherited from G4VPhysicsConstructor
G4bool RegisterProcess (G4VProcess *process, G4ParticleDefinition *particle)
 
G4ParticleTable::G4PTblDicIteratorGetParticleIterator () const
 
PhysicsBuilder_V GetBuilders () const
 
void AddBuilder (G4PhysicsBuilderInterface *bld)
 
- Protected Attributes inherited from G4VPhysicsConstructor
G4int verboseLevel = 0
 
G4String namePhysics = ""
 
G4int typePhysics = 0
 
G4ParticleTabletheParticleTable = nullptr
 
G4int g4vpcInstanceID = 0
 
- Static Protected Attributes inherited from G4VPhysicsConstructor
static G4RUN_DLL G4VPCManager subInstanceManager
 

Detailed Description

Definition at line 41 of file G4FastSimulationPhysics.hh.

Constructor & Destructor Documentation

◆ G4FastSimulationPhysics()

G4FastSimulationPhysics::G4FastSimulationPhysics ( const G4String & name = "FastSimP")

Definition at line 54 of file G4FastSimulationPhysics.cc.

56 fVerbose(false)
57{;}
G4VPhysicsConstructor(const G4String &="")

◆ ~G4FastSimulationPhysics()

G4FastSimulationPhysics::~G4FastSimulationPhysics ( )
virtual

Definition at line 61 of file G4FastSimulationPhysics.cc.

62{;}

Member Function Documentation

◆ ActivateFastSimulation()

void G4FastSimulationPhysics::ActivateFastSimulation ( const G4String particleName,
const G4String parallelGeometryName = "" )

Definition at line 66 of file G4FastSimulationPhysics.cc.

67{
68 fParticlesUnderFastSimulation.push_back(particleName);
69 fGeometries .push_back(parallelGeometryName);
70}

◆ BeVerbose()

void G4FastSimulationPhysics::BeVerbose ( )
inline

Definition at line 58 of file G4FastSimulationPhysics.hh.

58{ fVerbose = true; }

◆ ConstructParticle()

void G4FastSimulationPhysics::ConstructParticle ( )
virtual

Implements G4VPhysicsConstructor.

Definition at line 74 of file G4FastSimulationPhysics.cc.

75{;}

◆ ConstructProcess()

void G4FastSimulationPhysics::ConstructProcess ( )
virtual

Implements G4VPhysicsConstructor.

Definition at line 79 of file G4FastSimulationPhysics.cc.

80{
81
82 auto myParticleIterator = GetParticleIterator();
83 myParticleIterator->reset();
84
85 while ( (*myParticleIterator)() )
86 {
87 G4ParticleDefinition* particle = myParticleIterator->value();
88 G4String particleName = particle->GetParticleName();
89 G4ProcessManager* pmanager = particle->GetProcessManager();
90
91 // -- include fast simulation manager process interface:
92 auto itr = std::find( fParticlesUnderFastSimulation.begin(),
93 fParticlesUnderFastSimulation.end(),
94 particleName );
95
96 if ( itr != fParticlesUnderFastSimulation.end() )
97 {
98 std::size_t ipos = itr - fParticlesUnderFastSimulation.begin();
99 G4String geometry = fGeometries[ipos];
100 if ( geometry == "" ) G4FastSimulationHelper::ActivateFastSimulation(pmanager);
101 else G4FastSimulationHelper::ActivateFastSimulation(pmanager, geometry);
102 }
103 }
104
105 // -- tells what is done:
106 if ( fVerbose )
107 {
108 // -- print:
109 myParticleIterator->reset();
110
111 while ( (*myParticleIterator)() )
112 {
113 G4ParticleDefinition* particle = myParticleIterator->value();
114 G4String particleName = particle->GetParticleName();
115 G4ProcessManager* pmanager = particle->GetProcessManager();
116
117 G4bool isUnderFastSimulation(false);
118 G4String processAndGeometryNames;
119
120 G4ProcessVector* vprocess = pmanager->GetProcessList();
121 for (G4int ip = 0 ; ip < (G4int)vprocess->size() ; ++ip)
122 {
123 G4VProcess* process = (*vprocess)[ip];
125 if ( pb != nullptr )
126 {
127 isUnderFastSimulation = true;
128 processAndGeometryNames += pb->GetProcessName();
129 processAndGeometryNames += "[geom:";
130 processAndGeometryNames += pb->GetWorldVolume()->GetName();
131 processAndGeometryNames += "] ";
132 }
133 }
134 if ( isUnderFastSimulation ) G4cout << std::setw(14) << particleName << " : " << processAndGeometryNames << G4endl;
135 }
136 }
137}
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
static void ActivateFastSimulation(G4ProcessManager *pmanager, G4String parallelGeometryName="")
G4ProcessManager * GetProcessManager() const
const G4String & GetParticleName() const
G4ProcessVector * GetProcessList() const
std::size_t size() const
const G4String & GetName() const
G4ParticleTable::G4PTblDicIterator * GetParticleIterator() const
const G4String & GetProcessName() const

The documentation for this class was generated from the following files: