ROOTANA
anaDisplay.cxx
Go to the documentation of this file.
1 #include <stdio.h>
2 #include <iostream>
3 
4 #include "TRootanaDisplay.hxx"
5 #include "TH1D.h"
6 #include "TV792Data.hxx"
7 
10 
11 
12 #include "TAnaManager.hxx"
13 #include "TTRB3Data.hxx"
14 
15 class MyTestLoop: public TRootanaDisplay {
16 
17 public:
18 
19  // An analysis manager. Define and fill histograms in
20  // analysis manager.
22 
24  SetOutputFilename("example_output");
25  DisableRootOutput(false);
26  anaManager = new TAnaManager();
27  // Number of events to skip before plotting one.
28  //SetNumberSkipEvent(10);
29  // Choose to use functionality to update after X seconds
31  // Uncomment this to enable the 'interesting event' functionality.
32  //iem_t::instance()->Enable();
33  }
34 
36 
37  // Set up tabbed canvases
38 
39  // Set up all the listed canvases from the AnaManager list of THistogramArrayBases
40  std::vector<THistogramArrayBase*> histos = anaManager->GetHistograms();
41 
42  for (unsigned int i = 0; i < histos.size(); i++) {
43  TCanvasHandleBase* canvas = histos[i]->CreateCanvas();
44  if (canvas) {
45  AddSingleCanvas(canvas, histos[i]->GetTabName());
46  }
47  }
48 
49  SetDisplayName("Example Display");
50  };
51 
52  virtual ~MyTestLoop() {};
53 
54  void BeginRun(int transition,int run,int time) {
55  std::cout << "User BOR method" << std::endl;
56  anaManager->BeginRun(transition, run, time);
57  std::cout << "End User BOR method" << std::endl;
58  }
59 
60  void EndRun(int transition,int run,int time) {
61  std::cout << "User EOR method" << std::endl;
62  anaManager->EndRun(transition, run, time);
63  }
64 
65  void ResetHistograms(){}
66 
67  void UpdateHistograms(TDataContainer& dataContainer){
68  // Update the cumulative histograms here
69  anaManager->ProcessMidasEvent(dataContainer);
70  }
71 
72  void PlotCanvas(TDataContainer& dataContainer){
73  // Update the transient (per-event) histograms here.
74  // saves CPU to not update them always when not being used.
75  anaManager->UpdateTransientPlots(dataContainer);
76  }
77 
78 };
79 
80 
81 
82 
83 
84 
85 int main(int argc, char *argv[])
86 {
87  MyTestLoop::CreateSingleton<MyTestLoop>();
88  return MyTestLoop::Get().ExecuteLoop(argc, argv);
89 }
90 
int main(int argc, char *argv[])
Definition: anaDisplay.cxx:85
void UpdateHistograms(TDataContainer &dataContainer)
This method can be implemented by users to update user histograms.
Definition: anaDisplay.cxx:67
void EndRun(int transition, int run, int time)
Definition: anaDisplay.cxx:60
void PlotCanvas(TDataContainer &dataContainer)
This method can be implemented by users to plotting of current canvas.
Definition: anaDisplay.cxx:72
TAnaManager * anaManager
Definition: anaDisplay.cxx:21
void AddAllCanvases()
User must.
Definition: anaDisplay.cxx:35
virtual ~MyTestLoop()
Definition: anaDisplay.cxx:52
void ResetHistograms()
This method can be implemented by users to plotting of current canvas.
Definition: anaDisplay.cxx:65
void BeginRun(int transition, int run, int time)
Definition: anaDisplay.cxx:54
std::vector< THistogramArrayBase * > GetHistograms()
Definition: TAnaManager.hxx:64
void EndRun(int transition, int run, int time)
Definition: TAnaManager.hxx:53
int ProcessMidasEvent(TDataContainer &dataContainer)
Processes the midas event, fills histograms, etc.
Definition: TAnaManager.cxx:77
void UpdateTransientPlots(TDataContainer &dataContainer)
void BeginRun(int transition, int run, int time)
Definition: TAnaManager.hxx:52
void AddSingleCanvas(std::string name, std::string subtab_name=std::string(""))
Add a new canvas; user will interactively fill it.
void SetDisplayName(std::string name)
Set Display name.
void SetOnlineUpdatingBasedSeconds(bool updateBasedSeconds=true)
static TRootanaEventLoop & Get(void)
void DisableRootOutput(bool disable=true)
void SetOutputFilename(std::string name)
int ExecuteLoop(int argc, char *argv[])
Method to actually process the Midas information, either as file or online.