Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ML2PhysicsListMessenger.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 // The code was written by :
27 // ^Claudio Andenna claudio.andenna@ispesl.it, claudio.andenna@iss.infn.it
28 // *Barbara Caccia barbara.caccia@iss.it
29 // with the support of Pablo Cirrone (LNS, INFN Catania Italy)
30 // with the contribute of Alessandro Occhigrossi*
31 //
32 // ^INAIL DIPIA - ex ISPESL and INFN Roma, gruppo collegato Sanità, Italy
33 // *Istituto Superiore di Sanità and INFN Roma, gruppo collegato Sanità, Italy
34 // Viale Regina Elena 299, 00161 Roma (Italy)
35 // tel (39) 06 49902246
36 // fax (39) 06 49387075
37 //
38 // more information:
39 // http://g4advancedexamples.lngs.infn.it/Examples/medical-linac
40 //
41 
42 
44 
45 #include "ML2PhysicsList.hh"
46 #include "G4UIdirectory.hh"
48 #include "G4UIcmdWithAString.hh"
49 
52 :pPhysicsList(pPhys)
53 {
54  physDir = new G4UIdirectory("/physic/");
55  physDir->SetGuidance("Commands to activate physics models and set cuts");
56 
57  gammaCutCmd = new G4UIcmdWithADoubleAndUnit("/physic/setGCut",this);
58  gammaCutCmd->SetGuidance("Set gamma cut.");
59  gammaCutCmd->SetParameterName("Gcut",false);
60  gammaCutCmd->SetUnitCategory("Length");
61  gammaCutCmd->SetRange("Gcut>0.0");
63 
64  electCutCmd = new G4UIcmdWithADoubleAndUnit("/physic/setECut",this);
65  electCutCmd->SetGuidance("Set electron cut.");
66  electCutCmd->SetParameterName("Ecut",false);
67  electCutCmd->SetUnitCategory("Length");
68  electCutCmd->SetRange("Ecut>0.0");
70 
71  protoCutCmd = new G4UIcmdWithADoubleAndUnit("/physic/setPCut",this);
72  protoCutCmd->SetGuidance("Set positron cut.");
73  protoCutCmd->SetParameterName("Pcut",false);
74  protoCutCmd->SetUnitCategory("Length");
75  protoCutCmd->SetRange("Pcut>0.0");
77 
78  allCutCmd = new G4UIcmdWithADoubleAndUnit("/physic/setCuts",this);
79  allCutCmd->SetGuidance("Set cut for all.");
80  allCutCmd->SetParameterName("cut",false);
81  allCutCmd->SetUnitCategory("Length");
82  allCutCmd->SetRange("cut>0.0");
84 
85  pListCmd = new G4UIcmdWithAString("/physic/addPhysics",this);
86  pListCmd->SetGuidance("Add physics list.");
87  pListCmd->SetParameterName("PList",false);
89 
90  packageListCmd = new G4UIcmdWithAString("/physic/addPackage",this);
91  packageListCmd->SetGuidance("Add physics package.");
92  packageListCmd->SetParameterName("package",false);
93  packageListCmd->AvailableForStates(G4State_PreInit);
94 }
95 
98 {
99  delete gammaCutCmd;
100  delete electCutCmd;
101  delete protoCutCmd;
102  delete allCutCmd;
103  delete pListCmd;
104  delete physDir;
105  delete packageListCmd;
106 }
107 
108 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
109 
111  G4String newValue)
112 {
113  if( command == gammaCutCmd )
114  { pPhysicsList->SetCutForGamma(gammaCutCmd->GetNewDoubleValue(newValue));}
115 
116  if( command == electCutCmd )
117  { pPhysicsList->SetCutForElectron(electCutCmd->GetNewDoubleValue(newValue));}
118 
119  if( command == protoCutCmd )
120  { pPhysicsList->SetCutForPositron(protoCutCmd->GetNewDoubleValue(newValue));}
121 
122  if( command == allCutCmd )
123  {
124  G4double cut = allCutCmd->GetNewDoubleValue(newValue);
125  pPhysicsList->SetCutForGamma(cut);
126  pPhysicsList->SetCutForElectron(cut);
127  pPhysicsList->SetCutForPositron(cut);
128  }
129 
130  if( command == pListCmd )
131  { pPhysicsList->AddPhysicsList(newValue);}
132 
133  if( command == packageListCmd )
134  { pPhysicsList->AddPackage(newValue);}
135 }
136 
137 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetCutForElectron(G4double)
void SetNewValue(G4UIcommand *, G4String)
void AddPackage(const G4String &name)
void SetUnitCategory(const char *unitCategory)
static G4double GetNewDoubleValue(const char *paramString)
void AddPhysicsList(const G4String &name)
ML2PhysicsListMessenger(ML2PhysicsList *)
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void SetCutForPositron(G4double)
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:240
void SetCutForGamma(G4double)
double G4double
Definition: G4Types.hh:76
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)