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[ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/advanced/underground_physics/src/DMXEventActionMessenger.cc (Version 11.3.0) and /examples/advanced/underground_physics/src/DMXEventActionMessenger.cc (Version 10.7)


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