ROOTANA
manalyzer_v0.h
Go to the documentation of this file.
1 // manalyzer.h
2 
3 #ifndef MANALYZER_H
4 #define MANALYZER_H
5 
6 #include <string>
7 #include <vector>
8 
9 #include "rootana_config.h"
10 #include "midasio.h"
11 #include "VirtualOdb.h"
12 
13 class TARootHelper;
14 
15 class TARunInfo
16 {
17  public:
18  int fRunNo;
19  std::string fFileName;
22 
23  public:
24  TARunInfo(int runno, const char* filename);
26 
27  private:
28  TARunInfo() {}; // hidden default constructor
29 };
30 
31 class TAFlowEvent
32 {
33  public:
35 
36  public:
38  virtual ~TAFlowEvent();
39 
40  template<class T> T* Find()
41  {
42  TAFlowEvent* f = this;
43  while (f) {
44  T *ptr = dynamic_cast<T*>(f);
45  if (ptr) return ptr;
46  f = f->fNext;
47  }
48  return NULL;
49  }
50 
51  private:
52  TAFlowEvent() {}; // hidden default constructor
53 };
54 
55 typedef int TAFlags;
56 
57 #define TAFlag_OK 0
58 #define TAFlag_SKIP (1<<0)
59 #define TAFlag_QUIT (1<<1)
60 #define TAFlag_WRITE (1<<2)
61 #define TAFlag_DISPLAY (1<<3)
62 
63 class TARunInterface
64 {
65  public:
66  TARunInterface(TARunInfo* runinfo); // ctor
67  virtual ~TARunInterface() {}; // dtor
68 
69  public:
70  virtual void BeginRun(TARunInfo* runinfo); // begin of run
71  virtual void EndRun(TARunInfo* runinfo); // end of run
72 
73  virtual void PauseRun(TARunInfo* runinfo); // pause of run (if online)
74  virtual void ResumeRun(TARunInfo* runinfo); // resume of run (if online)
75 
76  virtual TAFlowEvent* Analyze(TARunInfo* runinfo, TMEvent* event, TAFlags* flags, TAFlowEvent* flow);
77  virtual void AnalyzeSpecialEvent(TARunInfo* runinfo, TMEvent* event);
78 
79  private:
80  TARunInterface(); // hidden default constructor
81 };
82 
84 {
85  public:
86  TAModuleInterface() {}; // ctor
87  virtual ~TAModuleInterface() {}; // dtor
88 
89  public:
90  virtual TARunInterface* NewRun(TARunInfo* runinfo) = 0; // factory for module-specific Run objects
91 
92  public:
93  virtual void Init(const std::vector<std::string> &args); // start of analysis
94  virtual void Finish(); // end of analysis
95 };
96 
97 class TARegisterModule
98 {
99  public:
101  //static void Register(TAModuleInterface* m);
102  //static std::vector<TAModuleInterface*>* fgModules;
103  //static std::vector<TAModuleInterface*>* Get() const;
104 };
105 
106 #ifdef HAVE_ROOT
107 
108 #include "TFile.h"
109 #include "TDirectory.h"
110 #include "TApplication.h"
111 
112 class XmlServer;
113 class THttpServer;
114 
115 class TARootHelper
116 {
117  public:
118  TFile* fOutputFile;
119  static TDirectory* fgDir;
120  static TApplication* fgApp;
121  static XmlServer* fgXmlServer;
122  static THttpServer* fgHttpServer;
123 
124  public:
126  ~TARootHelper(); // dtor
127 
128  private:
129  TARootHelper() { }; // hidden default constructor
130 };
131 #endif
132 
133 int manalyzer_main(int argc, char* argv[]);
134 
135 #endif
136 
137 /* emacs
138  * Local Variables:
139  * tab-width: 8
140  * c-basic-offset: 3
141  * indent-tabs-mode: nil
142  * End:
143  */
144 
TAFlowEvent(TAFlowEvent *)
virtual ~TAFlowEvent()
TAFlowEvent * fNext
Definition: manalyzer.h:51
virtual void Finish()
virtual ~TAModuleInterface()
Definition: manalyzer_v0.h:87
virtual void Init(const std::vector< std::string > &args)
virtual TARunInterface * NewRun(TARunInfo *runinfo)=0
TARegisterModule(TAModuleInterface *m)
TARootHelper(const TARunInfo *)
static TApplication * fgApp
Definition: manalyzer.h:156
static THttpServer * fgHttpServer
Definition: manalyzer.h:157
static XmlServer * fgXmlServer
Definition: manalyzer_v0.h:121
TFile * fOutputFile
Definition: manalyzer.h:154
static TDirectory * fgDir
Definition: manalyzer.h:155
std::string fFileName
Definition: manalyzer.h:25
MVOdb * fOdb
Definition: manalyzer.h:26
int fRunNo
Definition: manalyzer.h:24
TARunInfo(int runno, const char *filename)
TARootHelper * fRoot
Definition: manalyzer.h:27
TARunInterface(TARunInfo *runinfo)
virtual void EndRun(TARunInfo *runinfo)
virtual void ResumeRun(TARunInfo *runinfo)
virtual void AnalyzeSpecialEvent(TARunInfo *runinfo, TMEvent *event)
virtual void PauseRun(TARunInfo *runinfo)
virtual void BeginRun(TARunInfo *runinfo)
virtual TAFlowEvent * Analyze(TARunInfo *runinfo, TMEvent *event, TAFlags *flags, TAFlowEvent *flow)
virtual ~TARunInterface()
Definition: manalyzer_v0.h:67
int TAFlags
Definition: manalyzer.h:72
int TAFlags
Definition: manalyzer_v0.h:55
int manalyzer_main(int argc, char *argv[])
Definition: manalyzer.cxx:2692