Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:23

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 // G4HEPEvtInterface
0027 //
0028 // Class description:
0029 //
0030 // This is a concrete class of G4VPrimaryGenerator.
0031 // It reads an ASCII file which contains particles generated by a
0032 // physics generator which supports a /HEPEVT/ common block.
0033 // 
0034 // The format of ASCII file must be equivalent to the following sample
0035 // Fortran code:
0036 //
0037 //***********************************************************
0038 //      SUBROUTINE HEP2G4
0039 //*
0040 //* Output /HEPEVT/ event structure to G4HEPEvtInterface
0041 //*
0042 //***********************************************************
0043 //      PARAMETER (NMXHEP=2000)
0044 //      COMMON/HEPEVT/NEVHEP,NHEP,ISTHEP(NMXHEP),IDHEP(NMXHEP),
0045 //     >JMOHEP(2,NMXHEP),JDAHEP(2,NMXHEP),PHEP(5,NMXHEP),VHEP(4,NMXHEP)
0046 //      DOUBLE PRECISION PHEP,VHEP
0047 //*
0048 //      WRITE(6,*) NHEP
0049 //      DO IHEP=1,NHEP
0050 //       WRITE(6,10) 
0051 //     >  ISTHEP(IHEP),IDHEP(IHEP),JDAHEP(1,IHEP),JDAHEP(2,IHEP),
0052 //     >  PHEP(1,IHEP),PHEP(2,IHEP),PHEP(3,IHEP),PHEP(5,IHEP)
0053 //10    FORMAT(I4,I10,I5,I5,4(1X,D15.8))
0054 //      ENDDO
0055 //*
0056 //      RETURN
0057 //      END
0058 //
0059 // The position and time of the primary interaction must be set by the
0060 // corresponding set methods of G4VPrimaryGenerator base class, otherwise
0061 // zero will be set.
0062 
0063 // Author: Makoto Asai, 1997
0064 // --------------------------------------------------------------------
0065 #ifndef G4HEPEvtInterface_hh
0066 #define G4HEPEvtInterface_hh 1
0067 
0068 #include <fstream>
0069 #include <vector>
0070 
0071 #include "globals.hh"
0072 #include "G4VPrimaryGenerator.hh"
0073 #include "G4HEPEvtParticle.hh"
0074 
0075 class G4PrimaryVertex;
0076 class G4Event;
0077 
0078 class G4HEPEvtInterface : public G4VPrimaryGenerator
0079 {
0080   public:
0081 
0082     explicit G4HEPEvtInterface(const char* evfile, G4int vl=0);
0083     // Constructor, "evfile" is the file name (with directory path).
0084   
0085     ~G4HEPEvtInterface() override = default;
0086     // Destructor
0087 
0088     void GeneratePrimaryVertex(G4Event* evt) override;
0089 
0090   private:
0091 
0092     G4int vLevel = 0;
0093     G4String fileName;
0094     std::ifstream inputFile;
0095     std::vector<G4HEPEvtParticle*> HPlist;
0096 };
0097 
0098 #endif