Geant4  9.6.p02
 All Classes 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 //
28 //
29 //
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 
48 :fPhysicsList(pPhys)
49 {
50 
51  fDirectory = new G4UIdirectory("/WLS/phys/");
52  fDirectory->SetGuidance("WLSPhysicsList control");
53 
54  fSetAbsorptionCMD = new G4UIcmdWithABool("/WLS/setAbsorption", this);
55  fSetAbsorptionCMD->SetGuidance("Turn on or off absorption process");
56  fSetAbsorptionCMD->AvailableForStates(G4State_Idle);
57 
58  verboseCmd = new G4UIcmdWithAnInteger("/WLS/phys/verbose",this);
59  verboseCmd->SetGuidance("set verbose for physics processes");
60  verboseCmd->SetParameterName("verbose",true);
61  verboseCmd->SetDefaultValue(1);
62  verboseCmd->SetRange("verbose>=0");
63  verboseCmd->AvailableForStates(G4State_Idle);
64 
65  cerenkovCmd = new G4UIcmdWithAnInteger("/WLS/phys/cerenkovMaxPhotons",this);
66  cerenkovCmd->SetGuidance("set max nb of photons per step");
67  cerenkovCmd->SetParameterName("MaxNumber",false);
68  cerenkovCmd->SetRange("MaxNumber>=0");
69  cerenkovCmd->AvailableForStates(G4State_Idle);
70 
71  fGammaCutCMD = new G4UIcmdWithADoubleAndUnit("/WLS/phys/gammaCut",this);
72  fGammaCutCMD->SetGuidance("Set gamma cut");
73  fGammaCutCMD->SetParameterName("Gcut",false);
74  fGammaCutCMD->SetUnitCategory("Length");
75  fGammaCutCMD->SetRange("Gcut>0.0");
76  fGammaCutCMD->SetDefaultUnit("mm");
78 
79  fElectCutCMD = new G4UIcmdWithADoubleAndUnit("/WLS/phys/electronCut",this);
80  fElectCutCMD->SetGuidance("Set electron cut");
81  fElectCutCMD->SetParameterName("Ecut",false);
82  fElectCutCMD->SetUnitCategory("Length");
83  fElectCutCMD->SetRange("Ecut>0.0");
84  fElectCutCMD->SetDefaultUnit("mm");
86 
87  fPosCutCMD = new G4UIcmdWithADoubleAndUnit("/WLS/phys/positronCut",this);
88  fPosCutCMD->SetGuidance("Set positron cut");
89  fPosCutCMD->SetParameterName("Pcut",false);
90  fPosCutCMD->SetUnitCategory("Length");
91  fPosCutCMD->SetRange("Pcut>0.0");
92  fPosCutCMD->SetDefaultUnit("mm");
94 
95  fAllCutCMD = new G4UIcmdWithADoubleAndUnit("/WLS/phys/allCuts",this);
96  fAllCutCMD->SetGuidance("Set cut for all");
97  fAllCutCMD->SetParameterName("cut",false);
98  fAllCutCMD->SetUnitCategory("Length");
99  fAllCutCMD->SetRange("cut>0.0");
100  fAllCutCMD->SetDefaultUnit("mm");
102 
103  fStepMaxCMD = new G4UIcmdWithADoubleAndUnit("/WLS/phys/stepMax",this);
104  fStepMaxCMD->SetGuidance("Set max. step length in the detector");
105  fStepMaxCMD->SetParameterName("mxStep",false);
106  fStepMaxCMD->SetUnitCategory("Length");
107  fStepMaxCMD->SetRange("mxStep>0.0");
108  fStepMaxCMD->SetDefaultUnit("mm");
110 
111  fClearPhysicsCMD =
112  new G4UIcmdWithoutParameter("/WLS/phys/clearPhysics",this);
113  fClearPhysicsCMD->SetGuidance("Clear the physics list");
115 
116  fRemovePhysicsCMD = new G4UIcmdWithAString("/WLS/phys/removePhysics",this);
117  fRemovePhysicsCMD->SetGuidance("Remove a physics process from Physics List");
118  fRemovePhysicsCMD->SetParameterName("PList",false);
119  fRemovePhysicsCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
120 
121  fListCMD = new G4UIcmdWithoutParameter("/WLS/phys/list",this);
122  fListCMD->SetGuidance("Available Physics Lists");
123  fListCMD->AvailableForStates(G4State_Idle);
124 
125  fDecayDirectory = new G4UIdirectory("/decay/");
126  fDecayDirectory->SetGuidance("Decay chain control commands.");
127 
128  fPienuCMD = new G4UIcmdWithoutParameter("/decay/pienu", this);
129  fPienuCMD->SetGuidance("Sets the pi+ to decay into e+, nu");
130 
131  fPimunuCMD = new G4UIcmdWithoutParameter("/decay/pimunu", this);
132  fPimunuCMD->SetGuidance("Sets the pi+ to decay into mu+, nu");
133 
134 }
135 
137 {
138  delete verboseCmd;
139  delete cerenkovCmd;
140 
141  delete fSetAbsorptionCMD;
142 
143  delete fGammaCutCMD;
144  delete fElectCutCMD;
145  delete fPosCutCMD;
146  delete fAllCutCMD;
147 
148  delete fClearPhysicsCMD;
149  delete fRemovePhysicsCMD;
150 
151  delete fListCMD;
152 
153  delete fPienuCMD;
154  delete fPimunuCMD;
155 
156  delete fDirectory;
157 }
158 
160  G4String newValue)
161 {
162  if( command == fSetAbsorptionCMD ) {
163  fPhysicsList->SetAbsorption(G4UIcmdWithABool::GetNewBoolValue(newValue));
164  }
165 
166  else if( command == verboseCmd ) {
167  fPhysicsList->SetVerbose(verboseCmd->GetNewIntValue(newValue));
168  }
169 
170  else if( command == cerenkovCmd ) {
171  fPhysicsList->
172  SetNbOfPhotonsCerenkov(cerenkovCmd->GetNewIntValue(newValue));
173  }
174 
175  else if (command == fPienuCMD) {
176  particleTable = G4ParticleTable::GetParticleTable();
177  particleDef = particleTable->FindParticle("pi+");
178  mode = new G4PhaseSpaceDecayChannel("pi+",1.0,2,"e+","nu_e");
179  table=new G4DecayTable();
180  table->Insert(mode);
181  // mode = new G4PionRadiativeDecayChannel("pi+",0.000017);
182  // table->Insert(mode);
183  particleDef->SetDecayTable(table);
184  }
185 
186  else if (command == fPimunuCMD) {
187  particleTable = G4ParticleTable::GetParticleTable();
188  particleDef = particleTable->FindParticle("pi+");
189  mode = new G4PhaseSpaceDecayChannel("pi+",1.000,2,"mu+","nu_mu");
190  table=new G4DecayTable();
191  table->Insert(mode);
192  particleDef->SetDecayTable(table);
193  }
194 
195  else if (command == fGammaCutCMD) {
196  fPhysicsList->SetCutForGamma(fGammaCutCMD
197  ->GetNewDoubleValue(newValue));
198  }
199  else if (command == fElectCutCMD) {
200  fPhysicsList->SetCutForElectron(fElectCutCMD
201  ->GetNewDoubleValue(newValue));
202  }
203  else if (command == fPosCutCMD) {
204  fPhysicsList->SetCutForPositron(fPosCutCMD
205  ->GetNewDoubleValue(newValue));
206  }
207  else if (command == fAllCutCMD) {
208  G4double cut = fAllCutCMD->GetNewDoubleValue(newValue);
209  fPhysicsList->SetCutForGamma(cut);
210  fPhysicsList->SetCutForElectron(cut);
211  fPhysicsList->SetCutForPositron(cut);
212  }
213  else if (command == fStepMaxCMD) {
214  fPhysicsList->SetStepMax(fStepMaxCMD
215  ->GetNewDoubleValue(newValue));
216  }
217  else if (command == fClearPhysicsCMD) {
218  fPhysicsList->ClearPhysics();
219  }
220  else if (command == fRemovePhysicsCMD) {
221  G4String name = newValue;
222  fPhysicsList->RemoveFromPhysicsList(name);
223  }
224 }