ACTARSim
ACTAR TPC Simulation Reference Guide
ActarSimSciDetectorMessenger.cc
Go to the documentation of this file.
1 // - AUTHOR: Hector Alvarez-Pol 04/2008
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 ActarSimSciDetectorMessenger
11 /// Messenger of the Scintillator detector
12 /////////////////////////////////////////////////////////////////
13 
15 
16 #include "G4RunManager.hh"
17 
20 
21 #include "G4UIdirectory.hh"
22 #include "G4UIcmdWithAString.hh"
23 #include "G4UIcmdWithAnInteger.hh"
24 #include "G4UIcmdWithADoubleAndUnit.hh"
25 #include "G4UIcmdWith3VectorAndUnit.hh"
26 #include "G4UIcmdWithoutParameter.hh"
27 
28 //////////////////////////////////////////////////////////////////
29 /// Constructor with complete functionality
32  :ActarSimSciDetector(ActarSimSciDet) {
33 
34  detDir = new G4UIdirectory("/ActarSim/det/sci/");
35  detDir->SetGuidance("scintillator detector control");
36 
37  printCmd = new G4UIcmdWithoutParameter("/ActarSim/det/sci/print",this);
38  printCmd->SetGuidance("Prints geometry.");
39  printCmd->AvailableForStates(G4State_Idle);
40 
41  sideCoverageCmd = new G4UIcmdWithAnInteger("/ActarSim/det/sci/sideCoverage",this);
42  sideCoverageCmd->SetGuidance("Selects the scintillator coverage (default 1).");
43  sideCoverageCmd->SetGuidance(" 6 bits to indicate which sci wall is present (1) or absent (0). The order is: ");
44  sideCoverageCmd->SetGuidance(" bit1 (lsb) beam output wall ");
45  sideCoverageCmd->SetGuidance(" bit2 lower (gravity based) wall ");
46  sideCoverageCmd->SetGuidance(" bit3 upper (gravity based) wall ");
47  sideCoverageCmd->SetGuidance(" bit4 left (from beam point of view) wall ");
48  sideCoverageCmd->SetGuidance(" bit5 right (from beam point of view) wall ");
49  sideCoverageCmd->SetGuidance(" bit6 (msb) beam entrance wall ");
50  sideCoverageCmd->SetGuidance(" Convert the final binary to a decimal number (betwee 0 and 63) and set the coverage! ");
51  sideCoverageCmd->SetParameterName("type",false);
52  sideCoverageCmd->AvailableForStates(G4State_Idle);
53 
54  xBoxHalfLengthCmd = new G4UIcmdWithADoubleAndUnit("/ActarSim/det/sci/xBoxHalfLength",this);
55  xBoxHalfLengthCmd->SetGuidance("Sets the x half length of the scintillator detectors box");
56  xBoxHalfLengthCmd->SetParameterName("xBoxSci",false);
57  xBoxHalfLengthCmd->SetRange("xBoxSci>=0.");
58  xBoxHalfLengthCmd->SetUnitCategory("Length");
59  xBoxHalfLengthCmd->SetDefaultValue(0.5);
60  xBoxHalfLengthCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
61 
62  yBoxHalfLengthCmd = new G4UIcmdWithADoubleAndUnit("/ActarSim/det/sci/yBoxHalfLength",this);
63  yBoxHalfLengthCmd->SetGuidance("Sets the y half length of the scintillator detectors box");
64  yBoxHalfLengthCmd->SetParameterName("yBoxSci",false);
65  yBoxHalfLengthCmd->SetRange("yBoxSci>=0.");
66  yBoxHalfLengthCmd->SetUnitCategory("Length");
67  yBoxHalfLengthCmd->SetDefaultValue(0.5);
68  yBoxHalfLengthCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
69 
70  zBoxHalfLengthCmd = new G4UIcmdWithADoubleAndUnit("/ActarSim/det/sci/zBoxHalfLength",this);
71  zBoxHalfLengthCmd->SetGuidance("Sets the z half length of the scintillator detectors box");
72  zBoxHalfLengthCmd->SetParameterName("zBoxSci",false);
73  zBoxHalfLengthCmd->SetRange("zBoxSci>=0.");
74  zBoxHalfLengthCmd->SetUnitCategory("Length");
75  zBoxHalfLengthCmd->SetDefaultValue(0.5);
76  zBoxHalfLengthCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
77 }
78 
79 //////////////////////////////////////////////////////////////////
80 /// Destructor
82  delete detDir;
83  delete printCmd;
84  delete sideCoverageCmd;
85  delete xBoxHalfLengthCmd;
86  delete yBoxHalfLengthCmd;
87  delete zBoxHalfLengthCmd;
88 }
89 
90 //////////////////////////////////////////////////////////////////
91 /// Setting the new values and connecting to actions
93  G4String newValue) {
94  if( command == printCmd )
96 
97  if( command == sideCoverageCmd)
98  ActarSimSciDetector->SetSideCoverage(sideCoverageCmd->GetNewIntValue(newValue));
99 
100  if( command == xBoxHalfLengthCmd)
101  ActarSimSciDetector->SetXBoxSciHalfLength(xBoxHalfLengthCmd->GetNewDoubleValue(newValue));
102 
103  if( command == yBoxHalfLengthCmd)
104  ActarSimSciDetector->SetYBoxSciHalfLength(yBoxHalfLengthCmd->GetNewDoubleValue(newValue));
105 
106  if( command == zBoxHalfLengthCmd)
107  ActarSimSciDetector->SetZBoxSciHalfLength(zBoxHalfLengthCmd->GetNewDoubleValue(newValue));
108 }
G4UIcmdWithADoubleAndUnit * zBoxHalfLengthCmd
Sets the z half length of the sci detectors box.
G4UIcmdWithAnInteger * sideCoverageCmd
Selects the scintillator coverage (default 1)
ActarSimSciDetectorMessenger(ActarSimSciDetectorConstruction *)
Constructor with complete functionality.
G4UIdirectory * detDir
Directory in messenger structure.
G4UIcmdWithADoubleAndUnit * xBoxHalfLengthCmd
Sets the x half length of the sci detectors box.
void SetNewValue(G4UIcommand *, G4String)
Setting the new values and connecting to actions.
void PrintDetectorParameters()
Prints Scintillator detector parameters. TODO: To be filled.
G4UIcmdWithADoubleAndUnit * yBoxHalfLengthCmd
Sets the y half length of the sci detectors box.
G4UIcmdWithoutParameter * printCmd
Prints geometry.
ActarSimSciDetectorConstruction * ActarSimSciDetector
Pointer to main sci detector class.