Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DEventWriterROOT_factory.h
Go to the documentation of this file.
1 #ifndef _DEventWriterROOT_factory_
2 #define _DEventWriterROOT_factory_
3 
4 #include <JANA/JFactory.h>
5 #include <JANA/JEventLoop.h>
6 
8 
9 class DEventWriterROOT_factory : public jana::JFactory<DEventWriterROOT>
10 {
11  public:
12  DEventWriterROOT_factory(){use_factory = 1;}; //prevents JANA from searching the input file for these objects
14 
15  private:
16  jerror_t brun(jana::JEventLoop *locEventLoop, int locRunNumber)
17  {
18  // Create single DEventWriterROOT object and marks the factory as persistent so it doesn't get deleted every event.
19  SetFactoryFlag(PERSISTANT);
20  ClearFactoryFlag(WRITE_TO_OUTPUT);
21 
22  _data.push_back(new DEventWriterROOT());
23  _data.back()->Initialize(locEventLoop);
24  return NOERROR;
25  }
26 
27  jerror_t fini(void)
28  {
29  // Delete object: Must be "this" thread so that interfaces deleted properly
30  delete _data[0];
31  _data.clear();
32  return NOERROR;
33  }
34 };
35 
36 #endif // _DEventWriterROOT_factory_
37 
jerror_t brun(jana::JEventLoop *locEventLoop, int locRunNumber)