Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /geant4/examples/extended/parameterisations/Par03/src/Par03EMShowerMessenger.cc was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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 /// \file Par03EMShowerMessenger.cc
0027 /// \brief Implementation of the Par03EMShowerMessenger class
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 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
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 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
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 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
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 }