Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
JEventProcessor_L3_online.cc
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: JEventProcessor_L3_online.cc
4 // Created: Fri Nov 9 11:58:09 EST 2012
5 // Creator: wolin (on Linux stan.jlab.org 2.6.32-279.11.1.el6.x86_64 x86_64)
6 
7 
8 #include <stdint.h>
9 #include <vector>
10 #include <random>
11 
12 
14 #include <JANA/JApplication.h>
15 
16 using namespace std;
17 using namespace jana;
18 
19 
20 // for root
21 #include <TDirectory.h>
22 #include <TH1.h>
23 
24 
25 // root hist pointers
26 static TH1I * l3;
27 
28 
29 
30 //----------------------------------------------------------------------------------
31 
32 
33 // Routine used to create our JEventProcessor
34 extern "C"{
35  void InitPlugin(JApplication *app){
36  InitJANAPlugin(app);
37  app->AddProcessor(new JEventProcessor_L3_online());
38  }
39 }
40 
41 
42 //----------------------------------------------------------------------------------
43 
44 
46 }
47 
48 
49 //----------------------------------------------------------------------------------
50 
51 
53 }
54 
55 
56 //----------------------------------------------------------------------------------
57 
59 
60  // create root folder for evnt and cd to it, store main dir
61  TDirectory *main = gDirectory;
62  gDirectory->mkdir("l3")->cd();
63 
64 
65  // book hist
66  l3 = new TH1I("l3","l3",100,0,100);
67 
68 
69  // back to main dir
70  main->cd();
71 
72  return NOERROR;
73 }
74 
75 
76 //----------------------------------------------------------------------------------
77 
78 
79 jerror_t JEventProcessor_L3_online::brun(JEventLoop *eventLoop, int32_t runnumber) {
80  // This is called whenever the run number changes
81  return NOERROR;
82 }
83 
84 
85 //----------------------------------------------------------------------------------
86 
87 
88 jerror_t JEventProcessor_L3_online::evnt(JEventLoop *eventLoop, uint64_t eventnumber) {
89 
90  // This is called for every event. Use of common resources like writing
91  // to a file or filling a histogram should be mutex protected. Using
92  // loop-Get(...) to get reconstructed objects (and thereby activating the
93  // reconstruction algorithm) should be done outside of any mutex lock
94  // since multiple threads may call this method at the same time.
95 
96 
97  japp->RootWriteLock();
98 
99  // fill hist
100 
101  japp->RootUnLock();
102 
103  return NOERROR;
104 }
105 
106 
107 //----------------------------------------------------------------------------------
108 
109 
111  // This is called whenever the run number changes, before it is
112  // changed to give you a chance to clean up before processing
113  // events from the next run number.
114  return NOERROR;
115 }
116 
117 
118 //----------------------------------------------------------------------------------
119 
120 
122  // Called before program exit after event processing is finished.
123  return NOERROR;
124 }
125 
126 
127 //----------------------------------------------------------------------------------
128 //----------------------------------------------------------------------------------
JApplication * japp
InitPlugin_t InitPlugin
static TH1I * l3
jerror_t fini(void)
Called after last event of last event source has been processed.
jerror_t evnt(jana::JEventLoop *eventLoop, uint64_t eventnumber)
Called every event.
jerror_t init(void)
Called once at program start.
jerror_t brun(jana::JEventLoop *eventLoop, int32_t runnumber)
Called everytime a new run number is detected.
int main(int argc, char *argv[])
Definition: gendoc.cc:6
jerror_t erun(void)
Called everytime run number changes, provided brun has been called.