Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-03-29 07:51:51

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 PrimaryGeneratorAction.hh
0027 /// \brief Definition of the PrimaryGeneratorAction class
0028 
0029 #ifndef PrimaryGeneratorAction_h
0030 #define PrimaryGeneratorAction_h 1
0031 
0032 //---------------------------------------------------------------------------
0033 //
0034 // ClassName:   PrimaryGeneratorAction
0035 //
0036 // Description: Generate primary beam
0037 //
0038 // Authors: V.Grichine, V.Ivanchenko
0039 //
0040 // Modified:
0041 //
0042 //----------------------------------------------------------------------------
0043 //
0044 
0045 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0046 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0047 
0048 #include "G4Event.hh"
0049 #include "G4ParticleGun.hh"
0050 #include "G4ThreeVector.hh"
0051 #include "G4VUserPrimaryGeneratorAction.hh"
0052 #include "globals.hh"
0053 
0054 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0055 
0056 class PrimaryGeneratorMessenger;
0057 class DetectorConstruction;
0058 
0059 class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
0060 {
0061   public:
0062     // The constructor defines a ParticleGun object, which allows
0063     // shooting a beam of particles through the experimental set-up.
0064     PrimaryGeneratorAction(DetectorConstruction* pDet);
0065 
0066     // The destructor. It deletes the ParticleGun.
0067     virtual ~PrimaryGeneratorAction();
0068 
0069     // It reads the parameters of the primary particles.
0070     // Generates the primary event via the ParticleGun method.
0071     void GeneratePrimaries(G4Event* anEvent);
0072 
0073     // Get/Set methods
0074     void SetBeamEnergy(G4double val);
0075 
0076     inline void SetBeamSigmaE(G4double val) { fSigmaE = val; };
0077     inline void SetBeamX(G4double val) { fX0 = val; };
0078     inline void SetBeamY(G4double val) { fY0 = val; };
0079     inline void SetBeamZ(G4double val) { fZ0 = val; };
0080     inline void SetBeamSigmaX(G4double val) { fSigmaX = val; };
0081     inline void SetBeamSigmaY(G4double val) { fSigmaY = val; };
0082     inline void SetBeamSigmaZ(G4double val) { fSigmaY = val; };
0083     inline void SetBeamMinCosTheta(G4double val) { fMinCosTheta = val; };
0084     inline void SetSigmaTheta(G4double val) { fSigmaTheta = val; };
0085     inline void SetVerbose(G4int val) { fVerbose = val; };
0086     inline void SetRandom(const G4String& type) { fGauss = type; };
0087 
0088     G4bool GetVerbose() const { return fVerbose; }
0089 
0090   private:
0091     void InitializeMe();
0092 
0093     PrimaryGeneratorAction& operator=(const PrimaryGeneratorAction& right);
0094     PrimaryGeneratorAction(const PrimaryGeneratorAction&);
0095 
0096     G4int fVerbose;
0097     PrimaryGeneratorMessenger* fMessenger;
0098     G4ParticleGun* fParticleGun;
0099     DetectorConstruction* fDetector;
0100 
0101     G4int fCounter;
0102     G4double fX0, fY0, fZ0;
0103     G4double fSigmaX, fSigmaY, fSigmaZ;
0104     G4double fRMax2;
0105     G4double fSigmaE;
0106     G4double fSigmaTheta;
0107     G4double fEnergy;
0108     G4double fMinCosTheta;
0109     G4ThreeVector fPosition;
0110     G4ThreeVector fDirection;
0111     G4String fGauss;
0112 };
0113 
0114 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0115 
0116 #endif