45 inputFile.open((
char*)evfile);
46 if (inputFile.is_open())
50 G4cout <<
"G4HEPEvtInterface - " << fileName <<
" is open." <<
G4endl;
54 G4Exception(
"G4HEPEvtInterface::G4HEPEvtInterface",
"Event0201",
65 if (inputFile.is_open())
71 G4Exception(
"G4HEPEvtInterface::G4HEPEvtInterface",
"Event0201",
76 G4Exception(
"G4HEPEvtInterface::GeneratePrimaryVertex",
"Event0202",
78 "End-Of-File: HEPEvt input file -- no more event to read!");
84 G4cout <<
"G4HEPEvtInterface - reading " << NHEP
85 <<
" HEPEvt particles from " << fileName <<
"." <<
G4endl;
87 for(
G4int IHEP=0; IHEP<NHEP; ++IHEP )
98 inputFile >> ISTHEP >> IDHEP >> JDAHEP1 >> JDAHEP2
99 >> PHEP1 >> PHEP2 >> PHEP3 >> PHEP5;
100 if( inputFile.eof() )
102 G4Exception(
"G4HEPEvtInterface::GeneratePrimaryVertex",
"Event0203",
104 "Unexpected End-Of-File in the middle of an event");
108 G4cout <<
" " << ISTHEP <<
" " << IDHEP <<
" " << JDAHEP1
109 <<
" " << JDAHEP2 <<
" " << PHEP1 <<
" " << PHEP2
110 <<
" " << PHEP3 <<
" " << PHEP5 <<
G4endl;
116 particle->SetMass( PHEP5*GeV );
117 particle->SetMomentum(PHEP1*GeV, PHEP2*GeV, PHEP3*GeV );
126 HPlist.push_back( hepParticle );
131 if( HPlist.empty() )
return;
135 for(
auto & i : HPlist)
137 if( i->GetJDAHEP1() > 0 )
139 G4int jda1 = i->GetJDAHEP1()-1;
140 G4int jda2 = i->GetJDAHEP2()-1;
142 for(
G4int j=jda1; j<=jda2; ++j )
145 if(HPlist[j]->GetISTHEP()>0)
160 for(
auto & ii : HPlist)
162 if( ii->GetISTHEP() > 0 )
166 vertex->SetPrimary( initialParticle );
172 for(
auto & iii : HPlist)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4GLOB_DLL std::ostream G4cout
void AddPrimaryVertex(G4PrimaryVertex *aPrimaryVertex)
G4HEPEvtInterface(const char *evfile, G4int vl=0)
void GeneratePrimaryVertex(G4Event *evt) override
void SetDaughter(G4PrimaryParticle *np)
G4ThreeVector particle_position