Geant4-11
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
G4GlobalFastSimulationManager Class Reference

#include <G4GlobalFastSimulationManager.hh>

Public Member Functions

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

Static Public Member Functions

static G4GlobalFastSimulationManagerGetGlobalFastSimulationManager ()
 
static G4GlobalFastSimulationManagerGetInstance ()
 

Private Member Functions

void DisplayRegion (G4Region *motherRegion, G4int depth, std::vector< G4ParticleDefinition * > &particles) const
 
 G4GlobalFastSimulationManager ()
 

Private Attributes

G4FastSimulationVector< G4FastSimulationManagerProcessfFSMPVector
 
G4FastSimulationMessengerfTheFastSimulationMessenger
 
G4FastSimulationVector< G4FastSimulationManagerManagedManagers
 

Static Private Attributes

static G4ThreadLocal G4GlobalFastSimulationManagerfGlobalFastSimulationManager = 0
 

Detailed Description

Definition at line 84 of file G4GlobalFastSimulationManager.hh.

Constructor & Destructor Documentation

◆ ~G4GlobalFastSimulationManager()

G4GlobalFastSimulationManager::~G4GlobalFastSimulationManager ( )

Definition at line 95 of file G4GlobalFastSimulationManager.cc.

References fTheFastSimulationMessenger.

◆ G4GlobalFastSimulationManager()

G4GlobalFastSimulationManager::G4GlobalFastSimulationManager ( )
private

Member Function Documentation

◆ ActivateFastSimulationModel()

void G4GlobalFastSimulationManager::ActivateFastSimulationModel ( const G4String aName)

Definition at line 126 of file G4GlobalFastSimulationManager.cc.

127{
128 G4bool result = false;
129 for (size_t ifsm=0; ifsm<ManagedManagers.size(); ifsm++)
130 result = result || ManagedManagers[ifsm]->
132 if(result)
133 G4cout << "Model " << aName << " activated.";
134 else
135 G4cout << "Model " << aName << " not found.";
136 G4cout << G4endl;
137}
bool G4bool
Definition: G4Types.hh:86
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
G4FastSimulationVector< G4FastSimulationManager > ManagedManagers

References ActivateFastSimulationModel(), G4cout, G4endl, and ManagedManagers.

Referenced by ActivateFastSimulationModel(), and G4FastSimulationMessenger::SetNewValue().

◆ AddFastSimulationManager()

void G4GlobalFastSimulationManager::AddFastSimulationManager ( G4FastSimulationManager fsmanager)

Definition at line 104 of file G4GlobalFastSimulationManager.cc.

106{
107 ManagedManagers.push_back(fsmanager);
108}

References ManagedManagers.

◆ AddFSMP()

void G4GlobalFastSimulationManager::AddFSMP ( G4FastSimulationManagerProcess fp)

Definition at line 116 of file G4GlobalFastSimulationManager.cc.

117{
118 fFSMPVector.push_back(fp);
119}
G4FastSimulationVector< G4FastSimulationManagerProcess > fFSMPVector

References fFSMPVector.

Referenced by G4FastSimulationManagerProcess::G4FastSimulationManagerProcess().

◆ DisplayRegion()

void G4GlobalFastSimulationManager::DisplayRegion ( G4Region motherRegion,
G4int  depth,
std::vector< G4ParticleDefinition * > &  particles 
) const
private

Definition at line 209 of file G4GlobalFastSimulationManager.cc.

