Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:21:58

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 PrimaryGeneratorSource.hh
0028 /// \brief Header file for Primary Generator Source class for Molecular DNA simulation
0029 
0030 #ifndef MOLECULAR_PRIMARY_GENERATORSOURCE_HH
0031 #define MOLECULAR_PRIMARY_GENERATORSOURCE_HH
0032 
0033 #include "G4ParticleDefinition.hh"
0034 #include "G4ParticleTable.hh"
0035 #include "G4ThreeVector.hh"
0036 
0037 #include <fstream>
0038 #include <list>
0039 
0040 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0041 // - Abstract PrimaryGeneratorSource
0042 //        - pure virtual functions
0043 // - Implementations:
0044 //        - PrimaryGeneratorSourceGRASCSV
0045 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0046 
0047 // Class to handle Primary objects
0048 class Primary
0049 {
0050   public:
0051     // Primary class constructor
0052     Primary() { ; }
0053 
0054     // Primary class destructor
0055     ~Primary() = default;
0056 
0057     void SetName(const G4String& name) { fName = name; }
0058     void SetName(G4int PDGnum)
0059     {
0060       if (PDGnum != 0) {
0061         G4ParticleTable* pTable = G4ParticleTable::GetParticleTable();
0062         G4ParticleDefinition* particle = pTable->FindParticle(PDGnum);
0063         fName = particle->GetParticleName();
0064       }
0065       else {
0066         fName = "";
0067       }
0068     }
0069 
0070     G4String GetName() const { return fName; }
0071 
0072     void SetPosition(const G4ThreeVector& position) { fPosition = position; }
0073     G4ThreeVector GetPosition() const { return fPosition; }
0074 
0075     void SetMomentum(const G4ThreeVector& momentum) { fMomentum = momentum; }
0076     G4ThreeVector GetMomentum() const { return fMomentum; }
0077 
0078     void SetMomentumDirection(const G4ThreeVector& momentumDir) { fMomentumDir = momentumDir; }
0079     G4ThreeVector GetMomentumDirection() const { return fMomentumDir; }
0080 
0081     void SetEnergy(const G4double& energy) { fEnergy = energy; }
0082     G4double GetEnergy() const { return fEnergy; }
0083 
0084     G4ParticleDefinition* GetParticleDefinition()
0085     {
0086       G4ParticleTable* pTable = G4ParticleTable::GetParticleTable();
0087       G4ParticleDefinition* particle = pTable->FindParticle(fName.data());
0088       return particle;
0089     }
0090 
0091     void Print()
0092     {
0093       G4cout << " *** " << fName << " *** " << G4endl;
0094       G4cout << " * Position: " << fPosition << G4endl;
0095       G4cout << " * Momentum Direction: " << fMomentumDir << G4endl;
0096       G4cout << " * Energy: " << fEnergy << G4endl;
0097       G4cout << " ***  *** ***" << G4endl;
0098     }
0099 
0100   private:
0101     G4String fName;
0102     G4ThreeVector fPosition;
0103     G4ThreeVector fMomentum;
0104     G4ThreeVector fMomentumDir;
0105     G4double fEnergy;
0106 };
0107 
0108 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0109 
0110 class PrimaryGeneratorSource
0111 {
0112   public:
0113     // PrimaryGeneratorSource class destructor
0114     virtual ~PrimaryGeneratorSource() = default;
0115 
0116     // Define Primary class within PrimaryGeneratorSource
0117     virtual Primary* GetPrimary() = 0;
0118     virtual void SetBufferSize(G4int) = 0;
0119     virtual void SetnParticles(G4int) = 0;
0120 };
0121 
0122 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0123 
0124 #endif