Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ML2MainMessenger.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 
43 #include "ML2MainMessenger.hh"
44 #include "G4SystemOfUnits.hh"
45 
47 {
48 
49  CInputData=InData;
50  phaseSpaceCentre=new G4UIcmdWith3VectorAndUnit("/general/centrePhaseSpace", this);
51  phaseSpaceCentre->SetDefaultUnit("mm");
52  phaseSpaceCentre->SetDefaultValue(G4ThreeVector(0.,0.,164.));
53  phaseSpaceCentre->SetGuidance("position of the centre of the plane phase space");
54  CInputData->setPhaseSpaceCentre(G4ThreeVector(0.*mm,0.*mm,164.*mm));
55 
56  phaseSpaceHalfSize=new G4UIcmdWith3VectorAndUnit("/general/halfSizePhaseSpace", this);
57  phaseSpaceHalfSize->SetDefaultUnit("mm");
58  phaseSpaceHalfSize->SetDefaultValue(G4ThreeVector(100.,100.,1.));
59  phaseSpaceHalfSize->SetGuidance("half size of the plane phase space");
60  CInputData->setPhaseSpaceHalfSize(G4ThreeVector(100.*mm,100.*mm,1.*mm));
61 
62  bSavePhaseSpace=new G4UIcmdWithABool("/general/bSavePhaseSpace",this);
63  bSavePhaseSpace->SetDefaultValue(false);
64  bSavePhaseSpace->SetGuidance("true if to save the phase space");
65  CInputData->setbSavePhaseSPace(false);
66 
67  bForcePhaseSpaceBeforeJaws=new G4UIcmdWithABool("/general/bForcePhaseSpaceBeforeJaws",this);
68  bForcePhaseSpaceBeforeJaws->SetDefaultValue(false);
69  bForcePhaseSpaceBeforeJaws->SetGuidance("to automatically put the phase plane before the jaws");
70  CInputData->setbForcePhaseSpaceBeforeJaws(false);
71 
72  bStopAtPhaseSpace=new G4UIcmdWithABool("/general/bStopAtPhaseSpace",this);
73  bStopAtPhaseSpace->SetDefaultValue(false);
74  bStopAtPhaseSpace->SetGuidance("true if to kill the particle at the phase space");
75  CInputData->setbStopAtPhaseSpace(false);
76 
77  bSaveROG=new G4UIcmdWithABool("/general/bSaveROG",this);
78  bSaveROG->SetDefaultValue(true);
79  bSaveROG->SetGuidance("true if save the ROG volume");
80  CInputData->setbSaveROG(true);
81 
82  bOnlyVisio=new G4UIcmdWithABool("/OnlyVisio",this);
83  bOnlyVisio->SetDefaultValue(false);
84  bOnlyVisio->SetGuidance("switch the visualization mode");
85  CInputData->setbOnlyVisio(false);
86 
87  ROGOutFile=new G4UIcmdWithAString("/general/ROGOutFile",this);
88  ROGOutFile->SetDefaultValue("");
89  ROGOutFile->SetGuidance("full path of the ROG file name");
90  CInputData->setROGOutFile("defaultROGFile.txt");
91 
92  phaseSPaceOutFile=new G4UIcmdWithAString("/general/PhaseSpaceOutFile",this);
93  phaseSPaceOutFile->SetDefaultValue("");
94  phaseSPaceOutFile->SetGuidance("full file name of the phase space");
95  CInputData->setPhaseSpaceOutFile("");
96 
97  maxNumberOfEvents=new G4UIcmdWithAnInteger("/convergence/maxNumberOfEvents", this);
98  maxNumberOfEvents->SetDefaultValue(10);
99  maxNumberOfEvents->SetGuidance(" maximum number of events at least in one experimental voxel");
100  CInputData->setMaxNumberOfEvents(10);
101 
102  nMaxLoop=new G4UIcmdWithAnInteger("/convergence/nMaxLoop", this);
103  nMaxLoop->SetDefaultValue(1);
104  nMaxLoop->SetGuidance("it is used if /convergence/bCompareExp is false");
105  CInputData->setNmaxLoop(1);
106 
107  bCompareExp=new G4UIcmdWithABool("/convergence/bCompareExp",this);
108  bCompareExp->SetDefaultValue(false);
109  bCompareExp->SetGuidance("to compare the data with an experimental file data");
110  CInputData->setBCompareExp(false);
111 
112  fileExperimentalData=new G4UIcmdWithAString("/convergence/fileExperimentalData",this);
113  fileExperimentalData->SetDefaultValue("");
114  fileExperimentalData->SetGuidance("full path and name of the experimental file results");
115  CInputData->setFileExperimentalData("");
116 
117  fileExperimentalDataOut=new G4UIcmdWithAString("/convergence/fileExperimentalDataOut",this);
118  fileExperimentalDataOut->SetDefaultValue("");
119  fileExperimentalDataOut->SetGuidance("full path and name of the experimental file results");
120  CInputData->setFileExperimentalDataOut("");
121 
122  nBeam=new G4UIcmdWithAnInteger("/general/nBeam",this);
123  nBeam->SetDefaultValue(100);
124  nBeam->SetGuidance("number of events to run");
125  CInputData->setNBeams(100);
126 
127  nMaxParticlesInRamPlanePhaseSpace=new G4UIcmdWithAnInteger("/general/nMaxParticlesInRamPlanePhaseSpace",this);
128  nMaxParticlesInRamPlanePhaseSpace->SetDefaultValue(10000);
129  nMaxParticlesInRamPlanePhaseSpace->SetGuidance("maximum particle number stored in RAM before saving - for phase space");
130  CInputData->setNMaxParticlesInRamPlanePhaseSpace(10000);
131 
132  saving_in_Selected_Voxels_every_events=new G4UIcmdWithAnInteger("/general/saving_in_Selected_Voxels_every_events",this);
133  saving_in_Selected_Voxels_every_events->SetDefaultValue(10000);
134  saving_in_Selected_Voxels_every_events->SetGuidance("maximum particle number stored before saving - for experiemntal data comparison");
136 
137  saving_in_ROG_Voxels_every_events=new G4UIcmdWithAnInteger("/general/saving_in_ROG_Voxels_every_events",this);
138  saving_in_ROG_Voxels_every_events->SetDefaultValue(1000);
139  saving_in_ROG_Voxels_every_events->SetGuidance("maximum particle number stored before saving - for ROG");
140  CInputData->setSaving_in_ROG_Voxels_every_events(1000);
141 
142  max_N_particles_in_PhSp_File=new G4UIcmdWithAnInteger("/general/max_N_particles_in_PhSp_File",this);
143  max_N_particles_in_PhSp_File->SetDefaultValue(1000);
144  max_N_particles_in_PhSp_File->SetGuidance("maximum particle number stored in the phase space file");
145  CInputData->setMax_N_particles_in_PhSp_File(1000);
146 }
147 
149 {
150  delete saving_in_Selected_Voxels_every_events;
151  delete saving_in_ROG_Voxels_every_events;
152  delete max_N_particles_in_PhSp_File;
153  delete phaseSpaceCentre;
154  delete phaseSpaceHalfSize;
155  delete phaseSPaceOutFile;
156  delete ROGOutFile;
157  delete bSavePhaseSpace;
158  delete bForcePhaseSpaceBeforeJaws;
159  delete bStopAtPhaseSpace;
160  delete bSaveROG;
161 
162  delete nBeam;
163  delete nMaxParticlesInRamPlanePhaseSpace;
164 
165  delete maxNumberOfEvents;
166  delete bCompareExp;
167  delete bOnlyVisio;
168  delete fileExperimentalData;
169  delete fileExperimentalDataOut;
170  delete nMaxLoop;
171 }
172 
174 {
175  if (cmd==nBeam)
176  {CInputData->setNBeams(nBeam->GetNewIntValue(newValue));}
177 
178  if (cmd==nMaxParticlesInRamPlanePhaseSpace)
179  {CInputData->setNMaxParticlesInRamPlanePhaseSpace(nMaxParticlesInRamPlanePhaseSpace->GetNewIntValue(newValue));}
180 
181  if (cmd==saving_in_Selected_Voxels_every_events)
182  {CInputData->setSaving_in_Selected_Voxels_every_events(saving_in_Selected_Voxels_every_events->GetNewIntValue(newValue));}
183 
184  if (cmd==saving_in_ROG_Voxels_every_events)
185  {CInputData->setSaving_in_ROG_Voxels_every_events(saving_in_ROG_Voxels_every_events->GetNewIntValue(newValue));}
186 
187  if (cmd==max_N_particles_in_PhSp_File)
188  {CInputData->setMax_N_particles_in_PhSp_File(max_N_particles_in_PhSp_File->GetNewIntValue(newValue));}
189 
190  if (cmd==phaseSpaceCentre)
191  {CInputData->setPhaseSpaceCentre(phaseSpaceCentre->GetNew3VectorRawValue(newValue));}
192 
193  if (cmd==phaseSpaceHalfSize)
194  {
195  CInputData->setPhaseSpaceHalfSize(phaseSpaceHalfSize->GetNew3VectorRawValue(newValue));
196  }
197 
198  if (cmd==bOnlyVisio)
199  {CInputData->setbOnlyVisio(bOnlyVisio->GetNewBoolValue(newValue));}
200 
201  if (cmd==bForcePhaseSpaceBeforeJaws)
202  {CInputData->setbForcePhaseSpaceBeforeJaws(bForcePhaseSpaceBeforeJaws->GetNewBoolValue(newValue));}
203 
204  if (cmd==bSavePhaseSpace)
205  {CInputData->setbSavePhaseSPace(bSavePhaseSpace->GetNewBoolValue(newValue));}
206 
207  if (cmd==bSaveROG)
208  {CInputData->setbSaveROG(bSaveROG->GetNewBoolValue(newValue));}
209 
210  if (cmd==bStopAtPhaseSpace)
211  {CInputData->setbStopAtPhaseSpace(bStopAtPhaseSpace->GetNewBoolValue(newValue));}
212 
213  if (cmd==phaseSPaceOutFile)
214  {CInputData->setPhaseSpaceOutFile(newValue);}
215 
216  if (cmd==ROGOutFile)
217  {CInputData->setROGOutFile(newValue);}
218 
219  if (cmd==maxNumberOfEvents)
220  {CInputData->setMaxNumberOfEvents(maxNumberOfEvents->GetNewIntValue(newValue));}
221 
222  if (cmd==nMaxLoop)
223  {CInputData->setNmaxLoop(nMaxLoop->GetNewIntValue(newValue));}
224 
225  if (cmd==bCompareExp)
226  {CInputData->setBCompareExp(bCompareExp->GetNewBoolValue(newValue));}
227 
228  if (cmd==fileExperimentalData)
229  {CInputData->setFileExperimentalData(newValue);}
230 
231  if (cmd==fileExperimentalDataOut)
232  {CInputData->setFileExperimentalDataOut(newValue);}
233 }
void setNMaxParticlesInRamPlanePhaseSpace(G4int val)
static constexpr double mm
Definition: G4SIunits.hh:115
void setPhaseSpaceCentre(G4ThreeVector val)
void setSaving_in_ROG_Voxels_every_events(G4int val)
CLHEP::Hep3Vector G4ThreeVector
static G4int GetNewIntValue(const char *paramString)
void SetDefaultUnit(const char *defUnit)
void setbForcePhaseSpaceBeforeJaws(G4bool val)
void setFileExperimentalDataOut(G4String val)
void setMaxNumberOfEvents(G4int val)
static G4bool GetNewBoolValue(const char *paramString)
void setbStopAtPhaseSpace(G4bool val)
void SetDefaultValue(G4bool defVal)
void setFileExperimentalData(G4String val)
void setbSaveROG(G4bool val)
void setPhaseSpaceHalfSize(G4ThreeVector val)
void setMax_N_particles_in_PhSp_File(G4int val)
void setBCompareExp(G4bool val)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
CML2MainMessenger(CML2CInputData *CInputData)
void setNBeams(G4int val)
void setROGOutFile(G4String val)
void SetDefaultValue(G4ThreeVector defVal)
void SetNewValue(G4UIcommand *cmd, G4String newValue)
void setPhaseSpaceOutFile(G4String val)
void SetDefaultValue(const char *defVal)
void setbSavePhaseSPace(G4bool val)
void setNmaxLoop(G4int val)
void SetDefaultValue(G4int defVal)
void setSaving_in_Selected_Voxels_every_events(G4int val)
static G4ThreeVector GetNew3VectorRawValue(const char *paramString)
void setbOnlyVisio(G4bool val)