BOSS 6.6.4.p01
BESIII Offline Software System
Loading...
Searching...
No Matches
G4SvcRunManager Class Reference

#include <G4SvcRunManager.h>

+ Inheritance diagram for G4SvcRunManager:

Public Member Functions

 G4SvcRunManager ()
 
virtual ~G4SvcRunManager ()
 
G4Event * GenerateEvent (G4int i_event)
 
void SimulateEvent (int i)
 
void PrintPrimary (G4Event *anEvent)
 

Friends

class G4Svc
 

Detailed Description

Definition at line 15 of file G4SvcRunManager.h.

Constructor & Destructor Documentation

◆ G4SvcRunManager()

G4SvcRunManager::G4SvcRunManager ( )

Definition at line 38 of file G4SvcRunManager.cpp.

38 :
39 G4RunManager(),
40 m_logLevel(6) {
41}

◆ ~G4SvcRunManager()

G4SvcRunManager::~G4SvcRunManager ( )
virtual

Definition at line 45 of file G4SvcRunManager.cpp.

45 {
46}

Member Function Documentation

◆ GenerateEvent()

G4Event * G4SvcRunManager::GenerateEvent ( G4int  i_event)

Definition at line 48 of file G4SvcRunManager.cpp.

49{
50 G4Event* anEvent = new G4Event(i_event);
51
52 if(!userPrimaryGeneratorAction)
53 {
54 if(m_logLevel<=4)
55 std::cout<<"calling the hepmc interface"<<std::endl;
56 BesHepMCInterface* hepmcInterface = new BesHepMCInterface;
57 hepmcInterface->SetLogLevel(m_logLevel);
58 HepMC::GenEvent* hepmcEvent = hepmcInterface->GenerateHepMCEvent();
59 if(m_logLevel<=4)
60 std::cout<<"got the hepmcEvent"<<std::endl;
61 hepmcInterface->HepMC2G4(hepmcEvent, anEvent);
62 delete hepmcInterface;
63 if(m_logLevel<=4)
64 PrintPrimary(anEvent);
65
66 }
67 else{
68 if(storeRandomNumberStatus) {
69 G4String fileN = randomNumberStatusDir + "currentEvent.rndm";
70 CLHEP::HepRandom::saveEngineStatus(fileN);
71 }
72 userPrimaryGeneratorAction->GeneratePrimaries(anEvent);
73 }
74 return anEvent;
75}
HepMC::GenEvent * GenerateHepMCEvent()
void HepMC2G4(HepMC::GenEvent *hepmcevt, G4Event *g4event)
void SetLogLevel(G4int level)
void PrintPrimary(G4Event *anEvent)

Referenced by SimulateEvent().

◆ PrintPrimary()

void G4SvcRunManager::PrintPrimary ( G4Event *  anEvent)

Definition at line 77 of file G4SvcRunManager.cpp.

78{
79 G4cout<<G4endl<<"primary particles of this event: "<<G4endl;
80 G4int n_vertex = anEvent->GetNumberOfPrimaryVertex();
81 for( G4int i=0; i<n_vertex; i++ )
82 {
83 G4cout<<"vertex:"<<i<<G4endl;
84 G4PrimaryVertex* primaryVertex = anEvent->GetPrimaryVertex(i);
85 G4PrimaryParticle* primaryParticle = primaryVertex->GetPrimary();
86 G4cout<<"PDGCode:";
87 while( primaryParticle != 0 )
88 {
89 G4int PDGcode = primaryParticle->GetPDGcode();
90 G4cout<<PDGcode<<" ";
91 primaryParticle = primaryParticle->GetNext();
92 }
93 G4cout<<G4endl;
94 }
95 G4cout<<G4endl;
96}

Referenced by GenerateEvent().

◆ SimulateEvent()

void G4SvcRunManager::SimulateEvent ( int  i)

Definition at line 97 of file G4SvcRunManager.cpp.

98{
99 //G4StateManager* stateManager = G4StateManager::GetStateManager();
100 //stateManager->SetNewState(G4State_EventProc);
101 currentEvent = GenerateEvent(i);
102 eventManager->ProcessOneEvent(currentEvent);
103 AnalyzeEvent(currentEvent);
104 //stateManager->SetNewState(G4State_GeomClosed);
105 StackPreviousEvent(currentEvent);
106 currentEvent = 0;
107 if(m_logLevel<=4)
108 std::cout<<"SimulateEvent : done simulating one event "<<std::endl<<std::endl;
109}
G4Event * GenerateEvent(G4int i_event)

Referenced by G4Svc::SimulateEvents().

Friends And Related Function Documentation

◆ G4Svc

friend class G4Svc
friend

Definition at line 17 of file G4SvcRunManager.h.


The documentation for this class was generated from the following files: