GGS(GenericGEANT4Simulation)Software  2.7.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 
20  _cmdDir = new G4UIdirectory("/GGS/userActions/lostEnergyAction/");
21  _cmdDir->SetGuidance("Commands for lost energy info action.");
22 
23  _outBaseCmd = new G4UIcmdWithAString("/GGS/userActions/lostEnergyAction/fileBase", this);
24  _outBaseCmd->SetGuidance("Sets the base name for ROOT output file");
25  _outBaseCmd->SetGuidance(" Can be with or without extension (.root will be used automatically)");
26  _outBaseCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
27 
28  _outTreeCmd = new G4UIcmdWithAString("/GGS/userActions/lostEnergyAction/treeName", this);
29  _outTreeCmd->SetGuidance("Set the name of the TTree object in the ROOT output file.");
30  _outTreeCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
31 
32  _energyTypeCmd = new G4UIcmdWithAString("/GGS/userActions/lostEnergyAction/energyType", this);
33  _energyTypeCmd->SetGuidance("Set the type of lost energy.");
34  _energyTypeCmd->SetCandidates("kinetic total");
35  _energyTypeCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
36 }
37 
38 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
39 
41 
42  delete _cmdDir;
43  delete _outBaseCmd;
44  delete _outTreeCmd;
45 }
46 
47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
48 
49 void GGSLostEnergyMessenger::SetNewValue(G4UIcommand *command, G4String newValue) {
50 
51  if (command == _outBaseCmd)
52  _action->SetOutputFileBase(newValue);
53 
54  if (command == _outTreeCmd)
55  _action->SetOutputTreeName(newValue);
56 
57  if (command == _energyTypeCmd) {
58  if (newValue == "kinetic")
59  _action->SetKineticAsLostEnergy();
60  if (newValue == "total")
61  _action->SetTotalAsLostEnergy();
62  }
63 }
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.