File indexing completed on 2025-02-23 09:22:33
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 #include "Par03EMShowerMessenger.hh"
0027
0028 #include "Par03EMShowerModel.hh"
0029
0030 #include "G4UIcmdWithADouble.hh"
0031 #include "G4UIcmdWithADoubleAndUnit.hh"
0032 #include "G4UIcmdWithAnInteger.hh"
0033 #include "G4UIcmdWithoutParameter.hh"
0034 #include "G4UIdirectory.hh"
0035
0036 Par03EMShowerMessenger::Par03EMShowerMessenger(Par03EMShowerModel* aModel) : fModel(aModel)
0037 {
0038 fDirectory = new G4UIdirectory("/Par03/fastSim/");
0039 fDirectory->SetGuidance("Set mesh parameters for the example fast sim model.");
0040
0041 fPrintCmd = new G4UIcmdWithoutParameter("/Par03/fastSim/print", this);
0042 fPrintCmd->SetGuidance("Print current settings.");
0043
0044 fSigmaCmd = new G4UIcmdWithADoubleAndUnit("/Par03/fastSim/transverseProfile/sigma", this);
0045 fSigmaCmd->SetGuidance("Set sigma parameter of 2D Gaussian distribution.");
0046 fSigmaCmd->SetParameterName("Sigma", false);
0047 fSigmaCmd->SetUnitCategory("Length");
0048
0049 fAlphaCmd = new G4UIcmdWithADouble("/Par03/fastSim/longitudinalProfile/alpha", this);
0050 fAlphaCmd->SetGuidance("Set alpha parameter of Gamma distribution.");
0051 fAlphaCmd->SetParameterName("Alpha", false);
0052
0053 fBetaCmd = new G4UIcmdWithADouble("/Par03/fastSim/longitudinalProfile/beta", this);
0054 fBetaCmd->SetGuidance("Set beta parameter of Gamma distribution.");
0055 fBetaCmd->SetParameterName("Beta", false);
0056
0057 fNbOfHitsCmd = new G4UIcmdWithAnInteger("/Par03/fastSim/numberOfHits", this);
0058 fNbOfHitsCmd->SetGuidance(
0059 "Set number of (same energy) energy deposits created in fast simulation. "
0060 "Those deposits will be scored in the detector according to the readout of "
0061 "the sensitive detector.");
0062 fNbOfHitsCmd->SetParameterName("Number", false);
0063
0064 fLongMaxDepthCmd = new G4UIcmdWithADouble("/Par03/fastSim/longitudinalProfile/maxDepth", this);
0065 fLongMaxDepthCmd->SetGuidance("Set maximum shower depth used in parametrisation.");
0066 fLongMaxDepthCmd->SetGuidance("Expressed in units of radiation length.");
0067 fLongMaxDepthCmd->SetParameterName("Depth", false);
0068 }
0069
0070
0071
0072 Par03EMShowerMessenger::~Par03EMShowerMessenger()
0073 {
0074 delete fPrintCmd;
0075 delete fSigmaCmd;
0076 delete fAlphaCmd;
0077 delete fBetaCmd;
0078 delete fNbOfHitsCmd;
0079 delete fLongMaxDepthCmd;
0080 delete fDirectory;
0081 }
0082
0083
0084
0085 void Par03EMShowerMessenger::SetNewValue(G4UIcommand* aCommand, G4String aNewValues)
0086 {
0087 if (aCommand == fPrintCmd) {
0088 fModel->Print();
0089 }
0090 else if (aCommand == fSigmaCmd) {
0091 fModel->SetSigma(fSigmaCmd->GetNewDoubleValue(aNewValues));
0092 }
0093 else if (aCommand == fAlphaCmd) {
0094 fModel->SetAlpha(fAlphaCmd->GetNewDoubleValue(aNewValues));
0095 }
0096 else if (aCommand == fBetaCmd) {
0097 fModel->SetBeta(fBetaCmd->GetNewDoubleValue(aNewValues));
0098 }
0099 else if (aCommand == fNbOfHitsCmd) {
0100 fModel->SetNbOfHits(fNbOfHitsCmd->GetNewIntValue(aNewValues));
0101 }
0102 else if (aCommand == fLongMaxDepthCmd) {
0103 fModel->SetLongMaxDepth(fLongMaxDepthCmd->GetNewDoubleValue(aNewValues));
0104 }
0105 }
0106
0107
0108
0109 G4String Par03EMShowerMessenger::GetCurrentValue(G4UIcommand* aCommand)
0110 {
0111 G4String cv;
0112
0113 if (aCommand == fSigmaCmd) {
0114 cv = fSigmaCmd->ConvertToString(fModel->GetSigma());
0115 }
0116 else if (aCommand == fAlphaCmd) {
0117 cv = fAlphaCmd->ConvertToString(fModel->GetAlpha());
0118 }
0119 else if (aCommand == fBetaCmd) {
0120 cv = fBetaCmd->ConvertToString(fModel->GetBeta());
0121 }
0122 else if (aCommand == fNbOfHitsCmd) {
0123 cv = fNbOfHitsCmd->ConvertToString(fModel->GetNbOfHits());
0124 }
0125 else if (aCommand == fLongMaxDepthCmd) {
0126 cv = fLongMaxDepthCmd->ConvertToString(fModel->GetLongMaxDepth());
0127 }
0128 return cv;
0129 }