Belle II Software development
EclPainterCommon Class Reference

Painter for EclData that shows common event characteristics on 1D histograms. More...

#include <EclPainterCommon.h>

Inheritance diagram for EclPainterCommon:
EclPainter

Public Types

enum  Type {
  ENERGY ,
  ENERGY_SUM ,
  TIME
}
 Subtype of histogram to draw. More...
 

Public Member Functions

 EclPainterCommon (EclData *data, Type type)
 Constructor for EclPainter subclass.
 
virtual ~EclPainterCommon ()
 Destructor for EclPainter subclass.
 
Type getType ()
 Return subtype of ECLPainterCommon.
 
virtual void getInformation (int px, int py, MultilineWidget *panel) override
 Sets the information to be displayed in the provided MultilineWidget.
 
void Draw () override
 Redraw the canvas.
 
void setData (EclData *data)
 Set EclData to display in painter.
 
EclDatagetData ()
 Return currently displayed EclData.
 
const EclDatagetData () const
 Return currently displayed EclData.
 
void setMapper (ECL::ECLChannelMapper *mapper)
 Set ECLChannelMapper for CellID <-> (crate, shaper, chid) conversion.
 
ECL::ECLChannelMappergetMapper ()
 Return currently set ECLChannelMapper.
 
void setDisplayedSubsystem (EclData::EclSubsystem sys)
 Change between the displayed ECL subsystem (barrel, forward and backward endcaps).
 
EclData::EclSubsystem getDisplayedSubsystem ()
 Get currently displayed ECL subsystem.
 
TString getSubsystemTitle (EclData::EclSubsystem subsys)
 Return title of ECL subsystem to use in painter.
 
virtual EclPainterhandleClick (int px, int py)
 Some EclPainters can shift to another view upon click.
 
virtual void setXRange (int x1, int x2)
 Set XRange for histogram in EclPainter.
 

Protected Member Functions

void getNewRootObjectName (char *buf, int size)
 Make unique name for next root object.
 

Private Member Functions

int getMinX ()
 Return m_x_min.
 
int getMaxX ()
 Return m_x_max.
 
void initHisto ()
 Initialize histogram.
 
void setTitles ()
 Update titles of the histogram.
 
void cloneFrom (const EclPainter &other)
 Clone attributes from other EclPainter.
 

Private Attributes

Type m_type
 Display subtypes of this class.
 
TH1F * m_hist
 Histogram for energy distribution.
 
EclDatam_ecl_data
 Data to draw.
 
ECL::ECLChannelMapperm_mapper
 mapper for CellID <-> (crate, shaper, chid) conversion.
 
EclData::EclSubsystem displayed_subsys
 Identifier of displayed ECL subsystem.
 

Static Private Attributes

static int m_obj_counter = 0
 Counter to make unique names for new root objects.
 

Detailed Description

Painter for EclData that shows common event characteristics on 1D histograms.

Definition at line 27 of file EclPainterCommon.h.

Member Enumeration Documentation

◆ Type

enum Type

Subtype of histogram to draw.

Enumerator
ENERGY 

Energy per channel distribution.

ENERGY_SUM 

Energy per event distribution.

TIME 

Time distribution.

Definition at line 30 of file EclPainterCommon.h.

30 {
31 ENERGY,
33 TIME
34 };
@ ENERGY_SUM
Energy per event distribution.
@ ENERGY
Energy per channel distribution.
@ TIME
Time distribution.

Constructor & Destructor Documentation

◆ EclPainterCommon()

EclPainterCommon ( EclData data,
Type  type 
)

Constructor for EclPainter subclass.

Definition at line 16 of file EclPainterCommon.cc.

16 :
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}
Type m_type
Display subtypes of this class.
TH1F * m_hist
Histogram for energy distribution.
void initHisto()
Initialize histogram.
Painter for EclData, parent class, created with EclPainterFactory.
Definition: EclPainter.h:29

◆ ~EclPainterCommon()

~EclPainterCommon ( )
virtual

Destructor for EclPainter subclass.

Definition at line 27 of file EclPainterCommon.cc.

28{
29 delete m_hist;
30}

Member Function Documentation

◆ cloneFrom()

void cloneFrom ( const EclPainter other)
privateinherited

Clone attributes from other EclPainter.

Definition at line 93 of file EclPainter.cc.

94{
95 m_ecl_data = new EclData(*other.m_ecl_data);
96 m_mapper = other.m_mapper;
98}
This class contains data for ECLSimHit's and provides several relevant conversion functions for bette...
Definition: EclData.h:31
ECL::ECLChannelMapper * m_mapper
mapper for CellID <-> (crate, shaper, chid) conversion.
Definition: EclPainter.h:113
EclData * m_ecl_data
Data to draw.
Definition: EclPainter.h:111
EclData::EclSubsystem displayed_subsys
Identifier of displayed ECL subsystem.
Definition: EclPainter.h:116

◆ Draw()

void Draw ( )
overridevirtual

Redraw the canvas.

Implements EclPainter.

Definition at line 74 of file EclPainterCommon.cc.

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}
int getMinX()
Return m_x_min.
int getMaxX()
Return m_x_max.
void setTitles()
Update titles of the histogram.
Type getType()
Return subtype of ECLPainterCommon.
EclData::EclSubsystem getDisplayedSubsystem()
Get currently displayed ECL subsystem.
Definition: EclPainter.cc:51
EclData * getData()
Return currently displayed EclData.
Definition: EclPainter.h:46

◆ getData() [1/2]

EclData * getData ( )
inlineinherited

Return currently displayed EclData.

Definition at line 46 of file EclPainter.h.

46{ return m_ecl_data; }

◆ getData() [2/2]

