Back to home page

EIC code displayed by LXR

 
 

    


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 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 // --------------------------------------------------------------
0028 //   GEANT 4 - Underground Dark Matter Detector Advanced Example
0029 //
0030 //      For information related to this code contact: Alex Howard
0031 //      e-mail: alexander.howard@cern.ch
0032 // --------------------------------------------------------------
0033 // Comments
0034 //
0035 //                  Underground Advanced
0036 //               by A. Howard and H. Araujo 
0037 //                    (27th November 2001)
0038 //
0039 // EventActionMessenger program
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   // saving event information
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   // drawing event
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