Back to home page

EIC code displayed by LXR

 
 

    


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

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 /// \file B5/include/PrimaryGeneratorAction.hh
0028 /// \brief Definition of the B5::PrimaryGeneratorAction class
0029 
0030 #ifndef B5PrimaryGeneratorAction_h
0031 #define B5PrimaryGeneratorAction_h 1
0032 
0033 #include "G4VUserPrimaryGeneratorAction.hh"
0034 #include "globals.hh"
0035 
0036 #include <CLHEP/Units/SystemOfUnits.h>
0037 
0038 class G4ParticleGun;
0039 class G4GenericMessenger;
0040 class G4Event;
0041 class G4ParticleDefinition;
0042 
0043 namespace B5
0044 {
0045 
0046 /// Primary generator
0047 ///
0048 /// A single particle is generated.
0049 /// User can select
0050 /// - the initial momentum and angle
0051 /// - the momentum and angle spreads
0052 /// - random selection of a particle type from proton, kaon+, pi+, muon+, e+
0053 
0054 class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
0055 {
0056   public:
0057     PrimaryGeneratorAction();
0058     ~PrimaryGeneratorAction() override;
0059 
0060     void GeneratePrimaries(G4Event*) override;
0061 
0062     void SetMomentum(G4double val) { fMomentum = val; }
0063     G4double GetMomentum() const { return fMomentum; }
0064 
0065     void SetSigmaMomentum(G4double val) { fSigmaMomentum = val; }
0066     G4double GetSigmaMomentum() const { return fSigmaMomentum; }
0067 
0068     void SetSigmaAngle(G4double val) { fSigmaAngle = val; }
0069     G4double GetSigmaAngle() const { return fSigmaAngle; }
0070 
0071     void SetRandomize(G4bool val) { fRandomizePrimary = val; }
0072     G4bool GetRandomize() const { return fRandomizePrimary; }
0073 
0074   private:
0075     void DefineCommands();
0076 
0077     G4ParticleGun* fParticleGun = nullptr;
0078     G4GenericMessenger* fMessenger = nullptr;
0079     G4ParticleDefinition* fPositron = nullptr;
0080     G4ParticleDefinition* fMuon = nullptr;
0081     G4ParticleDefinition* fPion = nullptr;
0082     G4ParticleDefinition* fKaon = nullptr;
0083     G4ParticleDefinition* fProton = nullptr;
0084     G4double fMomentum = 1000. * CLHEP::MeV;
0085     G4double fSigmaMomentum = 50. * CLHEP::MeV;
0086     G4double fSigmaAngle = 2. * CLHEP::deg;
0087     G4bool fRandomizePrimary = true;
0088 };
0089 
0090 }  // namespace B5
0091 
0092 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0093 
0094 #endif