source: trunk/examples/advanced/gammaray_telescope/src/GammaRayTelPrimaryGeneratorMessenger.cc @ 1272

Last change on this file since 1272 was 1230, checked in by garnier, 14 years ago

update to geant4.9.3

File size: 5.6 KB
Line 
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//
27// $Id: GammaRayTelPrimaryGeneratorMessenger.cc,v 1.8 2006/06/29 15:57:01 gunter Exp $
28// GEANT4 tag $Name: geant4-09-03-cand-01 $
29// ------------------------------------------------------------
30//      GEANT 4 class implementation file
31//      CERN Geneva Switzerland
32//
33//
34//      ------------ GammaRayTelPrimaryGeneratorMessenger  ------
35//           by G.Santin, F.Longo & R.Giannitrapani (13 nov 2000)
36//
37// ************************************************************
38
39//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
40//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
41
42#include "GammaRayTelPrimaryGeneratorMessenger.hh"
43
44#include "GammaRayTelPrimaryGeneratorAction.hh"
45#include "G4UIcmdWithAnInteger.hh"
46#include "G4UIcmdWithAString.hh"
47#include "G4UIcmdWithADoubleAndUnit.hh"
48#include "G4UIcmdWithABool.hh"
49
50//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
51
52GammaRayTelPrimaryGeneratorMessenger::GammaRayTelPrimaryGeneratorMessenger
53(GammaRayTelPrimaryGeneratorAction* GammaRayTelGun)
54  :GammaRayTelAction(GammaRayTelGun)
55{ 
56  RndmCmd = new G4UIcmdWithAString("/gun/random",this);
57  RndmCmd->SetGuidance("Shoot randomly the incident particle.");
58  RndmCmd->SetGuidance("  Choice : on(default), off");
59  RndmCmd->SetParameterName("choice",true);
60  RndmCmd->SetDefaultValue("on");
61  RndmCmd->SetCandidates("on off");
62  RndmCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
63 
64  SourceTypeCmd = new G4UIcmdWithAnInteger("/gun/sourceType",this);
65  SourceTypeCmd->SetGuidance("Select the type of incident flux.");
66  SourceTypeCmd->SetGuidance("  Choice : 0(default), 1(isotropic), 2(wide parallel beam)");
67  SourceTypeCmd->SetParameterName("choice",true);
68  SourceTypeCmd->SetDefaultValue((G4int)0);
69  SourceTypeCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
70
71  VertexRadiusCmd = new G4UIcmdWithADoubleAndUnit("/gun/vertexRadius",this);
72  VertexRadiusCmd->SetGuidance("Radius (and unit) of sphere for vertices of incident flux.");
73  VertexRadiusCmd->SetParameterName("choice",true);
74  VertexRadiusCmd->SetDefaultValue((G4double)1.*cm);
75  VertexRadiusCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
76 
77  SpectrumTypeCmd = new G4UIcmdWithAnInteger("/gun/spectrumType",this);
78  SpectrumTypeCmd->SetGuidance("Select the type of incident spectrum.");
79  SpectrumTypeCmd->SetGuidance("  Choice : 0(default), 1(), 2(E^{-gamma}), 3()");
80  SpectrumTypeCmd->SetParameterName("choice",true);
81  SpectrumTypeCmd->SetDefaultValue((G4int)0);
82  SpectrumTypeCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
83
84
85  SourceGenCmd = new G4UIcmdWithABool("/gun/sourceGen",this);
86  SourceGenCmd->SetGuidance("Select the native Generation");
87  SourceGenCmd->SetGuidance("  Choice : true(native), false(GPS)");
88  SourceGenCmd->SetParameterName("choice",true);
89  SourceGenCmd->SetDefaultValue((G4bool)true);
90  SourceGenCmd->AvailableForStates(G4State_PreInit);
91
92}
93
94//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
95
96GammaRayTelPrimaryGeneratorMessenger::~GammaRayTelPrimaryGeneratorMessenger()
97{
98  delete RndmCmd;
99  delete SourceTypeCmd;
100  delete VertexRadiusCmd;
101  delete SpectrumTypeCmd;
102  delete SourceGenCmd;
103}
104
105//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
106
107void GammaRayTelPrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
108{ 
109  if( command == RndmCmd )
110    { GammaRayTelAction->SetRndmFlag(newValue);}
111 
112  if( command == SourceTypeCmd )
113    { GammaRayTelAction->SetSourceType(SourceTypeCmd->GetNewIntValue(newValue));}
114 
115  if( command == VertexRadiusCmd )
116    { GammaRayTelAction->SetVertexRadius(VertexRadiusCmd->GetNewDoubleValue(newValue));}
117 
118  if( command == SpectrumTypeCmd )
119    { GammaRayTelAction->SetSpectrumType(SpectrumTypeCmd->GetNewIntValue(newValue));}
120
121  if( command == SourceGenCmd )
122    { GammaRayTelAction->SetSourceGen(SourceGenCmd->GetNewBoolValue(newValue));}
123}
124
125//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
126
127
128
129
130
131
132
133
134
135
136
137
Note: See TracBrowser for help on using the repository browser.