Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DChargedTrack_factory.cc
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: DChargedTrack_factory.cc
4 // Created: Thu Dec 3 17:27:55 EST 2009
5 // Creator: staylor (on Linux ifarml6 2.6.18-128.el5 x86_64)
6 //
7 
8 
9 #include <iostream>
10 #include <iomanip>
11 using namespace std;
12 
13 #include "DChargedTrack_factory.h"
14 using namespace jana;
15 
16 //------------------
17 // init
18 //------------------
20 {
21  return NOERROR;
22 }
23 
24 //------------------
25 // brun
26 //------------------
27 jerror_t DChargedTrack_factory::brun(jana::JEventLoop *locEventLoop, int32_t runnumber)
28 {
29  return NOERROR;
30 }
31 
32 //------------------
33 // evnt
34 //------------------
35 jerror_t DChargedTrack_factory::evnt(jana::JEventLoop *locEventLoop, uint64_t eventnumber)
36 {
37  vector<const DChargedTrackHypothesis*> locChargedTrackHypotheses;
38  locEventLoop->Get(locChargedTrackHypotheses);
39 
40  map<JObject::oid_t, vector<const DChargedTrackHypothesis*> > locHypothesesByTrackID;
41  for(size_t loc_i = 0; loc_i < locChargedTrackHypotheses.size(); loc_i++)
42  locHypothesesByTrackID[locChargedTrackHypotheses[loc_i]->Get_TrackTimeBased()->candidateid].push_back(locChargedTrackHypotheses[loc_i]);
43 
44  map<JObject::oid_t, vector<const DChargedTrackHypothesis*> >::iterator locIterator = locHypothesesByTrackID.begin();
45  for(; locIterator != locHypothesesByTrackID.end(); ++locIterator)
46  {
47  DChargedTrack* locChargedTrack = new DChargedTrack();
48  locChargedTrack->candidateid = locIterator->first;
49  locChargedTrack->dChargedTrackHypotheses = locIterator->second;
50  _data.push_back(locChargedTrack);
51  }
52 
53  return NOERROR;
54 }
55 
56 //------------------
57 // erun
58 //------------------
60 {
61  return NOERROR;
62 }
63 
64 //------------------
65 // fini
66 //------------------
68 {
69  return NOERROR;
70 }
71 
72 
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 erun(void)
Called everytime run number changes, provided brun has been called.
jerror_t init(void)
Called once at program start.
jerror_t fini(void)
Called after last event of last event source has been processed.
vector< const DChargedTrackHypothesis * > dChargedTrackHypotheses
Definition: DChargedTrack.h:28