Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-20 08:29:50

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 PhysicsListMessenger.cc
0027 /// \brief Implementation of the PhysicsListMessenger class
0028 
0029 //---------------------------------------------------------------------------
0030 //
0031 // ClassName:   PhysicsListMessenger
0032 //
0033 // Description: EM physics with a possibility to add PAI model
0034 //
0035 // Author:      V.Ivanchenko 01.09.2010
0036 //
0037 //----------------------------------------------------------------------------
0038 //
0039 
0040 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0041 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0042 
0043 #include "PhysicsListMessenger.hh"
0044 
0045 #include "PhysicsList.hh"
0046 #include "TestParameters.hh"
0047 
0048 #include "G4UIcmdWithADouble.hh"
0049 #include "G4UIcmdWithADoubleAndUnit.hh"
0050 #include "G4UIcmdWithAString.hh"
0051 #include "G4UIcmdWithAnInteger.hh"
0052 #include "G4UIdirectory.hh"
0053 
0054 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0055 
0056 PhysicsListMessenger::PhysicsListMessenger(PhysicsList* pPhys) : fPhysicsList(pPhys)
0057 {
0058   fPhysDir = new G4UIdirectory("/testem/phys/");
0059   fPhysDir->SetGuidance("physics list commands");
0060 
0061   fECmd = new G4UIcmdWithADoubleAndUnit("/testem/phys/setMaxE", this);
0062   fECmd->SetGuidance("Set max energy deposit");
0063   fECmd->SetParameterName("Emax", false);
0064   fECmd->SetUnitCategory("Energy");
0065   fECmd->SetRange("Emax>0.0");
0066   fECmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0067 
0068   fEBCmd = new G4UIcmdWithAnInteger("/testem/phys/setNbinsE", this);
0069   fEBCmd->SetGuidance("Set number of bins in energy.");
0070   fEBCmd->SetParameterName("Ebins", false);
0071   fEBCmd->SetRange("Ebins>0");
0072   fEBCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0073 
0074   fCBCmd = new G4UIcmdWithAnInteger("/testem/phys/setNbinsCl", this);
0075   fCBCmd->SetGuidance("Set number of bins of clusters.");
0076   fCBCmd->SetParameterName("Cbins", false);
0077   fCBCmd->SetRange("Cbins>0");
0078   fCBCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0079 
0080   fCMCmd = new G4UIcmdWithAnInteger("/testem/phys/setMaxCl", this);
0081   fCMCmd->SetGuidance("Set max number of clusters.");
0082   fCMCmd->SetParameterName("Cmax", false);
0083   fCMCmd->SetRange("Cmax>0");
0084   fCMCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0085 
0086   fListCmd = new G4UIcmdWithAString("/testem/phys/addPhysics", this);
0087   fListCmd->SetGuidance("Add modula physics list.");
0088   fListCmd->SetParameterName("PList", false);
0089   fListCmd->AvailableForStates(G4State_PreInit);
0090 
0091   fADCCmd = new G4UIcmdWithADoubleAndUnit("/testem/phys/setEnergyPerChannel", this);
0092   fADCCmd->SetGuidance("Set energy per ADC channel");
0093   fADCCmd->SetParameterName("enadc", false, false);
0094   fADCCmd->SetUnitCategory("Energy");
0095   fADCCmd->SetDefaultUnit("keV");
0096   fADCCmd->SetRange("enadc>0.");
0097   fADCCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0098 
0099   fNorCmd = new G4UIcmdWithADouble("/testem/phys/setNormFactor", this);
0100   fNorCmd->SetGuidance("Set factor for histogram normalisation");
0101   fNorCmd->SetParameterName("nfac", false, false);
0102   fNorCmd->SetRange("nfac>0.");
0103   fNorCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0104 
0105   fSmCmd = new G4UIcmdWithADoubleAndUnit("/testem/phys/setEnergySmear", this);
0106   fSmCmd->SetGuidance("Set intrinsic width of detector response");
0107   fSmCmd->SetParameterName("sm", false, false);
0108   fSmCmd->SetDefaultUnit("keV");
0109   fSmCmd->SetRange("sm>0.");
0110   fSmCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0111 }
0112 
0113 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0114 
0115 PhysicsListMessenger::~PhysicsListMessenger()
0116 {
0117   delete fECmd;
0118   delete fEBCmd;
0119   delete fCBCmd;
0120   delete fCMCmd;
0121   delete fListCmd;
0122   delete fADCCmd;
0123   delete fNorCmd;
0124   delete fSmCmd;
0125   delete fPhysDir;
0126 }
0127 
0128 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0129 
0130 void PhysicsListMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0131 {
0132   TestParameters* man = TestParameters::GetPointer();
0133 
0134   if (command == fECmd) {
0135     man->SetMaxEnergy(fECmd->GetNewDoubleValue(newValue));
0136   }
0137   if (command == fEBCmd) {
0138     man->SetNumberBins(fEBCmd->GetNewIntValue(newValue));
0139   }
0140   if (command == fCBCmd) {
0141     man->SetNumberBinsCluster(fCBCmd->GetNewIntValue(newValue));
0142   }
0143   if (command == fCMCmd) {
0144     man->SetMaxCluster(fCMCmd->GetNewIntValue(newValue));
0145   }
0146   if (command == fListCmd) {
0147     fPhysicsList->AddPhysicsList(newValue);
0148   }
0149   if (command == fADCCmd) {
0150     man->SetEnergyPerChannel(fADCCmd->GetNewDoubleValue(newValue));
0151   }
0152   if (command == fNorCmd) {
0153     man->SetNormFactor(fNorCmd->GetNewDoubleValue(newValue));
0154   }
0155   if (command == fSmCmd) {
0156     man->SetEnergySmear(fSmCmd->GetNewDoubleValue(newValue));
0157   }
0158 }
0159 
0160 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......