ACTARSim
ACTAR TPC Simulation Reference Guide
ActarSimSilDetectorMessenger.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 ActarSimSilDetectorMessenger
11 /// Messenger of the Silicon 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
30 /// command included in this AnalysisMessenger:
31 /// - ActarSim/det/sil/print
32 /// - /ActarSim/det/sil/sideCoverage
33 /// - /ActarSim/det/sil/xBoxHalfLength
34 /// - /ActarSim/det/sil/yBoxHalfLength
35 /// - /ActarSim/det/sil/zBoxHalfLength
38  :ActarSimSilDetector(ActarSimSilDet) {
39  detDir = new G4UIdirectory("/ActarSim/det/sil/");
40  detDir->SetGuidance("silicon detector control");
41 
42  printCmd = new G4UIcmdWithoutParameter("/ActarSim/det/sil/print",this);
43  printCmd->SetGuidance("Prints geometry.");
44  printCmd->AvailableForStates(G4State_Idle);
45 
46  sideCoverageCmd = new G4UIcmdWithAnInteger("/ActarSim/det/sil/sideCoverage",this);
47  sideCoverageCmd->SetGuidance("Selects the silicon coverage (default 1).");
48  sideCoverageCmd->SetGuidance(" 6 bits to indicate which sci wall is present (1) or absent (0). The order is: ");
49  sideCoverageCmd->SetGuidance(" bit1 (lsb) beam output wall ");
50  sideCoverageCmd->SetGuidance(" bit2 lower (gravity based) wall ");
51  sideCoverageCmd->SetGuidance(" bit3 upper (gravity based) wall ");
52  sideCoverageCmd->SetGuidance(" bit4 left (from beam point of view) wall ");
53  sideCoverageCmd->SetGuidance(" bit5 right (from beam point of view) wall ");
54  sideCoverageCmd->SetGuidance(" bit6 (msb) beam entrance wall ");
55  sideCoverageCmd->SetGuidance(" Convert the final binary to a decimal number (betwee 0 and 63) and set the coverage! ");
56  sideCoverageCmd->SetParameterName("type",false);
57  sideCoverageCmd->AvailableForStates(G4State_Idle);
58 
59  xBoxHalfLengthCmd = new G4UIcmdWithADoubleAndUnit("/ActarSim/det/sil/xBoxHalfLength",this);
60  xBoxHalfLengthCmd->SetGuidance("Sets the x half length of the silicon detectors box");
61  xBoxHalfLengthCmd->SetParameterName("xBoxSil",false);
62  xBoxHalfLengthCmd->SetRange("xBoxSil>=0.");
63  xBoxHalfLengthCmd->SetUnitCategory("Length");
64  xBoxHalfLengthCmd->SetDefaultValue(0.5);
65  xBoxHalfLengthCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
66 
67  yBoxHalfLengthCmd = new G4UIcmdWithADoubleAndUnit("/ActarSim/det/sil/yBoxHalfLength",this);
68  yBoxHalfLengthCmd->SetGuidance("Sets the y half length of the silicon detectors box");
69  yBoxHalfLengthCmd->SetParameterName("yBoxSil",false);
70  yBoxHalfLengthCmd->SetRange("yBoxSil>=0.");
71  yBoxHalfLengthCmd->SetUnitCategory("Length");
72  yBoxHalfLengthCmd->SetDefaultValue(0.5);
73  yBoxHalfLengthCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
74 
75  zBoxHalfLengthCmd = new G4UIcmdWithADoubleAndUnit("/ActarSim/det/sil/zBoxHalfLength",this);
76  zBoxHalfLengthCmd->SetGuidance("Sets the z half length of the silicon detectors box");
77  zBoxHalfLengthCmd->SetParameterName("zBoxSil",false);
78  zBoxHalfLengthCmd->SetRange("zBoxSil>=0.");
79  zBoxHalfLengthCmd->SetUnitCategory("Length");
80  zBoxHalfLengthCmd->SetDefaultValue(0.5);
81  zBoxHalfLengthCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
82 }
83 
84 //////////////////////////////////////////////////////////////////
85 /// Destructor
87  delete detDir;
88  delete printCmd;
89  delete sideCoverageCmd;
90  delete xBoxHalfLengthCmd;
91  delete yBoxHalfLengthCmd;
92  delete zBoxHalfLengthCmd;
93 }
94 
95 //////////////////////////////////////////////////////////////////
96 /// Setting the values using the ActarSimROOTAnalysis interface
98  G4String newValue) {
99  if( command == printCmd )
101 
102  if( command == sideCoverageCmd)
103  ActarSimSilDetector->SetSideCoverage(sideCoverageCmd->GetNewIntValue(newValue));
104 
105  if( command == xBoxHalfLengthCmd)
106  ActarSimSilDetector->SetXBoxSilHalfLength(xBoxHalfLengthCmd->GetNewDoubleValue(newValue));
107 
108  if( command == yBoxHalfLengthCmd)
109  ActarSimSilDetector->SetYBoxSilHalfLength(yBoxHalfLengthCmd->GetNewDoubleValue(newValue));
110 
111  if( command == zBoxHalfLengthCmd)
112  ActarSimSilDetector->SetZBoxSilHalfLength(zBoxHalfLengthCmd->GetNewDoubleValue(newValue));
113 }
G4UIcmdWithADoubleAndUnit * zBoxHalfLengthCmd
Sets the z half length of the silicon detectors box.
G4UIcmdWithoutParameter * printCmd
Prints geometry.
ActarSimSilDetectorConstruction * ActarSimSilDetector
Pointer to main detector class.
G4UIcmdWithAnInteger * sideCoverageCmd
Selects the silicon coverage (default 1)
void PrintDetectorParameters()
Prints Scintillator detector parameters.
G4UIcmdWithADoubleAndUnit * xBoxHalfLengthCmd
Sets the x half length of the silicon detectors box.
void SetNewValue(G4UIcommand *, G4String)
Setting the values using the ActarSimROOTAnalysis interface.
ActarSimSilDetectorMessenger(ActarSimSilDetectorConstruction *)
G4UIdirectory * detDir
Directory in messenger structure.
G4UIcmdWithADoubleAndUnit * yBoxHalfLengthCmd
Sets the y half length of the silicon detectors box.