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

#include <G4GlobalFastSimulationManager.hh>

Public Member Functions

 ~G4GlobalFastSimulationManager ()
 
G4VFastSimulationModelGetFastSimulationModel (const G4String &modelName, const G4VFastSimulationModel *previousFound=nullptr) const
 
void AddFastSimulationManager (G4FastSimulationManager *)
 
void RemoveFastSimulationManager (G4FastSimulationManager *)
 
void AddFSMP (G4FastSimulationManagerProcess *)
 
void RemoveFSMP (G4FastSimulationManagerProcess *)
 
void FastSimulationNeedsToBeClosed ()
 
void ShowSetup ()
 
void ListEnvelopes (const G4String &aName="all", listType aListType=NAMES_ONLY)
 
void ListEnvelopes (const G4ParticleDefinition *)
 
void ActivateFastSimulationModel (const G4String &)
 
void InActivateFastSimulationModel (const G4String &)
 
void Flush ()
 

Static Public Member Functions

static G4GlobalFastSimulationManagerGetGlobalFastSimulationManager ()
 
static G4GlobalFastSimulationManagerGetInstance ()
 

Friends

class G4ThreadLocalSingleton< G4GlobalFastSimulationManager >
 

Detailed Description

Definition at line 84 of file G4GlobalFastSimulationManager.hh.

Constructor & Destructor Documentation

◆ ~G4GlobalFastSimulationManager()

G4GlobalFastSimulationManager::~G4GlobalFastSimulationManager ( )

Definition at line 88 of file G4GlobalFastSimulationManager.cc.

89{
90 delete fTheFastSimulationMessenger;
91}

Member Function Documentation

◆ ActivateFastSimulationModel()

void G4GlobalFastSimulationManager::ActivateFastSimulationModel ( const G4String & aName)

Definition at line 116 of file G4GlobalFastSimulationManager.cc.

117{
118 G4bool result = false;
119 for (auto& ManagedManager : ManagedManagers)
120 result = result || ManagedManager->ActivateFastSimulationModel(aName);
121
122 G4cout << "Model " << aName << (result ? " activated." : " not found.") << G4endl;
123}
bool G4bool
Definition G4Types.hh:86
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout

Referenced by G4FastSimulationMessenger::SetNewValue().

◆ AddFastSimulationManager()

void G4GlobalFastSimulationManager::AddFastSimulationManager ( G4FastSimulationManager * fsmanager)

Definition at line 96 of file G4GlobalFastSimulationManager.cc.

97{
98 ManagedManagers.push_back(fsmanager);
99}

Referenced by G4FastSimulationManager::G4FastSimulationManager().

◆ AddFSMP()

◆ FastSimulationNeedsToBeClosed()

void G4GlobalFastSimulationManager::FastSimulationNeedsToBeClosed ( )

◆ Flush()

void G4GlobalFastSimulationManager::Flush ( )

Definition at line 134 of file G4GlobalFastSimulationManager.cc.

135{
136 // loop over all models (that need flushing?) and flush
137 for (auto& ManagedManager : ManagedManagers)
138 ManagedManager->FlushModels();
139}

◆ GetFastSimulationModel()

G4VFastSimulationModel * G4GlobalFastSimulationManager::GetFastSimulationModel ( const G4String & modelName,
const G4VFastSimulationModel * previousFound = nullptr ) const

Definition at line 291 of file G4GlobalFastSimulationManager.cc.

293{
294 G4VFastSimulationModel* model = nullptr;
295 // -- flag used to navigate accross the various managers;
296 bool foundPrevious(false);
297 for (auto ManagedManager : ManagedManagers) {
298 model = ManagedManager->GetFastSimulationModel(modelName, previousFound, foundPrevious);
299 if (model != nullptr) break;
300 }
301 return model;
302}

◆ GetGlobalFastSimulationManager()

◆ GetInstance()

G4GlobalFastSimulationManager * G4GlobalFastSimulationManager::GetInstance ( )
static

Definition at line 72 of file G4GlobalFastSimulationManager.cc.

73{
75}
static G4GlobalFastSimulationManager * GetGlobalFastSimulationManager()

◆ InActivateFastSimulationModel()

void G4GlobalFastSimulationManager::InActivateFastSimulationModel ( const G4String & aName)

Definition at line 125 of file G4GlobalFastSimulationManager.cc.

126{
127 G4bool result = false;
128 for (auto& ManagedManager : ManagedManagers)
129 result = result || ManagedManager->InActivateFastSimulationModel(aName);
130
131 G4cout << "Model " << aName << (result ? " inactivated." : " not found.") << G4endl;
132}

Referenced by G4FastSimulationMessenger::SetNewValue().

◆ ListEnvelopes() [1/2]

void G4GlobalFastSimulationManager::ListEnvelopes ( const G4ParticleDefinition * aPD)

Definition at line 285 of file G4GlobalFastSimulationManager.cc.

286{
287 for (auto& ManagedManager : ManagedManagers)
288 ManagedManager->ListModels(aPD);
289}

◆ ListEnvelopes() [2/2]

void G4GlobalFastSimulationManager::ListEnvelopes ( const G4String & aName = "all",
listType aListType = NAMES_ONLY )

Definition at line 255 of file G4GlobalFastSimulationManager.cc.

