Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DMCThrown_factory_Primary.cc
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: DMCThrown_factory_Primary.cc
4 // Created: Thu Dec 3 17:27:55 EST 2009
5 // Creator: pmatt (on Linux ifarml6 2.6.18-128.el5 x86_64)
6 //
7 
9 
10 using namespace jana;
11 
12 //------------------
13 // init
14 //------------------
16 {
17  SetFactoryFlag(NOT_OBJECT_OWNER);
18  return NOERROR;
19 }
20 
21 //------------------
22 // brun
23 //------------------
24 jerror_t DMCThrown_factory_Primary::brun(jana::JEventLoop *locEventLoop, int32_t runnumber)
25 {
26  locEventLoop->GetSingle(dAnalysisUtilities);
27  return NOERROR;
28 }
29 
30 //------------------
31 // evnt
32 //------------------
33 jerror_t DMCThrown_factory_Primary::evnt(jana::JEventLoop *locEventLoop, uint64_t eventnumber)
34 {
35  _data.clear();
36 
37  deque<pair<const DMCThrown*, deque<const DMCThrown*> > > locThrownSteps;
38  dAnalysisUtilities->Get_ThrownParticleSteps(locEventLoop, locThrownSteps);
39 
40  if(locThrownSteps.empty())
41  return NOERROR;
42 
43  deque<const DMCThrown*>& locParticles = locThrownSteps[0].second;
44  for(size_t loc_i = 0; loc_i < locParticles.size(); ++loc_i)
45  _data.push_back(const_cast<DMCThrown*>(locParticles[loc_i]));
46 
47  return NOERROR;
48 }
49 
50 
51 //------------------
52 // erun
53 //------------------
55 {
56  return NOERROR;
57 }
58 
59 //------------------
60 // fini
61 //------------------
63 {
64  return NOERROR;
65 }
66 
jerror_t brun(jana::JEventLoop *locEventLoop, int32_t runnumber)
Called everytime a new run number is detected.
jerror_t evnt(jana::JEventLoop *locEventLoop, uint64_t eventnumber)
Called every event.
jerror_t init(void)
Called once at program start.
jerror_t erun(void)
Called everytime run number changes, provided brun has been called.
jerror_t fini(void)
Called after last event of last event source has been processed.