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