G4FastSimulationMessenger.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 
00030 #include "G4FastSimulationMessenger.hh"
00031 #include "G4UIdirectory.hh"
00032 #include "G4UIcmdWithAString.hh"
00033 #include "G4UIcmdWithoutParameter.hh"
00034 
00035 #include "G4ios.hh"
00036 
00037 G4FastSimulationMessenger::
00038 G4FastSimulationMessenger(G4GlobalFastSimulationManager* theGFSM)
00039   : fGlobalFastSimulationManager(theGFSM)
00040 {
00041   fFSDirectory = new G4UIdirectory("/param/");
00042   fFSDirectory->SetGuidance("Fast Simulation print/control commands.");
00043 
00044   fShowSetupCmd =
00045     new G4UIcmdWithoutParameter("/param/showSetup", this);
00046   fShowSetupCmd->SetGuidance("Show fast simulation setup:");
00047   fShowSetupCmd->SetGuidance("    - for each world region:");
00048   fShowSetupCmd->SetGuidance("        1) fast simulation manager process attached;");
00049   fShowSetupCmd->SetGuidance("               - and to which particles the process is attached to;");
00050   fShowSetupCmd->SetGuidance("        2) region hierarchy;");
00051   fShowSetupCmd->SetGuidance("               - with for each the fast simulation models attached;");
00052   fShowSetupCmd->AvailableForStates(G4State_Idle, G4State_GeomClosed);
00053 
00054   fListEnvelopesCmd = 
00055     new G4UIcmdWithAString("/param/listEnvelopes", this);
00056   fListEnvelopesCmd->SetParameterName("ParticleName",true);
00057   fListEnvelopesCmd->SetDefaultValue("all");
00058   fListEnvelopesCmd->SetGuidance("List all the envelope names for a given Particle");
00059   fListEnvelopesCmd->SetGuidance("(or for all particles if without parameters).");
00060   fListEnvelopesCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
00061   
00062   fListModelsCmd = 
00063     new G4UIcmdWithAString("/param/listModels", this);
00064   fListModelsCmd->SetParameterName("EnvelopeName",true);
00065   fListModelsCmd->SetDefaultValue("all");
00066   fListModelsCmd->SetGuidance("List all the Model names for a given Envelope");
00067   fListModelsCmd->SetGuidance("(or for all envelopes if without parameters).");
00068   fListModelsCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
00069   
00070   fListIsApplicableCmd =
00071     new G4UIcmdWithAString("/param/listIsApplicable", this);
00072   fListIsApplicableCmd->SetParameterName("ModelName",true);
00073   fListIsApplicableCmd->SetDefaultValue("all");
00074   fListIsApplicableCmd->SetGuidance("List all the Particle names a given Model is applicable");
00075   fListIsApplicableCmd->SetGuidance("(or for all Models if without parameters).");
00076 
00077   fActivateModel =
00078     new G4UIcmdWithAString("/param/ActivateModel", this);
00079   fActivateModel->SetParameterName("ModelName",false);
00080   fActivateModel->SetGuidance("Activate a given Model.");
00081 
00082   fInActivateModel =
00083     new G4UIcmdWithAString("/param/InActivateModel", this);
00084   fInActivateModel->SetParameterName("ModelName",false);
00085   fInActivateModel->SetGuidance("InActivate a given Model.");
00086 }
00087 
00088 G4FastSimulationMessenger::~G4FastSimulationMessenger()
00089 {
00090   delete fShowSetupCmd;
00091   fShowSetupCmd = 0;
00092   delete fListIsApplicableCmd;
00093   fListIsApplicableCmd = 0;
00094   delete fActivateModel;
00095   fActivateModel = 0;
00096   delete fInActivateModel;
00097   fInActivateModel = 0;
00098   delete fListModelsCmd;
00099   fListModelsCmd = 0;
00100   delete fListEnvelopesCmd;
00101   fListEnvelopesCmd = 0;
00102   delete fFSDirectory;
00103   fFSDirectory = 0;
00104 }
00105 
00106 void G4FastSimulationMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
00107 {
00108   if (command == fShowSetupCmd)
00109     fGlobalFastSimulationManager->ShowSetup();
00110   if( command == fListEnvelopesCmd)
00111   {
00112     if(newValue == "all") 
00113       fGlobalFastSimulationManager->ListEnvelopes();
00114     else 
00115       fGlobalFastSimulationManager->
00116         ListEnvelopes(G4ParticleTable::GetParticleTable()->
00117                       FindParticle(newValue));
00118   }
00119   if( command == fListModelsCmd)
00120     fGlobalFastSimulationManager->ListEnvelopes(newValue, MODELS); 
00121   if( command == fListIsApplicableCmd)
00122     fGlobalFastSimulationManager->ListEnvelopes(newValue, ISAPPLICABLE);
00123   if( command == fActivateModel)
00124     fGlobalFastSimulationManager->ActivateFastSimulationModel(newValue);
00125   if( command == fInActivateModel)
00126     fGlobalFastSimulationManager->InActivateFastSimulationModel(newValue);
00127 }

Generated on Mon May 27 17:48:15 2013 for Geant4 by  doxygen 1.4.7