Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DTOFGeometry_factory.h
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: DTOFGeometry_factory.h
4 // Created: Mon Jul 18 11:43:31 EST 2005
5 // Creator: remitche (on Linux mantrid00 2.4.20-18.8 i686)
6 //
7 
8 #ifndef _DTOFGeometry_factory_
9 #define _DTOFGeometry_factory_
10 
11 #include <JANA/JFactory.h>
12 using namespace jana;
13 
14 #include "DTOFGeometry.h"
15 
16 class DTOFGeometry_factory:public JFactory<DTOFGeometry>{
17  public:
20 
21  DTOFGeometry *tofgeometry=nullptr;
22 
23  //------------------
24  // brun
25  //------------------
26  jerror_t brun(JEventLoop *loop, int32_t runnumber)
27  {
28  // (See DTAGHGeometry_factory.h)
29  SetFactoryFlag(NOT_OBJECT_OWNER);
30  ClearFactoryFlag(WRITE_TO_OUTPUT);
31 
32  if( tofgeometry ) delete tofgeometry;
33 
34  // Get the geometry
35  DApplication* dapp = dynamic_cast<DApplication*>(loop->GetJApplication());
36  const DGeometry* locGeometry = dapp->GetDGeometry(runnumber);
37  tofgeometry = new DTOFGeometry(locGeometry);
38 
39  return NOERROR;
40  }
41 
42  //------------------
43  // evnt
44  //------------------
45  jerror_t evnt(JEventLoop *loop, uint64_t eventnumber)
46  {
47  // Reuse existing DBCALGeometry object.
48  if( tofgeometry ) _data.push_back( tofgeometry );
49 
50  return NOERROR;
51  }
52 
53  //------------------
54  // erun
55  //------------------
56  jerror_t erun(void)
57  {
58  if( tofgeometry ) delete tofgeometry;
59  tofgeometry = NULL;
60 
61  return NOERROR;
62  }
63 };
64 
65 #endif // _DTOFGeometry_factory_
66 
DApplication * dapp
jerror_t evnt(JEventLoop *loop, uint64_t eventnumber)
DGeometry * GetDGeometry(unsigned int run_number)
jerror_t brun(JEventLoop *loop, int32_t runnumber)