210{
211 G4String indent = " ";
212 for (G4int I=0; I<depth; I++) indent += " ";
213 G4cout << indent << "Region: `" << region->GetName() <<"'" << G4endl;
214 G4FastSimulationManager* fastSimManager = region->GetFastSimulationManager();
215 if (fastSimManager)
216 {
217 indent += " ";
218 G4cout << indent << "Model(s):" << G4endl;
219 indent += " ";
220 for (size_t im=0; im<fastSimManager->GetFastSimulationModelList().size(); im++)
221 {
222 G4cout << indent << "`" << (fastSimManager->GetFastSimulationModelList())[im]->GetName() << "'";
223 G4cout << " ; applicable to:";
225 for (G4int iParticle=0; iParticle<particles->entries(); iParticle++)
226 {
227 if ((fastSimManager->GetFastSimulationModelList())[im]->IsApplicable(*(particles->GetParticle(iParticle))))
228 {
229 G4cout << " " << particles->GetParticle(iParticle)->GetParticleName();
230 G4bool known(false);
231 for (size_t l=0; l<particlesKnown.size();l++) if(particlesKnown[l] == particles->GetParticle(iParticle)) {known = true; break;}
232 if (!known) G4cout << "[!!]";
233 }
234 }
235 G4cout << G4endl;
236 }
237 }
238
239 // -- all that to check mothership of "region"
241 for (size_t ip=0; ip<physVolStore->size(); ip++)
242 {
243 G4VPhysicalVolume* physVol = (*physVolStore)[ip];
244 if (physVol->GetLogicalVolume()->IsRootRegion())
245 if (physVol->GetMotherLogical())
246 {
247 G4Region* thisVolMotherRegion = physVol->GetMotherLogical()->GetRegion();
248 if (thisVolMotherRegion == region)
249 DisplayRegion(physVol->GetLogicalVolume()->GetRegion(), depth+1, particlesKnown);
250 }
251 }
252}
int G4int
Definition: G4Types.hh:85
const std::vector< G4VFastSimulationModel * > & GetFastSimulationModelList() const
void DisplayRegion(G4Region *motherRegion, G4int depth, std::vector< G4ParticleDefinition * > &particles) const
G4bool IsRootRegion() const
G4Region * GetRegion() const
const G4String & GetParticleName() const
G4ParticleDefinition * GetParticle(G4int index) const
G4int entries() const
static G4ParticleTable * GetParticleTable()
static G4PhysicalVolumeStore * GetInstance()
G4LogicalVolume * GetMotherLogical() const
G4LogicalVolume * GetLogicalVolume() const

References DisplayRegion(), G4ParticleTable::entries(), G4cout, G4endl, G4Region::GetFastSimulationManager(), G4FastSimulationManager::GetFastSimulationModelList(), G4PhysicalVolumeStore::GetInstance(), G4VPhysicalVolume::GetLogicalVolume(), G4VPhysicalVolume::GetMotherLogical(), G4Region::GetName(), G4ParticleTable::GetParticle(), G4ParticleDefinition::GetParticleName(), G4ParticleTable::GetParticleTable(), G4LogicalVolume::GetRegion(), and G4LogicalVolume::IsRootRegion().

Referenced by DisplayRegion(), and ShowSetup().

◆ FastSimulationNeedsToBeClosed()

void G4GlobalFastSimulationManager::FastSimulationNeedsToBeClosed ( )

◆ GetFastSimulationModel()

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

Definition at line 302 of file G4GlobalFastSimulationManager.cc.

304{
305 G4VFastSimulationModel* model = 0;
306 // -- flag used to navigate accross the various managers;
307 bool foundPrevious(false);
308 for (size_t ifsm=0; ifsm<ManagedManagers.size(); ifsm++)
309 {
310 model = ManagedManagers[ifsm]->
311 GetFastSimulationModel(modelName, previousFound, foundPrevious);
312 if (model) break;
313 }
314 return model;
315}
G4VFastSimulationModel * GetFastSimulationModel(const G4String &modelName, const G4VFastSimulationModel *previousFound=0) const

References GetFastSimulationModel(), and ManagedManagers.

Referenced by GetFastSimulationModel().

◆ GetGlobalFastSimulationManager()

G4GlobalFastSimulationManager * G4GlobalFastSimulationManager::GetGlobalFastSimulationManager ( )
static

◆ GetInstance()

G4GlobalFastSimulationManager * G4GlobalFastSimulationManager::GetInstance ( )
static

Definition at line 79 of file G4GlobalFastSimulationManager.cc.

80{
82}
static G4GlobalFastSimulationManager * GetGlobalFastSimulationManager()

References GetGlobalFastSimulationManager().

◆ InActivateFastSimulationModel()

void G4GlobalFastSimulationManager::InActivateFastSimulationModel ( const G4String aName)

Definition at line 139 of file G4GlobalFastSimulationManager.cc.

140{
141 G4bool result = false;
142 for (size_t ifsm=0; ifsm<ManagedManagers.size(); ifsm++)
143 result = result || ManagedManagers[ifsm]->
145 if (result) G4cout << "Model " << aName << " inactivated.";
146 else G4cout << "Model " << aName << " not found.";
147 G4cout << G4endl;
148}
void InActivateFastSimulationModel(const G4String &)

