Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
JEventProcessor_danarest.cc
Go to the documentation of this file.
1 //
2 // JEventProcessor_danarest.cc
3 //
4 // JANA event processor plugin writes out rest events to a file
5 //
6 // Richard Jones, 1-July-2012
7 
9 #include <TRACKING/DMCThrown.h>
10 
11 // Make us a plugin
12 // for initializing plugins
13 extern "C" {
14  void InitPlugin(JApplication *app) {
15  InitJANAPlugin(app);
16  app->AddProcessor(new JEventProcessor_danarest(), true);
17  }
18 } // "extern C"
19 
20 //-------------------------------
21 // init
22 //-------------------------------
24 {
25  return NOERROR;
26 }
27 
28 //-------------------------------
29 // brun
30 //-------------------------------
31 jerror_t JEventProcessor_danarest::brun(JEventLoop *locEventLoop, int32_t runnumber)
32 {
33 
34  return NOERROR;
35 }
36 
37 //-------------------------------
38 // evnt
39 //-------------------------------
40 jerror_t JEventProcessor_danarest::evnt(JEventLoop *locEventLoop, uint64_t eventnumber)
41 {
42  // Check if we have thrown events (therefore MC)
43  vector<const DMCThrown *>throwns;
44  locEventLoop->Get(throwns);
45 
46  //CHECK TRIGGER TYPE
47  const DTrigger* locTrigger = NULL;
48  locEventLoop->GetSingle(locTrigger);
49  if(throwns.size()==0 && (!locTrigger->Get_IsPhysicsEvent()))
50  return NOERROR;
51 
52  // Write this event to the rest output stream.
53  vector<const DEventWriterREST*> locEventWriterRESTVector;
54  locEventLoop->Get(locEventWriterRESTVector);
55  locEventWriterRESTVector[0]->Write_RESTEvent(locEventLoop, "");
56 
57  return NOERROR;
58 }
59 
60 //-------------------------------
61 // erun
62 //-------------------------------
64 {
65  return NOERROR;
66 }
67 
68 //-------------------------------
69 // fini
70 //-------------------------------
72 {
73  return NOERROR;
74 }
jerror_t evnt(JEventLoop *loop, uint64_t eventnumber)
Called every event.
bool Get_IsPhysicsEvent(void) const
jerror_t brun(JEventLoop *loop, int32_t runnumber)
Called everytime a new run number is detected.
InitPlugin_t InitPlugin
jerror_t init(void)
Called once at program start.
jerror_t fini(void)
Called after last event of last event source has been processed.
jerror_t erun(void)
Called everytime run number changes, provided brun has been called.