9 #include <ecl/modules/eclDisplay/EclPainter2D.h>
17 #include <ecl/modules/eclDisplay/geometry.h>
18 #include <ecl/utility/ECLChannelMapper.h>
19 #include <ecl/modules/eclDisplay/MultilineWidget.h>
26 using namespace ECLDisplayUtility;
38 m_hist =
new TH2F(obj_name,
"title", max_x, 1, max_x + 1,
41 m_hist->GetXaxis()->CenterTitle();
42 m_hist->GetXaxis()->SetTitleOffset(1.1);
43 m_hist->GetYaxis()->CenterTitle();
44 m_hist->GetYaxis()->SetTitleOffset(-1.1);
45 m_hist->GetZaxis()->CenterTitle();
70 const char* name[3][3] = {
71 {
"Events per channel",
"Events per shaper"},
72 {
"Energy per channel (MeV)",
"Energy per shaper (MeV)"},
73 {
"Time per channel (ns)",
"Time per shaper (ns)"}
75 const char* zname[3] = {
76 "Events",
"Energy (MeV)",
"Time"
79 TString title = TString(name[GetMode()][(
int)
m_type]) +
" (" +
85 m_hist->GetXaxis()->SetTitle(
"Theta id");
86 m_hist->GetYaxis()->SetTitle(
"Phi id");
89 m_hist->GetXaxis()->SetTitle(
"Shaper id");
90 m_hist->GetYaxis()->SetTitle(
"Collector id");
92 m_hist->GetZaxis()->SetTitle(zname[GetMode()]);
136 grid =
new TPad(
"grid",
"", 0, 0, 1, 1);
138 grid->SetRightMargin(gPad->GetRightMargin());
140 grid->SetFillStyle(4000);
141 grid->SetFrameFillStyle(0);
146 TVirtualPad*
main = gPad;
159 while (max_y >= 100) {
165 hgrid->GetYaxis()->SetNdivisions(max_y);
167 hgrid->GetYaxis()->SetLabelOffset(1e3);
168 hgrid->GetXaxis()->SetLabelOffset(1e3);
170 hgrid->GetYaxis()->SetTickLength(0.);
171 hgrid->GetXaxis()->SetTickLength(0.);
184 Float_t upx = gPad->AbsPixeltoX(px);
185 Float_t x = gPad->PadtoX(upx);
186 int binx =
m_hist->GetXaxis()->FindBin(x);
188 Float_t upy = gPad->AbsPixeltoY(py);
189 Float_t y = gPad->PadtoY(upy);
190 int biny =
m_hist->GetYaxis()->FindBin(y);
193 sprintf(info,
"theta_id = %d", binx);
195 sprintf(info,
"phi_id = %d", biny);
197 sprintf(info,
"channel_id = %d",
getData()->getChannel(biny, binx));
201 sprintf(info,
"crate_id = %d", biny);
203 sprintf(info,
"shaper_id = %d (%d)", (biny - 1) * 12 + binx, binx);
223 const int* ev_counts = data->getEventCounts();
224 const float* energy_sums = data->getEnergySums();
233 m_hist->Fill(id_x, id_y, energy_sums[i]);
235 m_hist->Fill(id_x, id_y, ev_counts[i]);
238 gStyle->SetNumberContours(255);
239 gStyle->SetPalette(PALETTE_ID);
241 m_hist->GetXaxis()->SetTicks(
"+-");
242 m_hist->GetYaxis()->SetTicks(
"+-");
int getCrateID(int iCOPPERNode, int iFINESSE)
get crate number by given COPPER node number and FINESSE number
int getShaperPosition(int cellID)
get position of the shaper in the crate by given CellId
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 * getData()
Return currently displayed EclData.
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.
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.
Abstract base class for different kinds of events.
int main(int argc, char **argv)
Run all tests.