Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-17 07:52: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 // gpaterno, October 2025
0027 //
0028 /// \file PrimaryGeneratorAction.hh
0029 /// \brief Description of the PrimaryGeneratorAction class
0030 //
0031 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0032 
0033 #ifndef PrimaryGeneratorAction_h
0034 #define PrimaryGeneratorAction_h 1
0035 
0036 #include "PrimaryGeneratorActionMessenger.hh"
0037 
0038 #include "G4VUserPrimaryGeneratorAction.hh"
0039 #include "globals.hh"
0040 #include "G4SystemOfUnits.hh"
0041 
0042 class G4GeneralParticleSource;
0043 class G4ParticleGun;
0044 class G4Event;
0045 
0046 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0047 
0048 /// PrimaryGeneratorAction class. We have both the GPS and a Particle Gun.  
0049 /// A set of custom commands based on the Particle Gun are defined to better 
0050 /// simulate a bunch of particles in a particle accelerator.  
0051 
0052 class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
0053 {
0054 public:
0055     PrimaryGeneratorAction();
0056     ~PrimaryGeneratorAction() override;
0057     
0058     void GeneratePrimaries(G4Event*) override;
0059     
0060     void SetUseGPS(G4bool vBool) {fUseGPS = vBool;};
0061     
0062     void SetType(G4String val) {fType = val;}   
0063     void SetEnergy(G4double val) {fEnergy = val;}
0064     void SetRelSigmaEnergy(G4double val) {fRelSigmaEnergy = val;}
0065     void SetX(G4double val) {fX = val;}
0066     void SetY(G4double val) {fY = val;}
0067     void SetZ(G4double val) {fZ = val;}
0068     void SetT(G4double val) {fT = val;}
0069     void SetXp(G4double val) {fXp = val;}
0070     void SetYp(G4double val) {fYp = val;}
0071     void SetSigmaX(G4double val) {fSigmaX = val;}
0072     void SetSigmaY(G4double val) {fSigmaY = val;}
0073     void SetSigmaZ(G4double val) {fSigmaZ = val;}
0074     void SetSigmaT(G4double val) {fSigmaT = val;}
0075     void SetSigmaXp(G4double val) {fSigmaXp = val;}
0076     void SetSigmaYp(G4double val) {fSigmaYp = val;}
0077    
0078 private:
0079     PrimaryGeneratorActionMessenger* fMessenger{nullptr};
0080 
0081     G4GeneralParticleSource* fGPS{nullptr};
0082     G4ParticleGun* fGun{nullptr};
0083         
0084     G4bool fUseGPS = false;
0085     
0086     G4String fType = "e-";
0087     G4double fEnergy = 2.86*GeV;
0088     G4double fRelSigmaEnergy = 1.e-3;
0089     G4double fX = 0*mm;
0090     G4double fY = 0*mm;
0091     G4double fZ = -30*mm;
0092     G4double fT = 0*ns;
0093     G4double fXp = 0;
0094     G4double fYp = 0;
0095     G4double fSigmaX = 1.*mm;
0096     G4double fSigmaY = 1.*mm;
0097     G4double fSigmaZ = 1.*mm;
0098     G4double fSigmaT = 0.*ns;
0099     G4double fSigmaXp = 1.e-5;
0100     G4double fSigmaYp = 1.e-5;  
0101 };
0102 
0103 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0104 
0105 #endif
0106