Belle II Software development
EclPainterCommon.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8//This module
9#include <ecl/modules/eclDisplay/EclPainterCommon.h>
10
11//Root
12#include <TH1.h>
13
14using namespace Belle2;
15
17 EclPainter(data)
18{
19 m_type = type;
20
21 initHisto();
22 m_hist->GetXaxis()->CenterTitle();
23 m_hist->GetXaxis()->SetTitleOffset(1.1);
24 m_hist->GetYaxis()->SetTitleOffset(1.1);
25}
26
28{
29 delete m_hist;
30}
31
33{
34 switch (m_type) {
35 case ENERGY:
36 return 0;
37 case ENERGY_SUM:
38 return 0;
39 case TIME:
40 return -2048;
41 }
42
43 return 0;
44}
45
47{
48 switch (m_type) {
49 case ENERGY:
50 return 150;
51 case ENERGY_SUM:
52 return 2500;
53 case TIME:
54 return 2048;
55 }
56
57 return 0;
58}
59
61{
62
63 char obj_name[255];
64 getNewRootObjectName(obj_name, 255);
65 m_hist = new TH1F(obj_name, "title", getMaxX() / 10,
66 getMinX(), getMaxX());
67}
68
70{
71 EclPainter::getInformation(px, py, panel);
72}
73
75{
76 EclData* data = getData();
77
78 setTitles();
79 m_hist->Reset();
80
81 switch (getType()) {
82 case ENERGY:
83 data->fillEnergyHistogram(m_hist, getMinX(), getMaxX(), getDisplayedSubsystem());
84 break;
85 case ENERGY_SUM:
86 data->fillEnergySumHistogram(m_hist, getMinX(), getMaxX(), getDisplayedSubsystem());
87 break;
88 case TIME:
89 data->fillTimeHistogram(m_hist, getMinX(), getMaxX(), getDisplayedSubsystem());
90 break;
91 }
92
93 m_hist->Draw();
94}
95
96
98{
99 const char* name[3] = {
100 "Energy per channel",
101 "Energy sum per event",
102 "Time"
103 };
104 const char* xname[3] = {
105 "Energy (MeV)",
106 "Energy (MeV)",
107 "Time (ns)"
108 };
109
110 int type = (int)getType();
111
112 TString title = TString(name[type]) + " (" +
113 getSubsystemTitle(getDisplayedSubsystem()) + ")";
114 m_hist->SetTitle(title);
115
116 m_hist->SetXTitle(xname[type]);
117 m_hist->SetYTitle("");
118}
119
121{
122 return m_type;
123}
This class contains data for ECLSimHit's and provides several relevant conversion functions for bette...
Definition: EclData.h:31
Type m_type
Display subtypes of this class.
TH1F * m_hist
Histogram for energy distribution.
Type
Subtype of histogram to draw.
@ ENERGY_SUM
Energy per event distribution.
@ ENERGY
Energy per channel distribution.
@ TIME
Time distribution.
int getMinX()
Return m_x_min.
int getMaxX()
Return m_x_max.
virtual ~EclPainterCommon()
Destructor for EclPainter subclass.
void setTitles()
Update titles of the histogram.
virtual void getInformation(int px, int py, MultilineWidget *panel) override
Sets the information to be displayed in the provided MultilineWidget.
Type getType()
Return subtype of ECLPainterCommon.
void initHisto()
Initialize histogram.
void Draw() override
Redraw the canvas.
EclPainterCommon(EclData *data, Type type)
Constructor for EclPainter subclass.
Painter for EclData, parent class, created with EclPainterFactory.
Definition: EclPainter.h:29
EclData::EclSubsystem getDisplayedSubsystem()
Get currently displayed ECL subsystem.
Definition: EclPainter.cc:51
virtual void getInformation(int px, int py, MultilineWidget *panel)
Sets the information to be displayed in the provided MultilineWidget.
Definition: EclPainter.cc:72
EclData * getData()
Return currently displayed EclData.
Definition: EclPainter.h:46
void getNewRootObjectName(char *buf, int size)
Make unique name for next root object.
Definition: EclPainter.cc:88
Widget which contains the dynamic amount of TGLabel objects.
Abstract base class for different kinds of events.