Belle II Software  release-08-01-10
EclPainter.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 
9 /* Own header. */
10 #include <ecl/modules/eclDisplay/EclPainter.h>
11 
12 /* ECL headers. */
13 #include <ecl/mapper/ECLChannelMapper.h>
14 #include <ecl/modules/eclDisplay/MultilineWidget.h>
15 
16 /* ROOT headers. */
17 #include <TString.h>
18 
19 using namespace Belle2;
20 using namespace ECL;
21 
23 
25  m_mapper(0)
26 {
27  setData(data);
28  displayed_subsys = EclData::ALL;
29 }
30 
31 EclPainter::~EclPainter()
32 {
33 
34 }
35 
37 {
38  m_mapper = mapper;
39 }
40 
42 {
43  return m_mapper;
44 }
45 
47 {
48  displayed_subsys = sys;
49 }
50 
52 {
53  return displayed_subsys;
54 }
55 
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 }
71 
73 {
74  char info[255];
75  sprintf(info, "energy emission = %.2f MeV", m_ecl_data->getEnergyTotal());
76  panel->setLine(0, info);
77 }
78 
80 {
81  return nullptr;
82 }
83 
84 void EclPainter::setXRange(int, int)
85 {
86 }
87 
88 void EclPainter::getNewRootObjectName(char* buf, int n)
89 {
90  snprintf(buf, n, "ECL DATA_%d", m_obj_counter++);
91 }
92 
94 {
95  m_ecl_data = new EclData(*other.m_ecl_data);
96  m_mapper = other.m_mapper;
98 }
99 
This class provides access to ECL channel map that is either a) Loaded from the database (see ecl/dbo...
This class contains data for ECLSimHit's and provides several relevant conversion functions for bette...
Definition: EclData.h:31
float getEnergyTotal()
Definition: EclData.cc:188
EclSubsystem
Subsystems of ECL: ALL all subsystems BARR barrel only FORW forward endcap only BACKW backward endcap...
Definition: EclData.h:98
Painter for EclData, parent class, created with EclPainterFactory.
Definition: EclPainter.h:29
ECL::ECLChannelMapper * m_mapper
mapper for CellID <-> (crate, shaper, chid) conversion.
Definition: EclPainter.h:113
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
void cloneFrom(const EclPainter &other)
Clone attributes from other EclPainter.
Definition: EclPainter.cc:93
void setMapper(ECL::ECLChannelMapper *mapper)
Set ECLChannelMapper for CellID <-> (crate, shaper, chid) conversion.
Definition: EclPainter.cc:36
TString getSubsystemTitle(EclData::EclSubsystem subsys)
Return title of ECL subsystem to use in painter.
Definition: EclPainter.cc:56
void getNewRootObjectName(char *buf, int size)
Make unique name for next root object.
Definition: EclPainter.cc:88
static int m_obj_counter
Counter to make unique names for new root objects.
Definition: EclPainter.h:109
virtual EclPainter * handleClick(int px, int py)
Some EclPainters can shift to another view upon click.
Definition: EclPainter.cc:79
void setDisplayedSubsystem(EclData::EclSubsystem sys)
Change between the displayed ECL subsystem (barrel, forward and backward endcaps).
Definition: EclPainter.cc:46
EclPainter(EclData *data)
Default constructor.
Definition: EclPainter.cc:24
ECL::ECLChannelMapper * getMapper()
Return currently set ECLChannelMapper.
Definition: EclPainter.cc:41
void setData(EclData *data)
Set EclData to display in painter.
Definition: EclPainter.h:44
virtual void setXRange(int x1, int x2)
Set XRange for histogram in EclPainter.
Definition: EclPainter.cc:84
EclData * m_ecl_data
Data to draw.
Definition: EclPainter.h:111
EclData::EclSubsystem displayed_subsys
Identifier of displayed ECL subsystem.
Definition: EclPainter.h:116
Widget which contains the dynamic amount of TGLabel objects.
void setLine(int line_id, const char *text)
Set content of the specified line to 'text'.
Abstract base class for different kinds of events.