Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrackingMessenger.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 //
28 //
29 // $Id: TrackingMessenger.cc 98257 2016-07-04 17:39:46Z gcosmo $
30 //
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 
34 #include "TrackingMessenger.hh"
35 #include "TrackingAction.hh"
36 
37 #include "G4UIcmdWithABool.hh"
38 #include "G4UIcommand.hh"
39 #include "G4UIparameter.hh"
40 
41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
42 
44 :G4UImessenger(),
45  fTrackingAction(trackA),fTrackingCmd(0),fTimeWindowCmd(0)
46 {
47  fTrackingCmd = new G4UIcmdWithABool("/rdecay01/fullChain",this);
48  fTrackingCmd->SetGuidance("allow full decay chain");
49  fTrackingCmd->SetParameterName("flag",true);
50  fTrackingCmd->SetDefaultValue(true);
51 
52  fTimeWindowCmd = new G4UIcommand("/rdecay01/timeWindow",this);
53  fTimeWindowCmd->SetGuidance("set time window to survey activity per nuclide");
54  fTimeWindowCmd->SetGuidance(" t1, delta_t");
55  //
56  G4UIparameter* t1Prm = new G4UIparameter("t1",'d',false);
57  t1Prm->SetGuidance("time_1");
58  t1Prm->SetParameterRange("t1>0.");
59  fTimeWindowCmd->SetParameter(t1Prm);
60  //
61  G4UIparameter* unit1Prm = new G4UIparameter("unit1",'s',false);
62  unit1Prm->SetGuidance("unit of t1");
64  unit1Prm->SetParameterCandidates(unitList);
65  fTimeWindowCmd->SetParameter(unit1Prm);
66  //
67  G4UIparameter* dtPrm = new G4UIparameter("dt",'d',false);
68  dtPrm->SetGuidance("delta_t");
69  dtPrm->SetParameterRange("dt>0.");
70  fTimeWindowCmd->SetParameter(dtPrm);
71  //
72  G4UIparameter* unit2Prm = new G4UIparameter("unit2",'s',false);
73  unit2Prm->SetGuidance("unit of dt");
74  unit2Prm->SetParameterCandidates(unitList);
75  fTimeWindowCmd->SetParameter(unit2Prm);
76  //
78 }
79 
80 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
81 
83 {
84  delete fTrackingCmd;
85  delete fTimeWindowCmd;
86 }
87 
88 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
89 
91 {
92  if (command == fTrackingCmd)
93  { fTrackingAction->SetFullChain(fTrackingCmd->GetNewBoolValue(newValue));}
94 
95  if (command == fTimeWindowCmd)
96  {
97  G4double t1; G4double dt;
98  G4String unt1, unt2;
99  std::istringstream is(newValue);
100  is >> t1 >> unt1 >> dt >> unt2;
101  t1 *= G4UIcommand::ValueOf(unt1);
102  dt *= G4UIcommand::ValueOf(unt2);
103  fTrackingAction->SetTimeWindow (t1, dt);
104  }
105 }
106 
107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:152
Definition of the TrackingMessenger class.
void SetParameterRange(const char *theRange)
void SetParameterCandidates(const char *theString)
static G4bool GetNewBoolValue(const char *paramString)
void SetDefaultValue(G4bool defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetFullChain(G4bool flag)
static G4String UnitsList(const char *unitCategory)
Definition: G4UIcommand.cc:321
void SetTimeWindow(G4double, G4double)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:240
virtual void SetNewValue(G4UIcommand *, G4String)
static G4double ValueOf(const char *unitName)
Definition: G4UIcommand.cc:309
tuple t1
Definition: plottest35.py:33
double G4double
Definition: G4Types.hh:76
void SetGuidance(const char *theGuidance)
static G4String CategoryOf(const char *unitName)
Definition: G4UIcommand.cc:316
TrackingMessenger(TrackingAction *)