G4VisCommandSceneAddGhosts Class Reference

#include <G4VisCommandsSceneAdd.hh>

Inheritance diagram for G4VisCommandSceneAddGhosts:

G4VVisCommandScene G4VVisCommand G4UImessenger

Public Member Functions

 G4VisCommandSceneAddGhosts ()
virtual ~G4VisCommandSceneAddGhosts ()
G4String GetCurrentValue (G4UIcommand *command)
void SetNewValue (G4UIcommand *command, G4String newValue)

Detailed Description

Definition at line 173 of file G4VisCommandsSceneAdd.hh.


Constructor & Destructor Documentation

G4VisCommandSceneAddGhosts::G4VisCommandSceneAddGhosts (  ) 

Definition at line 725 of file G4VisCommandsSceneAdd.cc.

00725                                                         {
00726   G4bool omitable;
00727   fpCommand = new G4UIcmdWithAString ("/vis/scene/add/ghosts", this);
00728   fpCommand -> SetGuidance
00729     ("Adds ghost volumes (G4FlavoredParallelWorld) to the current scene.");
00730   fpCommand -> SetGuidance ("Selects by particle.");
00731   fpCommand -> SetParameterName ("particle", omitable = true);
00732   fpCommand -> SetDefaultValue ("all");
00733 }

G4VisCommandSceneAddGhosts::~G4VisCommandSceneAddGhosts (  )  [virtual]

Definition at line 735 of file G4VisCommandsSceneAdd.cc.

00735                                                          {
00736   delete fpCommand;
00737 }


Member Function Documentation

G4String G4VisCommandSceneAddGhosts::GetCurrentValue ( G4UIcommand command  )  [virtual]

Reimplemented from G4UImessenger.

Definition at line 739 of file G4VisCommandsSceneAdd.cc.

00739                                                                   {
00740   return "";
00741 }

void G4VisCommandSceneAddGhosts::SetNewValue ( G4UIcommand command,
G4String  newValue 
) [virtual]

Reimplemented from G4UImessenger.

Definition at line 743 of file G4VisCommandsSceneAdd.cc.

References G4VisManager::confirmations, G4ParticleTable::entries(), G4VisManager::errors, G4ParticleTable::FindParticle(), G4VVisCommand::fpVisManager, G4cout, G4endl, G4VGlobalFastSimulationManager::GetConcreteInstance(), G4VisManager::GetCurrentScene(), G4VGlobalFastSimulationManager::GetFlavoredWorldForThis(), G4ParticleTable::GetParticle(), G4ParticleTable::GetParticleTable(), G4VisManager::GetVerbosity(), G4VVisCommand::UpdateVisManagerScene(), and G4VisManager::warnings.

00743                                                                             {
00744 
00745   G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
00746   G4bool warn(verbosity >= G4VisManager::warnings);
00747 
00748   G4Scene* pScene = fpVisManager->GetCurrentScene();
00749   if (!pScene) {
00750     if (verbosity >= G4VisManager::errors) {
00751       G4cout << "ERROR: No current scene.  Please create one." << G4endl;
00752     }
00753     return;
00754   }
00755   const G4String& currentSceneName = pScene -> GetName ();
00756 
00757   // Gets the G4GlobalFastSimulationManager pointer if any.
00758   G4VGlobalFastSimulationManager* theGlobalFastSimulationManager;
00759   if(!(theGlobalFastSimulationManager = 
00760        G4VGlobalFastSimulationManager::GetConcreteInstance ())){
00761     if (verbosity >= G4VisManager::errors) {
00762       G4cout << "ERROR: no G4GlobalFastSimulationManager" << G4endl;
00763     }
00764     return;
00765   }
00766   
00767   // Gets the G4ParticleTable pointer.
00768   G4ParticleTable* theParticleTable=G4ParticleTable::GetParticleTable();
00769   
00770   // If "all" (the default) loops on all known particles
00771   if(newValue=="all") 
00772     {
00773       G4VFlavoredParallelWorld* CurrentFlavoredWorld = 0;
00774       G4bool successful = false;
00775       for (G4int iParticle=0; iParticle<theParticleTable->entries(); 
00776            iParticle++)
00777         {
00778           CurrentFlavoredWorld = theGlobalFastSimulationManager->
00779             GetFlavoredWorldForThis(theParticleTable->GetParticle(iParticle));
00780           
00781           if(CurrentFlavoredWorld)
00782             successful = successful || pScene -> 
00783               AddRunDurationModel(new G4FlavoredParallelWorldModel 
00784                                   (CurrentFlavoredWorld), warn);
00785         }
00786       if (successful) 
00787         {
00788           if (verbosity >= G4VisManager::confirmations) 
00789             G4cout << "Ghosts have been added to scene \""
00790                    << currentSceneName << "\"."
00791                    << G4endl;
00792           UpdateVisManagerScene (currentSceneName);
00793         }
00794       else 
00795         {
00796           G4cout << "ERROR: There are no ghosts."<<G4endl;
00797           G4VisCommandsSceneAddUnsuccessful(verbosity);
00798         }
00799       return;
00800     }
00801   
00802   // Given a particle name looks just for the concerned Ghosts, if any.
00803   G4ParticleDefinition* currentParticle = 
00804     theParticleTable->FindParticle(newValue);
00805   
00806   if (currentParticle == NULL) 
00807     {
00808       if (verbosity >= G4VisManager::errors) 
00809         G4cout << "ERROR: \"" << newValue
00810                << "\": not found this particle name!" << G4endl;
00811       return;
00812     }
00813   
00814   G4VFlavoredParallelWorld* worldForThis =
00815     theGlobalFastSimulationManager->GetFlavoredWorldForThis(currentParticle);
00816   if(worldForThis) 
00817     {
00818       G4bool successful = pScene -> AddRunDurationModel
00819         (new G4FlavoredParallelWorldModel (worldForThis), warn);
00820       if (successful) {
00821         if (verbosity >= G4VisManager::confirmations) 
00822           G4cout << "Ghosts have been added to scene \""
00823                  << currentSceneName << "\"."
00824                  << G4endl;
00825         UpdateVisManagerScene (currentSceneName);
00826       }
00827     }
00828   else 
00829     if (verbosity >= G4VisManager::errors) 
00830       {
00831         G4cout << "ERROR: There are no ghosts for \""<<newValue<<"\""<<G4endl;
00832         G4VisCommandsSceneAddUnsuccessful(verbosity);
00833       }
00834 }


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:53:45 2013 for Geant4 by  doxygen 1.4.7