10#include "G4Svc/G4SvcRunManager.h"
11#include "G4Svc/BesHepMCInterface.h"
15#include "G4HCofThisEvent.hh"
16#include "G4VHitsCollection.hh"
17#include "G4THitsCollection.hh"
18#include "G4VUserDetectorConstruction.hh"
19#include "G4VUserPhysicsList.hh"
20#include "G4SDManager.hh"
21#include "G4PrimaryParticle.hh"
23#include "G4TrajectoryContainer.hh"
24#include "G4Trajectory.hh"
26#include "GaudiKernel/System.h"
27#include "GaudiKernel/IMessageSvc.h"
30#include "G4VUserPrimaryGeneratorAction.hh"
50 G4Event* anEvent =
new G4Event(i_event);
52 if(!userPrimaryGeneratorAction)
55 std::cout<<
"calling the hepmc interface"<<std::endl;
60 std::cout<<
"got the hepmcEvent"<<std::endl;
61 hepmcInterface->
HepMC2G4(hepmcEvent, anEvent);
62 delete hepmcInterface;
68 if(storeRandomNumberStatus) {
69 G4String fileN = randomNumberStatusDir +
"currentEvent.rndm";
70 CLHEP::HepRandom::saveEngineStatus(fileN);
72 userPrimaryGeneratorAction->GeneratePrimaries(anEvent);
79 G4cout<<G4endl<<
"primary particles of this event: "<<G4endl;
80 G4int n_vertex = anEvent->GetNumberOfPrimaryVertex();
81 for( G4int i=0; i<n_vertex; i++ )
83 G4cout<<
"vertex:"<<i<<G4endl;
84 G4PrimaryVertex* primaryVertex = anEvent->GetPrimaryVertex(i);
85 G4PrimaryParticle* primaryParticle = primaryVertex->GetPrimary();
87 while( primaryParticle != 0 )
89 G4int PDGcode = primaryParticle->GetPDGcode();
91 primaryParticle = primaryParticle->GetNext();
102 eventManager->ProcessOneEvent(currentEvent);
103 AnalyzeEvent(currentEvent);
105 StackPreviousEvent(currentEvent);
108 std::cout<<
"SimulateEvent : done simulating one event "<<std::endl<<std::endl;
HepMC::GenEvent * GenerateHepMCEvent()
void HepMC2G4(HepMC::GenEvent *hepmcevt, G4Event *g4event)
void SetLogLevel(G4int level)
void PrintPrimary(G4Event *anEvent)
void SimulateEvent(int i)
G4Event * GenerateEvent(G4int i_event)
virtual ~G4SvcRunManager()