Warning, file /geant4/examples/advanced/underground_physics/src/DMXEventActionMessenger.cc was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042 #include "DMXEventActionMessenger.hh"
0043
0044 #include <sstream>
0045
0046 #include "DMXEventAction.hh"
0047
0048 #include "G4UIdirectory.hh"
0049 #include "G4UIcmdWithAString.hh"
0050 #include "G4UIcmdWithAnInteger.hh"
0051 #include "G4UIcmdWithABool.hh"
0052 #include "G4UIcommand.hh"
0053 #include "globals.hh"
0054
0055
0056 DMXEventActionMessenger::DMXEventActionMessenger(DMXEventAction* EvAct)
0057 :eventAction(EvAct){
0058
0059
0060 dmxDirectory = new G4UIdirectory("/dmx/");
0061 dmxDirectory->SetGuidance("DM Example commands.");
0062
0063 SavePmtCmd = new G4UIcmdWithABool("/dmx/savePmt",this);
0064 SavePmtCmd->SetGuidance("Set flag to save (x,y,z) of hits in PMT");
0065 SavePmtCmd->SetGuidance("into file 'pmt.out'");
0066 SavePmtCmd->SetGuidance("Default = false");
0067 SavePmtCmd->SetParameterName("savePmtFlag", false);
0068
0069 SaveHitsCmd = new G4UIcmdWithABool("/dmx/saveHits",this);
0070 SaveHitsCmd->SetGuidance("Set flag to save hits in each run");
0071 SaveHitsCmd->SetGuidance("into file 'hits.out'");
0072 SaveHitsCmd->SetGuidance("Default = true");
0073 SaveHitsCmd->SetParameterName("saveHitsFlag", false);
0074
0075
0076
0077 drawDirectory = new G4UIdirectory("/dmx/draw/");
0078 drawDirectory->SetGuidance("DM Example draw commands.");
0079
0080 DrawColsCmd = new G4UIcmdWithAString("/dmx/draw/drawColours",this);
0081 DrawColsCmd->SetGuidance("Tracks drawn by Event (standard colours) or by Step (custom colours)");
0082 DrawColsCmd->SetGuidance(" Choice : custom, standard(default)");
0083 DrawColsCmd->SetParameterName("drawColsFlag", false);
0084 DrawColsCmd->SetCandidates("custom standard");
0085 DrawColsCmd->AvailableForStates(G4State_Idle);
0086
0087 DrawTrksCmd = new G4UIcmdWithAString("/dmx/draw/drawTracks",this);
0088 DrawTrksCmd->SetGuidance("Draw the tracks in the event");
0089 DrawTrksCmd->SetGuidance(" Choice : none, charged, noscint, all(default)");
0090 DrawTrksCmd->SetParameterName("drawTrksFlag", false);
0091 DrawTrksCmd->SetCandidates("none charged noscint all");
0092 DrawTrksCmd->AvailableForStates(G4State_Idle);
0093
0094 DrawHitsCmd = new G4UIcmdWithABool("/dmx/draw/drawHits",this);
0095 DrawHitsCmd->SetGuidance("Set flag to draw hits in PMT.");
0096 DrawHitsCmd->SetGuidance("Default = true");
0097 DrawHitsCmd->SetParameterName("drawHitsFlag", false);
0098 DrawHitsCmd->SetDefaultValue(true);
0099
0100 PrintCmd = new G4UIcmdWithAnInteger("/dmx/printModulo",this);
0101 PrintCmd->SetGuidance("Print events modulo n");
0102 PrintCmd->SetParameterName("EventNb",false);
0103 PrintCmd->SetRange("EventNb>0");
0104 PrintCmd->AvailableForStates(G4State_Idle);
0105
0106 }
0107
0108
0109 DMXEventActionMessenger::~DMXEventActionMessenger() {
0110
0111 delete SavePmtCmd;
0112 delete SaveHitsCmd;
0113 delete dmxDirectory;
0114 delete DrawColsCmd;
0115 delete DrawTrksCmd;
0116 delete DrawHitsCmd;
0117 delete drawDirectory;
0118 delete PrintCmd;
0119
0120 }
0121
0122 void DMXEventActionMessenger::SetNewValue
0123 (G4UIcommand* command, G4String newValue) {
0124
0125 if(command == DrawColsCmd)
0126 eventAction->SetDrawColsFlag(newValue);
0127
0128 if(command == DrawTrksCmd)
0129 eventAction->SetDrawTrksFlag(newValue);
0130
0131 if(command == DrawHitsCmd) {
0132 G4int vl;
0133 const char* t = newValue;
0134 std::istringstream is(t);
0135 is >> vl;
0136 eventAction->SetDrawHitsFlag(vl!=0);
0137 }
0138
0139 if(command == SavePmtCmd) {
0140 G4int vl;
0141 const char* t = newValue;
0142 std::istringstream is(t);
0143 is >> vl;
0144 eventAction->SetSavePmtFlag(vl!=0);
0145 }
0146
0147 if(command == SaveHitsCmd) {
0148 G4int vl;
0149 const char* t = newValue;
0150 std::istringstream is(t);
0151 is >> vl;
0152 eventAction->SetSaveHitsFlag(vl!=0);
0153 }
0154
0155 if(command == PrintCmd)
0156 {eventAction->SetPrintModulo(PrintCmd->GetNewIntValue(newValue));}
0157
0158
0159 }
0160