ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ML2MainMessenger.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ML2MainMessenger.cc
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 
44 #include "ML2MainMessenger.hh"
45 
46 #include "G4ios.hh"
47 #include "G4SystemOfUnits.hh"
48 
50 {
51  CInputData = InData;
52  phaseSpaceCentre = new G4UIcmdWith3VectorAndUnit("/general/centrePhaseSpace", this);
53  phaseSpaceCentre -> SetDefaultUnit("mm");
54  phaseSpaceCentre -> SetDefaultValue(G4ThreeVector(0.,0.,164.));
55  phaseSpaceCentre -> SetGuidance("position of the centre of the phase space plane");
56  CInputData -> setPhaseSpaceCentre(G4ThreeVector(0.*mm,0.*mm,164.*mm));
57 
58  phaseSpaceHalfSize = new G4UIcmdWith3VectorAndUnit("/general/halfSizePhaseSpace", this);
59  phaseSpaceHalfSize -> SetDefaultUnit("mm");
60  phaseSpaceHalfSize -> SetDefaultValue(G4ThreeVector(100.,100.,1.));
61  phaseSpaceHalfSize -> SetGuidance("half size of the phase space plane");
62  CInputData -> setPhaseSpaceHalfSize(G4ThreeVector(100.*mm,100.*mm,1.*mm));
63 
64  bSavePhaseSpace = new G4UIcmdWithABool("/general/bSavePhaseSpace",this);
65  bSavePhaseSpace -> SetDefaultValue(false);
66  bSavePhaseSpace -> SetGuidance("save the phase space");
67  CInputData -> setbSavePhaseSPace(false);
68 
69  bForcePhaseSpaceBeforeJaws = new G4UIcmdWithABool("/general/bForcePhaseSpaceBeforeJaws",this);
70  bForcePhaseSpaceBeforeJaws -> SetDefaultValue(false);
71  bForcePhaseSpaceBeforeJaws -> SetGuidance("automatically put the phase plane before the jaws");
72  CInputData -> setbForcePhaseSpaceBeforeJaws(false);
73 
74  bStopAtPhaseSpace = new G4UIcmdWithABool("/general/bStopAtPhaseSpace",this);
75  bStopAtPhaseSpace -> SetDefaultValue(false);
76  bStopAtPhaseSpace -> SetGuidance("kill the particle at the phase space");
77  CInputData-> setbStopAtPhaseSpace(false);
78 
79  bSaveROG = new G4UIcmdWithABool("/general/bSaveROG",this);
80  bSaveROG -> SetDefaultValue(true);
81  bSaveROG -> SetGuidance("save the ROG volume");
82  CInputData -> setbSaveROG(true);
83 
84  bOnlyVisio = new G4UIcmdWithABool("/OnlyVisio",this);
85  bOnlyVisio -> SetDefaultValue(false);
86  bOnlyVisio -> SetGuidance("switch the visualization mode");
87  CInputData -> setbOnlyVisio(false);
88 
89  ROGOutFile = new G4UIcmdWithAString("/general/ROGOutFile",this);
90  ROGOutFile -> SetDefaultValue("");
91  ROGOutFile -> SetGuidance("full path and name of the ROG file");
92  CInputData -> setROGOutFile("defaultROGFile.txt");
93 
94  phaseSPaceOutFile = new G4UIcmdWithAString("/general/PhaseSpaceOutFile",this);
95  phaseSPaceOutFile -> SetDefaultValue("");
96  phaseSPaceOutFile -> SetGuidance("full path and name of the phase space file");
97  CInputData -> setPhaseSpaceOutFile("");
98 
99  maxNumberOfEvents=new G4UIcmdWithAnInteger("/convergence/maxNumberOfEvents", this);
101  maxNumberOfEvents->SetGuidance("number of events to be reached in one experimental voxel");
103 
104  nMaxLoop = new G4UIcmdWithAnInteger("/convergence/nMaxLoop", this);
105  nMaxLoop -> SetDefaultValue(1);
106  nMaxLoop -> SetGuidance("used if /convergence/bCompareExp is false");
107  CInputData -> setNmaxLoop(1);
108 
109  bCompareExp = new G4UIcmdWithABool("/convergence/bCompareExp", this);
110  bCompareExp -> SetDefaultValue(false);
111  bCompareExp -> SetGuidance("compare the data with an experimental data file");
112  CInputData -> setBCompareExp(false);
113 
114  fileExperimentalData = new G4UIcmdWithAString("/convergence/fileExperimentalData", this);
115  fileExperimentalData -> SetDefaultValue("");
116  fileExperimentalData -> SetGuidance("full path and name of the experimental data file");
117  CInputData -> setFileExperimentalData("");
118 
119  fileExperimentalDataOut = new G4UIcmdWithAString("/convergence/fileExperimentalDataOut", this);
120  fileExperimentalDataOut -> SetDefaultValue("");
121  fileExperimentalDataOut -> SetGuidance("full path and name of the experimental data out file");
122  CInputData -> setFileExperimentalDataOut("");
123 
124  nBeam = new G4UIcmdWithAnInteger("/general/nBeam", this);
125  nBeam -> SetDefaultValue(100);
126  nBeam -> SetGuidance("number of events to run");
127  CInputData -> setNBeams(100);
128 
129  nMaxParticlesInRamPlanePhaseSpace = new G4UIcmdWithAnInteger("/general/nMaxParticlesInRamPlanePhaseSpace",this);
130  nMaxParticlesInRamPlanePhaseSpace -> SetDefaultValue(10000);
131  nMaxParticlesInRamPlanePhaseSpace -> SetGuidance("maximum number of particles stored in RAM before saving phase space file");
132  CInputData -> setNMaxParticlesInRamPlanePhaseSpace(10000);
133 
134  saving_in_Selected_Voxels_every_events = new G4UIcmdWithAnInteger("/general/saving_in_Selected_Voxels_every_events",this);
135  saving_in_Selected_Voxels_every_events -> SetDefaultValue(10000);
136  saving_in_Selected_Voxels_every_events -> SetGuidance("maximum number of particles stored before saving experimental data out file");
137  CInputData -> setSaving_in_Selected_Voxels_every_events(10000);
138 
139  saving_in_ROG_Voxels_every_events = new G4UIcmdWithAnInteger("/general/saving_in_ROG_Voxels_every_events",this);
140  saving_in_ROG_Voxels_every_events -> SetDefaultValue(1000);
141  saving_in_ROG_Voxels_every_events -> SetGuidance("maximum number of particles stored before saving ROG file");
142  CInputData -> setSaving_in_ROG_Voxels_every_events(1000);
143 
144  max_N_particles_in_PhSp_File = new G4UIcmdWithAnInteger("/general/max_N_particles_in_PhSp_File",this);
145  max_N_particles_in_PhSp_File -> SetDefaultValue(1000);
146  max_N_particles_in_PhSp_File -> SetGuidance("maximum number of particles stored in the phase space file");
147  CInputData -> setMax_N_particles_in_PhSp_File(1000);
148 
149  // SUSANNA: command to fix the number of voxels in the phantom segmentation
150  fVoxelsXCmd = new G4UIcmdWithAnInteger("/general/numberVoxelsX",this);
151  fVoxelsXCmd -> SetDefaultValue(30);
152  fVoxelsXCmd -> SetGuidance("number of voxels along X axis");
153  CInputData->setVoxelsX(30);
154 
155  fVoxelsYCmd = new G4UIcmdWithAnInteger("/general/numberVoxelsY",this);
156  fVoxelsYCmd -> SetDefaultValue(30);
157  fVoxelsYCmd -> SetGuidance("number of voxels along Y axis");
158  CInputData->setVoxelsY(30);
159 
160  fVoxelsZCmd = new G4UIcmdWithAnInteger("/general/numberVoxelsZ",this);
161  fVoxelsZCmd -> SetDefaultValue(30);
162  fVoxelsZCmd -> SetGuidance("number of voxels along Z axis");
163  CInputData->setVoxelsZ(30);
164 
165 }
166 
168 {
169  delete fVoxelsXCmd;
170  delete fVoxelsYCmd;
171  delete fVoxelsZCmd;
175  delete phaseSpaceCentre;
176  delete phaseSpaceHalfSize;
177  delete phaseSPaceOutFile;
178  delete ROGOutFile;
179  delete bSavePhaseSpace;
181  delete bStopAtPhaseSpace;
182  delete bSaveROG;
183 
184  delete nBeam;
186 
187  delete maxNumberOfEvents;
188  delete bCompareExp;
189  delete bOnlyVisio;
190  delete fileExperimentalData;
192  delete nMaxLoop;
193 }
194 
196 {
197  if (cmd==nBeam)
198  {CInputData->setNBeams(nBeam->GetNewIntValue(newValue));}
199 
202 
205 
208 
211 
212  if (cmd==phaseSpaceCentre)
214 
215  if (cmd==phaseSpaceHalfSize)
216  {
218  }
219 
220  if (cmd==bOnlyVisio)
222 
225 
226  if (cmd==bSavePhaseSpace)
228 
229  if (cmd==bSaveROG)
231 
232  if (cmd==bStopAtPhaseSpace)
234 
235  if (cmd==phaseSPaceOutFile)
236  {CInputData->setPhaseSpaceOutFile(newValue);}
237 
238  if (cmd==ROGOutFile)
239  {CInputData->setROGOutFile(newValue);}
240 
241  if (cmd==maxNumberOfEvents)
243 
244  if (cmd==nMaxLoop)
246 
247  if (cmd==bCompareExp)
249 
250  if (cmd==fileExperimentalData)
251  {CInputData->setFileExperimentalData(newValue);}
252 
253  if (cmd==fileExperimentalDataOut)
255 
256 
260 }