source: trunk/examples/advanced/xray_fluorescence/src/XrayFluoPlanePrimaryGeneratorMessenger.cc@ 1158

Last change on this file since 1158 was 807, checked in by garnier, 17 years ago

update

File size: 5.0 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: XrayFluoPlanePrimarygeneratorMessenger.cc
28// GEANT4 tag $Name:
29//
30// Author: Alfonso Mantero (Alfonso.mantero@ge.infn.it)
31//
32// History:
33// -----------
34// 02 Sep 2003 Alfonso Mantero created
35//
36// -------------------------------------------------------------------
37
38#include "XrayFluoPlanePrimaryGeneratorMessenger.hh"
39#include "XrayFluoPlanePrimaryGeneratorAction.hh"
40#include "G4UIcmdWithAString.hh"
41
42//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
43
44XrayFluoPlanePrimaryGeneratorMessenger::XrayFluoPlanePrimaryGeneratorMessenger(XrayFluoPlanePrimaryGeneratorAction* XrayFluoGun)
45:XrayFluoAction(XrayFluoGun)
46{
47 RndmCmd = new G4UIcmdWithAString("/gun/random",this);
48 RndmCmd->SetGuidance("Shoot particles from a point-like source at infinity, witth an incidence angle with the plane of 45 deg");
49 RndmCmd->SetGuidance(" Choice : on(default), off");
50 RndmCmd->SetParameterName("choice",true);
51 RndmCmd->SetDefaultValue("on");
52 RndmCmd->SetCandidates("on off");
53 RndmCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
54
55 RndmVert = new G4UIcmdWithAString("/gun/beam",this);
56 RndmVert->SetGuidance("Creates a round beam of particles of 0.5mm in diameter.");
57 RndmVert->SetGuidance(" Choice : on(default), off");
58 RndmVert->SetParameterName("choice",true);
59 RndmVert->SetDefaultValue("on");
60 RndmVert->SetCandidates("on off");
61 RndmVert->AvailableForStates(G4State_PreInit,G4State_Idle);
62
63 spectrum = new G4UIcmdWithAString("/gun/spectrum",this);
64 spectrum->SetGuidance("Shoot the incident particle with a certain energy spectrum.");
65 spectrum->SetGuidance(" Choice : on(default), off");
66 spectrum->SetParameterName("choice",true);
67 spectrum->SetDefaultValue("on");
68 spectrum->SetCandidates("on off");
69 spectrum->AvailableForStates(G4State_PreInit,G4State_Idle);
70
71 isoVert = new G4UIcmdWithAString("/gun/isoVert",this);
72 isoVert->SetGuidance("Shoot the incident particle from an isotropic direction.");
73 isoVert->SetGuidance(" Choice : on(default), off");
74 isoVert->SetParameterName("choice",true);
75 isoVert->SetDefaultValue("on");
76 isoVert->SetCandidates("on off");
77 isoVert->AvailableForStates(G4State_PreInit,G4State_Idle);
78
79 G4cout << "XrayFluoPlanePrimaryGeneratorMessenger created" << G4endl;
80
81}
82
83//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
84
85XrayFluoPlanePrimaryGeneratorMessenger::~XrayFluoPlanePrimaryGeneratorMessenger()
86{
87 delete RndmCmd;
88 delete RndmVert;
89 delete spectrum;
90 delete isoVert;
91
92 G4cout << "XrayFluoPlanePrimaryGeneratorMessenger deleted" << G4endl;
93
94}
95
96//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
97
98void XrayFluoPlanePrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
99{
100 if( command == RndmCmd )
101 {
102 XrayFluoAction->SetRndmFlag(newValue);
103 XrayFluoAction->SetRndmVert("off");
104 XrayFluoAction->SetIsoVert("off");
105 }
106
107 if( command == RndmVert )
108 {
109 XrayFluoAction->SetRndmVert(newValue);
110 XrayFluoAction->SetIsoVert("off");
111 XrayFluoAction->SetRndmFlag("off");
112 }
113 if( command == spectrum )
114 { XrayFluoAction->SetSpectrum(newValue);}
115
116 if( command == isoVert )
117 {
118 XrayFluoAction->SetIsoVert(newValue);
119 XrayFluoAction->SetRndmFlag("off");
120 XrayFluoAction->SetRndmVert("off");
121 }
122}
123
124//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
125
Note: See TracBrowser for help on using the repository browser.