ACTARSim
ACTAR TPC Simulation Reference Guide
ActarSimAnalysisMessenger.cc
Go to the documentation of this file.
1 // - AUTHOR: Hector Alvarez-Pol 11/2004
2 /******************************************************************
3  * Copyright (C) 2005-2016, Hector Alvarez-Pol *
4  * All rights reserved. *
5  * *
6  * License according to GNU LESSER GPL (see lgpl-3.0.txt). *
7  * For the list of contributors see CREDITS. *
8  ******************************************************************/
9 //////////////////////////////////////////////////////////////////
10 /// \class ActarSimAnalysisMessenger
11 /// Messenger for the analysis interaction
12 /////////////////////////////////////////////////////////////////
13 
15 
16 #include "ActarSimROOTAnalysis.hh"
17 #include "G4UIdirectory.hh"
18 #include "G4UIcmdWithAString.hh"
19 #include "G4UIcmdWithADoubleAndUnit.hh"
20 #include "G4UIcmdWithAnInteger.hh"
21 #include "globals.hh"
22 
23 //////////////////////////////////////////////////////////////////
24 /// Constructor
25 /// command included in this AnalysisMessenger:
26 /// - /ActarSim/analControl/storeTracks
27 /// - /ActarSim/analControl/storeTrackHistos
28 /// - /ActarSim/analControl/storeEvents
29 /// - /ActarSim/analControl/storeSimpleTracks
30 /// - /ActarSim/analControl/storeHistograms
31 /// - /ActarSim/analControl/setMinStrideLength
33  :analExample(analEx) {
34  analDir = new G4UIdirectory("/ActarSim/analControl/");
35  analDir->SetGuidance("Analysis control");
36 
37  storeTracksCmd = new G4UIcmdWithAString("/ActarSim/analControl/storeTracks",this);
38  storeTracksCmd->SetGuidance("Store the tracks in the output Tree");
39  storeTracksCmd->SetGuidance(" Choice : on, off(default)");
40  storeTracksCmd->SetParameterName("choice",true);
41  storeTracksCmd->SetDefaultValue("off");
42  storeTracksCmd->SetCandidates("on off");
43  storeTracksCmd->AvailableForStates(G4State_Idle);
44 
45  storeTrackHistosCmd = new G4UIcmdWithAString("/ActarSim/analControl/storeTrackHistos",this);
46  storeTrackHistosCmd->SetGuidance("Store the tracks in Histograms");
47  storeTrackHistosCmd->SetGuidance(" Choice : on, off(default)");
48  storeTrackHistosCmd->SetParameterName("choice",true);
49  storeTrackHistosCmd->SetDefaultValue("off");
50  storeTrackHistosCmd->SetCandidates("on off");
51  storeTrackHistosCmd->AvailableForStates(G4State_Idle);
52 
53  storeEventsCmd = new G4UIcmdWithAString("/ActarSim/analControl/storeEvents",this);
54  storeEventsCmd->SetGuidance("Store the events in the output Tree");
55  storeEventsCmd->SetGuidance(" Choice : on, off(default)");
56  storeEventsCmd->SetParameterName("choice",true);
57  storeEventsCmd->SetDefaultValue("off");
58  storeEventsCmd->SetCandidates("on off");
59  storeEventsCmd->AvailableForStates(G4State_Idle);
60 
61  storeSimpleTracksCmd = new G4UIcmdWithAString("/ActarSim/analControl/storeSimpleTracks",this);
62  storeSimpleTracksCmd->SetGuidance("Store the simple tracks in the output Tree");
63  storeSimpleTracksCmd->SetGuidance(" Choice : on, off(default)");
64  storeSimpleTracksCmd->SetParameterName("choice",true);
65  storeSimpleTracksCmd->SetDefaultValue("off");
66  storeSimpleTracksCmd->SetCandidates("on off");
67  storeSimpleTracksCmd->AvailableForStates(G4State_Idle);
68 
69  storeHistosCmd = new G4UIcmdWithAString("/ActarSim/analControl/storeHistograms",this);
70  storeHistosCmd->SetGuidance("Store histograms in the output Tree");
71  storeHistosCmd->SetGuidance(" Choice : on, off(default)");
72  storeHistosCmd->SetParameterName("choice",true);
73  storeHistosCmd->SetDefaultValue("off");
74  storeHistosCmd->SetCandidates("on off");
75  storeHistosCmd->AvailableForStates(G4State_Idle);
76 
77  setMinStrideLengthCmd = new G4UIcmdWithADoubleAndUnit("/ActarSim/analControl/setMinStrideLength",this);
78  setMinStrideLengthCmd->SetGuidance("Sets the minimum value for the stride length.");
79  setMinStrideLengthCmd->SetGuidance("Specifies the minimum length of the strides in the simpleTracks approximation.");
80  setMinStrideLengthCmd->SetGuidance(" Choice : on, off(default)");
81  setMinStrideLengthCmd->SetParameterName("length",false);
82  setMinStrideLengthCmd->SetRange("length>=0.");
83  setMinStrideLengthCmd->SetUnitCategory("Length");
84  setMinStrideLengthCmd->SetDefaultValue(1.);
85  setMinStrideLengthCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
86 }
87 
88 //////////////////////////////////////////////////////////////////
89 /// Destructor
91  delete storeTracksCmd;
92  delete storeTrackHistosCmd;
93  delete setMinStrideLengthCmd;
94  delete storeEventsCmd;
95  delete storeSimpleTracksCmd;
96  delete storeHistosCmd;
97  delete analDir;
98 }
99 
100 //////////////////////////////////////////////////////////////////
101 /// Setting the values using the ActarSimROOTAnalysis interface
102 void ActarSimAnalysisMessenger::SetNewValue(G4UIcommand* command,
103  G4String newValue) {
104 
105  if(command == storeTracksCmd)
106  analExample->SetStoreTracksFlag(newValue);
107 
108  if(command == storeTrackHistosCmd)
110 
111  if(command == storeEventsCmd)
112  analExample->SetStoreEventsFlag(newValue);
113 
114  if(command == storeSimpleTracksCmd)
116 
117  if(command == storeHistosCmd)
119 
120  if(command == setMinStrideLengthCmd)
121  analExample->SetMinStrideLength(setMinStrideLengthCmd->GetNewDoubleValue(newValue));
122 }
ActarSimAnalysisMessenger(ActarSimROOTAnalysis *)
void SetStoreTracksFlag(G4String val)
G4UIcmdWithAString * storeSimpleTracksCmd
Store the simple tracks in the output Tree.
void SetStoreHistogramsFlag(G4String val)
G4UIcmdWithAString * storeTracksCmd
Store the tracks in the output Tree.
void SetStoreEventsFlag(G4String val)
void SetMinStrideLength(Double_t value)
Setter of the minimum stride length in the gas.
G4UIcmdWithADoubleAndUnit * setMinStrideLengthCmd
Sets the minimum value for the stride length.
void SetStoreTrackHistosFlag(G4String val)
G4UIdirectory * analDir
Directory in messenger structure.
void SetStoreSimpleTracksFlag(G4String val)
ActarSimROOTAnalysis * analExample
Pointer to main analysis class.
G4UIcmdWithAString * storeHistosCmd
Store histograms in the output Tree.
G4UIcmdWithAString * storeTrackHistosCmd
Store the tracks in Histograms.
void SetNewValue(G4UIcommand *, G4String)
Setting the values using the ActarSimROOTAnalysis interface.
G4UIcmdWithAString * storeEventsCmd
Store the events in the output Tree.