Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:33

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
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 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
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 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
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 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
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 }