CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
BesHepMCInterface Class Reference

#include <BesHepMCInterface.h>

+ Inheritance diagram for BesHepMCInterface:

Public Member Functions

 BesHepMCInterface ()
 
 ~BesHepMCInterface ()
 
HepMC::GenEvent * GenerateHepMCEvent ()
 
- Public Member Functions inherited from G4HepMCInterface
void HepMC2G4 (HepMC::GenEvent *hepmcevt, G4Event *g4event)
 
void Print (const HepMC::GenEvent *hepmcevt)
 
G4int CheckType (const HepMC::GenEvent *hepmcevt)
 
void Boost (HepMC::GenEvent *hepmcevt)
 
void PrintHPlist ()
 
G4int GetLogLevel ()
 
void SetLogLevel (G4int level)
 
 G4HepMCInterface ()
 
virtual ~G4HepMCInterface ()
 
HepMC::GenEvent * GetHepMCGenEvent () const
 
virtual void GeneratePrimaryVertex (G4Event *anEvent)
 

Additional Inherited Members

- Public Attributes inherited from G4HepMCInterface
std::vector< G4HepMCParticle * > HPlist
 
virtual HepMC::GenEvent * GenerateHepMCEvent ()
 
- Protected Attributes inherited from G4HepMCInterface
HepMC::GenEvent * hepmcEvent
 
G4int m_logLevel
 

Detailed Description

Definition at line 9 of file BesHepMCInterface.h.

Constructor & Destructor Documentation

◆ BesHepMCInterface()

BesHepMCInterface::BesHepMCInterface ( )

Definition at line 12 of file BesHepMCInterface.cpp.

13{
14 p_evtSvc = 0;
15}

◆ ~BesHepMCInterface()

BesHepMCInterface::~BesHepMCInterface ( )

Definition at line 16 of file BesHepMCInterface.cpp.

17{
18 //std::cout<< "\b the BesHepMCInterface is being destroyed "<<std::endl;
19}

Member Function Documentation

◆ GenerateHepMCEvent()

HepMC::GenEvent * BesHepMCInterface::GenerateHepMCEvent ( )
virtual

Reimplemented from G4HepMCInterface.

Definition at line 21 of file BesHepMCInterface.cpp.

22{
23
24 if (p_evtSvc == 0) {
25 //std::cout<<" standard interface to EvtDataSvc for retrieving HepMC events"<<std::endl;
26 ISvcLocator* svcLocator = Gaudi::svcLocator(); // from Bootstrap
27 StatusCode sc=svcLocator->service("EventDataSvc", p_evtSvc);
28 if (sc.isFailure())
29 {
30 //std::cout<<"BesHepMCInterface could not access EventDataSvc!!"<<std::endl;
31 }
32 }
33 int n = 0;
34 //std::cout <<" BesHepMCInterface::GenerateAnEvent "<<std::endl;
35
36 SmartDataPtr<McGenEventCol> mcCollptr( p_evtSvc, "/Event/Gen");
37
38 if ( mcCollptr != 0 ) {
39 //std::cout <<" could retrieve the collection "<<std::endl;
40
41 n = mcCollptr->size();
42
43 //std::cout <<" nr of events "<<n<<std::endl;
44
45 McGenEventCol::const_iterator it = mcCollptr->begin();
46
47 McGenEvent* mcEvent = (McGenEvent* ) (*it);
48 // getting only the first event here.
49 // std::cout <<"iterator"<<std::endl;
50
51 HepMC::GenEvent *p_evt;
52
53 //std::cout <<"hepmc event"<<std::endl;
54 p_evt = mcEvent->getGenEvt();
55 //std::cout << "eventNumber = " << p_evt-> event_number() << std::endl;
56
57 //std::cout << " BesHepMCInterface:: --> " <<std::endl;
58 //std::cout << " particles_size = " << p_evt->particles_size()
59 // << " vertices_size = " << p_evt->vertices_size()
60 // << std::endl;
61
62 //std::cout <<"got it"<<std::endl;
63
64 return p_evt;
65 }
66
67 else {
68 std::cout << "no McGenEventCollection found." << std::endl;
69 }
70 return 0;
71}
const Int_t n
GenEvent * getGenEvt() const
Definition: McGenEvent.cxx:12

Referenced by G4SvcRunManager::GenerateEvent().


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