const EclData * getData ( ) const
inlineinherited

Return currently displayed EclData.

Definition at line 48 of file EclPainter.h.

48{ return m_ecl_data; }

◆ getDisplayedSubsystem()

EclData::EclSubsystem getDisplayedSubsystem ( )
inherited

Get currently displayed ECL subsystem.

Definition at line 51 of file EclPainter.cc.

52{
53 return displayed_subsys;
54}

◆ getInformation()

void getInformation ( int  px,
int  py,
MultilineWidget panel 
)
overridevirtual

Sets the information to be displayed in the provided MultilineWidget.

Parameters
pxX coordinate of mouse cursor.
pyY coordinate of mouse cursor.
panelMultilineWidget to display the information

Reimplemented from EclPainter.

Definition at line 69 of file EclPainterCommon.cc.

70{
71 EclPainter::getInformation(px, py, panel);
72}
virtual void getInformation(int px, int py, MultilineWidget *panel)
Sets the information to be displayed in the provided MultilineWidget.
Definition: EclPainter.cc:72

◆ getMapper()

ECL::ECLChannelMapper * getMapper ( )
inherited

Return currently set ECLChannelMapper.

Definition at line 41 of file EclPainter.cc.

42{
43 return m_mapper;
44}

◆ getMaxX()

int getMaxX ( )
private

Return m_x_max.

Definition at line 46 of file EclPainterCommon.cc.

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}

◆ getMinX()

int getMinX ( )
private

Return m_x_min.

Definition at line 32 of file EclPainterCommon.cc.

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}

◆ getNewRootObjectName()

void getNewRootObjectName ( char *  buf,
int  size 
)
protectedinherited

Make unique name for next root object.

Definition at line 88 of file EclPainter.cc.

89{
90 snprintf(buf, n, "ECL DATA_%d", m_obj_counter++);
91}
static int m_obj_counter
Counter to make unique names for new root objects.
Definition: EclPainter.h:109

◆ getSubsystemTitle()

TString getSubsystemTitle ( EclData::EclSubsystem  subsys)
inherited

Return title of ECL subsystem to use in painter.

Definition at line 56 of file EclPainter.cc.

57{
58 switch (subsys) {
59 case EclData::BARR:
60 return TString("Barrel");
61 case EclData::FORW:
62 return TString("Forward endcap");
63 case EclData::BACKW:
64 return TString("Backward endcap");
65 case EclData::ALL:
66 return TString("Full ECL");
67 default:
68 return TString();
69 }
70}

◆ getType()

Return subtype of ECLPainterCommon.

Definition at line 120 of file EclPainterCommon.cc.

121{
122 return m_type;
123}

◆ handleClick()

EclPainter * handleClick ( int  px,
int  py 
)
virtualinherited

Some EclPainters can shift to another view upon click.

(For example, clicking on crate reveals histogram of shapers in that crate)

Returns
EclPainter with new perspective/range.

Reimplemented in EclPainter1D.

Definition at line 79 of file EclPainter.cc.

80{
81 return nullptr;
82}

◆ initHisto()

void initHisto ( )
private

Initialize histogram.

Definition at line 60 of file EclPainterCommon.cc.

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}
void getNewRootObjectName(char *buf, int size)
Make unique name for next root object.
Definition: EclPainter.cc:88

◆ setData()

void setData ( EclData data)
inlineinherited

Set EclData to display in painter.


Definition at line 44 of file EclPainter.h.

44{ m_ecl_data = data; }

◆ setDisplayedSubsystem()

void setDisplayedSubsystem ( EclData::EclSubsystem  sys)
inherited

Change between the displayed ECL subsystem (barrel, forward and backward endcaps).

Definition at line 46 of file EclPainter.cc.

47{
48 displayed_subsys = sys;
49}

◆ setMapper()

void setMapper ( ECL::ECLChannelMapper mapper)
inherited

Set ECLChannelMapper for CellID <-> (crate, shaper, chid) conversion.

Definition at line 36 of file EclPainter.cc.

37{
38 m_mapper = mapper;
39}

◆ setTitles()

void setTitles ( )
private

Update titles of the histogram.

Definition at line 97 of file EclPainterCommon.cc.

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]) + " (" +
114 m_hist->SetTitle(title);
115
116 m_hist->SetXTitle(xname[type]);
117 m_hist->SetYTitle("");
118}
TString getSubsystemTitle(EclData::EclSubsystem subsys)
Return title of ECL subsystem to use in painter.
Definition: EclPainter.cc:56

◆ setXRange()

void setXRange ( int  x1,
int  x2 
)
virtualinherited

Set XRange for histogram in EclPainter.

Reimplemented in EclPainter1D.

Definition at line 84 of file EclPainter.cc.

85{
86}

Member Data Documentation

◆ displayed_subsys

EclData::EclSubsystem displayed_subsys
privateinherited

Identifier of displayed ECL subsystem.

Definition at line 116 of file EclPainter.h.

◆ m_ecl_data

EclData* m_ecl_data
privateinherited

Data to draw.

Definition at line 111 of file EclPainter.h.

◆ m_hist

TH1F* m_hist
private

Histogram for energy distribution.

Definition at line 49 of file EclPainterCommon.h.

◆ m_mapper

ECL::ECLChannelMapper* m_mapper
privateinherited

mapper for CellID <-> (crate, shaper, chid) conversion.

Definition at line 113 of file EclPainter.h.

◆ m_obj_counter

int m_obj_counter = 0
staticprivateinherited

Counter to make unique names for new root objects.

Definition at line 109 of file EclPainter.h.

◆ m_type

Type m_type
private

Display subtypes of this class.

Definition at line 47 of file EclPainterCommon.h.


The documentation for this class was generated from the following files: