Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 // 27 // ------------------------------------------- 28 // GEANT 4 - Underground Dark Matter Detecto 29 // 30 // For information related to this code c 31 // e-mail: alexander.howard@cern.ch 32 // ------------------------------------------- 33 // Comments 34 // 35 // Underground Advanced 36 // by A. Howard and H. Araujo 37 // (27th November 2001) 38 // 39 // EventActionMessenger program 40 // ------------------------------------------- 41 42 #include "DMXEventActionMessenger.hh" 43 44 #include <sstream> 45 46 #include "DMXEventAction.hh" 47 48 #include "G4UIdirectory.hh" 49 #include "G4UIcmdWithAString.hh" 50 #include "G4UIcmdWithAnInteger.hh" 51 #include "G4UIcmdWithABool.hh" 52 #include "G4UIcommand.hh" 53 #include "globals.hh" 54 55 56 DMXEventActionMessenger::DMXEventActionMesseng 57 :eventAction(EvAct){ 58 59 // saving event information 60 dmxDirectory = new G4UIdirectory("/dmx/"); 61 dmxDirectory->SetGuidance("DM Example comman 62 63 SavePmtCmd = new G4UIcmdWithABool("/dmx/save 64 SavePmtCmd->SetGuidance("Set flag to save (x 65 SavePmtCmd->SetGuidance("into file 'pmt.out' 66 SavePmtCmd->SetGuidance("Default = false"); 67 SavePmtCmd->SetParameterName("savePmtFlag", 68 69 SaveHitsCmd = new G4UIcmdWithABool("/dmx/sav 70 SaveHitsCmd->SetGuidance("Set flag to save h 71 SaveHitsCmd->SetGuidance("into file 'hits.ou 72 SaveHitsCmd->SetGuidance("Default = true"); 73 SaveHitsCmd->SetParameterName("saveHitsFlag" 74 75 76 // drawing event 77 drawDirectory = new G4UIdirectory("/dmx/draw 78 drawDirectory->SetGuidance("DM Example draw 79 80 DrawColsCmd = new G4UIcmdWithAString("/dmx/d 81 DrawColsCmd->SetGuidance("Tracks drawn by Ev 82 DrawColsCmd->SetGuidance(" Choice : custom, 83 DrawColsCmd->SetParameterName("drawColsFlag" 84 DrawColsCmd->SetCandidates("custom standard" 85 DrawColsCmd->AvailableForStates(G4State_Idle 86 87 DrawTrksCmd = new G4UIcmdWithAString("/dmx/d 88 DrawTrksCmd->SetGuidance("Draw the tracks in 89 DrawTrksCmd->SetGuidance(" Choice : none, c 90 DrawTrksCmd->SetParameterName("drawTrksFlag" 91 DrawTrksCmd->SetCandidates("none charged nos 92 DrawTrksCmd->AvailableForStates(G4State_Idle 93 94 DrawHitsCmd = new G4UIcmdWithABool("/dmx/dra 95 DrawHitsCmd->SetGuidance("Set flag to draw h 96 DrawHitsCmd->SetGuidance("Default = true"); 97 DrawHitsCmd->SetParameterName("drawHitsFlag" 98 DrawHitsCmd->SetDefaultValue(true); 99 100 PrintCmd = new G4UIcmdWithAnInteger("/dmx/pr 101 PrintCmd->SetGuidance("Print events modulo n 102 PrintCmd->SetParameterName("EventNb",false); 103 PrintCmd->SetRange("EventNb>0"); 104 PrintCmd->AvailableForStates(G4State_Idle); 105 106 } 107 108 109 DMXEventActionMessenger::~DMXEventActionMessen 110 111 delete SavePmtCmd; 112 delete SaveHitsCmd; 113 delete dmxDirectory; 114 delete DrawColsCmd; 115 delete DrawTrksCmd; 116 delete DrawHitsCmd; 117 delete drawDirectory; 118 delete PrintCmd; 119 120 } 121 122 void DMXEventActionMessenger::SetNewValue 123 (G4UIcommand* command, G4String newValue) { 124 125 if(command == DrawColsCmd) 126 eventAction->SetDrawColsFlag(newValue); 127 128 if(command == DrawTrksCmd) 129 eventAction->SetDrawTrksFlag(newValue); 130 131 if(command == DrawHitsCmd) { 132 G4int vl; 133 const char* t = newValue; 134 std::istringstream is(t); 135 is >> vl; 136 eventAction->SetDrawHitsFlag(vl!=0); 137 } 138 139 if(command == SavePmtCmd) { 140 G4int vl; 141 const char* t = newValue; 142 std::istringstream is(t); 143 is >> vl; 144 eventAction->SetSavePmtFlag(vl!=0); 145 } 146 147 if(command == SaveHitsCmd) { 148 G4int vl; 149 const char* t = newValue; 150 std::istringstream is(t); 151 is >> vl; 152 eventAction->SetSaveHitsFlag(vl!=0); 153 } 154 155 if(command == PrintCmd) 156 {eventAction->SetPrintModulo(PrintCmd->Get 157 158 159 } 160 161