Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HistoManagerMessenger.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 //
30 // $Id: HistoManagerMessenger.cc 70747 2013-06-05 11:56:02Z ihrivnac $
31 //
32 //
34 //
35 // HistoManagerMessenger
36 //
37 // Created: 20.06.08 V.Ivanchenko
38 //
39 // Modified:
40 //
42 //
43 
44 #include "HistoManagerMessenger.hh"
45 
46 #include "HistoManager.hh"
47 #include "G4UIdirectory.hh"
48 #include "G4UIcmdWithABool.hh"
49 #include "G4UIcmdWithAString.hh"
50 #include "G4UIcmdWithAnInteger.hh"
51 #include "G4UIcmdWith3Vector.hh"
54 #include "HistoManager.hh"
55 
56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
57 
59 :G4UImessenger(), fHisto(p)
60 {
61  fbinCmd = new G4UIcmdWithAnInteger("/testhadr/nBinsE",this);
62  fbinCmd->SetGuidance("Set number of bins for energy");
63  fbinCmd->SetParameterName("NEbins",false);
65 
66  fnOfAbsCmd = new G4UIcmdWithAnInteger("/testhadr/nBinsP",this);
67  fnOfAbsCmd->SetGuidance("Set number of bins for momentum");
68  fnOfAbsCmd->SetParameterName("NPbins",false);
70 
71  fpartCmd = new G4UIcmdWithAString("/testhadr/particle",this);
72  fpartCmd->SetGuidance("Set particle name");
73  fpartCmd->SetParameterName("Particle",false);
75 
76  fcsCmd = new G4UIcmdWithAString("/testhadr/targetElm",this);
77  fcsCmd->SetGuidance("Set element name");
78  fcsCmd->SetParameterName("Elm",false);
80 
81  fe1Cmd = new G4UIcmdWithADoubleAndUnit("/testhadr/minEnergy",this);
82  fe1Cmd->SetGuidance("Set min kinetic energy");
83  fe1Cmd->SetParameterName("eMin",false);
84  fe1Cmd->SetUnitCategory("Energy");
86 
87  fe2Cmd = new G4UIcmdWithADoubleAndUnit("/testhadr/maxEnergy",this);
88  fe2Cmd->SetGuidance("Set max kinetic energy");
89  fe2Cmd->SetParameterName("eMax",false);
90  fe2Cmd->SetUnitCategory("Energy");
92 
93  fp1Cmd = new G4UIcmdWithADoubleAndUnit("/testhadr/minMomentum",this);
94  fp1Cmd->SetGuidance("Set min momentum");
95  fp1Cmd->SetParameterName("pMin",false);
96  fp1Cmd->SetUnitCategory("Energy");
98 
99  fp2Cmd = new G4UIcmdWithADoubleAndUnit("/testhadr/maxMomentum",this);
100  fp2Cmd->SetGuidance("Set max momentum");
101  fp2Cmd->SetParameterName("pMax",false);
102  fp2Cmd->SetUnitCategory("Energy");
104 
105  fverbCmd = new G4UIcmdWithAnInteger("/testhadr/verbose",this);
106  fverbCmd->SetGuidance("Set verbose for ");
107  fverbCmd->SetParameterName("verb",false);
109 
110  fFCmd = new G4UIcmdWithAString("/testhadr/fileName",this);
111  fFCmd->SetGuidance("set name for the histograms file");
112 }
113 
114 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
115 
117 {
118  delete fnOfAbsCmd;
119  delete fpartCmd;
120  delete fcsCmd;
121  delete fe1Cmd;
122  delete fe2Cmd;
123  delete fp1Cmd;
124  delete fp2Cmd;
125  delete fverbCmd;
126  delete fFCmd;
127 }
128 
129 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
130 
132 {
133  if( command == fbinCmd ) {
134  fHisto->SetNumberOfBinsE(fbinCmd->GetNewIntValue(newValue));
135  } else if( command == fnOfAbsCmd ) {
136  fHisto->SetNumberOfBinsP(fnOfAbsCmd->GetNewIntValue(newValue));
137  } else if( command == fverbCmd ) {
138  fHisto->SetVerbose(fverbCmd->GetNewIntValue(newValue));
139  } else if( command == fpartCmd ) {
140  fHisto->SetParticleName(newValue);
141  } else if( command == fcsCmd ) {
142  fHisto->SetElementName(newValue);
143  } else if( command == fe1Cmd ) {
144  fHisto->SetMinKinEnergy(fe1Cmd->GetNewDoubleValue(newValue));
145  } else if( command == fe2Cmd ) {
146  fHisto->SetMaxKinEnergy(fe2Cmd->GetNewDoubleValue(newValue));
147  } else if( command == fp1Cmd ) {
148  fHisto->SetMinMomentum(fp1Cmd->GetNewDoubleValue(newValue));
149  } else if( command == fp2Cmd ) {
150  fHisto->SetMaxMomentum(fp2Cmd->GetNewDoubleValue(newValue));
151  } else if( command == fFCmd ) {
152  fHisto->SetHistoName(newValue);
153  }
154 }
155 
156 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
157 
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static G4int GetNewIntValue(const char *paramString)
const char * p
Definition: xmltok.h:285
void SetMinMomentum(G4double val)
void SetNumberOfBinsE(G4int val)
void SetUnitCategory(const char *unitCategory)
static G4double GetNewDoubleValue(const char *paramString)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void SetMaxMomentum(G4double val)
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:240
void SetMaxKinEnergy(G4double val)
void SetMinKinEnergy(G4double val)
void SetElementName(const G4String &)
virtual void SetNewValue(G4UIcommand *, G4String)
void SetVerbose(G4int val)
Definition: HistoManager.hh:95
void SetHistoName(G4String &val)
void SetParticleName(const G4String &)
HistoManagerMessenger(HistoManager *)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetNumberOfBinsP(G4int val)