Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
F04PhysicsListMessenger.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 #include "globals.hh"
31 
33 #include "F04PhysicsList.hh"
34 
35 #include <G4UIdirectory.hh>
36 #include <G4UIcmdWithAString.hh>
39 
40 #include "G4ParticleTable.hh"
41 #include "G4ParticleDefinition.hh"
42 
43 #include "G4DecayTable.hh"
44 #include "G4VDecayChannel.hh"
45 
48 
49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
50 
52  : fPhysicsList(pPhys)
53 {
54  fDirectory = new G4UIdirectory("/exp/phys/");
55  fDirectory->SetGuidance("Control the physics lists");
56 
57  fGammaCutCMD = new G4UIcmdWithADoubleAndUnit("/exp/phys/gammaCut",this);
58  fGammaCutCMD->SetGuidance("Set gamma cut");
59  fGammaCutCMD->SetParameterName("Gcut",false);
60  fGammaCutCMD->SetUnitCategory("Length");
61  fGammaCutCMD->SetRange("Gcut>0.0");
62  fGammaCutCMD->SetDefaultUnit("mm");
64 
65  fElectCutCMD = new G4UIcmdWithADoubleAndUnit("/exp/phys/electronCut",
66  this);
67  fElectCutCMD->SetGuidance("Set electron cut");
68  fElectCutCMD->SetParameterName("Ecut",false);
69  fElectCutCMD->SetUnitCategory("Length");
70  fElectCutCMD->SetRange("Ecut>0.0");
71  fElectCutCMD->SetDefaultUnit("mm");
73 
74  fPosCutCMD = new G4UIcmdWithADoubleAndUnit("/exp/phys/positronCut",
75  this);
76  fPosCutCMD->SetGuidance("Set positron cut");
77  fPosCutCMD->SetParameterName("Pcut",false);
78  fPosCutCMD->SetUnitCategory("Length");
79  fPosCutCMD->SetRange("Pcut>0.0");
80  fPosCutCMD->SetDefaultUnit("mm");
82 
83  fAllCutCMD = new G4UIcmdWithADoubleAndUnit("/exp/phys/allCuts",this);
84  fAllCutCMD->SetGuidance("Set cut for all");
85  fAllCutCMD->SetParameterName("cut",false);
86  fAllCutCMD->SetUnitCategory("Length");
87  fAllCutCMD->SetRange("cut>0.0");
88  fAllCutCMD->SetDefaultUnit("mm");
90 
91  fStepMaxCMD = new G4UIcmdWithADoubleAndUnit("/exp/phys/stepMax",this);
92  fStepMaxCMD->SetGuidance("Set max. step length in the detector");
93  fStepMaxCMD->SetParameterName("mxStep",false);
94  fStepMaxCMD->SetUnitCategory("Length");
95  fStepMaxCMD->SetRange("mxStep>0.0");
96  fStepMaxCMD->SetDefaultUnit("mm");
98 /*
99  fClearPhysicsCMD = new G4UIcmdWithoutParameter("/exp/phys/clearPhysics",
100  this);
101  fClearPhysicsCMD->SetGuidance("Clear the physics list");
102  fClearPhysicsCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
103 
104  fRemovePhysicsCMD = new G4UIcmdWithAString("/exp/phys/removePhysics",this);
105  fRemovePhysicsCMD->
106  SetGuidance("Remove a physics process from Physics List");
107  fRemovePhysicsCMD->SetParameterName("PList",false);
108  fRemovePhysicsCMD->AvailableForStates(G4State_PreInit,G4State_Idle);
109 */
110  fDecayDirectory = new G4UIdirectory("/decay/");
111  fDecayDirectory->SetGuidance("Decay chain control commands.");
112 
113  fPienuCMD = new G4UIcmdWithoutParameter("/decay/pienu", this);
114  fPienuCMD->SetGuidance("Sets the pi+ to decay into e+, nu");
115 
116  fPimunuCMD = new G4UIcmdWithoutParameter("/decay/pimunu", this);
117  fPimunuCMD->SetGuidance("Sets the pi+ to decay into mu+, nu");
118 
119 }
120 
121 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
122 
124 {
125  delete fGammaCutCMD;
126  delete fElectCutCMD;
127  delete fPosCutCMD;
128  delete fAllCutCMD;
129 /*
130  delete fClearPhysicsCMD;
131  delete fRemovePhysicsCMD;
132 */
133  delete fPienuCMD;
134  delete fPimunuCMD;
135 }
136 
137 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
138 
140  G4String newValue)
141 {
143 
144  if (command == fPienuCMD) {
145  G4ParticleDefinition* fParticleDef = fParticleTable->FindParticle("pi+");
146  G4VDecayChannel* fMode =
147  new G4PhaseSpaceDecayChannel("pi+",0.999983,2,"e+","nu_e");
148  G4DecayTable* fTable = new G4DecayTable();
149  fTable->Insert(fMode);
150  fMode = new G4PionRadiativeDecayChannel("pi+",0.000017);
151  fTable->Insert(fMode);
152  fParticleDef->SetDecayTable(fTable);
153  }
154 
155  if (command == fPimunuCMD) {
156  G4ParticleDefinition* fParticleDef = fParticleTable->FindParticle("pi+");
157  G4VDecayChannel* fMode =
158  new G4PhaseSpaceDecayChannel("pi+",1.000,2,"mu+","nu_mu");
159  G4DecayTable* fTable = new G4DecayTable();
160  fTable->Insert(fMode);
161  fParticleDef->SetDecayTable(fTable);
162  }
163 
164  if (command == fGammaCutCMD) {
165  fPhysicsList->SetCutForGamma(fGammaCutCMD
166  ->GetNewDoubleValue(newValue));
167  }
168  else if (command == fElectCutCMD) {
169  fPhysicsList->SetCutForElectron(fElectCutCMD
170  ->GetNewDoubleValue(newValue));
171  }
172  else if (command == fPosCutCMD) {
173  fPhysicsList->SetCutForPositron(fPosCutCMD
174  ->GetNewDoubleValue(newValue));
175  }
176  else if (command == fAllCutCMD) {
177  G4double cut = fAllCutCMD->GetNewDoubleValue(newValue);
178  fPhysicsList->SetCutForGamma(cut);
179  fPhysicsList->SetCutForElectron(cut);
180  fPhysicsList->SetCutForPositron(cut);
181  }
182  else if (command == fStepMaxCMD) {
183  fPhysicsList->SetStepMax(fStepMaxCMD
184  ->GetNewDoubleValue(newValue));
185  }
186 /* else if (command == fClearPhysicsCMD) {
187  fPhysicsList->ClearPhysics();
188  }
189  else if (command == fRemovePhysicsCMD) {
190  G4String name = newValue;
191  fPhysicsList->RemoveFromPhysicsList(name);
192  }
193 */
194 }