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 () override
 Destructor for EclPainter subclass.
 
 EclPainterCommon (const EclPainterCommon &)=delete
 Copy constructor (disabled).
 
EclPainterCommonoperator= (const EclPainterCommon &)=delete
 Operator = (disabled).
 
Type getType ()
 Return subtype of ECLPainterCommon.
 
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.
 
virtual void getInformation (int px, int py, MultilineWidget *panel)
 Sets the information to be displayed in the provided MultilineWidget.
 
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.
 

Static Public Member Functions

static TString getSubsystemTitle (EclData::EclSubsystem subsys)
 Return title of ECL subsystem to use in painter.
 

Static Protected Member Functions

static 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,
32 ENERGY_SUM,
33 TIME
34 };

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.
EclPainter(EclData *data)
Default constructor.
Definition EclPainter.cc:24

◆ ~EclPainterCommon()

~EclPainterCommon ( )
overridevirtual

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}
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 69 of file EclPainterCommon.cc.

70{
71 EclData* data = getData();
72
73 setTitles();
74 m_hist->Reset();
75
76 switch (getType()) {
77 case ENERGY:
78 data->fillEnergyHistogram(m_hist, getMinX(), getMaxX(), getDisplayedSubsystem());
79 break;
80 case ENERGY_SUM:
81 data->fillEnergySumHistogram(m_hist, getMinX(), getMaxX(), getDisplayedSubsystem());
82 break;
83 case TIME:
84 data->fillTimeHistogram(m_hist, getMinX(), getMaxX(), getDisplayedSubsystem());
85 break;
86 }
87
88 m_hist->Draw();
89}
@ 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.
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 )
virtualinherited

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 in EclPainter1D, and EclPainter2D.

Definition at line 72 of file EclPainter.cc.

73{
74 char info[255];
75 sprintf(info, "energy emission = %.2f MeV", m_ecl_data->getEnergyTotal());
76 panel->setLine(0, info);
77}
void setLine(int line_id, const char *text)
Set content of the specified line to 'text'.

◆ 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 )
staticprotectedinherited

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)
staticinherited

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 115 of file EclPainterCommon.cc.

116{
117 return m_type;
118}

◆ 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}
static 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 92 of file EclPainterCommon.cc.

93{
94 const char* name[3] = {
95 "Energy per channel",
96 "Energy sum per event",
97 "Time"
98 };
99 const char* xname[3] = {
100 "Energy (MeV)",
101 "Energy (MeV)",
102 "Time (ns)"
103 };
104
105 int type = (int)getType();
106
107 TString title = TString(name[type]) + " (" +
109 m_hist->SetTitle(title);
110
111 m_hist->SetXTitle(xname[type]);
112 m_hist->SetYTitle("");
113}
static 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 54 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 52 of file EclPainterCommon.h.


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