Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-04 08:05:12

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 hadronic/Hadr02/src/DetectorMessenger.cc
0027 /// \brief Implementation of the DetectorMessenger class
0028 //
0029 //
0030 /////////////////////////////////////////////////////////////////////////
0031 //
0032 // DetectorMessenger
0033 //
0034 // Created: 31.01.03 V.Ivanchenko
0035 //
0036 // Modified:
0037 // 04.06.2006 Adoptation of hadr01 (V.Ivanchenko)
0038 // 16.11.2006 Add beamCmd (V.Ivanchenko)
0039 //
0040 ////////////////////////////////////////////////////////////////////////
0041 //
0042 
0043 #include "DetectorMessenger.hh"
0044 
0045 #include "DetectorConstruction.hh"
0046 #include "HistoManager.hh"
0047 
0048 #include "G4PhysicalConstants.hh"
0049 #include "G4SystemOfUnits.hh"
0050 #include "G4UIcmdWith3Vector.hh"
0051 #include "G4UIcmdWithABool.hh"
0052 #include "G4UIcmdWithADoubleAndUnit.hh"
0053 #include "G4UIcmdWithAString.hh"
0054 #include "G4UIcmdWithAnInteger.hh"
0055 #include "G4UIcmdWithoutParameter.hh"
0056 #include "G4UIdirectory.hh"
0057 
0058 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0059 
0060 DetectorMessenger::DetectorMessenger(DetectorConstruction* det)
0061   : G4UImessenger(),
0062     fDetector(det),
0063     fTestDir(0),
0064     fMatCmd(0),
0065     fMat1Cmd(0),
0066     fIonCmd(0),
0067     fRCmd(0),
0068     fLCmd(0),
0069     fEdepCmd(0),
0070     fBinCmd(0),
0071     fNOfAbsCmd(0),
0072     fVerbCmd(0),
0073     fBeamCmd(0)
0074 {
0075   fTestDir = new G4UIdirectory("/testhadr/");
0076   fTestDir->SetGuidance(" Hadronic Extended Example.");
0077 
0078   fMatCmd = new G4UIcmdWithAString("/testhadr/TargetMat", this);
0079   fMatCmd->SetGuidance("Select Material for the target");
0080   fMatCmd->SetParameterName("tMaterial", false);
0081   fMatCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0082 
0083   fMat1Cmd = new G4UIcmdWithAString("/testhadr/WorldMat", this);
0084   fMat1Cmd->SetGuidance("Select Material for world");
0085   fMat1Cmd->SetParameterName("wMaterial", false);
0086   fMat1Cmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0087 
0088   fIonCmd = new G4UIcmdWithAString("/testhadr/ionPhysics", this);
0089   fIonCmd->SetGuidance("Select ion Physics");
0090   fIonCmd->SetParameterName("DPMJET", false);
0091   fIonCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0092 
0093   fRCmd = new G4UIcmdWithADoubleAndUnit("/testhadr/TargetRadius", this);
0094   fRCmd->SetGuidance("Set radius of the target");
0095   fRCmd->SetParameterName("radius", false);
0096   fRCmd->SetUnitCategory("Length");
0097   fRCmd->SetRange("radius>0");
0098   fRCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0099 
0100   fLCmd = new G4UIcmdWithADoubleAndUnit("/testhadr/TargetLength", this);
0101   fLCmd->SetGuidance("Set length of the target");
0102   fLCmd->SetParameterName("length", false);
0103   fLCmd->SetUnitCategory("Length");
0104   fLCmd->SetRange("length>0");
0105   fLCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0106 
0107   fBinCmd = new G4UIcmdWithAnInteger("/testhadr/NumberOfBinsE", this);
0108   fBinCmd->SetGuidance("Set number of bins for Energy");
0109   fBinCmd->SetParameterName("NEbins", false);
0110   fBinCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0111 
0112   fNOfAbsCmd = new G4UIcmdWithAnInteger("/testhadr/NumberDivZ", this);
0113   fNOfAbsCmd->SetGuidance("Set number of slices");
0114   fNOfAbsCmd->SetParameterName("NZ", false);
0115   fNOfAbsCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0116 
0117   fEdepCmd = new G4UIcmdWithADoubleAndUnit("/testhadr/MaxEdep", this);
0118   fEdepCmd->SetGuidance("Set max energy in histogram");
0119   fEdepCmd->SetParameterName("edep", false);
0120   fEdepCmd->SetUnitCategory("Energy");
0121   fEdepCmd->SetRange("edep>0");
0122   fEdepCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0123 
0124   fBeamCmd = new G4UIcmdWithABool("/testhadr/DefaultBeamPosition", this);
0125   fBeamCmd->SetGuidance("show inelastic and elastic cross sections");
0126 
0127   fVerbCmd = new G4UIcmdWithAnInteger("/testhadr/Verbose", this);
0128   fVerbCmd->SetGuidance("Set verbose for ");
0129   fVerbCmd->SetParameterName("verb", false);
0130   fVerbCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0131 }
0132 
0133 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0134 
0135 DetectorMessenger::~DetectorMessenger()
0136 {
0137   delete fMatCmd;
0138   delete fMat1Cmd;
0139   delete fIonCmd;
0140   delete fRCmd;
0141   delete fLCmd;
0142   delete fNOfAbsCmd;
0143   delete fTestDir;
0144   delete fBeamCmd;
0145   delete fVerbCmd;
0146   delete fEdepCmd;
0147 }
0148 
0149 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0150 
0151 void DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0152 {
0153   HistoManager* h = HistoManager::GetPointer();
0154   if (command == fMatCmd) {
0155     fDetector->SetTargetMaterial(newValue);
0156   }
0157   else if (command == fMat1Cmd) {
0158     fDetector->SetWorldMaterial(newValue);
0159   }
0160   else if (command == fIonCmd) {
0161     h->SetIonPhysics(newValue);
0162   }
0163   else if (command == fRCmd) {
0164     fDetector->SetTargetRadius(fRCmd->GetNewDoubleValue(newValue));
0165   }
0166   else if (command == fLCmd) {
0167     h->SetTargetLength(fLCmd->GetNewDoubleValue(newValue));
0168   }
0169   else if (command == fNOfAbsCmd) {
0170     h->SetNumberOfSlices(fNOfAbsCmd->GetNewIntValue(newValue));
0171   }
0172   else if (command == fBinCmd) {
0173     h->SetNumberOfBinsE(fBinCmd->GetNewIntValue(newValue));
0174   }
0175   else if (command == fVerbCmd) {
0176     h->SetVerbose(fVerbCmd->GetNewIntValue(newValue));
0177   }
0178   else if (command == fBeamCmd) {
0179     h->SetDefaultBeamPositionFlag(fBeamCmd->GetNewBoolValue(newValue));
0180   }
0181   else if (command == fEdepCmd) {
0182     h->SetMaxEnergyDeposit(fEdepCmd->GetNewDoubleValue(newValue));
0183   }
0184 }
0185 
0186 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......