Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DMXEventActionMessenger.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // --------------------------------------------------------------
28 // GEANT 4 - Underground Dark Matter Detector Advanced Example
29 //
30 // For information related to this code contact: Alex Howard
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 
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 
57 :eventAction(EvAct){
58 
59  // saving event information
60  dmxDirectory = new G4UIdirectory("/dmx/");
61  dmxDirectory->SetGuidance("DM Example commands.");
62 
63  SavePmtCmd = new G4UIcmdWithABool("/dmx/savePmt",this);
64  SavePmtCmd->SetGuidance("Set flag to save (x,y,z) of hits in PMT");
65  SavePmtCmd->SetGuidance("into file 'pmt.out'");
66  SavePmtCmd->SetGuidance("Default = false");
67  SavePmtCmd->SetParameterName("savePmtFlag", false);
68 
69  SaveHitsCmd = new G4UIcmdWithABool("/dmx/saveHits",this);
70  SaveHitsCmd->SetGuidance("Set flag to save hits in each run");
71  SaveHitsCmd->SetGuidance("into file 'hits.out'");
72  SaveHitsCmd->SetGuidance("Default = true");
73  SaveHitsCmd->SetParameterName("saveHitsFlag", false);
74 
75 
76  // drawing event
77  drawDirectory = new G4UIdirectory("/dmx/draw/");
78  drawDirectory->SetGuidance("DM Example draw commands.");
79 
80  DrawColsCmd = new G4UIcmdWithAString("/dmx/draw/drawColours",this);
81  DrawColsCmd->SetGuidance("Tracks drawn by Event (standard colours) or by Step (custom colours)");
82  DrawColsCmd->SetGuidance(" Choice : custom, standard(default)");
83  DrawColsCmd->SetParameterName("drawColsFlag", false);
84  DrawColsCmd->SetCandidates("custom standard");
85  DrawColsCmd->AvailableForStates(G4State_Idle);
86 
87  DrawTrksCmd = new G4UIcmdWithAString("/dmx/draw/drawTracks",this);
88  DrawTrksCmd->SetGuidance("Draw the tracks in the event");
89  DrawTrksCmd->SetGuidance(" Choice : none, charged, noscint, all(default)");
90  DrawTrksCmd->SetParameterName("drawTrksFlag", false);
91  DrawTrksCmd->SetCandidates("none charged noscint all");
92  DrawTrksCmd->AvailableForStates(G4State_Idle);
93 
94  DrawHitsCmd = new G4UIcmdWithABool("/dmx/draw/drawHits",this);
95  DrawHitsCmd->SetGuidance("Set flag to draw hits in PMT.");
96  DrawHitsCmd->SetGuidance("Default = true");
97  DrawHitsCmd->SetParameterName("drawHitsFlag", false);
98  DrawHitsCmd->SetDefaultValue(true);
99 
100  PrintCmd = new G4UIcmdWithAnInteger("/dmx/printModulo",this);
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 
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 
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->GetNewIntValue(newValue));}
157 
158 
159 }
160