source: trunk/examples/advanced/xray_fluorescence/src/XrayFluoPrimaryGeneratorMessenger.cc @ 1187

Last change on this file since 1187 was 807, checked in by garnier, 16 years ago

update

File size: 5.7 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: XrayFluoPrimarygeneratorMessenger.cc
28// GEANT4 tag $Name: xray_fluo-V03-02-00
29//
30// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
31//
32// History:
33// -----------
34// 28 Nov 2001 Elena Guardincerri     Created
35//
36// -------------------------------------------------------------------
37
38#include "XrayFluoPrimaryGeneratorMessenger.hh"
39#include "XrayFluoPrimaryGeneratorAction.hh"
40#include "G4UIcmdWithAString.hh"
41#include "G4UIcmdWithABool.hh"
42
43//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
44
45XrayFluoPrimaryGeneratorMessenger::XrayFluoPrimaryGeneratorMessenger(XrayFluoPrimaryGeneratorAction* XrayFluoGun)
46  :XrayFluoAction(XrayFluoGun)
47{ 
48  RndmCmd = new G4UIcmdWithAString("/gun/random",this);
49  RndmCmd->SetGuidance("Shoot randomly the incident particle.");
50  RndmCmd->SetGuidance("  Choice : on(default), off");
51  RndmCmd->SetParameterName("choice",true);
52  RndmCmd->SetDefaultValue("on");
53  RndmCmd->SetCandidates("on off");
54  RndmCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
55
56  RndmVert = new G4UIcmdWithAString("/gun/randomVert",this);
57  RndmVert->SetGuidance("Shoot randomly the incident particle.");
58  RndmVert->SetGuidance("  Choice : on(default), off");
59  RndmVert->SetParameterName("choice",true);
60  RndmVert->SetDefaultValue("on");
61  RndmVert->SetCandidates("on off");
62  RndmVert->AvailableForStates(G4State_PreInit,G4State_Idle);
63
64  spectrum = new G4UIcmdWithAString("/gun/spectrum",this);
65  spectrum->SetGuidance("Shoot the incident particle with a certain energy spectrum.");
66  spectrum->SetGuidance("  Choice : on(default), off");
67  spectrum->SetParameterName("choice",true);
68  spectrum->SetDefaultValue("on");
69  spectrum->SetCandidates("on off");
70  spectrum->AvailableForStates(G4State_PreInit,G4State_Idle);
71
72  isoVert = new G4UIcmdWithAString("/gun/isoVert",this);
73  isoVert->SetGuidance("Shoot the incident particle from an isotrofic direction.");
74  isoVert->SetGuidance("  Choice : on(default), off");
75  isoVert->SetParameterName("choice",true);
76  isoVert->SetDefaultValue("on");
77  isoVert->SetCandidates("on off");
78  isoVert->AvailableForStates(G4State_PreInit,G4State_Idle);
79
80  loadPahseSpace=new G4UIcmdWithAString("/gun/loadGunData",this);
81  loadPahseSpace->SetGuidance("Load emission from samples form previous runs");
82  loadPahseSpace->SetGuidance("Please enter the filename");
83  loadPahseSpace->SetParameterName("choice",true);
84  loadPahseSpace->AvailableForStates(G4State_Idle);
85
86  loadRayleighData=new G4UIcmdWithABool("/gun/loadRayleighFlag",this);
87  loadRayleighData->SetGuidance("Select if data form rayleigh scattering must be loaded");
88  loadRayleighData->SetGuidance("To be used before and togheter with /gun/loadGunData");
89  loadRayleighData->SetParameterName("Rayleigh Flag",true);
90  loadRayleighData->SetDefaultValue(true);
91  loadRayleighData->AvailableForStates(G4State_Idle);
92
93  G4cout << "XrayFluoPrimaryGeneratorMessenger created" << G4endl;
94
95}
96
97//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
98
99XrayFluoPrimaryGeneratorMessenger::~XrayFluoPrimaryGeneratorMessenger()
100{
101  delete RndmCmd;
102  delete  RndmVert;
103  delete spectrum;
104  delete isoVert;
105  delete loadPahseSpace;
106  delete loadRayleighData;
107  G4cout << "XrayFluoPrimaryGeneratorMessenger deleted" << G4endl;
108
109}
110
111//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
112
113void XrayFluoPrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
114{ 
115  if( command == RndmCmd )
116   { XrayFluoAction->SetRndmFlag(newValue);}
117 if( command == RndmVert )
118   { XrayFluoAction->SetRndmVert(newValue);}
119 if( command == spectrum )
120   { XrayFluoAction->SetSpectrum(newValue);} 
121 if( command == isoVert )
122   { XrayFluoAction->SetIsoVert(newValue);}
123 if( command == loadPahseSpace )
124   { XrayFluoAction->ActivatePhaseSpace(newValue);}
125 if( command == loadRayleighData )
126   { 
127     G4cout << "newValue: " << newValue << G4endl;
128
129     G4bool newRayFlag = loadRayleighData->GetNewBoolValue(newValue);
130     XrayFluoAction->SetRayleighFlag(newRayFlag);
131   }
132}
133
134//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
135
Note: See TracBrowser for help on using the repository browser.