ROOTANA
Loading...
Searching...
No Matches
manalyzer_example_cxx.cxx
Go to the documentation of this file.
1//
2// MIDAS analyzer example 1: pure C++ analyzer
3//
4// K.Olchanski
5//
6
7#include <stdio.h>
8
9#include "manalyzer.h"
10#include "midasio.h"
11
13{
14public:
16 : TARunObject(runinfo)
17 {
18 printf("ctor, run %d, file %s\n", runinfo->fRunNo, runinfo->fFileName.c_str());
20 fModuleName = "ExampleCxx";
21 }
22
24 {
25 printf("dtor!\n");
26 }
27
28 void BeginRun(TARunInfo* runinfo)
29 {
30 printf("BeginRun, run %d, file %s\n", runinfo->fRunNo, runinfo->fFileName.c_str());
32 }
33
34 void EndRun(TARunInfo* runinfo)
35 {
36 printf("EndRun, run %d\n", runinfo->fRunNo);
37 printf("Counted %d events in run %d\n", fRunEventCounter, runinfo->fRunNo);
38 }
39
40 void NextSubrun(TARunInfo* runinfo)
41 {
42 printf("NextSubrun, run %d, file %s\n", runinfo->fRunNo, runinfo->fFileName.c_str());
43 }
44
45 void PauseRun(TARunInfo* runinfo)
46 {
47 printf("PauseRun, run %d\n", runinfo->fRunNo);
48 }
49
50 void ResumeRun(TARunInfo* runinfo)
51 {
52 printf("ResumeRun, run %d\n", runinfo->fRunNo);
53 }
54
55 TAFlowEvent* Analyze(TARunInfo* runinfo, TMEvent* event, TAFlags* flags, TAFlowEvent* flow)
56 {
57 printf("Analyze, run %d, event serno %d, id 0x%04x, data size %d\n", runinfo->fRunNo, event->serial_number, (int)event->event_id, event->data_size);
58 //event->old_event.SetBankList();
59 //event->old_event.Print();
60
62
63 return flow;
64 }
65
66 void AnalyzeSpecialEvent(TARunInfo* runinfo, TMEvent* event)
67 {
68 printf("AnalyzeSpecialEvent, run %d, event serno %d, id 0x%04x, data size %d\n", runinfo->fRunNo, event->serial_number, (int)event->event_id, event->data_size);
69 }
70
72};
73
75{
76public:
77 void Usage()
78 {
79 printf("\tExample TAFactory Usage!\n");
80 printf("\tPrint valid arguements for this modules here!");
81 }
82 void Init(const std::vector<std::string> &args)
83 {
84 printf("Init!\n");
85 printf("Arguments:\n");
86 for (unsigned i=0; i<args.size(); i++)
87 printf("arg[%d]: [%s]\n", i, args[i].c_str());
88 }
89
90 void Finish()
91 {
92 printf("Finish!\n");
93 }
94
96 {
97 printf("NewRunObject, run %d, file %s\n", runinfo->fRunNo, runinfo->fFileName.c_str());
98 return new ExampleCxx(runinfo);
99 }
100};
101
103
104/* emacs
105 * Local Variables:
106 * tab-width: 8
107 * c-basic-offset: 3
108 * indent-tabs-mode: nil
109 * End:
110 */
void Init(const std::vector< std::string > &args)
TARunObject * NewRunObject(TARunInfo *runinfo)
void AnalyzeSpecialEvent(TARunInfo *runinfo, TMEvent *event)
void BeginRun(TARunInfo *runinfo)
ExampleCxx(TARunInfo *runinfo)
void EndRun(TARunInfo *runinfo)
void PauseRun(TARunInfo *runinfo)
TAFlowEvent * Analyze(TARunInfo *runinfo, TMEvent *event, TAFlags *flags, TAFlowEvent *flow)
void ResumeRun(TARunInfo *runinfo)
void NextSubrun(TARunInfo *runinfo)
std::string fFileName
Definition manalyzer.h:25
int fRunNo
Definition manalyzer.h:24
std::string fModuleName
Definition manalyzer.h:84
uint32_t serial_number
MIDAS event serial number.
Definition midasio.h:59
uint32_t data_size
MIDAS event data size.
Definition midasio.h:61
uint16_t event_id
MIDAS event ID.
Definition midasio.h:57
int TAFlags
Definition manalyzer.h:72
static TARegister tar(new ExampleCxxFactory)