CGEM BOSS 6.6.5.i
BESIII Offline Software System
Loading...
Searching...
No Matches
BesRunActionMessenger.cc
Go to the documentation of this file.
1//---------------------------------------------------------------------------//
2// BOOST --- BESIII Object_Oriented Simulation Tool //
3//---------------------------------------------------------------------------//
4//Description: passing parameters to event action
5//Author: Deng Ziyan
6//Created: Sep, 2004
7//Modified:
8//Comment:
9//---------------------------------------------------------------------------//
10
12#include "BesRunAction.hh"
13#include "G4UIdirectory.hh"
14#include "G4UIcommand.hh"
15#include "G4UIcmdWithAnInteger.hh"
16#include "G4UIcmdWithAString.hh"
17#include "G4ios.hh"
18
20:m_runAction(runAction)
21{
22 m_runActionDirectory = new G4UIdirectory("/runAction/");
23 m_runActionDirectory->SetGuidance("BESIII run action");
24
25 //MCTruth command
26 m_MCTruthCmd = new G4UIcmdWithAnInteger("/runAction/MCTruth",this);
27 m_MCTruthCmd->SetGuidance("whether to save MC Truth information.");
28 m_MCTruthCmd->SetParameterName("MCTruthFlag",true);
29 m_MCTruthCmd->SetRange("MCTruthFlag>=0");
30 m_MCTruthCmd->SetDefaultValue(0);
31
32 //ascii I/O command
33 /*G4UIparameter* parameter;
34 G4bool omittable;
35
36 m_asciiCmd = new G4UIcommand("/runAction/ascii",this);
37 m_asciiCmd->SetGuidance("Ascii I/O in BES.");
38 m_asciiCmd->SetGuidance("mdcTruFlag, cgemTruFlag, tofTruFlag, emcTruFlag, mucTruFlag,mdcDigiFlag, cgemDigiFlag, tofDigiFlag, emcDigiFlag, mucDigiFlag, asciiFileName");
39
40 parameter = new G4UIparameter("mdcTruFlag",'i',omittable = true);
41 parameter->SetGuidance("whether output mdc Truth information to asciiFile");
42 parameter->SetParameterRange("mdcTruFlag >= 0");
43 parameter->SetDefaultValue(1);
44 m_asciiCmd->SetParameter(parameter);
45
46 parameter = new G4UIparameter("cgemTruFlag",'i',omittable = true);
47 parameter->SetGuidance("whether output cgem Truth information to asciiFile");
48 parameter->SetParameterRange("cgemTruFlag >= 0");
49 parameter->SetDefaultValue(1);
50 m_asciiCmd->SetParameter(parameter);
51
52 parameter = new G4UIparameter("tofTruFlag",'i',omittable = true);
53 parameter->SetGuidance("whether output tof truth information to asciiFile");
54 parameter->SetParameterRange("tofTruFlag >= 0");
55 parameter->SetDefaultValue(1);
56 m_asciiCmd->SetParameter(parameter);
57
58
59 parameter = new G4UIparameter("emcTruFlag",'i',omittable = true);
60 parameter->SetGuidance("whether output emc truth information to asciiFile");
61 parameter->SetParameterRange("emcTruFlag >= 0");
62 parameter->SetDefaultValue(1);
63 m_asciiCmd->SetParameter(parameter);
64
65 parameter = new G4UIparameter("mucTruFlag",'i',omittable = true);
66 parameter->SetGuidance("whether output muc truth information to asciiFile");
67 parameter->SetParameterRange("mucTruFlag >= 0");
68 parameter->SetDefaultValue(1);
69 m_asciiCmd->SetParameter(parameter);
70
71
72 parameter = new G4UIparameter("mdcDigiFlag",'i',omittable = true);
73 parameter->SetGuidance("whether output mdc digi information to asciiFile");
74 parameter->SetParameterRange("mdcDigiFlag >= 0");
75 parameter->SetDefaultValue(1);
76 m_asciiCmd->SetParameter(parameter);
77
78 parameter = new G4UIparameter("cgemDigiFlag",'i',omittable = true);
79 parameter->SetGuidance("whether output cgem digi information to asciiFile");
80 parameter->SetParameterRange("cgemDigiFlag >= 0");
81 parameter->SetDefaultValue(1);
82 m_asciiCmd->SetParameter(parameter);
83
84 parameter = new G4UIparameter("tofDigiFlag",'i',omittable = true);
85 parameter->SetGuidance("whether output tof digi information to asciiFile");
86 parameter->SetParameterRange("tofDigiFlag >= 0");
87 parameter->SetDefaultValue(1);
88 m_asciiCmd->SetParameter(parameter);
89
90
91 parameter = new G4UIparameter("emcDigiFlag",'i',omittable = true);
92 parameter->SetGuidance("whether output emc digi information to asciiFile");
93 parameter->SetParameterRange("emcDigiFlag >= 0");
94 parameter->SetDefaultValue(1);
95 m_asciiCmd->SetParameter(parameter);
96
97 parameter = new G4UIparameter("mucDigiFlag",'i',omittable = true);
98 parameter->SetGuidance("whether output muc digi information to asciiFile");
99 parameter->SetParameterRange("mucDigiFlag >= 0");
100 parameter->SetDefaultValue(1);
101 m_asciiCmd->SetParameter(parameter);
102
103 parameter = new G4UIparameter("asciiFileName",'s',omittable = true);
104 parameter->SetGuidance("specify the ascii file name");
105 parameter->SetDefaultValue("AsciiDmp_out.dat");
106 m_asciiCmd->SetParameter(parameter);
107 */
108
109}
110
112{
113 delete m_runActionDirectory;
114 delete m_MCTruthCmd;
115 delete m_asciiCmd;
116}
117
118void BesRunActionMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
119{
120 if( command == m_MCTruthCmd)
121 m_runAction->SetMCTruthFlag(m_MCTruthCmd->GetNewIntValue(newValue));
122
123 /*else if( command == m_asciiCmd)
124 {
125 G4int mdcTruFlag, cgemTruFlag, tofTruFlag, emcTruFlag, mucTruFlag;
126 G4int mdcDigiFlag, cgemDigiFlag, tofDigiFlag, emcDigiFlag, mucDigiFlag;
127 G4String fileName;
128
129 std::istrstream is ((char*)newValue.data());
130 is >> mdcTruFlag >> cgemTruFlag >> tofTruFlag >> emcTruFlag >> mucTruFlag
131 >> mdcDigiFlag >> cgemDigiFlag >> tofDigiFlag >> emcDigiFlag >> mucDigiFlag
132 >> fileName;
133 m_runAction->SetMdcTruFlag(mdcTruFlag);
134 m_runAction->SetCgemTruFlag(cgemTruFlag);
135 m_runAction->SetTofTruFlag(tofTruFlag);
136 m_runAction->SetEmcTruFlag(emcTruFlag);
137 m_runAction->SetMucTruFlag(mucTruFlag);
138
139 m_runAction->SetMdcDigiFlag(mdcDigiFlag);
140 m_runAction->SetCgemDigiFlag(cgemDigiFlag);
141 m_runAction->SetTofDigiFlag(tofDigiFlag);
142 m_runAction->SetEmcDigiFlag(emcDigiFlag);
143 m_runAction->SetMucDigiFlag(mucDigiFlag);
144
145 m_runAction->SetAsciiFile(fileName);
146 }*/
147}
148
149
150
151
152
153
154
155
156
157
158
159
160
161
BesRunActionMessenger(BesRunAction *runAction)
void SetNewValue(G4UIcommand *command, G4String newValues)
void SetMCTruthFlag(G4int flag)