Belle II Software development
EclPainter Class Referenceabstract

Painter for EclData, parent class, created with EclPainterFactory. More...

#include <EclPainter.h>

Inheritance diagram for EclPainter:
EclPainter1D EclPainter2D EclPainterCommon EclPainterPolar

Public Member Functions

 EclPainter (EclData *data)
 Default constructor.
 
 EclPainter (const EclPainter &other)
 Copy constructor.
 
EclPainteroperator= (const EclPainter &other)
 Assignment operator.
 
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 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.
 
virtual void Draw ()=0
 Redraw the canvas.
 

Protected Member Functions

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

Private Member Functions

void cloneFrom (const EclPainter &other)
 Clone attributes from other EclPainter.
 

Private Attributes

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, parent class, created with EclPainterFactory.

Definition at line 29 of file EclPainter.h.

Constructor & Destructor Documentation

◆ EclPainter() [1/2]

EclPainter ( EclData data)
explicit

Default constructor.

Parameters
dataData to display.

Definition at line 24 of file EclPainter.cc.

24 :
25 m_mapper(0)
26{
27 setData(data);
28 displayed_subsys = EclData::ALL;
29}
ECL::ECLChannelMapper * m_mapper
mapper for CellID <-> (crate, shaper, chid) conversion.
Definition: EclPainter.h:113
void setData(EclData *data)
Set EclData to display in painter.
Definition: EclPainter.h:44
EclData::EclSubsystem displayed_subsys
Identifier of displayed ECL subsystem.
Definition: EclPainter.h:116

◆ EclPainter() [2/2]

EclPainter ( const EclPainter other)
inline

Copy constructor.

Definition at line 37 of file EclPainter.h.

37{ cloneFrom(other); }
void cloneFrom(const EclPainter &other)
Clone attributes from other EclPainter.
Definition: EclPainter.cc:93

◆ ~EclPainter()

~EclPainter ( )
virtual

Definition at line 31 of file EclPainter.cc.

32{
33
34}

Member Function Documentation

◆ cloneFrom()

void cloneFrom ( const EclPainter other)
private

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
EclData * m_ecl_data
Data to draw.
Definition: EclPainter.h:111

◆ Draw()

virtual void Draw ( )
pure virtual

Redraw the canvas.

Implemented in EclPainter1D, EclPainter2D, EclPainterCommon, and EclPainterPolar.

◆ getData() [1/2]

EclData * getData ( )
inline

Return currently displayed EclData.

Definition at line 46 of file EclPainter.h.

46{ return m_ecl_data; }

◆ getData() [2/2]

const EclData * getData ( ) const
inline

Return currently displayed EclData.

Definition at line 48 of file EclPainter.h.

48{ return m_ecl_data; }

◆ getDisplayedSubsystem()

EclData::EclSubsystem getDisplayedSubsystem ( )

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

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, EclPainter2D, EclPainterCommon, and EclPainterPolar.

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}
float getEnergyTotal()
Definition: EclData.cc:188
void setLine(int line_id, const char *text)
Set content of the specified line to 'text'.

◆ getMapper()

ECL::ECLChannelMapper * getMapper ( )

Return currently set ECLChannelMapper.

Definition at line 41 of file EclPainter.cc.

42{
43 return m_mapper;
44}

◆ getNewRootObjectName()

void getNewRootObjectName ( char *  buf,
int  size 
)
protected

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)

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}

◆ handleClick()

EclPainter * handleClick ( int  px,
int  py 
)
virtual

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}

◆ operator=()

EclPainter & operator= ( const EclPainter other)
inline

Assignment operator.

Definition at line 41 of file EclPainter.h.

41{ cloneFrom(other); return *this; }

◆ setData()

void setData ( EclData data)
inline

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)

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)

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

Definition at line 36 of file EclPainter.cc.

37{
38 m_mapper = mapper;
39}

◆ setXRange()

void setXRange ( int  x1,
int  x2 
)
virtual

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
private

Identifier of displayed ECL subsystem.

Definition at line 116 of file EclPainter.h.

◆ m_ecl_data

EclData* m_ecl_data
private

Data to draw.

Definition at line 111 of file EclPainter.h.

◆ m_mapper

ECL::ECLChannelMapper* m_mapper
private

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

Definition at line 113 of file EclPainter.h.

◆ m_obj_counter

int m_obj_counter = 0
staticprivate

Counter to make unique names for new root objects.

Definition at line 109 of file EclPainter.h.


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