256{
257 if (theType == ISAPPLICABLE) {
258 for (auto& ManagedManager : ManagedManagers)
259 ManagedManager->ListModels(aName);
260 return;
261 }
262
263 if (aName == "all") {
264 G4int titled = 0;
265 for (auto& ManagedManager : ManagedManagers) {
266 if (theType == NAMES_ONLY) {
267 if ((titled++) == 0) G4cout << "Current Envelopes for Fast Simulation:\n";
268 G4cout << " ";
269 ManagedManager->ListTitle();
270 G4cout << G4endl;
271 }
272 else
273 ManagedManager->ListModels();
274 }
275 }
276 else {
277 for (auto& ManagedManager : ManagedManagers)
278 if (aName == ManagedManager->GetEnvelope()->GetName()) {
279 ManagedManager->ListModels();
280 break;
281 }
282 }
283}
int G4int
Definition G4Types.hh:85

Referenced by G4FastSimulationMessenger::SetNewValue().

◆ RemoveFastSimulationManager()

void G4GlobalFastSimulationManager::RemoveFastSimulationManager ( G4FastSimulationManager * fsmanager)

Definition at line 101 of file G4GlobalFastSimulationManager.cc.

102{
103 ManagedManagers.remove(fsmanager);
104}
T * remove(const T *)

Referenced by G4FastSimulationManager::~G4FastSimulationManager().

◆ RemoveFSMP()

void G4GlobalFastSimulationManager::RemoveFSMP ( G4FastSimulationManagerProcess * fp)

Definition at line 111 of file G4GlobalFastSimulationManager.cc.

112{
113 fFSMPVector.remove(fp);
114}

Referenced by G4FastSimulationManagerProcess::~G4FastSimulationManagerProcess().

◆ ShowSetup()

void G4GlobalFastSimulationManager::ShowSetup ( )

Definition at line 144 of file G4GlobalFastSimulationManager.cc.

145{
146 std::vector<G4VPhysicalVolume*> worldDone;
147 G4VPhysicalVolume* world;
149 // ----------------------------------------------------
150 // -- loop on regions to get the list of world volumes:
151 // ----------------------------------------------------
152 G4cout << "\nFast simulation setup:" << G4endl;
153 for (auto& region : *regions) {
154 world = region->GetWorldPhysical();
155 if (world == nullptr) // region does not belong to any (existing) world
156 {
157 continue;
158 }
159 G4bool newWorld = true;
160 for (auto& ii : worldDone)
161 if (ii == world) {
162 newWorld = false;
163 break;
164 }
165 if (newWorld) {
166 worldDone.push_back(world);
167 G4Region* worldRegion = world->GetLogicalVolume()->GetRegion();
168 // -- preambule: print physical volume and region names...
169 if (world
171 ->GetNavigatorForTracking()
172 ->GetWorldVolume())
173 G4cout << "\n * Mass Geometry with ";
174 else
175 G4cout << "\n * Parallel Geometry with ";
176 G4cout << "world volume: `" << world->GetName() << "' [region : `" << worldRegion->GetName()
177 << "']" << G4endl;
178 // -- ... and print G4FSMP(s) attached to this world volume:
179 G4bool findG4FSMP(false);
180 // -- show to what particles this G4FSMP is attached to:
181 std::vector<G4ParticleDefinition*> particlesKnown;
182 for (auto& ip : fFSMPVector)
183 if (ip->GetWorldVolume() == world) {
184 G4cout << " o G4FastSimulationProcess: '" << ip->GetProcessName() << "'" << G4endl;
185 G4cout << " Attached to:";
187 for (G4int iParticle = 0; iParticle < particles->entries(); iParticle++) {
188 G4ParticleDefinition* particle = particles->GetParticle(iParticle);
189 G4ProcessVector* processes = particle->GetProcessManager()->GetProcessList();
190 if (processes->contains(ip)) {
191 G4cout << " " << particle->GetParticleName();
192 findG4FSMP = true;
193 particlesKnown.push_back(particle);
194 }
195 }
196 G4cout << G4endl;
197 }
198 if (!findG4FSMP) G4cout << " o G4FastSimulationProcess: (none)" << G4endl;
199 // -- now display the regions in this world volume, with mother<->daughter link shown by
200 // indentation:
201 G4cout << " o Region(s) and model(s) setup:" << G4endl;
202 DisplayRegion(worldRegion, 1, particlesKnown);
203 }
204 }
205}
G4Region * GetRegion() const
G4ProcessManager * GetProcessManager() const
const G4String & GetParticleName() const
G4ParticleDefinition * GetParticle(G4int index) const
G4int entries() const
static G4ParticleTable * GetParticleTable()
G4ProcessVector * GetProcessList() const
G4bool contains(G4VProcess *aProcess) const
static G4RegionStore * GetInstance()
const G4String & GetName() const
static G4TransportationManager * GetTransportationManager()
G4LogicalVolume * GetLogicalVolume() const
const G4String & GetName() const

Referenced by G4FastSimulationMessenger::SetNewValue().

Friends And Related Symbol Documentation

◆ G4ThreadLocalSingleton< G4GlobalFastSimulationManager >

Definition at line 1 of file G4GlobalFastSimulationManager.hh.


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