Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-17 07:52:14

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 // gpaterno, October 2025
0027 //
0028 /// \file PrimaryGeneratorActionMessenger.cc
0029 /// \brief Implementation of the PrimaryGeneratorActionMessenger class
0030 //
0031 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0032 
0033 #include "PrimaryGeneratorActionMessenger.hh"
0034 #include "PrimaryGeneratorAction.hh"
0035 
0036 #include "G4UIcmdWithABool.hh"
0037 #include "G4UIcmdWithAString.hh"
0038 #include "G4UIcmdWithADoubleAndUnit.hh"
0039 #include "G4UIcmdWithADouble.hh"
0040 
0041 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0042 
0043 PrimaryGeneratorActionMessenger::PrimaryGeneratorActionMessenger(PrimaryGeneratorAction* pg):
0044 fPrimaryGeneratorAction(pg)
0045 {     
0046     fUseGPSCmd = new G4UIcmdWithABool("/gun/UseGPS", this);
0047     fUseGPSCmd->SetGuidance("Choice : (1) true, (0) false.");
0048     fUseGPSCmd->SetParameterName("setGPS", true);
0049     fUseGPSCmd->SetDefaultValue(false);
0050     
0051          
0052     fPrimaryTypeCmd = new G4UIcmdWithAString("/gun/primaryType",this);
0053     fPrimaryTypeCmd->SetParameterName("primaryType",true);
0054     fPrimaryTypeCmd->SetDefaultValue("e-");
0055       
0056     fPrimaryEnergyCmd = new G4UIcmdWithADoubleAndUnit("/gun/primaryEnergy",this);
0057     fPrimaryEnergyCmd->SetParameterName("primaryEnergy",true);
0058     fPrimaryEnergyCmd->SetDefaultValue(6);
0059     fPrimaryEnergyCmd->SetDefaultUnit("GeV");
0060       
0061     fPrimaryRelSigmaEnergyCmd = new G4UIcmdWithADouble("/gun/primaryRelSigmaEnergy",this);
0062     fPrimaryRelSigmaEnergyCmd->SetParameterName("primaryRelSigmaEnergy",true);
0063     fPrimaryRelSigmaEnergyCmd->SetDefaultValue(1.0e-3);
0064     
0065     fPrimaryXCmd = new G4UIcmdWithADoubleAndUnit("/gun/primaryX",this);
0066     fPrimaryXCmd->SetParameterName("primaryX",true);
0067     fPrimaryXCmd->SetDefaultValue(0);
0068     fPrimaryXCmd->SetDefaultUnit("mm");
0069 
0070     fPrimaryYCmd = new G4UIcmdWithADoubleAndUnit("/gun/primaryY",this);
0071     fPrimaryYCmd->SetParameterName("primaryY",true);
0072     fPrimaryYCmd->SetDefaultValue(0);
0073     fPrimaryYCmd->SetDefaultUnit("mm");
0074   
0075     fPrimaryZCmd = new G4UIcmdWithADoubleAndUnit("/gun/primaryZ",this);
0076     fPrimaryZCmd->SetParameterName("primaryZ",true);
0077     fPrimaryZCmd->SetDefaultValue(0);
0078     fPrimaryZCmd->SetDefaultUnit("mm");
0079 
0080     fPrimaryTCmd = new G4UIcmdWithADoubleAndUnit("/gun/primaryT",this);
0081     fPrimaryTCmd->SetParameterName("primaryT",true);
0082     fPrimaryTCmd->SetDefaultValue(0);
0083     fPrimaryTCmd->SetDefaultUnit("ns");
0084       
0085     fPrimaryXpCmd = new G4UIcmdWithADoubleAndUnit("/gun/primaryXp",this);
0086     fPrimaryXpCmd->SetParameterName("primaryXp",true);
0087     fPrimaryXpCmd->SetDefaultValue(0);
0088     fPrimaryXpCmd->SetDefaultUnit("rad");
0089     
0090     fPrimaryYpCmd = new G4UIcmdWithADoubleAndUnit("/gun/primaryYp",this);
0091     fPrimaryYpCmd->SetParameterName("primaryYp",true);
0092     fPrimaryYpCmd->SetDefaultValue(0);
0093     fPrimaryYpCmd->SetDefaultUnit("rad");   
0094            
0095     fPrimarySigmaXCmd = new G4UIcmdWithADoubleAndUnit("/gun/primarySigmaX",this);
0096     fPrimarySigmaXCmd->SetParameterName("primarySigmaX",true);
0097     fPrimarySigmaXCmd->SetDefaultValue(0);
0098     fPrimarySigmaXCmd->SetDefaultUnit("mm");
0099 
0100     fPrimarySigmaYCmd = new G4UIcmdWithADoubleAndUnit("/gun/primarySigmaY",this);
0101     fPrimarySigmaYCmd->SetParameterName("primarySigmaY",true);
0102     fPrimarySigmaYCmd->SetDefaultValue(0);
0103     fPrimarySigmaYCmd->SetDefaultUnit("mm");
0104 
0105     fPrimarySigmaZCmd = new G4UIcmdWithADoubleAndUnit("/gun/primarySigmaZ",this);
0106     fPrimarySigmaZCmd->SetParameterName("primarySigmaZ",true);
0107     fPrimarySigmaZCmd->SetDefaultValue(0);
0108     fPrimarySigmaZCmd->SetDefaultUnit("mm");
0109   
0110     fPrimarySigmaTCmd = new G4UIcmdWithADoubleAndUnit("/gun/primarySigmaT",this);
0111     fPrimarySigmaTCmd->SetParameterName("primarySigmaT",true);
0112     fPrimarySigmaTCmd->SetDefaultValue(0);
0113     fPrimarySigmaTCmd->SetDefaultUnit("ns");
0114   
0115     fPrimarySigmaXpCmd = new G4UIcmdWithADoubleAndUnit("/gun/primarySigmaXp",this);
0116     fPrimarySigmaXpCmd->SetParameterName("primarySigmaXp",true);
0117     fPrimarySigmaXpCmd->SetDefaultValue(1.0e-5);
0118     fPrimarySigmaXpCmd->SetDefaultUnit("rad");
0119   
0120     fPrimarySigmaYpCmd = new G4UIcmdWithADoubleAndUnit("/gun/primarySigmaYp",this);
0121     fPrimarySigmaYpCmd->SetParameterName("primarySigmaYp",true);
0122     fPrimarySigmaYpCmd->SetDefaultValue(1.0e-5);
0123     fPrimarySigmaYpCmd->SetDefaultUnit("rad");
0124 }
0125 
0126 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0127 
0128 PrimaryGeneratorActionMessenger::~PrimaryGeneratorActionMessenger()
0129 {
0130     delete fUseGPSCmd;
0131       
0132     delete fPrimaryTypeCmd; 
0133     delete fPrimaryEnergyCmd; 
0134     delete fPrimaryRelSigmaEnergyCmd;
0135     delete fPrimaryXCmd;  
0136     delete fPrimaryYCmd;
0137     delete fPrimaryZCmd;
0138     delete fPrimaryTCmd;
0139     delete fPrimaryXpCmd;
0140     delete fPrimaryYpCmd;   
0141     delete fPrimarySigmaXCmd; 
0142     delete fPrimarySigmaYCmd; 
0143     delete fPrimarySigmaZCmd;
0144     delete fPrimarySigmaTCmd; 
0145     delete fPrimarySigmaXpCmd; 
0146     delete fPrimarySigmaYpCmd;
0147 }
0148 
0149 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0150 
0151 void PrimaryGeneratorActionMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0152 {                       
0153     if (command == fPrimaryTypeCmd) {
0154         fPrimaryGeneratorAction->SetType(newValue);
0155     }          
0156     if (command == fPrimaryEnergyCmd) {
0157         fPrimaryGeneratorAction->SetEnergy(fPrimaryEnergyCmd->GetNewDoubleValue(newValue));
0158     }
0159     if (command == fPrimaryRelSigmaEnergyCmd) {
0160         fPrimaryGeneratorAction->
0161             SetRelSigmaEnergy(fPrimaryRelSigmaEnergyCmd->GetNewDoubleValue(newValue));
0162     }
0163     if (command == fPrimaryXCmd) {
0164         fPrimaryGeneratorAction->SetX(fPrimaryXCmd->GetNewDoubleValue(newValue));
0165     }
0166     if (command == fPrimaryYCmd) {
0167         fPrimaryGeneratorAction->SetY(fPrimaryYCmd->GetNewDoubleValue(newValue));
0168     }  
0169     if (command == fPrimaryZCmd) {
0170         fPrimaryGeneratorAction->SetZ(fPrimaryZCmd->GetNewDoubleValue(newValue));
0171     }  
0172     if (command == fPrimaryTCmd) {
0173         fPrimaryGeneratorAction->SetT(fPrimaryTCmd->GetNewDoubleValue(newValue));
0174     }  
0175     if (command == fPrimaryXpCmd) {
0176         fPrimaryGeneratorAction->SetXp(fPrimaryXpCmd->GetNewDoubleValue(newValue));
0177     }
0178     if (command == fPrimaryYpCmd) {
0179         fPrimaryGeneratorAction->SetYp(fPrimaryYpCmd->GetNewDoubleValue(newValue));
0180     }  
0181     if (command == fPrimarySigmaXCmd) {
0182         fPrimaryGeneratorAction->SetSigmaX(fPrimarySigmaXCmd->GetNewDoubleValue(newValue));
0183     }
0184     if (command == fPrimarySigmaYCmd) {
0185         fPrimaryGeneratorAction->SetSigmaY(fPrimarySigmaYCmd->GetNewDoubleValue(newValue));
0186     }
0187     if (command == fPrimarySigmaZCmd) {
0188         fPrimaryGeneratorAction->SetSigmaZ(fPrimarySigmaZCmd->GetNewDoubleValue(newValue));
0189     }
0190     if (command == fPrimarySigmaTCmd) {
0191         fPrimaryGeneratorAction->SetSigmaT(fPrimarySigmaTCmd->GetNewDoubleValue(newValue));
0192     }
0193     if (command == fPrimarySigmaXpCmd) {
0194         fPrimaryGeneratorAction->SetSigmaXp(fPrimarySigmaXpCmd->GetNewDoubleValue(newValue));
0195     }
0196     if (command == fPrimarySigmaYpCmd) {
0197         fPrimaryGeneratorAction->SetSigmaYp(fPrimarySigmaYpCmd->GetNewDoubleValue(newValue));
0198     }       
0199 }
0200 
0201 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0202