Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4FastSimulationPhysics Class Reference

#include <G4FastSimulationPhysics.hh>

Inheritance diagram for G4FastSimulationPhysics:
Collaboration diagram for G4FastSimulationPhysics:

Public Member Functions

 G4FastSimulationPhysics (const G4String &name="FastSimP")
 
virtual ~G4FastSimulationPhysics ()
 
void ActivateFastSimulation (const G4String &particleName)
 
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
 
void SetVerboseLevel (G4int value)
 
G4int GetVerboseLevel () const
 
G4int GetInstanceID () const
 

Additional Inherited Members

- Static Public Member Functions inherited from G4VPhysicsConstructor
static const G4VPCManagerGetSubInstanceManager ()
 
- Protected Member Functions inherited from G4VPhysicsConstructor
G4bool RegisterProcess (G4VProcess *process, G4ParticleDefinition *particle)
 
G4ParticleTable::G4PTblDicIteratorGetParticleIterator () const
 
- Protected Attributes inherited from G4VPhysicsConstructor
G4int verboseLevel
 
G4String namePhysics
 
G4int typePhysics
 
G4ParticleTabletheParticleTable
 
G4int g4vpcInstanceID
 
- Static Protected Attributes inherited from G4VPhysicsConstructor
static G4RUN_DLL G4VPCManager subInstanceManager
 

Detailed Description

Definition at line 42 of file G4FastSimulationPhysics.hh.

Constructor & Destructor Documentation

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

Definition at line 55 of file G4FastSimulationPhysics.cc.

56  : G4VPhysicsConstructor(name),
57  fVerbose(false)
58 {;}
G4VPhysicsConstructor(const G4String &="")
G4FastSimulationPhysics::~G4FastSimulationPhysics ( )
virtual

Definition at line 62 of file G4FastSimulationPhysics.cc.

63 {;}

Member Function Documentation

void G4FastSimulationPhysics::ActivateFastSimulation ( const G4String particleName)

Definition at line 67 of file G4FastSimulationPhysics.cc.

68 {
69  fParticlesUnderFastSimulation.push_back(particleName);
70  fGeometries .push_back("");
71 }
void G4FastSimulationPhysics::ActivateFastSimulation ( const G4String particleName,
const G4String parallelGeometryName 
)

Definition at line 75 of file G4FastSimulationPhysics.cc.

76 {
77  fParticlesUnderFastSimulation.push_back(particleName);
78  fGeometries .push_back(parallelGeometryName);
79 }
void G4FastSimulationPhysics::BeVerbose ( )
inline

Definition at line 60 of file G4FastSimulationPhysics.hh.

60 { fVerbose = true; }
void G4FastSimulationPhysics::ConstructParticle ( )
virtual

Implements G4VPhysicsConstructor.

Definition at line 83 of file G4FastSimulationPhysics.cc.

84 {;}
void G4FastSimulationPhysics::ConstructProcess ( )
virtual

Implements G4VPhysicsConstructor.

Definition at line 88 of file G4FastSimulationPhysics.cc.

89 {
90 
91  auto myParticleIterator = GetParticleIterator();
92  myParticleIterator->reset();
93 
94  while ( (*myParticleIterator)() )
95  {
96  G4ParticleDefinition* particle = myParticleIterator->value();
97  G4String particleName = particle->GetParticleName();
98  G4ProcessManager* pmanager = particle->GetProcessManager();
99 
100  // -- include fast simulation manager process interface:
101  auto itr = std::find( fParticlesUnderFastSimulation.begin(),
102  fParticlesUnderFastSimulation.end(),
103  particleName );
104 
105  if ( itr != fParticlesUnderFastSimulation.end() )
106  {
107  size_t ipos = itr - fParticlesUnderFastSimulation.begin();
108  G4String geometry = fGeometries[ipos];
109  if ( geometry == "" ) G4FastSimulationHelper::ActivateFastSimulation(pmanager);
110  else G4FastSimulationHelper::ActivateFastSimulation(pmanager, geometry);
111  }
112  }
113 
114  // -- tells what is done:
115  if ( fVerbose )
116  {
117  // -- print:
118  myParticleIterator->reset();
119 
120  while ( (*myParticleIterator)() )
121  {
122  G4ParticleDefinition* particle = myParticleIterator->value();
123  G4String particleName = particle->GetParticleName();
124  G4ProcessManager* pmanager = particle->GetProcessManager();
125 
126  G4bool isUnderFastSimulation(false);
127  G4String processAndGeometryNames;
128  G4int icount(0);
129 
130  G4ProcessVector* vprocess = pmanager->GetProcessList();
131  for (G4int ip = 0 ; ip < vprocess->size() ; ip++)
132  {
133  G4VProcess* process = (*vprocess)[ip];
134  G4FastSimulationManagerProcess* pb = dynamic_cast< G4FastSimulationManagerProcess* >(process);
135  if ( pb != nullptr )
136  {
137  isUnderFastSimulation = true;
138  if ( icount < 3 )
139  {
140  processAndGeometryNames += pb->GetProcessName();
141  processAndGeometryNames += "[geom:";
142  processAndGeometryNames += pb->GetWorldVolume()->GetName();
143  processAndGeometryNames += "] ";
144  }
145  else
146  {
147  processAndGeometryNames += "\n ";
148  processAndGeometryNames += pb->GetProcessName();
149  processAndGeometryNames += "[geom:";
150  processAndGeometryNames += pb->GetWorldVolume()->GetName();
151  processAndGeometryNames += "] ";
152  icount = 0;
153  }
154  }
155  }
156  if ( isUnderFastSimulation ) G4cout << std::setw(14) << particleName << " : " << processAndGeometryNames << G4endl;
157  }
158  }
159 }
int G4int
Definition: G4Types.hh:78
const G4String & GetParticleName() const
static void ActivateFastSimulation(G4ProcessManager *pmanager)
G4ParticleTable::G4PTblDicIterator * GetParticleIterator() const
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
bool G4bool
Definition: G4Types.hh:79
const G4String & GetProcessName() const
Definition: G4VProcess.hh:408
G4int size() const
G4ProcessManager * GetProcessManager() const
#define G4endl
Definition: G4ios.hh:61
G4ProcessVector * GetProcessList() const

Here is the call graph for this function:


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