GGS(GenericGEANT4Simulation)Software  2.99.0
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Macros
GGSHadrIntMessenger.cpp
Go to the documentation of this file.
1 /*
2  * GGSHadrIntMessenger.cpp
3  *
4  * Created on: 08 Jun 2011
5  * Author: Nicola Mori
6  */
7 
10 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
11 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
14 
15 #include "G4UIcmdWithABool.hh"
16 #include "G4UIcmdWithADouble.hh"
17 #include "G4UIcmdWithAString.hh"
18 
19 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
20 
22 
23  _cmdDir = new G4UIdirectory("/GGS/userActions/hadrIntAction/");
24  _cmdDir->SetGuidance("Commands for hadronic interaction info action.");
25 
26  _outBaseCmd = new G4UIcmdWithAString("/GGS/userActions/hadrIntAction/fileBase", this);
27  _outBaseCmd->SetGuidance("Sets the base name for ROOT output file");
28  _outBaseCmd->SetGuidance(" Can be with or without extension (.root will be used automatically)");
29  _outBaseCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
30 
31  _outTreeCmd = new G4UIcmdWithAString("/GGS/userActions/hadrIntAction/treeName", this);
32  _outTreeCmd->SetGuidance("Set the name of the TTree object in the ROOT output file.");
33  _outTreeCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
34 
35  _setFractionCmd = new G4UIcmdWithADouble("/GGS/userActions/hadrIntAction/energyFraction", this);
36  _setFractionCmd->SetGuidance("Sets the minimum fraction of primary energy to tag quasi-elastic interactions.");
37  _setFractionCmd->SetParameterName("fraction", false);
38  _setFractionCmd->SetRange("fraction>=0. && fraction<=1.");
39  _setFractionCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
40 
41  _outProductsCmd = new G4UIcmdWithABool("/GGS/userActions/hadrIntAction/outProducts", this);
42  _outProductsCmd->SetGuidance("Toggles on and off saving interaction products.");
43  _outProductsCmd->SetParameterName("outProducts", false);
44  _outProductsCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
45 }
46 
47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
48 
50 
51  delete _cmdDir;
52  delete _outBaseCmd;
53  delete _outTreeCmd;
54  delete _outProductsCmd;
55 }
56 
57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
58 
59 void GGSHadrIntMessenger::SetNewValue(G4UIcommand *command, G4String newValue) {
60 
61  if (command == _outBaseCmd)
62  _action->SetOutputFileBase(newValue);
63 
64  if (command == _outTreeCmd)
65  _action->SetOutputTreeName(newValue);
66 
67  if (command == _setFractionCmd)
68  _action->SetEnergyFraction(_setFractionCmd->GetNewDoubleValue(newValue));
69 
70  if (command == _outProductsCmd) {
71  _action->SetOutputOfProducts(_outProductsCmd->GetNewBoolValue(newValue));
72  }
73 }
void SetOutputFileBase(const std::string &outFileBase)
Sets the output file base name.
void SetOutputTreeName(const std::string &outTreeName)
Sets the output tree name.
void SetOutputOfProducts(bool output)
Toggles the output of hadronic interaction products.
void SetNewValue(G4UIcommand *command, G4String newValue)
Override of SetNewValue method.
void SetEnergyFraction(double fraction)
Sets the maximum secondary energy fraction for hadronic interactions.
~GGSHadrIntMessenger()
Destructor.
GGSHadrIntMessenger(GGSHadrIntAction *action)
Constructor.
Action which finds the hadronic interaction points for each primary particle.