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