Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:17:04

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 //
0028 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0029 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0030 
0031 #ifndef Run_h
0032 #define Run_h 1
0033 
0034 #include "G4Electron.hh"
0035 #include "G4Gamma.hh"
0036 #include "G4Positron.hh"
0037 #include "G4Run.hh"
0038 #include "globals.hh"
0039 
0040 #include <vector>
0041 
0042 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0043 //
0044 //// struct for keeping particle information
0045 // energy + momentum
0046 //
0047 struct ParticleInfo
0048 {
0049   G4float energy;
0050   G4float mx;
0051   G4float my;
0052   G4float mz;
0053   ParticleInfo(G4float e, G4float vx, G4float vy, G4float vz) : energy(e), mx(vx), my(vy), mz(vz) {}
0054 };
0055 
0056 // struct ParticleInfo
0057 // {
0058 //   G4float energy;
0059 //   G4float mx;
0060 //   G4float my;
0061 //   G4float mz;
0062 //   G4float x;
0063 //   G4float y;
0064 //   G4float z;
0065 //   ParticleInfo(G4float e, G4float vx, G4float vy, G4float vz,
0066 //                         G4float x0, G4float y0, G4float z0)
0067 //     : energy(e)
0068 //     , mx(vx)
0069 //     , my(vy)
0070 //     , mz(vz)
0071 //     , x(x0)
0072 //     , y(y0)
0073 //     , z(z0)
0074 //   {}
0075 // };
0076 
0077 struct RunInfo
0078 {
0079   uint8_t projectionIndex;  // 1 byte
0080   uint16_t sliceIndex;  //
0081   uint16_t pixelIndex;
0082   uint32_t nbParticle;  // 4 bytes
0083   RunInfo(uint8_t proI, uint16_t sI, uint16_t pI, uint32_t nb = 0)
0084     : projectionIndex(proI), sliceIndex(sI), pixelIndex(pI), nbParticle(nb)
0085   {}
0086 };
0087 
0088 class Run : public G4Run
0089 {
0090 public:
0091   Run(G4bool isP, G4int nbProjs, G4int nbSlices, G4int nbPixels, G4int resumeProjectionIndex);
0092   ~Run() override;
0093 
0094 public:
0095   void Merge(const G4Run*) override;
0096   void EndOfRun();
0097 
0098   G4bool GetIsPIXE();
0099   G4int GetCurrentProjection();
0100   G4int GetCurrentSlice();
0101   G4int GetCurrentPixel();
0102 
0103   void FillGammaAtExit(ParticleInfo gammaInfo);
0104   void FillGammaAtCreation(ParticleInfo gammaInfo);
0105   void FillProtonAtExit(ParticleInfo protonInfo);
0106 
0107   void ClearVecs();
0108   void WriteFile(const std::string fName, RunInfo& runInfo, std::vector<ParticleInfo>& vec);
0109 
0110 private:
0111   G4bool isPIXE;
0112   std::vector<ParticleInfo> gammaAtExit;  // gamma at exit for a run
0113   std::vector<ParticleInfo> gammaAtCreation;  // gamma at creation for a run
0114   std::vector<ParticleInfo> protonAtExit;  // proton at exit for a run
0115 
0116   G4int fProjectionIndex;
0117   G4int fSliceIndex;
0118   G4int fPixelIndex;
0119 
0120   G4int fNbProjections;
0121   G4int fNbSlices;
0122   G4int fNbPixels;
0123   G4int fResumeProjIndex;
0124 };
0125 
0126 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0127 
0128 #endif