References G4cout, G4endl, InActivateFastSimulationModel(), and ManagedManagers.

Referenced by InActivateFastSimulationModel(), and G4FastSimulationMessenger::SetNewValue().

◆ ListEnvelopes() [1/2]

void G4GlobalFastSimulationManager::ListEnvelopes ( const G4ParticleDefinition aPD)

Definition at line 295 of file G4GlobalFastSimulationManager.cc.

296{
297 for (size_t ifsm=0; ifsm<ManagedManagers.size(); ifsm++)
298 ManagedManagers[ifsm]->ListModels(aPD);
299}

References ManagedManagers.

◆ ListEnvelopes() [2/2]

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

Definition at line 259 of file G4GlobalFastSimulationManager.cc.

261{
262 if (theType == ISAPPLICABLE)
263 {
264 for (size_t ifsm=0; ifsm<ManagedManagers.size(); ifsm++) ManagedManagers[ifsm]->ListModels(aName);
265 return;
266 }
267
268 if(aName == "all")
269 {
270 G4int titled = 0;
271 for (size_t ifsm=0; ifsm<ManagedManagers.size(); ifsm++)
272 {
273 if(theType == NAMES_ONLY)
274 {
275 if(!(titled++))
276 G4cout << "Current Envelopes for Fast Simulation:\n";
277 G4cout << " ";
278 ManagedManagers[ifsm]->ListTitle();
279 G4cout << G4endl;
280 }
281 else ManagedManagers[ifsm]->ListModels();
282 }
283 }
284 else
285 {
286 for (size_t ifsm=0; ifsm<ManagedManagers.size(); ifsm++)
287 if(aName == ManagedManagers[ifsm]-> GetEnvelope()->GetName())
288 {
289 ManagedManagers[ifsm]->ListModels();
290 break;
291 }
292 }
293}

References G4cout, G4endl, ISAPPLICABLE, ManagedManagers, and NAMES_ONLY.

Referenced by G4FastSimulationMessenger::SetNewValue().

◆ RemoveFastSimulationManager()

void G4GlobalFastSimulationManager::RemoveFastSimulationManager ( G4FastSimulationManager fsmanager)

Definition at line 110 of file G4GlobalFastSimulationManager.cc.

112{
113 ManagedManagers.remove(fsmanager);
114}
T * remove(const T *)

References ManagedManagers, and G4FastSimulationVector< T >::remove().

◆ RemoveFSMP()

void G4GlobalFastSimulationManager::RemoveFSMP ( G4FastSimulationManagerProcess fp)

◆ ShowSetup()

void G4GlobalFastSimulationManager::ShowSetup ( )

Definition at line 154 of file G4GlobalFastSimulationManager.cc.

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

References G4ProcessVector::contains(), DisplayRegion(), G4ParticleTable::entries(), fFSMPVector, G4cout, G4endl, G4RegionStore::GetInstance(), G4VPhysicalVolume::GetLogicalVolume(), G4Region::GetName(), G4VPhysicalVolume::GetName(), G4ParticleTable::GetParticle(), G4ParticleDefinition::GetParticleName(), G4ParticleTable::GetParticleTable(), G4ProcessManager::GetProcessList(), G4ParticleDefinition::GetProcessManager(), G4LogicalVolume::GetRegion(), and G4TransportationManager::GetTransportationManager().

Referenced by G4FastSimulationMessenger::SetNewValue().

Field Documentation

◆ fFSMPVector

G4FastSimulationVector<G4FastSimulationManagerProcess> G4GlobalFastSimulationManager::fFSMPVector
private

Definition at line 162 of file G4GlobalFastSimulationManager.hh.

Referenced by AddFSMP(), RemoveFSMP(), and ShowSetup().

◆ fGlobalFastSimulationManager

G4ThreadLocal G4GlobalFastSimulationManager * G4GlobalFastSimulationManager::fGlobalFastSimulationManager = 0
staticprivate

Definition at line 159 of file G4GlobalFastSimulationManager.hh.

Referenced by GetGlobalFastSimulationManager().

◆ fTheFastSimulationMessenger

G4FastSimulationMessenger* G4GlobalFastSimulationManager::fTheFastSimulationMessenger
private

◆ ManagedManagers

G4FastSimulationVector<G4FastSimulationManager> G4GlobalFastSimulationManager::ManagedManagers
private

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