File indexing completed on 2025-08-05 08:20:43
0001
0002
0003
0004
0005 #include "PHG4HcalPrototypeDetectorMessenger.h"
0006
0007 #include "PHG4HcalPrototypeDetector.h"
0008
0009 #include <Geant4/G4ApplicationState.hh> // for G4State_Idle, G4State...
0010 #include <Geant4/G4String.hh> // for G4String
0011 #include <Geant4/G4UIcmdWithADoubleAndUnit.hh>
0012 #include <Geant4/G4UIcmdWithAString.hh>
0013 #include <Geant4/G4UIcmdWithoutParameter.hh>
0014 #include <Geant4/G4UIdirectory.hh>
0015
0016
0017
0018 PHG4HcalPrototypeDetectorMessenger::PHG4HcalPrototypeDetectorMessenger(PHG4HcalPrototypeDetector* Det)
0019 : fPHG4HcalPrototypeDetector(Det)
0020 {
0021 sPhnxDir = new G4UIdirectory("/sPhnx/");
0022 sPhnxDir->SetGuidance("UI commands for modifying the prototype detector properties.");
0023
0024 detDir = new G4UIdirectory("/sPhnx/det/");
0025 detDir->SetGuidance("UI commands for changing the detector geometry.");
0026
0027 fMaterCmd = new G4UIcmdWithAString("/sPhnx/det/setMat", this);
0028 fMaterCmd->SetGuidance("Select material of the world.");
0029 fMaterCmd->SetParameterName("choice", false);
0030 fMaterCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0031
0032 fUpdateCmd = new G4UIcmdWithoutParameter("/sPhnx/det/update", this);
0033 fUpdateCmd->SetGuidance("Update geometry.");
0034 fUpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
0035 fUpdateCmd->SetGuidance("if you changed geometrical value(s).");
0036 fUpdateCmd->AvailableForStates(G4State_Idle);
0037
0038 outerHcalDPhiCmd = new G4UIcmdWithADoubleAndUnit("/sPhnx/det/setOuterHcalAngularSpan", this);
0039 outerHcalDPhiCmd->SetGuidance("Change the outer hcal angular span (default: 0.28 rad).");
0040 outerHcalDPhiCmd->SetGuidance("Need to run the detector update command after running this command!");
0041 outerHcalDPhiCmd->SetParameterName("hcal2DPhi", false);
0042 outerHcalDPhiCmd->SetUnitCategory("radian");
0043 outerHcalDPhiCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0044
0045 outerPlateTiltAngleCmd = new G4UIcmdWithADoubleAndUnit("/sPhnx/det/setOuterPlateTiltAngule", this);
0046 outerPlateTiltAngleCmd->SetGuidance("Change the outer plate tilt angle (default: 0.12 rad).");
0047 outerPlateTiltAngleCmd->SetGuidance("Need to run the detector update command after running this command!");
0048 outerPlateTiltAngleCmd->SetParameterName("hcal2TiltAngle", false);
0049 outerPlateTiltAngleCmd->SetUnitCategory("radian");
0050 outerPlateTiltAngleCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0051
0052 innerHcalDPhiCmd = new G4UIcmdWithADoubleAndUnit("/sPhnx/det/setInnerHcalAngularSpan", this);
0053 innerHcalDPhiCmd->SetGuidance("Change the inner hcal angular span (default: 0.28 rad).");
0054 innerHcalDPhiCmd->SetGuidance("Need to run the detector update command after running this command!");
0055 innerHcalDPhiCmd->SetParameterName("hcal1DPhi", false);
0056 innerHcalDPhiCmd->SetUnitCategory("radian");
0057 innerHcalDPhiCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0058
0059 innerPlateTiltAngleCmd = new G4UIcmdWithADoubleAndUnit("/sPhnx/det/setInnerPlateTiltAngule", this);
0060 innerPlateTiltAngleCmd->SetGuidance("Change the inner plate tilt angle (default: 0.30 rad).");
0061 innerPlateTiltAngleCmd->SetGuidance("Need to run the detector update command after running this command!");
0062 innerPlateTiltAngleCmd->SetParameterName("hcal1TiltAngle", false);
0063 innerPlateTiltAngleCmd->SetUnitCategory("radian");
0064 innerPlateTiltAngleCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0065 }
0066
0067
0068
0069 PHG4HcalPrototypeDetectorMessenger::~PHG4HcalPrototypeDetectorMessenger()
0070 {
0071 delete fMaterCmd;
0072 delete fUpdateCmd;
0073 delete outerHcalDPhiCmd;
0074 delete innerHcalDPhiCmd;
0075 delete outerPlateTiltAngleCmd;
0076 delete innerPlateTiltAngleCmd;
0077 }
0078
0079
0080
0081 void PHG4HcalPrototypeDetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0082 {
0083 if (command == fMaterCmd)
0084 {
0085 fPHG4HcalPrototypeDetector->SetMaterial(newValue);
0086 }
0087
0088 if (command == fUpdateCmd)
0089 {
0090 fPHG4HcalPrototypeDetector->UpdateGeometry();
0091 }
0092
0093 if (command == outerHcalDPhiCmd)
0094 {
0095 fPHG4HcalPrototypeDetector->SetOuterHcalDPhi(outerHcalDPhiCmd->GetNewDoubleValue(newValue));
0096 }
0097
0098 if (command == outerPlateTiltAngleCmd)
0099 {
0100 fPHG4HcalPrototypeDetector->SetOuterPlateTiltAngle(outerPlateTiltAngleCmd->GetNewDoubleValue(newValue));
0101 }
0102
0103 if (command == innerHcalDPhiCmd)
0104 {
0105 fPHG4HcalPrototypeDetector->SetInnerHcalDPhi(innerHcalDPhiCmd->GetNewDoubleValue(newValue));
0106 }
0107
0108 if (command == innerPlateTiltAngleCmd)
0109 {
0110 fPHG4HcalPrototypeDetector->SetInnerPlateTiltAngle(innerPlateTiltAngleCmd->GetNewDoubleValue(newValue));
0111 }
0112 }
0113
0114