Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DTAGHGeometry_factory.h
Go to the documentation of this file.
1 //
2 // File: DTAGHGeometry_factory.h
3 // Created: Sat Jul 5 10:09:27 EST 2014
4 // Creator: jonesrt on gluey.phys.uconn.edu
5 //
6 
7 #ifndef _DTAGHGeometry_factory_
8 #define _DTAGHGeometry_factory_
9 
10 #include <string>
11 
12 #include <JANA/JFactory.h>
13 #include <TAGGER/DTAGHGeometry.h>
14 
15 class DTAGHGeometry_factory : public JFactory<DTAGHGeometry> {
16  public:
19 
21 
22  //------------------
23  // brun
24  //------------------
25  jerror_t brun(JEventLoop *loop, int32_t runnumber)
26  {
27  // The NOT_OBJECT_OWNER flag tells JANA not to automatically
28  // delete the objects in _data. This allows the same geometry
29  // object to persist through multiple events.
30  //
31  // n.b. There is another, similar factory flag "PERSISTANT"
32  // that will also prevent the object from being deleted. That,
33  // however, will also prevent the brun and evnt methods from
34  // being called. Here, we want the brun method to be called since
35  // the geometry actually may change with run number. (This
36  // happened for Lubomir's J/Psi analysis where the tiny number
37  // of events spread over many runs were concatenated in a single
38  // job.)
39  SetFactoryFlag(NOT_OBJECT_OWNER);
40  ClearFactoryFlag(WRITE_TO_OUTPUT);
41 
42  if( taghgeometry ) delete taghgeometry;
43 
44  taghgeometry = new DTAGHGeometry(loop);
45 
46  return NOERROR;
47  }
48 
49  //------------------
50  // evnt
51  //------------------
52  jerror_t evnt(JEventLoop *loop, uint64_t eventnumber)
53  {
54  // Reuse existing DBCALGeometry object.
55  if( taghgeometry ) _data.push_back( taghgeometry );
56 
57  return NOERROR;
58  }
59 
60  //------------------
61  // erun
62  //------------------
63  jerror_t erun(void)
64  {
65  if( taghgeometry ) delete taghgeometry;
66  taghgeometry = NULL;
67 
68  return NOERROR;
69  }
70 };
71 
72 #endif // _DTAGHGeometry_factory_
jerror_t evnt(JEventLoop *loop, uint64_t eventnumber)
jerror_t brun(JEventLoop *loop, int32_t runnumber)