10#include <ecl/modules/eclDisplay/EclPainter2D.h>
13#include <ecl/mapper/ECLChannelMapper.h>
14#include <ecl/modules/eclDisplay/geometry.h>
15#include <ecl/modules/eclDisplay/MultilineWidget.h>
27using namespace ECLDisplayUtility;
39 m_hist =
new TH2F(obj_name,
"title", max_x, 1, max_x + 1,
42 m_hist->GetXaxis()->CenterTitle();
43 m_hist->GetXaxis()->SetTitleOffset(1.1);
44 m_hist->GetYaxis()->CenterTitle();
45 m_hist->GetYaxis()->SetTitleOffset(-1.1);
46 m_hist->GetZaxis()->CenterTitle();
71 const char* name[3][3] = {
72 {
"Events per channel",
"Events per shaper"},
73 {
"Energy per channel (MeV)",
"Energy per shaper (MeV)"},
74 {
"Time per channel (ns)",
"Time per shaper (ns)"}
76 const char* zname[3] = {
77 "Events",
"Energy (MeV)",
"Time"
80 TString title = TString(name[
GetMode()][(
int)
m_type]) +
" (" +
86 m_hist->GetXaxis()->SetTitle(
"Theta id");
87 m_hist->GetYaxis()->SetTitle(
"Phi id");
90 m_hist->GetXaxis()->SetTitle(
"Shaper id");
91 m_hist->GetYaxis()->SetTitle(
"Collector id");
137 grid =
new TPad(
"grid",
"", 0, 0, 1, 1);
139 grid->SetRightMargin(gPad->GetRightMargin());
141 grid->SetFillStyle(4000);
142 grid->SetFrameFillStyle(0);
147 TVirtualPad* main = gPad;
160 while (max_y >= 100) {
166 hgrid->GetYaxis()->SetNdivisions(max_y);
168 hgrid->GetYaxis()->SetLabelOffset(1e3);
169 hgrid->GetXaxis()->SetLabelOffset(1e3);
171 hgrid->GetYaxis()->SetTickLength(0.);
172 hgrid->GetXaxis()->SetTickLength(0.);
185 Float_t upx = gPad->AbsPixeltoX(px);
186 Float_t x = gPad->PadtoX(upx);
187 int binx =
m_hist->GetXaxis()->FindBin(x);
189 Float_t upy = gPad->AbsPixeltoY(py);
190 Float_t y = gPad->PadtoY(upy);
191 int biny =
m_hist->GetYaxis()->FindBin(y);
194 sprintf(info,
"theta_id = %d", binx);
196 sprintf(info,
"phi_id = %d", biny);
198 sprintf(info,
"channel_id = %d",
getData()->getChannel(biny, binx));
202 sprintf(info,
"crate_id = %d", biny);
204 sprintf(info,
"shaper_id = %d (%d)", (biny - 1) * 12 + binx, binx);
224 const int* ev_counts = data->getEventCounts();
225 const float* energy_sums = data->getEnergySums();
234 m_hist->Fill(id_x, id_y, energy_sums[i]);
236 m_hist->Fill(id_x, id_y, ev_counts[i]);
239 gStyle->SetNumberContours(255);
240 gStyle->SetPalette(PALETTE_ID);
242 m_hist->GetXaxis()->SetTicks(
"+-");
243 m_hist->GetYaxis()->SetTicks(
"+-");
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, 2D histograms.
~EclPainter2D()
Destructor for EclPainter subclass.
Type m_type
Display subtypes of this class.
void cloneFrom(const EclPainter2D &other)
Clone attributes from other EclPainter2D.
int channelToSegIdX(int channel)
Convert channel id to X bin number.
Type
Subtype of histogram to draw.
@ CHANNEL_2D
(theta_id:phi_id) histogram.
@ SHAPER_2D
(shaper:crate) histogram.
int getMaxX()
Returns number of X bins.
void setTitles()
Update histogram titles.
TH2C * hgrid
The grid itself, drawn in drawGrid().
virtual void getInformation(int px, int py, MultilineWidget *panel) override
Sets the information to be displayed in the provided MultilineWidget.
void initGrid()
Initialize grid for drawGrid().
Type getType()
Return subtype of ECLPainter2D.
int channelToSegIdY(int channel)
Convert channel id to Y bin number.
TPad * grid
Grid pad, drawn in drawGrid().
void drawGrid()
Draw grid over histogram.
int getMaxY()
Returns number of Y bins.
EclPainter2D(EclData *data, Type type)
Constructor for EclPainter subclass.
TH2F * m_hist
Displayed histogram.
virtual 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.
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.
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.