10#include <ecl/modules/eclDisplay/EclPainter1D.h>
13#include <ecl/mapper/ECLChannelMapper.h>
14#include <ecl/modules/eclDisplay/geometry.h>
15#include <ecl/modules/eclDisplay/MultilineWidget.h>
22using namespace ECLDisplayUtility;
30 m_hist->GetXaxis()->CenterTitle();
31 m_hist->GetXaxis()->SetTitleOffset(1.1);
32 m_hist->GetYaxis()->SetTitleOffset(1.1);
91 const char* name[3][5] = {
93 "Events per channel",
"Events per shaper",
"Events per collector",
94 "Events per phi_id",
"Events per theta_id"
98 "Energy per channel (MeV)",
"Energy per shaper (MeV)",
"Energy per collector (MeV)"
99 "Energy per phi_id (MeV)",
"Energy per theta_id (MeV)"
103 "Time per channel (ns)",
"Time per shaper (ns)",
"Time per collector (ns)",
104 "Time per phi_id (ns)",
"Time per theta_id (ns)"
107 const char* xname[3] = {
108 "Channel id",
"Shaper id",
"Collector id"
110 const char* yname[3] = {
111 "Events",
"Energy",
"Time"
114 TString title = TString(name[
GetMode()][(
int)
m_type]) +
" (" +
116 const char* xtitle = xname[(int)
m_type];
117 const char* ytitle = yname[
GetMode()];
120 m_hist->SetXTitle(xtitle);
121 m_hist->SetYTitle(ytitle);
130 Float_t upx = gPad->AbsPixeltoX(px);
131 Float_t x = gPad->PadtoX(upx);
132 int binx =
m_hist->GetXaxis()->FindBin(x) - 1;
135 sprintf(info,
"channel_id = %d (%d)", binx,
138 sprintf(info,
"shaper_id = %d",
getMapper()->getShaperPosition(binx));
140 sprintf(info,
"crate_id = %d",
getMapper()->getCrateID(binx));
144 sprintf(info,
"shaper_id = %d (%d)", binx, (binx - 1) % 12 + 1);
146 sprintf(info,
"crate_id = %d", (binx - 1) / 12 + 1);
150 sprintf(info,
"crate_id = %d", binx);
154 sprintf(info,
"phi_id = %d", binx);
158 sprintf(info,
"theta_id = %d", binx);
170 Float_t upx = gPad->AbsPixeltoX(px);
171 Float_t x = gPad->PadtoX(upx);
172 int binx =
m_hist->GetXaxis()->FindBin(x) - 1;
174 Float_t upy = gPad->AbsPixeltoY(py);
175 Float_t y = gPad->PadtoY(upy);
177 if (y < 0)
return nullptr;
184 ret->
setShaper((binx - 1) / 12 + 1, (binx - 1) % 12 + 1);
191 ret->
setXRange((binx - 1) * 12 + 1, (binx - 1) * 12 + 12);
201 m_hist->GetXaxis()->SetRange(xmin + 1, xmax + 1);
221 const int* ev_counts = data->getEventCounts();
222 const float* energy_sums = data->getEnergySums();
243 m_hist->Fill(
id, energy_sums[i]);
245 m_hist->Fill(
id, ev_counts[i]);
int getShaperPosition(int cellID)
Get position of the shaper in the crate by given CellId.
int getCrateID(int iCOPPERNode, int iFINESSE, bool pcie40=false)
Get crate number by given COPPER node number and FINESSE number.
This class contains data for ECLSimHit's and provides several relevant conversion functions for bette...
int getThetaId(int ch)
ECL CellId -> theta_id.
int getPhiId(int ch)
ECL CellId -> phi_id.
static int getCrystalCount()
Get number of crystals in ECL.
Painter for EclData, 1D histograms.
Type m_type
Display subtypes of this class.
virtual ~EclPainter1D()
Destructor for EclPainter subclass.
TH1F * m_hist
Displayed histogram.
Type
Subtype of histogram to draw.
@ SHAPER
Events/energy per ShaperDSP.
@ CRATE
Events/energy per crate/ECLCollector.
@ CHANNEL
Events/energy per channel.
void setXRange(int xmin, int xmax) override
Set XRange for histogram.
EclPainter1D(EclData *data, Type type)
Constructor for EclPainter subclass.
int getMaxX()
Returns number of X bins.
int m_crate
ID of currently selected crate.
void setTitles()
Update titles of the histogram.
int m_shaper
ID of currently selected shaper.
virtual EclPainter * handleClick(int px, int py) override
Creates sub-histogram for crates and shapers.
int channelToSegId(int channel)
Convert channel id to X bin number.
virtual void getInformation(int px, int py, MultilineWidget *panel) override
Sets the information to be displayed in the provided MultilineWidget.
Type getType()
Return subtype of ECLPainter1D.
void setCrate(int crate)
Show data only from specific crate.
void setShaper(int crate, int shaper)
Show data only from specific shaper.
void initHisto()
Initialize histogram.
void Draw() override
Redraw the canvas.
Painter for EclData, parent class, created with EclPainterFactory.
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.
EclData * getData()
Return currently displayed EclData.
void setMapper(ECL::ECLChannelMapper *mapper)
Set ECLChannelMapper for CellID <-> (crate, shaper, chid) conversion.
TString getSubsystemTitle(EclData::EclSubsystem subsys)
Return title of ECL subsystem to use in painter.
void getNewRootObjectName(char *buf, int size)
Make unique name for next root object.
void setDisplayedSubsystem(EclData::EclSubsystem sys)
Change between the displayed ECL subsystem (barrel, forward and backward endcaps).
ECL::ECLChannelMapper * getMapper()
Return currently set ECLChannelMapper.
int GetMode()
Returns current displayed mode (0 shows event count, 1 shows total energy)
Abstract base class for different kinds of events.