GGS(GenericGEANT4Simulation)Software  2.6.0
 All Data Structures Namespaces Files Functions Variables Typedefs Macros
GGSLostEnergyMessenger.cpp
Go to the documentation of this file.
1 /*
2  * GGSLostEnergyMessenger.cpp
3  *
4  * Created on: 16 Jun 2011
5  * Author: Nicola Mori
6  */
7 
10 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
11 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
15 
16 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
17 
19  _action(action) {
20 
21  _cmdDir = new G4UIdirectory("/GGS/userActions/lostEnergyAction/");
22  _cmdDir->SetGuidance("Commands for lost energy info action.");
23 
24  _outBaseCmd = new G4UIcmdWithAString("/GGS/userActions/lostEnergyAction/fileBase", this);
25  _outBaseCmd->SetGuidance("Sets the base name for ROOT output file");
26  _outBaseCmd->SetGuidance(" Can be with or without extension (.root will be used automatically)");
27  _outBaseCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
28 
29  _outTreeCmd = new G4UIcmdWithAString("/GGS/userActions/lostEnergyAction/treeName", this);
30  _outTreeCmd->SetGuidance("Set the name of the TTree object in the ROOT output file.");
31  _outTreeCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
32 
33  _energyTypeCmd = new G4UIcmdWithAString("/GGS/userActions/lostEnergyAction/energyType", this);
34  _energyTypeCmd->SetGuidance("Set the type of lost energy.");
35  _energyTypeCmd->SetCandidates("kinetic total");
36  _energyTypeCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
37 
38 }
39 
40 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
41 
43 
44  delete _cmdDir;
45  delete _outBaseCmd;
46  delete _outTreeCmd;
47 }
48 
49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
50 
51 void GGSLostEnergyMessenger::SetNewValue(G4UIcommand* command, G4String newValue) {
52 
53  if (command == _outBaseCmd)
54  _action->SetOutputFileBase(newValue);
55 
56  if (command == _outTreeCmd)
57  _action->SetOutputTreeName(newValue);
58 
59  if (command == _energyTypeCmd) {
60  if (newValue == "kinetic")
61  _action->SetKineticAsLostEnergy();
62  if (newValue == "total")
63  _action->SetTotalAsLostEnergy();
64  }
65 }
66 
void SetKineticAsLostEnergy()
Sets the kinetic energy as lost energy.
void SetOutputFileBase(const std::string &outFileBase)
Sets the output file base name.
void SetNewValue(G4UIcommand *command, G4String newValue)
Override of SetNewValue method.
void SetOutputTreeName(const std::string &outTreeName)
Sets the output tree name.
GGSLostEnergyMessenger(GGSLostEnergyAction *action)
Constructor.
void SetTotalAsLostEnergy()
Sets the total energy as lost energy.
Computes the lost energy due to particles escaping the world volume.