ROOTANA
Loading...
Searching...
No Matches
libAnalyzerDisplay
display_example.cxx
Go to the documentation of this file.
1
/// This is an example of the a user defined event display.
2
/// The user then needs to define how they what to update and plot histograms.
3
/// The updating of histograms happens for each event.
4
/// In online mode, the plotting of histograms only happens for each XX events;
5
/// for offline mode the plotting happens for each event.
6
///
7
/// There are two ways that users can decide to update and plot histograms:
8
///
9
/// 1) They can create histograms in their event display class and then fill
10
/// the methods UpdateHistograms(TMidasEvent*) and PlotCanvas(TMidasEvent*).
11
/// This histograms can then file in the canvases that are added using
12
/// AddSingleCanvas(std::string name).
13
///
14
/// In this example this method is used for the histogram sizeBankFR10,
15
/// which is just a histogram of the size of the bank called "FR10".
16
///
17
/// 2) They can create classes that are derived from TCanvasHandleBase. The derived
18
/// classes are then added using the method AddSingleCanvas(TCanvasHandleBase* handleClass).
19
/// In this example there are two classes derived from TCanvasHandleBase:
20
/// a) TSimpleExampleCanvas: this class just creates a tab/canvas with a
21
/// histogram of the size of the bank called "FR11".
22
/// a) TComplicatedExampleCanvas: this class creates a set of four different
23
/// canvases/histograms which the user can select using a ROOT number widget.
24
///
25
/// The actual ROOT GUI is encapsulated in a separate class TMainDisplayWindow.
26
/// The TRootanaDisplay has an instance of this TMainDisplayWindow class.
27
/// Users will be need to access the TMainDisplayWindow by calling
28
///
29
/// TRootanaDisplay::GetDisplayWindow()
30
///
31
/// in order to grab the particular canvas that we want plot on.
32
33
34
#include <stdio.h>
35
#include <iostream>
36
37
#include "
TRootanaDisplay.hxx
"
38
#include "TH1D.h"
39
40
#include "
TSimpleExampleCanvas.hxx
"
41
#include "
TComplicatedExampleCanvas.hxx
"
42
43
class
MyTestLoop
:
public
TRootanaDisplay
{
44
45
TH1F
*
sizeBankFR10
;
46
public
:
47
48
MyTestLoop
() {
49
50
// Initialize histograms.
51
sizeBankFR10
=
new
TH1F
(
"sizeBankFR10"
,
"Size of FR10 bank"
,2000,0,10000);
52
}
53
54
void
AddAllCanvases
(){
55
// Set up tabbed canvases
56
AddSingleCanvas
(
new
TSimpleExampleCanvas
());
57
AddSingleCanvas
(
new
TComplicatedExampleCanvas
());
58
AddSingleCanvas
(
"FR10"
);
59
SetNumberSkipEvent
(20);
60
SetDisplayName
(
"Example Display"
);
61
};
62
63
virtual
~MyTestLoop
() {};
64
65
void
ResetHistograms
(){
66
sizeBankFR10
->Reset();
67
}
68
69
void
UpdateHistograms
(
TDataContainer
&
dataContainer
){
70
void
*
ptr
;
71
// Update histograms
72
int
size
=
dataContainer
.GetMidasData().LocateBank(
NULL
,
"FR10"
, &
ptr
);
73
sizeBankFR10
->Fill(
size
);
74
75
}
76
77
78
void
PlotCanvas
(
TDataContainer
&
dataContainer
){
79
80
if
(
GetDisplayWindow
()->GetCurrentTabName().
compare
(
"FR10"
) == 0){
81
TCanvas
*
c1
=
GetDisplayWindow
()->
GetCanvas
(
"FR10"
);
82
c1
->Clear();
83
sizeBankFR10
->Draw();
84
c1
->Modified();
85
c1
->Update();
86
}
87
88
}
89
90
91
};
92
93
94
95
96
97
98
int
main
(
int
argc,
char
*argv[])
99
{
100
MyTestLoop::CreateSingleton<MyTestLoop>
();
101
return
MyTestLoop::Get
().
ExecuteLoop
(argc, argv);
102
}
103
TComplicatedExampleCanvas.hxx
TRootanaDisplay.hxx
TSimpleExampleCanvas.hxx
MyTestLoop
Definition
anaDisplay.cxx:15
MyTestLoop::UpdateHistograms
void UpdateHistograms(TDataContainer &dataContainer)
This method can be implemented by users to update user histograms.
Definition
display_example.cxx:69
MyTestLoop::PlotCanvas
void PlotCanvas(TDataContainer &dataContainer)
This method can be implemented by users to plotting of current canvas.
Definition
display_example.cxx:78
MyTestLoop::AddAllCanvases
void AddAllCanvases()
User must.
Definition
display_example.cxx:54
MyTestLoop::~MyTestLoop
virtual ~MyTestLoop()
Definition
display_example.cxx:63
MyTestLoop::sizeBankFR10
TH1F * sizeBankFR10
Definition
display_example.cxx:45
MyTestLoop::MyTestLoop
MyTestLoop()
Definition
display_example.cxx:48
MyTestLoop::ResetHistograms
void ResetHistograms()
This method can be implemented by users to plotting of current canvas.
Definition
display_example.cxx:65
TComplicatedExampleCanvas
A complicated canvas example, using the values from V792 module.
Definition
TComplicatedExampleCanvas.hxx:13
TDataContainer
Definition
TDataContainer.hxx:29
TMainDisplayWindow::GetCanvas
TCanvas * GetCanvas(const char *name)
Get a particular canvas based on canvas name.
Definition
TMainDisplayWindow.cxx:405
TRootanaDisplay
Definition
TRootanaDisplay.hxx:58
TRootanaDisplay::AddSingleCanvas
void AddSingleCanvas(std::string name, std::string subtab_name=std::string(""))
Add a new canvas; user will interactively fill it.
Definition
TRootanaDisplay.hxx:71
TRootanaDisplay::SetNumberSkipEvent
void SetNumberSkipEvent(int number)
Definition
TRootanaDisplay.hxx:132
TRootanaDisplay::SetDisplayName
void SetDisplayName(std::string name)
Set Display name.
Definition
TRootanaDisplay.hxx:154
TRootanaDisplay::GetDisplayWindow
TMainDisplayWindow * GetDisplayWindow()
Definition
TRootanaDisplay.hxx:83
TRootanaEventLoop::Get
static TRootanaEventLoop & Get(void)
Definition
TRootanaEventLoop.cxx:78
TRootanaEventLoop::ExecuteLoop
int ExecuteLoop(int argc, char *argv[])
Method to actually process the Midas information, either as file or online.
Definition
TRootanaEventLoop.cxx:244
TRootanaEventLoop::CreateSingleton
static void CreateSingleton()
Definition
TRootanaEventLoop.hxx:137
TSimpleExampleCanvas
Definition
TSimpleExampleCanvas.hxx:15
main
int main(int argc, char *argv[])
Definition
display_example.cxx:98
Generated on Wed Dec 25 2024 05:01:03 for ROOTANA by
1.9.8