G4HEPEvtInterface.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 
00030 #ifndef G4HEPEvtInterface_h
00031 #define G4HEPEvtInterface_h 1
00032 
00033 #include <fstream>
00034 #include <vector>
00035 #include "globals.hh"
00036 #include "G4VPrimaryGenerator.hh"
00037 #include "G4HEPEvtParticle.hh"
00038 
00039 class G4PrimaryVertex;
00040 class G4Event;
00041 
00042 // class description:
00043 //
00044 //  This is a concrete class of G4VPrimaryGenerator.
00045 //  This class object reads an ASCII file which contains particles generated
00046 // by a physics generator which supports /HEPEVT/ common block.
00047 // 
00048 //  The format of ASCII file must be equivalent to the follwing sample fortran
00049 // code.
00050 //***********************************************************
00051 //      SUBROUTINE HEP2G4
00052 //*
00053 //* Output /HEPEVT/ event structure to G4HEPEvtInterface
00054 //*
00055 //***********************************************************
00056 //      PARAMETER (NMXHEP=2000)
00057 //      COMMON/HEPEVT/NEVHEP,NHEP,ISTHEP(NMXHEP),IDHEP(NMXHEP),
00058 //     >JMOHEP(2,NMXHEP),JDAHEP(2,NMXHEP),PHEP(5,NMXHEP),VHEP(4,NMXHEP)
00059 //      DOUBLE PRECISION PHEP,VHEP
00060 //*
00061 //      WRITE(6,*) NHEP
00062 //      DO IHEP=1,NHEP
00063 //       WRITE(6,10) 
00064 //     >  ISTHEP(IHEP),IDHEP(IHEP),JDAHEP(1,IHEP),JDAHEP(2,IHEP),
00065 //     >  PHEP(1,IHEP),PHEP(2,IHEP),PHEP(3,IHEP),PHEP(5,IHEP)
00066 //10    FORMAT(4I5,4(1X,D15.8))
00067 //      ENDDO
00068 //*
00069 //      RETURN
00070 //      END
00071 //
00072 //  The position and time of the primary interaction must be set by the corresponding
00073 // set methods of G4VPrimaryGenerator base class, otherwise zero will be set.
00074 //
00075 
00076 class G4HEPEvtInterface:public G4VPrimaryGenerator
00077 {
00078   public: // with description
00079     G4HEPEvtInterface(char* evfile);
00080     G4HEPEvtInterface(G4String evfile);
00081     // Constructors, "evfile" is the file name (with directory path).
00082   
00083   public:
00084     ~G4HEPEvtInterface();
00085 
00086     void GeneratePrimaryVertex(G4Event* evt);
00087 
00088   private:
00089     G4String fileName;
00090     std::ifstream inputFile;
00091     std::vector<G4HEPEvtParticle*> HPlist;
00092 };
00093 
00094 #endif
00095 

Generated on Mon May 27 17:48:29 2013 for Geant4 by  doxygen 1.4.7