Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
WLSPhysicsListMessenger.cc
Go to the documentation of this file.
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 // $Id: WLSPhysicsListMessenger.cc 69561 2013-05-08 12:25:56Z gcosmo $
27 //
28 /// \file optical/wls/src/WLSPhysicsListMessenger.cc
29 /// \brief Implementation of the WLSPhysicsListMessenger class
30 //
31 //
32 #include "globals.hh"
33 
35 #include "WLSPhysicsList.hh"
36 
37 #include "G4UIdirectory.hh"
38 #include "G4UIcmdWithABool.hh"
39 #include "G4UIcmdWithAString.hh"
40 #include "G4UIcmdWithAnInteger.hh"
43 
46 
47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
48 
50  : fPhysicsList(pPhys)
51 {
52 
53  fDirectory = new G4UIdirectory("/WLS/phys/");
54  fDirectory->SetGuidance("WLSPhysicsList control");
55 
56  fSetAbsorptionCMD = new G4UIcmdWithABool("/WLS/setAbsorption", this);
57  fSetAbsorptionCMD->SetGuidance("Turn on or off absorption process");
58  fSetAbsorptionCMD->AvailableForStates(G4State_Idle);
59 
60  fVerboseCmd = new G4UIcmdWithAnInteger("/WLS/phys/verbose",this);
61  fVerboseCmd->SetGuidance("set verbose for physics processes");
62  fVerboseCmd->SetParameterName("verbose",true);
63  fVerboseCmd->SetDefaultValue(1);
64  fVerboseCmd->SetRange("verbose>=0");
65  fVerboseCmd->AvailableForStates(G4State_Idle);
66 
67  fCerenkovCmd =
68  new G4UIcmdWithAnInteger("/WLS/phys/cerenkovMaxPhotons",this);
69  fCerenkovCmd->SetGuidance("set max nb of photons per step");
70  fCerenkovCmd->SetParameterName("MaxNumber",false);
71  fCerenkovCmd->SetRange("MaxNumber>=0");
72  fCerenkovCmd->AvailableForStates(G4State_Idle);
73 
74  fGammaCutCMD = new G4UIcmdWithADoubleAndUnit("/WLS/phys/gammaCut",this);
75  fGammaCutCMD->SetGuidance("Set gamma cut");
76  fGammaCutCMD->SetParameterName("Gcut",false);
77  fGammaCutCMD->SetUnitCategory("Length");
78  fGammaCutCMD->SetRange("Gcut>0.0");
79  fGammaCutCMD->SetDefaultUnit("mm");
81 
82  fElectCutCMD = new G4UIcmdWithADoubleAndUnit("/WLS/phys/electronCut",this);
83  fElectCutCMD->SetGuidance("Set electron cut");
84  fElectCutCMD->SetParameterName("Ecut",false);
85  fElectCutCMD->SetUnitCategory("Length");
86  fElectCutCMD->SetRange("Ecut>0.0");
87  fElectCutCMD->SetDefaultUnit("mm");
89 
90  fPosCutCMD = new G4UIcmdWithADoubleAndUnit("/WLS/phys/positronCut",this);
91  fPosCutCMD->SetGuidance("Set positron cut");
92  fPosCutCMD->SetParameterName("Pcut",false);
93  fPosCutCMD->SetUnitCategory("Length");
94  fPosCutCMD->SetRange("Pcut>0.0");
95  fPosCutCMD->SetDefaultUnit("mm");
97 
98  fAllCutCMD = new G4UIcmdWithADoubleAndUnit("/WLS/phys/allCuts",this);
99  fAllCutCMD->SetGuidance("Set cut for all");
100  fAllCutCMD->SetParameterName("cut",false);
101  fAllCutCMD->SetUnitCategory("Length");
102  fAllCutCMD->SetRange("cut>0.0");
103  fAllCutCMD->SetDefaultUnit("mm");
105 
106  fStepMaxCMD = new G4UIcmdWithADoubleAndUnit("/WLS/phys/stepMax",this);
107  fStepMaxCMD->SetGuidance("Set max. step length in the detector");
108  fStepMaxCMD->SetParameterName("mxStep",false);
109  fStepMaxCMD->SetUnitCategory("Length");
110  fStepMaxCMD->SetRange("mxStep>0.0");
111  fStepMaxCMD->SetDefaultUnit("mm");
113 
114  fClearPhysicsCMD =
115  new G4UIcmdWithoutParameter("/WLS/phys/clearPhysics",this);
116  fClearPhysicsCMD->SetGuidance("Clear the physics list");
118 
119  fRemovePhysicsCMD = new G4UIcmdWithAString("/WLS/phys/removePhysics",this);
120  fRemovePhysicsCMD->
121  SetGuidance("Remove a physics process from Physics List");
122  fRemovePhysicsCMD->SetParameterName("PList",false);
123  fRemovePhysicsCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
124 
125  fListCMD = new G4UIcmdWithoutParameter("/WLS/phys/list",this);
126  fListCMD->SetGuidance("Available Physics Lists");
127  fListCMD->AvailableForStates(G4State_Idle);
128 
129  fDecayDirectory = new G4UIdirectory("/decay/");
130  fDecayDirectory->SetGuidance("Decay chain control commands.");
131 
132  fPienuCMD = new G4UIcmdWithoutParameter("/decay/pienu", this);
133  fPienuCMD->SetGuidance("Sets the pi+ to decay into e+, nu");
134 
135  fPimunuCMD = new G4UIcmdWithoutParameter("/decay/pimunu", this);
136  fPimunuCMD->SetGuidance("Sets the pi+ to decay into mu+, nu");
137 
138 }
139 
140 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
141 
143 {
144  delete fVerboseCmd;
145  delete fCerenkovCmd;
146 
147  delete fSetAbsorptionCMD;
148 
149  delete fGammaCutCMD;
150  delete fElectCutCMD;
151  delete fPosCutCMD;
152  delete fAllCutCMD;
153 
154  delete fClearPhysicsCMD;
155  delete fRemovePhysicsCMD;
156 
157  delete fListCMD;
158 
159  delete fPienuCMD;
160  delete fPimunuCMD;
161 
162  delete fDirectory;
163 }
164 
165 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
166 
168  G4String newValue)
169 {
170  if( command == fSetAbsorptionCMD ) {
171  fPhysicsList->SetAbsorption(G4UIcmdWithABool::GetNewBoolValue(newValue));
172  }
173 
174  else if( command == fVerboseCmd ) {
175  fPhysicsList->SetVerbose(fVerboseCmd->GetNewIntValue(newValue));
176  }
177 
178  else if( command == fCerenkovCmd ) {
179  fPhysicsList->
180  SetNbOfPhotonsCerenkov(fCerenkovCmd->GetNewIntValue(newValue));
181  }
182 
183  else if (command == fPienuCMD) {
185  G4ParticleDefinition* particleDef = particleTable->FindParticle("pi+");
186  G4VDecayChannel* mode =
187  new G4PhaseSpaceDecayChannel("pi+",1.0,2,"e+","nu_e");
188  G4DecayTable* table = new G4DecayTable();
189  table->Insert(mode);
190  // mode = new G4PionRadiativeDecayChannel("pi+",0.000017);
191  // table->Insert(mode);
192  particleDef->SetDecayTable(table);
193  }
194 
195  else if (command == fPimunuCMD) {
197  G4ParticleDefinition* particleDef = particleTable->FindParticle("pi+");
198  G4VDecayChannel* mode =
199  new G4PhaseSpaceDecayChannel("pi+",1.000,2,"mu+","nu_mu");
200  G4DecayTable* table = new G4DecayTable();
201  table->Insert(mode);
202  particleDef->SetDecayTable(table);
203  }
204 
205  else if (command == fGammaCutCMD) {
206  fPhysicsList->SetCutForGamma(fGammaCutCMD
207  ->GetNewDoubleValue(newValue));
208  }
209  else if (command == fElectCutCMD) {
210  fPhysicsList->SetCutForElectron(fElectCutCMD
211  ->GetNewDoubleValue(newValue));
212  }
213  else if (command == fPosCutCMD) {
214  fPhysicsList->SetCutForPositron(fPosCutCMD
215  ->GetNewDoubleValue(newValue));
216  }
217  else if (command == fAllCutCMD) {
218  G4double cut = fAllCutCMD->GetNewDoubleValue(newValue);
219  fPhysicsList->SetCutForGamma(cut);
220  fPhysicsList->SetCutForElectron(cut);
221  fPhysicsList->SetCutForPositron(cut);
222  }
223  else if (command == fStepMaxCMD) {
224  fPhysicsList->SetStepMax(fStepMaxCMD
225  ->GetNewDoubleValue(newValue));
226  }
227  else if (command == fClearPhysicsCMD) {
228  fPhysicsList->ClearPhysics();
229  }
230  else if (command == fRemovePhysicsCMD) {
231  G4String name = newValue;
232  fPhysicsList->RemoveFromPhysicsList(name);
233  }
234 }
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDecayTable(G4DecayTable *aDecayTable)
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static G4int GetNewIntValue(const char *paramString)
const XML_Char * name
void SetUnitCategory(const char *unitCategory)
static G4double GetNewDoubleValue(const char *paramString)
static G4bool GetNewBoolValue(const char *paramString)
void SetStepMax(G4double)
void ClearPhysics()
Make sure that the physics list is empty.
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:225
virtual void SetNewValue(G4UIcommand *, G4String)
WLSPhysicsListMessenger(WLSPhysicsList *)
void SetCutForPositron(G4double)
void Insert(G4VDecayChannel *aChannel)
Definition: G4DecayTable.cc:60
Definition of the WLSPhysicsListMessenger class.
void SetCutForGamma(G4double)
void RemoveFromPhysicsList(const G4String &)
Remove specific physics from physics list.
static G4ParticleTable * GetParticleTable()
Definition of the WLSPhysicsList class.
void SetDefaultUnit(const char *defUnit)
void SetDefaultValue(G4int defVal)
void SetCutForElectron(G4double)
double G4double
Definition: G4Types.hh:76
void SetAbsorption(G4bool)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetVerbose(G4int)