EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EicJEventSource.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file EicJEventSource.cc
1 
2 #include <TVirtualMC.h>
3 
4 #include <FairGeane.h>
5 #include <FairRun.h>
6 
7 #include <EicJEventSource.h>
8 
9 // ------------------------------------------------------------------------------------------
10 
12 {
13  //+++SetNumEventsToGetAtOnce(1, 1);
14 } // EicJEventSource::Open()
15 
16 // ------------------------------------------------------------------------------------------
17 
18 void EicJEventSource::GetEvent(std::shared_ptr<JEvent> jevent)
19 {
20  auto fRun = FairRun::Instance();
21  if (!fRun || !fRun->JanaLoopPossible() || !fRun->RunCoreImportNextEvent())
22  throw JEventSource::RETURN_STATUS::kNO_MORE_EVENTS;
23 
24  // This is indeed a hack, helping reconstruction.C to initialize
25  // geane-related stuff (and gMC in particular) in every thread;
26  if (!gMC) (new FairGeane())->Init();
27 
28  printf("\nEicJEventSource::GetEvent() - %4d(+1) [%u]\n",
29  fRun->GetCurrentEventIndex(), (unsigned)pthread_self());
30 
31  fRun->RunCoreProcessNextEvent();
32 } // EicJEventSource::GetEvent()
33 
34 // ------------------------------------------------------------------------------------------
35