34 #include "HGCal/TBStandaloneSimulator/interface/DetectorMessenger.hh"
35 #include "HGCal/TBStandaloneSimulator/interface/DetectorConstruction.hh"
37 #include "G4UIdirectory.hh"
38 #include "G4UIcmdWithAString.hh"
39 #include "G4UIcmdWithAnInteger.hh"
40 #include "G4UIcmdWithADoubleAndUnit.hh"
41 #include "G4UIcmdWithoutParameter.hh"
45 DetectorMessenger::DetectorMessenger(
46 DetectorConstruction* Det)
49 N03Dir =
new G4UIdirectory(
"/N03/");
50 N03Dir->SetGuidance(
"UI commands of this example");
52 detDir =
new G4UIdirectory(
"/N03/det/");
53 detDir->SetGuidance(
"detector control");
55 MagFieldCmd =
new G4UIcmdWithADoubleAndUnit(
"/N03/det/setField",
this);
56 MagFieldCmd->SetGuidance(
"Define magnetic field.");
57 MagFieldCmd->SetGuidance(
"Magnetic field will be in Z direction.");
58 MagFieldCmd->SetParameterName(
"Bz",
false);
59 MagFieldCmd->SetUnitCategory(
"Magnetic flux density");
60 MagFieldCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
62 SetModelCmd =
new G4UIcmdWithAnInteger(
"/N03/det/setModel",
this);
63 SetModelCmd->SetGuidance(
"Define detector model");
64 SetModelCmd->SetParameterName(
"Model",
true);
65 SetModelCmd->SetDefaultValue(0);
66 SetModelCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
72 DetectorMessenger::~DetectorMessenger()
82 void DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
84 if( command == MagFieldCmd ) {
85 Detector->SetMagField(MagFieldCmd->GetNewDoubleValue(newValue));
87 if (command == SetModelCmd ) {
88 Detector->SetDetModel(SetModelCmd->GetNewIntValue(newValue));