Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ML2PrimaryGenerationActionMessenger.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 
46 #include "G4UIcmdWithAString.hh"
47 #include "G4UIcmdWithAnInteger.hh"
49 
50 CML2PrimaryGenerationActionMessenger::CML2PrimaryGenerationActionMessenger(CML2PrimaryGenerationAction *PML2PrimaryGenerationAction) : pML2PrimaryGenerationAction(PML2PrimaryGenerationAction)
51 {
52  nRecycling=new G4UIcmdWithAnInteger("/primaryParticleData/nIdenticalParticles",this);
53  nRecycling->SetDefaultValue(1);
54  nRecycling->SetGuidance("number of identical particles generated in the primary generator");
55 
56  calculatedPhaseSpaceFileIN=new G4UIcmdWithAString("/primaryParticleData/calculatedPhaseSpaceFileIN",this);
57  calculatedPhaseSpaceFileIN->SetDefaultValue("");
58  calculatedPhaseSpaceFileIN->SetGuidance("full path and file name of the phase space file to be used as particle generator");
59 
60  sourceTypeName=new G4UIcmdWithAString("/primaryParticleData/sourceTypeName",this);
61  sourceTypeName->SetDefaultValue("");
62  sourceTypeName->SetGuidance("type of particle generator source (randomTarget, phaseSpace)");
63 
64  nMaxParticlesInRamPhaseSpace=new G4UIcmdWithAnInteger("/primaryParticleData/nMaxParticlesInRamPhaseSpace",this);
65  nMaxParticlesInRamPhaseSpace->SetDefaultValue(10000);
66  nMaxParticlesInRamPhaseSpace->SetGuidance("maximum particle number loaded from the phase space file each time");
67 
68  GunMeanEnegy=new G4UIcmdWithADoubleAndUnit("/primaryParticleData/GunMeanEnegy", this);
69  GunMeanEnegy->SetDefaultUnit("MeV");
70  GunMeanEnegy->SetDefaultValue(6.);
71  GunMeanEnegy->SetGuidance("mean energy of the primary particles");
72 
73  GunStdEnegy=new G4UIcmdWithADoubleAndUnit("/primaryParticleData/GunStdEnegy", this);
74  GunStdEnegy->SetDefaultUnit("MeV");
75  GunStdEnegy->SetDefaultValue(0.127);
76  GunStdEnegy->SetGuidance("std energy of the primary particles");
77 
78  GunRadious=new G4UIcmdWithADoubleAndUnit("/primaryParticleData/GunRadious", this);
79  GunRadious->SetDefaultUnit("mm");
80  GunRadious->SetDefaultValue(10.);
81  GunRadious->SetGuidance("radious primary particles beam");
82 }
83 
85 {
86  delete nRecycling;
87  delete nMaxParticlesInRamPhaseSpace;
88  delete GunMeanEnegy;
89  delete GunStdEnegy;
90  delete GunRadious;
91  delete calculatedPhaseSpaceFileIN;
92  delete sourceTypeName;
93 }
95 {
96  if (cmd==GunMeanEnegy)
97  {
98  GunMeanEnegy->GetNewUnitValue(newValue);
99  pML2PrimaryGenerationAction->setGunMeanEnergy(GunMeanEnegy->GetNewDoubleValue(newValue));
100  }
101 
102  if (cmd==GunStdEnegy)
103  {
104  GunStdEnegy->GetNewUnitValue(newValue);
105  pML2PrimaryGenerationAction->setGunStdEnergy(GunStdEnegy->GetNewDoubleValue(newValue));
106  }
107 
108  if (cmd==GunRadious)
109  {
110  GunRadious->GetNewUnitValue(newValue);
111  pML2PrimaryGenerationAction->setGunRadious(GunRadious->GetNewDoubleValue(newValue));
112  }
113 
114 
115  if (cmd==nMaxParticlesInRamPhaseSpace)
116  {
117  pML2PrimaryGenerationAction->setNMaxParticlesInRamPhaseSpace(nMaxParticlesInRamPhaseSpace->GetNewIntValue(newValue));
118  }
119 
120 
121  if (cmd==nRecycling)
122  {pML2PrimaryGenerationAction->setNRecycling(nRecycling->GetNewIntValue(newValue));}
123 
124  if (cmd==calculatedPhaseSpaceFileIN)
125  {pML2PrimaryGenerationAction->setCalculatedPhaseSpaceFileIN(newValue);}
126 
127  if (cmd==sourceTypeName)
128  {pML2PrimaryGenerationAction->setSourceTypeName(newValue);}
129 
130 
131 }
static G4int GetNewIntValue(const char *paramString)
static G4double GetNewDoubleValue(const char *paramString)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void SetNewValue(G4UIcommand *cmd, G4String newValue)
void setCalculatedPhaseSpaceFileIN(G4String val)
void SetDefaultValue(const char *defVal)
void SetDefaultUnit(const char *defUnit)
CML2PrimaryGenerationActionMessenger(CML2PrimaryGenerationAction *PML2PrimaryGenerationAction)
void SetDefaultValue(G4int defVal)
static G4double GetNewUnitValue(const char *paramString)