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 // Author: M.A. Cortes-Giraldo
0027 //
0028 // 2025-08-27: Its objects work in local runs, their mission is to store the
0029 //   info of the particles to be written in the IAEAphsp output files at
0030 //   the end of the run. In other words, they constitute a stack for
0031 //   IAEAphsp particles until the run finishes, when the IAEAphsp file is
0032 //   actually written.
0033 //
0034 
0035 #ifndef G4IAEAphspWriterStack_hh
0036 #define G4IAEAphspWriterStack_hh 1
0037 
0038 
0039 #include "globals.hh"
0040 #include "G4ThreeVector.hh"
0041 
0042 #include <set>
0043 #include <vector>
0044 
0045 class G4IAEAphspWriter;
0046 class G4Step;
0047 
0048 
0049 class G4IAEAphspWriterStack
0050 {
0051 
0052 public:
0053 
0054   G4IAEAphspWriterStack(const G4String filename);
0055   ~G4IAEAphspWriterStack();
0056 
0057   void AddZphsp(const G4double zphsp);
0058   void ClearZphspVec();
0059   void SetDataFromWriter(const G4IAEAphspWriter* );
0060   void PrepareRun();
0061   void PrepareNextEvent();
0062   void StoreParticleIfEligible(const G4Step*);
0063   void ClearRunVectors();
0064 
0065   void SetFileName(const G4String name)   { fFileName = name; }
0066 
0067   const G4String GetFileName() const                       {return fFileName;}
0068   const std::vector<G4double>* GetZphspVec() const         {return fZphspVec;}
0069   std::vector<std::vector<G4int>* >* GetPDGMtrx() const    {return fPDGMtrx;}
0070   std::vector<std::vector<G4ThreeVector>* >* GetPosMtrx() const
0071   {return fPosMtrx;}
0072   std::vector<std::vector<G4ThreeVector>* >* GetMomMtrx() const
0073   {return fMomMtrx;}
0074   std::vector<std::vector<G4double>* >* GetEneMtrx() const {return fEneMtrx;}
0075   std::vector<std::vector<G4double>* >* GetWtMtrx() const  {return fWtMtrx;}
0076   std::vector<std::vector<G4int>* >* GetNstatMtrx() const  {return fNstatMtrx;}
0077 
0078   
0079 private:
0080 
0081   G4IAEAphspWriterStack() = default;
0082   void StoreIAEAParticle(const G4Step* aStep, const G4int zStopIdx,
0083              const G4int pdgCode);
0084 
0085 
0086   // ------------
0087   // DATA MEMBERS
0088   // ------------
0089   
0090   // FILE PROPERTIES
0091 
0092   G4String fFileName;
0093   // Must include the path but not any of the IAEA extensions.
0094   // (This is set from G4IAEAphspWriter)
0095 
0096   std::vector<G4double>* fZphspVec = nullptr;
0097   // Vector storing the z-value of the phsp planes.
0098 
0099   // COUNTERS & TAGS
0100 
0101   std::vector<G4int>* fIncrNumberVec = nullptr;
0102   // Book-keeping of the number of previous events without having particles
0103   // crossing the phsp plane.
0104   // (i.e., the current incremental history number, or n_stat, of each phsp)
0105 
0106   std::vector< std::set<G4int>* >* fPassingTracksVec = nullptr;
0107   // Each set is meant to store the track ID of every particle
0108   // crossing one of the planes during an event.
0109   // This is done to avoid registering multiple crosses in the phsp file.
0110 
0111   // INFORMATION STORED DURING RUN
0112 
0113   // First component is the phsp plane, according to registration ordering.
0114   // Second components are the dynamic variables.
0115   std::vector< std::vector<G4int>* >*         fPDGMtrx = nullptr;
0116   std::vector< std::vector<G4ThreeVector>* >* fPosMtrx = nullptr;
0117   std::vector< std::vector<G4ThreeVector>* >* fMomMtrx = nullptr;
0118   std::vector< std::vector<G4double>* >*      fEneMtrx = nullptr;
0119   std::vector< std::vector<G4double>* >*      fWtMtrx = nullptr;
0120   std::vector< std::vector<G4int>* >*         fNstatMtrx = nullptr;
0121 
0122 };
0123 
0124 #endif