Belle II Software  release-08-01-10
EclPainter2D Class Reference

Painter for EclData, 2D histograms. More...

#include <EclPainter2D.h>

Inheritance diagram for EclPainter2D:
Collaboration diagram for EclPainter2D:

Public Types

enum  Type {
  CHANNEL_2D ,
  SHAPER_2D ,
  NONE
}
 Subtype of histogram to draw. More...
 

Public Member Functions

 EclPainter2D (EclData *data, Type type)
 Constructor for EclPainter subclass.
 
 EclPainter2D (const EclPainter2D &other)
 Copy constructor.
 
EclPainter2Doperator= (const EclPainter2D &other)
 Assignment operator.
 
 ~EclPainter2D ()
 Destructor for EclPainter subclass.
 
virtual void getInformation (int px, int py, MultilineWidget *panel) override
 Sets the information to be displayed in the provided MultilineWidget. More...
 
Type getType ()
 Return subtype of ECLPainter2D.
 
virtual void Draw () override
 Redraw the canvas.
 
void setData (EclData *data)
 Set EclData to display in painter. More...
 
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. More...
 
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

void cloneFrom (const EclPainter2D &other)
 Clone attributes from other EclPainter2D.
 
void setTitles ()
 Update histogram titles.
 
int getMaxX ()
 Returns number of X bins.
 
int getMaxY ()
 Returns number of Y bins.
 
int channelToSegIdX (int channel)
 Convert channel id to X bin number.
 
int channelToSegIdY (int channel)
 Convert channel id to Y bin number.
 
void initGrid ()
 Initialize grid for drawGrid().
 
void drawGrid ()
 Draw grid over histogram. More...
 

Private Attributes

Type m_type
 Display subtypes of this class.
 
TH2F * m_hist
 Displayed histogram.
 
TH2C * hgrid
 The grid itself, drawn in drawGrid().
 
TPad * grid
 Grid pad, drawn in drawGrid().
 
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, 2D histograms.

Definition at line 26 of file EclPainter2D.h.

Member Enumeration Documentation

◆ Type

enum Type

Subtype of histogram to draw.

Enumerator
CHANNEL_2D 

(theta_id:phi_id) histogram.

SHAPER_2D 

(shaper:crate) histogram.

Definition at line 29 of file EclPainter2D.h.

29  {
30  CHANNEL_2D,
31  SHAPER_2D,
32  NONE
33  };
@ CHANNEL_2D
(theta_id:phi_id) histogram.
Definition: EclPainter2D.h:30
@ SHAPER_2D
(shaper:crate) histogram.
Definition: EclPainter2D.h:31

Member Function Documentation

◆ drawGrid()

void drawGrid ( )
private

Draw grid over histogram.

Call after initGrid().

Definition at line 145 of file EclPainter2D.cc.

146 {
147  TVirtualPad* main = gPad;
148  grid->Draw("COLZ");
149  grid->cd();
150 
151  /* Creating grid */
152  char obj_name[255];
153  getNewRootObjectName(obj_name, 255);
154 
155  // NOTE: Root can't divide the histogram axes into more than 99
156  // primary sections, limiting the maximum grid cell size.
157  // To change this, new grid implementation might be necessary.
158  double max_y = getMaxY();
159  // Reducing the number of grid lines.
160  while (max_y >= 100) {
161  max_y /= 2;
162  }
163 
164  hgrid = new TH2C(obj_name, "", getMaxX(), 0, getMaxX(), max_y, 0, max_y);
165  hgrid->GetXaxis()->SetNdivisions(getMaxX());
166  hgrid->GetYaxis()->SetNdivisions(max_y);
167  // Hiding axis labels.
168  hgrid->GetYaxis()->SetLabelOffset(1e3);
169  hgrid->GetXaxis()->SetLabelOffset(1e3);
170  // Hiding axis ticks.
171  hgrid->GetYaxis()->SetTickLength(0.);
172  hgrid->GetXaxis()->SetTickLength(0.);
173 
174  hgrid->Draw();
175 
176  main->cd();
177 }
int getMaxX()
Returns number of X bins.
Definition: EclPainter2D.cc:96
TH2C * hgrid
The grid itself, drawn in drawGrid().
Definition: EclPainter2D.h:61
TPad * grid
Grid pad, drawn in drawGrid().
Definition: EclPainter2D.h:63
int getMaxY()
Returns number of Y bins.
void getNewRootObjectName(char *buf, int size)
Make unique name for next root object.
Definition: EclPainter.cc:88
int main(int argc, char **argv)
Run all tests.
Definition: test_main.cc:91

◆ 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 179 of file EclPainter2D.cc.

◆ 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.

◆ setData()

void setData ( EclData data)
inlineinherited

Set EclData to display in painter.


Definition at line 44 of file EclPainter.h.


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