ACTARSim
ACTAR TPC Simulation Reference Guide
ActarSimEventActionMessenger.cc
Go to the documentation of this file.
1 // - AUTHOR: Hector Alvarez-Pol 11/2004
2 /******************************************************************
3  * Copyright (C) 2005-2016, Hector Alvarez-Pol *
4  * All rights reserved. *
5  * *
6  * License according to GNU LESSER GPL (see lgpl-3.0.txt). *
7  * For the list of contributors see CREDITS. *
8  ******************************************************************/
9 //////////////////////////////////////////////////////////////////
10 /// \class ActarSimEventActionMessenger
11 /// Messenger for the event actions
12 /////////////////////////////////////////////////////////////////
13 
15 
16 #include "ActarSimEventAction.hh"
17 #include "G4UIdirectory.hh"
18 #include "G4UIcmdWithAString.hh"
19 #include "G4UIcmdWithAnInteger.hh"
20 #include "globals.hh"
21 
22 //////////////////////////////////////////////////////////////////
23 /// Constructor
24 /// command included in this AnalysisMessenger:
25 /// - /ActarSim/event/drawTracks
26 /// - /ActarSim/event/printModulo
28  :eventAction(EvAct) {
29  eventDir = new G4UIdirectory("/ActarSim/event/");
30  eventDir->SetGuidance("event control");
31 
32  DrawCmd = new G4UIcmdWithAString("/ActarSim/event/drawTracks",this);
33  DrawCmd->SetGuidance("Draw the tracks in the event");
34  DrawCmd->SetGuidance(" Choice : none, charged, neutral, all(default)");
35  DrawCmd->SetParameterName("choice",true);
36  DrawCmd->SetDefaultValue("all");
37  DrawCmd->SetCandidates("none charged neutral all");
38  DrawCmd->AvailableForStates(G4State_Idle);
39 
40  PrintCmd = new G4UIcmdWithAnInteger("/ActarSim/event/printModulo",this);
41  PrintCmd->SetGuidance("Print events modulo n");
42  PrintCmd->SetParameterName("EventNb",false);
43  PrintCmd->SetRange("EventNb>0");
44  PrintCmd->AvailableForStates(G4State_Idle);
45 }
46 
47 //////////////////////////////////////////////////////////////////
48 /// Destructor
50  delete DrawCmd;
51  delete PrintCmd;
52  delete eventDir;
53 }
54 
55 //////////////////////////////////////////////////////////////////
56 /// Setting the values using the ActarSimEventAction interface
57 void ActarSimEventActionMessenger::SetNewValue(G4UIcommand* command,G4String newValue) {
58  //
59  // Setting the values from the interfaces
60  //
61  if(command == DrawCmd)
62  eventAction->SetDrawFlag(newValue);
63 
64  if(command == PrintCmd)
65  eventAction->SetPrintModulo(PrintCmd->GetNewIntValue(newValue));
66 }
void SetDrawFlag(G4String val)
void SetPrintModulo(G4int val)
G4UIcmdWithAnInteger * PrintCmd
Print events modulo n.
G4UIdirectory * eventDir
Directory for the commands.
ActarSimEventActionMessenger(ActarSimEventAction *)
void SetNewValue(G4UIcommand *, G4String)
Setting the values using the ActarSimEventAction interface.
G4UIcmdWithAString * DrawCmd
Draw the tracks in the event.
ActarSimEventAction * eventAction
Pointer to event action class.