Geant4 Cross Reference |
>> 1 // This code implementation is the intellectual property of >> 2 // the GEANT4 collaboration. 1 // 3 // 2 // ******************************************* << 4 // By copying, distributing or modifying the Program (or any work 3 // * License and Disclaimer << 5 // based on the Program) you indicate your acceptance of this statement, 4 // * << 6 // and all its terms. 5 // * The Geant4 software is copyright of th << 7 // 6 // * the Geant4 Collaboration. It is provided << 8 // $Id: G4HEPEvtInterface.hh,v 1.2.2.1.2.1 1999/12/07 20:47:50 gunter Exp $ 7 // * conditions of the Geant4 Software License << 9 // GEANT4 tag $Name: geant4-01-00 $ 8 // * LICENSE and available at http://cern.ch/ << 10 // 9 // * include a list of copyright holders. << 11 10 // * << 12 #ifndef G4HEPEvtInterface_h 11 // * Neither the authors of this software syst << 13 #define G4HEPEvtInterface_h 1 12 // * institutes,nor the agencies providing fin << 14 13 // * work make any representation or warran << 15 #include <fstream.h> 14 // * regarding this software system or assum << 16 #include "g4rw/tpordvec.h" 15 // * use. Please see the license in the file << 17 #include "globals.hh" 16 // * for the full disclaimer and the limitatio << 18 #include "G4VPrimaryGenerator.hh" 17 // * << 19 #include "G4HEPEvtParticle.hh" 18 // * This code implementation is the result << 20 19 // * technical work of the GEANT4 collaboratio << 21 class G4PrimaryVertex; 20 // * By using, copying, modifying or distri << 22 class G4Event; 21 // * any work based on the software) you ag << 23 22 // * use in resulting scientific publicati << 24 // class description: 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* << 25 // << 26 // G4HEPEvtInterface << 27 // << 28 // Class description: << 29 // << 30 // This is a concrete class of G4VPrimaryGener << 31 // It reads an ASCII file which contains parti << 32 // physics generator which supports a /HEPEVT/ << 33 // << 34 // The format of ASCII file must be equivalent << 35 // Fortran code: << 36 // 25 // >> 26 // This is a concrete class of G4VPrimaryGenerator. >> 27 // This class object reads an ASCII file which contains particles generated >> 28 // by a physics generator which supports /HEPEVT/ common block. >> 29 // >> 30 // The format of ASCII file must be equivalent to the follwing sample fortran >> 31 // code. 37 //******************************************** 32 //*********************************************************** 38 // SUBROUTINE HEP2G4 33 // SUBROUTINE HEP2G4 39 //* 34 //* 40 //* Output /HEPEVT/ event structure to G4HEPEv 35 //* Output /HEPEVT/ event structure to G4HEPEvtInterface 41 //* 36 //* 42 //******************************************** 37 //*********************************************************** 43 // PARAMETER (NMXHEP=2000) 38 // PARAMETER (NMXHEP=2000) 44 // COMMON/HEPEVT/NEVHEP,NHEP,ISTHEP(NMXHE 39 // COMMON/HEPEVT/NEVHEP,NHEP,ISTHEP(NMXHEP),IDHEP(NMXHEP), 45 // >JMOHEP(2,NMXHEP),JDAHEP(2,NMXHEP),PHEP 40 // >JMOHEP(2,NMXHEP),JDAHEP(2,NMXHEP),PHEP(5,NMXHEP),VHEP(4,NMXHEP) 46 // DOUBLE PRECISION PHEP,VHEP 41 // DOUBLE PRECISION PHEP,VHEP 47 //* 42 //* 48 // WRITE(6,*) NHEP 43 // WRITE(6,*) NHEP 49 // DO IHEP=1,NHEP 44 // DO IHEP=1,NHEP 50 // WRITE(6,10) 45 // WRITE(6,10) 51 // > ISTHEP(IHEP),IDHEP(IHEP),JDAHEP(1,IH 46 // > ISTHEP(IHEP),IDHEP(IHEP),JDAHEP(1,IHEP),JDAHEP(2,IHEP), 52 // > PHEP(1,IHEP),PHEP(2,IHEP),PHEP(3,IHE 47 // > PHEP(1,IHEP),PHEP(2,IHEP),PHEP(3,IHEP),PHEP(5,IHEP) 53 //10 FORMAT(I4,I10,I5,I5,4(1X,D15.8)) << 48 //10 FORMAT(4I5,4(1X,D15.8)) 54 // ENDDO 49 // ENDDO 55 //* 50 //* 56 // RETURN 51 // RETURN 57 // END 52 // END 58 // 53 // 59 // The position and time of the primary intera << 54 // The position and time of the primary interaction must be set by the corresponding 60 // corresponding set methods of G4VPrimaryGene << 55 // set methods of G4VPrimaryGenerator base class, otherwise zero will be set. 61 // zero will be set. << 56 // 62 << 63 // Author: Makoto Asai, 1997 << 64 // ------------------------------------------- << 65 #ifndef G4HEPEvtInterface_hh << 66 #define G4HEPEvtInterface_hh 1 << 67 << 68 #include <fstream> << 69 #include <vector> << 70 << 71 #include "globals.hh" << 72 #include "G4VPrimaryGenerator.hh" << 73 #include "G4HEPEvtParticle.hh" << 74 << 75 class G4PrimaryVertex; << 76 class G4Event; << 77 57 78 class G4HEPEvtInterface : public G4VPrimaryGen << 58 class G4HEPEvtInterface:public G4VPrimaryGenerator 79 { 59 { 80 public: << 60 public: // with description 81 << 61 G4HEPEvtInterface(char* evfile); 82 explicit G4HEPEvtInterface(const char* evf << 62 G4HEPEvtInterface(G4String evfile); 83 // Constructor, "evfile" is the file name << 63 // Constructors, "evfile" is the file name (with directory path). 84 64 85 ~G4HEPEvtInterface() override = default; << 65 public: 86 // Destructor << 66 ~G4HEPEvtInterface(); 87 67 88 void GeneratePrimaryVertex(G4Event* evt) o << 68 void GeneratePrimaryVertex(G4Event* evt); 89 69 90 private: 70 private: 91 << 92 G4int vLevel = 0; << 93 G4String fileName; 71 G4String fileName; 94 std::ifstream inputFile; << 72 ifstream inputFile; 95 std::vector<G4HEPEvtParticle*> HPlist; << 73 G4RWTPtrOrderedVector<G4HEPEvtParticle> HPlist; 96 }; 74 }; 97 75 98 #endif 76 #endif >> 77 99 78