Belle II Software  release-06-01-15
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 //This module
9 #include <ecl/modules/eclDisplay/EclPainter.h>
10 
11 //Root
12 #include <TString.h>
13 
14 //ECL
15 #include <ecl/utility/ECLChannelMapper.h>
16 #include <ecl/modules/eclDisplay/MultilineWidget.h>
17 
18 using namespace Belle2;
19 using namespace ECL;
20 
22 
24  m_mapper(0)
25 {
26  setData(data);
27  displayed_subsys = EclData::ALL;
28 }
29 
30 EclPainter::~EclPainter()
31 {
32 
33 }
34 
36 {
37  m_mapper = mapper;
38 }
39 
41 {
42  return m_mapper;
43 }
44 
46 {
47  displayed_subsys = sys;
48 }
49 
51 {
52  return displayed_subsys;
53 }
54 
56 {
57  switch (subsys) {
58  case EclData::BARR:
59  return TString("Barrel");
60  case EclData::FORW:
61  return TString("Forward endcap");
62  case EclData::BACKW:
63  return TString("Backward endcap");
64  case EclData::ALL:
65  return TString("Full ECL");
66  default:
67  return TString();
68  }
69 }
70 
72 {
73  char info[255];
74  sprintf(info, "energy emission = %.2f MeV", m_ecl_data->getEnergyTotal());
75  panel->setLine(0, info);
76 }
77 
79 {
80  return nullptr;
81 }
82 
83 void EclPainter::setXRange(int, int)
84 {
85 }
86 
87 void EclPainter::getNewRootObjectName(char* buf, int n)
88 {
89  snprintf(buf, n, "ECL DATA_%d", m_obj_counter++);
90 }
91 
93 {
94  m_ecl_data = new EclData(*other.m_ecl_data);
95  m_mapper = other.m_mapper;
97 }
98 
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:186
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:112
EclData::EclSubsystem getDisplayedSubsystem()
Get currently displayed ECL subsystem.
Definition: EclPainter.cc:50
virtual void getInformation(int px, int py, MultilineWidget *panel)
Sets the information to be displayed in the provided MultilineWidget.
Definition: EclPainter.cc:71
void cloneFrom(const EclPainter &other)
Clone attributes from other EclPainter.
Definition: EclPainter.cc:92
void setMapper(ECL::ECLChannelMapper *mapper)
Set ECLChannelMapper for CellID <-> (crate, shaper, chid) conversion.
Definition: EclPainter.cc:35
TString getSubsystemTitle(EclData::EclSubsystem subsys)
Return title of ECL subsystem to use in painter.
Definition: EclPainter.cc:55
void getNewRootObjectName(char *buf, int size)
Make unique name for next root object.
Definition: EclPainter.cc:87
static int m_obj_counter
Counter to make unique names for new root objects.
Definition: EclPainter.h:108
virtual EclPainter * handleClick(int px, int py)
Some EclPainters can shift to another view upon click.
Definition: EclPainter.cc:78
void setDisplayedSubsystem(EclData::EclSubsystem sys)
Change between the displayed ECL subsystem (barrel, forward and backward endcaps).
Definition: EclPainter.cc:45
EclPainter(EclData *data)
Default constructor.
Definition: EclPainter.cc:23
ECL::ECLChannelMapper * getMapper()
Return currently set ECLChannelMapper.
Definition: EclPainter.cc:40
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:83
EclData * m_ecl_data
Data to draw.
Definition: EclPainter.h:110
EclData::EclSubsystem displayed_subsys
Identifier of displayed ECL subsystem.
Definition: EclPainter.h:115
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.