Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-17 07:51:37

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 #ifndef PrimaryGeneratorAction_h
0028 #define PrimaryGeneratorAction_h 1
0029 
0030 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
0031 
0032 #include "G4VUserPrimaryGeneratorAction.hh"
0033 #include "globals.hh"
0034 
0035 class G4Event;
0036 class G4ParticleGun;
0037 
0038 class G4IAEAphspReader;
0039 class PrimaryGeneratorMessenger;
0040 class DetectorConstruction;
0041 
0042 
0043 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
0044 
0045 class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
0046 {
0047 public:
0048 
0049   // The constructor defines a ParticleGun object, which allows
0050   // shooting a beam of particles through the experimental set-up.
0051   // It also needs a pointer to G4IAEAphspReader object in case we need to
0052   // read particles from an IAEAphsp file
0053   PrimaryGeneratorAction(const G4int threads);
0054 
0055   //The destructor. It deletes the ParticleGun.
0056   virtual ~PrimaryGeneratorAction() override;
0057  
0058   //Generates the primary event via the ParticleGun method,
0059   // and from the IAEA phase-space file.
0060   void GeneratePrimaries(G4Event* anEvent) override;
0061 
0062   //Get/Set methods
0063   inline void SetKinE(const G4double val)  { fKinE = val; };
0064   inline void SetDE(const G4double val)    { fDE = val; };
0065   inline void SetX0(const G4double val)  { fX0 = val;};
0066   inline void SetY0(const G4double val)  { fY0 = val;};
0067   inline void SetZ0(const G4double val)  { fZ0 = val;};
0068   inline void SetDX(const G4double val)  { fDX = val;};
0069   inline void SetDY(const G4double val)  { fDY = val;};
0070   inline void SetDZ(const G4double val)  { fDZ = val;};
0071   inline void SetVerbose(const G4int val) { fVerbose = val;};
0072 
0073   void SetIAEAphspReader(const G4String filename);
0074 
0075   inline G4int GetVerbose() const { return fVerbose; }
0076   inline G4IAEAphspReader* GetIAEAphspReader() const  {return fIAEAphspReader;}
0077 
0078 
0079 private:
0080 
0081   // Phase space reader
0082   G4IAEAphspReader* fIAEAphspReader = nullptr;
0083   G4int             fThreads;
0084   G4String          fIAEAphspReaderName;
0085 
0086   G4int fVerbose;
0087   PrimaryGeneratorMessenger* fMessenger;
0088   G4ParticleGun* fParticleGun;
0089 
0090   G4int fCounter;
0091   G4double fKinE, fDE;
0092   G4double fX0, fY0, fZ0;
0093   G4double fDX, fDY, fDZ;
0094 
0095 };
0096 
0097 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0098 
0099 #endif