EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EicJanaPlugin.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file EicJanaPlugin.cc
1 
2 #include <cstring>
3 
4 #include <TROOT.h>
5 
6 #include <JANA/JApplication.h>
7 #include <JANA/JEventSourceGeneratorT.h>
8 #include <JANA/JEvent.h>
9 
10 #include <FairRun.h>
11 
12 #include <EicJEventProcessor.h>
13 #include <EicJEventSource.h>
14 
15 extern "C" {
16  void InitPlugin(JApplication *app) {
17  // Does not have real effect at present (threads do not access any ROOT
18  // data concurrently);
19  ROOT::EnableThreadSafety();
20 
21  auto pm = app->GetJParameterManager();
22  assert(pm->Exists("libeicroot:macro"));
23 
24  // Disable the fRun->Run() call in the macro for EicRunAna;
26 
27  //+++gROOT->Macro(pm->GetParameterValue<string>("libeicroot:macro").c_str());
28  //gROOT->Macro((pm->GetParameterValue<string>("libeicroot:macro") + "(3)").c_str());
29 
30  auto fRun = FairRun::Instance();
31  // FIXME: this is a hack to let EicRunAna go through, but block EicRunSim;
32  if (fRun && fRun->JanaLoopPossible()) fRun->RunCoreStart();
33 
34  InitJANAPlugin(app);
35 
36  // Add source generator
37  app->Add( new JEventSourceGeneratorT<EicJEventSource>() );
38 
39  // Add event processor
40  app->Add( new EicJEventProcessor() );
41  } // InitPlugin()
42 } // "C"
43