Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:22:13

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 //
0027 // ------------------------------------------------------------
0028 //      GEANT 4 class implementation file
0029 //      CERN Geneva Switzerland
0030 //
0031 //
0032 //      ------------ GammaRayTelPrimaryGeneratorMessenger  ------
0033 //           by G.Santin, F.Longo & R.Giannitrapani (13 nov 2000)
0034 //
0035 // ************************************************************
0036 
0037 #include "GammaRayTelPrimaryGeneratorMessenger.hh"
0038 #include "GammaRayTelPrimaryGeneratorAction.hh"
0039 
0040 #include "G4SystemOfUnits.hh"
0041 #include "G4UIcmdWithAnInteger.hh"
0042 #include "G4UIcmdWithAString.hh"
0043 #include "G4UIcmdWithADoubleAndUnit.hh"
0044 #include "G4UIcmdWithABool.hh"
0045 
0046 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0047 
0048 GammaRayTelPrimaryGeneratorMessenger::GammaRayTelPrimaryGeneratorMessenger(GammaRayTelPrimaryGeneratorAction *GammaRayTelGun) : GammaRayTelAction(GammaRayTelGun) {
0049     rndmCmd = new G4UIcmdWithAString("/gun/random", this);
0050     rndmCmd->SetGuidance("Shoot randomly the incident particle.");
0051     rndmCmd->SetGuidance("Choice : on(default), off");
0052     rndmCmd->SetParameterName("choice", true);
0053     rndmCmd->SetDefaultValue("on");
0054     rndmCmd->SetCandidates("on off");
0055     rndmCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0056 
0057     sourceTypeCmd = new G4UIcmdWithAnInteger("/gun/sourceType", this);
0058     sourceTypeCmd->SetGuidance("Select the type of incident flux.");
0059     sourceTypeCmd->SetGuidance("Choice : 0(default), 1(isotropic), 2(wide parallel beam)");
0060     sourceTypeCmd->SetParameterName("choice", true);
0061     sourceTypeCmd->SetDefaultValue((G4int) 0);
0062     sourceTypeCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0063 
0064     vertexRadiusCmd = new G4UIcmdWithADoubleAndUnit("/gun/vertexRadius", this);
0065     vertexRadiusCmd->SetGuidance("Radius (and unit) of sphere for vertices of incident flux.");
0066     vertexRadiusCmd->SetParameterName("choice", true);
0067     vertexRadiusCmd->SetDefaultValue((G4double) 1. * cm);
0068     vertexRadiusCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0069 
0070     spectrumTypeCmd = new G4UIcmdWithAnInteger("/gun/spectrumType", this);
0071     spectrumTypeCmd->SetGuidance("Select the type of incident spectrum.");
0072     spectrumTypeCmd->SetGuidance("Choice : 0(default), 1(), 2(E^{-gamma}), 3()");
0073     spectrumTypeCmd->SetParameterName("choice", true);
0074     spectrumTypeCmd->SetDefaultValue((G4int) 0);
0075     spectrumTypeCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0076 
0077     sourceGenCmd = new G4UIcmdWithABool("/gun/sourceGen", this);
0078     sourceGenCmd->SetGuidance("Select the native Generation");
0079     sourceGenCmd->SetGuidance("  Choice : true(native), false(GPS)");
0080     sourceGenCmd->SetParameterName("choice", true);
0081     sourceGenCmd->SetDefaultValue((G4bool) true);
0082     sourceGenCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0083 }
0084 
0085 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0086 
0087 GammaRayTelPrimaryGeneratorMessenger::~GammaRayTelPrimaryGeneratorMessenger() {
0088     delete rndmCmd;
0089     delete sourceTypeCmd;
0090     delete vertexRadiusCmd;
0091     delete spectrumTypeCmd;
0092     delete sourceGenCmd;
0093 }
0094 
0095 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0096 
0097 void GammaRayTelPrimaryGeneratorMessenger::SetNewValue(G4UIcommand *command, G4String newValue) {
0098     if (command == rndmCmd) {
0099         GammaRayTelAction->SetRndmFlag(newValue);
0100     } else if (command == sourceTypeCmd) {
0101         GammaRayTelAction->SetSourceType(sourceTypeCmd->GetNewIntValue(newValue));
0102     } else if (command == vertexRadiusCmd) {
0103         GammaRayTelAction->SetVertexRadius(vertexRadiusCmd->GetNewDoubleValue(newValue));
0104     } else if (command == spectrumTypeCmd) {
0105         GammaRayTelAction->SetSpectrumType(spectrumTypeCmd->GetNewIntValue(newValue));
0106     } else if (command == sourceGenCmd) {
0107         GammaRayTelAction->SetSourceGen(sourceGenCmd->GetNewBoolValue(newValue));
0108     }
0109 }