Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DEventProcessor_trk_profile.cc
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: DEventProcessor_trk_profile.cc
4 // Created: Wed Jan 12 08:02:32 EST 2011
5 // Creator: davidl (on Darwin eleanor.jlab.org 10.6.0 i386)
6 //
7 
10 #include <PID/DChargedTrack.h>
11 using namespace jana;
12 
13 
14 const DTrackFitter *fitter = NULL;
15 
16 // Routine used to create our DEventProcessor
17 #include <JANA/JApplication.h>
18 extern "C"{
19 void InitPlugin(JApplication *app){
20  InitJANAPlugin(app);
21  app->AddProcessor(new DEventProcessor_trk_profile());
22 }
23 } // "C"
24 
25 
26 //------------------
27 // DEventProcessor_trk_profile (Constructor)
28 //------------------
30 {
31 
32 }
33 
34 //------------------
35 // ~DEventProcessor_trk_profile (Destructor)
36 //------------------
38 {
39 
40 }
41 
42 //------------------
43 // init
44 //------------------
46 {
47  // Create histograms here
48  return NOERROR;
49 }
50 
51 //------------------
52 // brun
53 //------------------
54 jerror_t DEventProcessor_trk_profile::brun(JEventLoop *eventLoop, int32_t runnumber)
55 {
56  return NOERROR;
57 }
58 
59 //------------------
60 // evnt
61 //------------------
62 jerror_t DEventProcessor_trk_profile::evnt(JEventLoop *loop, uint64_t eventnumber)
63 {
64  // Get DChargedTrack objects to activate tracking
65  vector<const DChargedTrack*> charged_tracks;
66  loop->Get(charged_tracks);
67 
68  // Get the track fitter object for use later
69  if(!fitter)loop->GetSingle(fitter);
70 
71  return NOERROR;
72 }
73 
74 //------------------
75 // erun
76 //------------------
78 {
79  if(fitter){
80  map<string, prof_time::time_diffs> prof_times;
81  fitter->GetProfilingTimes(prof_times);
82 
83  double Ntracks = prof_times["Ntracks"].real; // a special entry keeps count of tracks in "real" slot
84 
85  cout<<endl;
86  cout<<"Printing profiling info for track fitter ---("<<Ntracks<<" tracks)---"<<endl;
87  map<string, prof_time::time_diffs>::iterator iter = prof_times.begin();
88  for(; iter!=prof_times.end(); iter++){
89  if(iter->first == "Ntracks")continue; // skip Ntracks which is special
90  cout<< " "<<iter->first<<endl
91  <<" real="<< iter->second.real/Ntracks*1000.0<<"ms"<<endl
92  <<" prof="<< iter->second.prof/Ntracks*1000.0<<"ms"<<endl
93  <<" virt="<< iter->second.virt/Ntracks*1000.0<<"ms"<<endl
94  << endl;
95  }
96  cout<<endl;
97  }
98 
99  return NOERROR;
100 }
101 
102 //------------------
103 // fini
104 //------------------
106 {
107 
108  return NOERROR;
109 }
110 
The DTrackFitter class is a base class for different charged track fitting algorithms. It does not actually fit the track itself, but provides the interface and some common support features most algorthims will need to implement.
Definition: DTrackFitter.h:61
jerror_t evnt(jana::JEventLoop *eventLoop, 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 brun(jana::JEventLoop *eventLoop, int32_t runnumber)
Called everytime a new run number is detected.
InitPlugin_t InitPlugin
jerror_t fini(void)
Called after last event of last event source has been processed.
const DTrackFitter * fitter