1 | // |
---|
2 | // ******************************************************************** |
---|
3 | // * License and Disclaimer * |
---|
4 | // * * |
---|
5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
7 | // * conditions of the Geant4 Software License, included in the file * |
---|
8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
9 | // * include a list of copyright holders. * |
---|
10 | // * * |
---|
11 | // * Neither the authors of this software system, nor their employing * |
---|
12 | // * institutes,nor the agencies providing financial support for this * |
---|
13 | // * work make any representation or warranty, express or implied, * |
---|
14 | // * regarding this software system or assume any liability for its * |
---|
15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
16 | // * for the full disclaimer and the limitation of liability. * |
---|
17 | // * * |
---|
18 | // * This code implementation is the result of the scientific and * |
---|
19 | // * technical work of the GEANT4 collaboration. * |
---|
20 | // * By using, copying, modifying or distributing the software (or * |
---|
21 | // * any work based on the software) you agree to acknowledge its * |
---|
22 | // * use in resulting scientific publications, and indicate your * |
---|
23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
24 | // ******************************************************************** |
---|
25 | // |
---|
26 | // |
---|
27 | // $Id: G4FastSimulationMessenger.cc,v 1.9 2008/03/13 16:03:23 gcosmo Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-04-beta-01 $ |
---|
29 | // |
---|
30 | |
---|
31 | #include "G4FastSimulationMessenger.hh" |
---|
32 | #include "G4UIdirectory.hh" |
---|
33 | #include "G4UIcmdWithAString.hh" |
---|
34 | #include "G4UIcmdWithoutParameter.hh" |
---|
35 | |
---|
36 | #include "G4ios.hh" |
---|
37 | |
---|
38 | G4FastSimulationMessenger:: |
---|
39 | G4FastSimulationMessenger(G4GlobalFastSimulationManager* theGFSM) |
---|
40 | : fGlobalFastSimulationManager(theGFSM) |
---|
41 | { |
---|
42 | fFSDirectory = new G4UIdirectory("/param/"); |
---|
43 | fFSDirectory->SetGuidance("Fast Simulation print/control commands."); |
---|
44 | |
---|
45 | fShowSetupCmd = |
---|
46 | new G4UIcmdWithoutParameter("/param/showSetup", this); |
---|
47 | fShowSetupCmd->SetGuidance("Show fast simulation setup:"); |
---|
48 | fShowSetupCmd->SetGuidance(" - for each world region:"); |
---|
49 | fShowSetupCmd->SetGuidance(" 1) fast simulation manager process attached;"); |
---|
50 | fShowSetupCmd->SetGuidance(" - and to which particles the process is attached to;"); |
---|
51 | fShowSetupCmd->SetGuidance(" 2) region hierarchy;"); |
---|
52 | fShowSetupCmd->SetGuidance(" - with for each the fast simulation models attached;"); |
---|
53 | fShowSetupCmd->AvailableForStates(G4State_Idle, G4State_GeomClosed); |
---|
54 | |
---|
55 | fListEnvelopesCmd = |
---|
56 | new G4UIcmdWithAString("/param/listEnvelopes", this); |
---|
57 | fListEnvelopesCmd->SetParameterName("ParticleName",true); |
---|
58 | fListEnvelopesCmd->SetDefaultValue("all"); |
---|
59 | fListEnvelopesCmd->SetGuidance("List all the envelope names for a given Particle"); |
---|
60 | fListEnvelopesCmd->SetGuidance("(or for all particles if without parameters)."); |
---|
61 | fListEnvelopesCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
62 | |
---|
63 | fListModelsCmd = |
---|
64 | new G4UIcmdWithAString("/param/listModels", this); |
---|
65 | fListModelsCmd->SetParameterName("EnvelopeName",true); |
---|
66 | fListModelsCmd->SetDefaultValue("all"); |
---|
67 | fListModelsCmd->SetGuidance("List all the Model names for a given Envelope"); |
---|
68 | fListModelsCmd->SetGuidance("(or for all envelopes if without parameters)."); |
---|
69 | fListModelsCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
70 | |
---|
71 | fListIsApplicableCmd = |
---|
72 | new G4UIcmdWithAString("/param/listIsApplicable", this); |
---|
73 | fListIsApplicableCmd->SetParameterName("ModelName",true); |
---|
74 | fListIsApplicableCmd->SetDefaultValue("all"); |
---|
75 | fListIsApplicableCmd->SetGuidance("List all the Particle names a given Model is applicable"); |
---|
76 | fListIsApplicableCmd->SetGuidance("(or for all Models if without parameters)."); |
---|
77 | |
---|
78 | fActivateModel = |
---|
79 | new G4UIcmdWithAString("/param/ActivateModel", this); |
---|
80 | fActivateModel->SetParameterName("ModelName",false); |
---|
81 | fActivateModel->SetGuidance("Activate a given Model."); |
---|
82 | |
---|
83 | fInActivateModel = |
---|
84 | new G4UIcmdWithAString("/param/InActivateModel", this); |
---|
85 | fInActivateModel->SetParameterName("ModelName",false); |
---|
86 | fInActivateModel->SetGuidance("InActivate a given Model."); |
---|
87 | } |
---|
88 | |
---|
89 | G4FastSimulationMessenger::~G4FastSimulationMessenger() |
---|
90 | { |
---|
91 | delete fShowSetupCmd; |
---|
92 | fShowSetupCmd = 0; |
---|
93 | delete fListIsApplicableCmd; |
---|
94 | fListIsApplicableCmd = 0; |
---|
95 | delete fActivateModel; |
---|
96 | fActivateModel = 0; |
---|
97 | delete fInActivateModel; |
---|
98 | fInActivateModel = 0; |
---|
99 | delete fListModelsCmd; |
---|
100 | fListModelsCmd = 0; |
---|
101 | delete fListEnvelopesCmd; |
---|
102 | fListEnvelopesCmd = 0; |
---|
103 | delete fFSDirectory; |
---|
104 | fFSDirectory = 0; |
---|
105 | } |
---|
106 | |
---|
107 | void G4FastSimulationMessenger::SetNewValue(G4UIcommand * command,G4String newValue) |
---|
108 | { |
---|
109 | if (command == fShowSetupCmd) |
---|
110 | fGlobalFastSimulationManager->ShowSetup(); |
---|
111 | if( command == fListEnvelopesCmd) |
---|
112 | { |
---|
113 | if(newValue == "all") |
---|
114 | fGlobalFastSimulationManager->ListEnvelopes(); |
---|
115 | else |
---|
116 | fGlobalFastSimulationManager-> |
---|
117 | ListEnvelopes(G4ParticleTable::GetParticleTable()-> |
---|
118 | FindParticle(newValue)); |
---|
119 | } |
---|
120 | if( command == fListModelsCmd) |
---|
121 | fGlobalFastSimulationManager->ListEnvelopes(newValue, MODELS); |
---|
122 | if( command == fListIsApplicableCmd) |
---|
123 | fGlobalFastSimulationManager->ListEnvelopes(newValue, ISAPPLICABLE); |
---|
124 | if( command == fActivateModel) |
---|
125 | fGlobalFastSimulationManager->ActivateFastSimulationModel(newValue); |
---|
126 | if( command == fInActivateModel) |
---|
127 | fGlobalFastSimulationManager->InActivateFastSimulationModel(newValue); |
---|
128 | } |
---|