00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00033
00034
00051
00052
00053
00054 #include "globals.hh"
00055 #include "G4UIdirectory.hh"
00056 #include "G4UIcmdWithAnInteger.hh"
00057 #include "G4UIcmdWithAString.hh"
00058 #include "G4UIcmdWithoutParameter.hh"
00059 #include "G4UIcommand.hh"
00060 #include "G4UImessenger.hh"
00061
00062 #include "management/MJManagementEventAction.hh"
00063 #include "io/MJLogger.hh"
00064 #include "io/MJOutputLANLClover.hh"
00065 #include "io/MJOutputLANLCloverInNaIBarrel.hh"
00066 #include "io/MJOutputSolidBlock.hh"
00067 #include "gerdaio/MaGeOutputGermaniumArray.hh"
00068
00069
00070
00071
00072 #include "management/MJManagementEventActionMessenger.hh"
00073
00074
00075
00076 MJManagementEventActionMessenger::
00077 MJManagementEventActionMessenger(MJManagementEventAction *eventaction):
00078 fEventAction(eventaction)
00079 {
00080
00081 fEventDirectory = new G4UIdirectory("/MJ/eventaction/");
00082 fEventDirectory->
00083 SetGuidance("Parameters for the MJManagementEventAction class");
00084 fEventDirectory->
00085 SetGuidance("Controls what happens before, during and after each event.");
00086 fEventDirectory->
00087 SetGuidance("Determines output format (Root, etc.) and schema.");
00088
00089
00090 fGetOutputSchemaCmd = new
00091 G4UIcmdWithoutParameter("/MJ/eventaction/getrootschema",this);
00092 fGetOutputSchemaCmd->SetGuidance("Returns name of output schema.");
00093
00094
00095 fSetFileNameCmd = new
00096 G4UIcmdWithAString("/MJ/eventaction/rootfilename", this);
00097 fSetFileNameCmd->SetGuidance("Name for output file.");
00098
00099
00100 fSetSchemaCmd = new
00101 G4UIcmdWithAString("/MJ/eventaction/rootschema", this);
00102 fSetSchemaCmd->SetGuidance("Selects output schema for Output file.");
00103 fSetSchemaCmd->
00104 SetGuidance("Must be consistent with geometry selected.");
00105 fSetSchemaCmd->SetParameterName("rootoutputschema", true);
00106 fSetSchemaCmd->SetDefaultValue("LANLCloverNoPS");
00107 G4String schemacandidates;
00108 schemacandidates =
00109 "LANLCloverNoPS LANLCloverInNaIBarrel solidBlock GerdaArray GerdaArrayWithTrajectory GerdaHbook";
00110 fSetSchemaCmd->SetCandidates(schemacandidates);
00111
00112
00113 fSetReportingFrequencyCmd = new
00114 G4UIcmdWithAnInteger("/MJ/eventaction/reportingfrequency", this);
00115 fSetReportingFrequencyCmd->SetGuidance(
00116 "Set number of events between reporting current event #");
00117
00118 MJLog(trace) << "Event Action Messenger Defined." << endlog;
00119 }
00120
00121
00122
00123 MJManagementEventActionMessenger::MJManagementEventActionMessenger
00124 (const MJManagementEventActionMessenger & other)
00125 {;}
00126
00127
00128
00129 MJManagementEventActionMessenger::~MJManagementEventActionMessenger()
00130 {
00131 delete fEventDirectory;
00132 delete fGetOutputSchemaCmd;
00133 delete fSetFileNameCmd;
00134 delete fSetSchemaCmd;
00135 delete fSetReportingFrequencyCmd;
00136 }
00137
00138
00139
00140 void MJManagementEventActionMessenger::SetNewValue(G4UIcommand *command,
00141 G4String newValues)
00142 {
00143
00144 if(command == fSetReportingFrequencyCmd) {
00145 fEventAction->SetReportingFrequency(
00146 fSetReportingFrequencyCmd->GetNewIntValue(newValues));
00147
00148
00149 } else if(command == fSetFileNameCmd) {
00150 if(fEventAction->GetOutputManager())
00151 fEventAction->GetOutputManager()->SetFileName(newValues);
00152 else
00153 MJLog(error) << "No Output class defined. Please define one via"
00154 << " /MJ/eventaction/schema first." << endlog;
00155
00156
00157 } else if(command == fSetSchemaCmd) {
00158 if(newValues == "LANLCloverNoPS") {
00159 fEventAction->SetOutputManager(new MJOutputLANLClover("LANL1", true));
00160 fEventAction->SetOutputName("LANLCloverNoPS");
00161 MJLog(routine) << "LANL clover without waveform simulation selected." <<
00162 endlog;
00163 } else if(newValues == "LANLCloverInNaIBarrel") {
00164 fEventAction->SetOutputManager(new MJOutputLANLCloverInNaIBarrel("A",true));
00165 fEventAction->SetOutputName("LANLCloverInNaIBarrel");
00166 MJLog(routine) << "LANL clover without waveform simulation inside " <<
00167 "NaI barrel selected." << endlog;
00168 } else if(newValues == "solidBlock") {
00169 fEventAction->SetOutputManager(new MJOutputSolidBlock(true));
00170 fEventAction->SetOutputName("solidBlock");
00171 MJLog(routine) << "Solid block output format selected" << endlog;
00172 }
00173 else if (newValues == "GerdaArray") {
00174 fEventAction->SetOutputManager(new MaGeOutputGermaniumArray(true,false));
00175 fEventAction->SetOutputName("GerdaArray");
00176 MJLog(routine) << "Gerda Array output format selected" << endlog;
00177 }
00178 else if (newValues == "GerdaArrayWithTrajectory") {
00179 fEventAction->SetOutputManager(new MaGeOutputGermaniumArray(true,true));
00180 fEventAction->SetOutputName("GerdaArray");
00181 MJLog(routine) << "Gerda Array output format with trajectory selected" << endlog;
00182 }
00183 else if (newValues == "GerdaHbook") {
00184
00185
00186
00187 }
00188 else {
00189 MJLog(warning) << "Unknown Schema. Try again." << endlog;
00190 }
00191 }
00192 }
00193
00194
00195
00196 G4String MJManagementEventActionMessenger::GetCurrentValue(G4UIcommand *comm)
00197 {
00198 G4String cv;
00199 if(comm == fGetOutputSchemaCmd) {
00200 cv = fEventAction->GetOutputName();
00201 }
00202
00203 return cv;
00204 }
00205
00206
00207