ROOTANA
ana.cxx
Go to the documentation of this file.
1 // Default program for dealing with various standard TRIUMF VME setups:
2 // V792, V1190 (VME), L2249 (CAMAC), Agilent current meter
3 //
4 //
5 
6 #include <stdio.h>
7 #include <iostream>
8 #include <time.h>
9 
10 #include "TRootanaEventLoop.hxx"
11 #include "TAnaManager.hxx"
12 
13 
14 class Analyzer: public TRootanaEventLoop {
15 
16 
17 
18 
19 public:
20 
21  // An analysis manager. Define and fill histograms in
22  // analysis manager.
24 
26  //DisableAutoMainWindow();
27  UseBatchMode();
28  anaManager = 0;
29 
30  };
31 
32  virtual ~Analyzer() {};
33 
34  void Initialize(){
35 
36 #ifdef HAVE_THTTP_SERVER
37  std::cout << "Using THttpServer in read/write mode" << std::endl;
39 #endif
40 
41  }
42 
43  void InitManager(){
44 
45  if(anaManager)
46  delete anaManager;
47  anaManager = new TAnaManager();
48 
49  }
50 
51 
52  void BeginRun(int transition,int run,int time){
53 
54  InitManager();
55 
56  }
57 
58 
59  bool ProcessMidasEvent(TDataContainer& dataContainer){
60 
61  if(!anaManager) InitManager();
62 
63  anaManager->ProcessMidasEvent(dataContainer);
64 
65 
66  return true;
67  }
68 
69 
70 };
71 
72 
73 int main(int argc, char *argv[])
74 {
75 
76  Analyzer::CreateSingleton<Analyzer>();
77  return Analyzer::Get().ExecuteLoop(argc, argv);
78 
79 }
80 
int main(int argc, char *argv[])
Definition: ana.cxx:73
Definition: ana.cxx:14
void InitManager()
Definition: ana.cxx:43
Analyzer()
Definition: ana.cxx:25
void BeginRun(int transition, int run, int time)
Definition: ana.cxx:52
bool ProcessMidasEvent(TDataContainer &dataContainer)
Definition: ana.cxx:59
TAnaManager * anaManager
Definition: ana.cxx:23
void Initialize()
Definition: ana.cxx:34
virtual ~Analyzer()
Definition: ana.cxx:32
int ProcessMidasEvent(TDataContainer &dataContainer)
Processes the midas event, fills histograms, etc.
Definition: TAnaManager.cxx:77
static TRootanaEventLoop & Get(void)
void UseBatchMode()
Use a batch mode, where we don't check ROOT status.
int ExecuteLoop(int argc, char *argv[])
Method to actually process the Midas information, either as file or online.
void SetTHttpServerReadWrite(bool readwrite=true)