Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DNeutralParticle_factory.cc
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: DNeutralParticle_factory.cc
4 // Created: Tue Aug 9 14:29:24 EST 2011
5 // Creator: pmatt (on Linux ifarml6 2.6.18-128.el5 x86_64)
6 //
7 
8 
9 #include <iostream>
10 #include <iomanip>
11 using namespace std;
12 
14 using namespace jana;
15 
16 //------------------
17 // init
18 //------------------
20 {
21  return NOERROR;
22 }
23 
24 //------------------
25 // brun
26 //------------------
27 jerror_t DNeutralParticle_factory::brun(jana::JEventLoop *locEventLoop, int32_t runnumber)
28 {
29  return NOERROR;
30 }
31 
32 //------------------
33 // evnt
34 //------------------
35 jerror_t DNeutralParticle_factory::evnt(jana::JEventLoop *locEventLoop, uint64_t eventnumber)
36 {
37  vector<const DNeutralParticleHypothesis*> locNeutralParticleHypotheses;
38  locEventLoop->Get(locNeutralParticleHypotheses);
39 
40  map<const DNeutralShower*, vector<const DNeutralParticleHypothesis*> > locHypothesesByShower;
41  for(size_t loc_i = 0; loc_i < locNeutralParticleHypotheses.size(); loc_i++)
42  locHypothesesByShower[locNeutralParticleHypotheses[loc_i]->Get_NeutralShower()].push_back(locNeutralParticleHypotheses[loc_i]);
43 
44  for(auto& locPair : locHypothesesByShower)
45  {
46  DNeutralParticle* locNeutralParticle = new DNeutralParticle();
47  locNeutralParticle->dNeutralShower = locPair.first;
48  locNeutralParticle->dNeutralParticleHypotheses = locPair.second;
49  _data.push_back(locNeutralParticle);
50  }
51 
52  return NOERROR;
53 }
54 
55 //------------------
56 // erun
57 //------------------
59 {
60  return NOERROR;
61 }
62 
63 //------------------
64 // fini
65 //------------------
67 {
68  return NOERROR;
69 }
70 
71 
jerror_t erun(void)
Called everytime run number changes, provided brun has been called.
jerror_t init(void)
Called once at program start.
vector< const DNeutralParticleHypothesis * > dNeutralParticleHypotheses
jerror_t brun(jana::JEventLoop *locEventLoop, int32_t runnumber)
Called everytime a new run number is detected.
jerror_t fini(void)
Called after last event of last event source has been processed.
const DNeutralShower * dNeutralShower
jerror_t evnt(jana::JEventLoop *locEventLoop, uint64_t eventnumber)
Called every event.