53 Int_t nbinsx, Axis_t xlow, Axis_t xup,
54 Int_t nbinsy, Axis_t ylow, Axis_t yup)
55 : TH2F (name, title, nbinsx, xlow, xup, nbinsy, ylow, yup),
113 TH2F::Paint (option);
118 double oldmax = GetMaximumStored ();
119 double oldmin = GetMinimumStored ();
124 TH2F::Paint (option);
139 GetListOfFunctions()->Clear();
143 Double_t umin = gPad->GetUxmin();
144 Double_t umax = gPad->GetUxmax();
145 Double_t vmin = gPad->GetUymin();
146 Double_t vmax = gPad->GetUymax();
148 int pxmin = gPad->XtoAbsPixel (umin);
149 int pxmax = gPad->XtoAbsPixel (umax);
150 int pymin = gPad->YtoAbsPixel (vmin);
151 int pymax = gPad->YtoAbsPixel (vmax);
152 if (pxmin > pxmax)
std::swap (pxmin, pxmax);
153 if (pymin > pymax)
std::swap (pymin, pymax);
154 int pxsize = pxmax - pxmin + 1;
155 int pysize = pymax - pymin + 1;
156 std::vector<unsigned int> counts (pxsize * pysize);
158 TVirtualPad* pad = gPad;
161 unsigned int maxcount = 0;
162 unsigned int n =
m_vals.size();
163 for (
unsigned int i=0; i<n; i++) {
164 u = pad->XtoPad (
m_vals[i].first);
165 v = pad->YtoPad (
m_vals[i].second);
166 if (u < umin) u = umin;
167 if (u > umax) u = umax;
168 if (v < vmin) v = vmin;
169 if (v > vmax) v = vmax;
171 int px = pad->XtoAbsPixel (u);
172 int py = pad->YtoAbsPixel (v);
173 if (px < pxmin || px > pxmax || py < pymin || py > pymax)
continue;
174 unsigned ndx = (px-pxmin) + (py-pymin) * pxsize;
175 assert (ndx < counts.size());
177 if (counts[ndx] > maxcount)
178 maxcount = counts[ndx];
181 const unsigned int NCOLOR = 255;
188 else if (maxcount > 2)
189 step =
static_cast<float>(NCOLOR-1)/(maxcount-1);
195 unsigned int ccounts[NCOLOR];
196 std::uninitialized_fill (ccounts, ccounts+NCOLOR, 0);
197 size_t ndxmax = counts.size();
198 for (
unsigned int i=0; i < ndxmax; i++) {
199 unsigned int count = counts[i];
201 unsigned int color =
static_cast<unsigned int> ((
count-1)*step);
207 TPolyMarker* pms[NCOLOR];
208 std::uninitialized_fill (pms, pms+NCOLOR, (TPolyMarker*)0);
211 for (
int py = pymin; py <= pymax; ++py) {
212 for (
int px = pxmin; px <= pxmax; ++px) {
213 unsigned int ndx = (px-pxmin) + (py-pymin) * pxsize;
214 assert (ndx < ndxmax);
215 unsigned int count = counts[ndx];
217 Double_t u = pad->AbsPixeltoX (px);
218 Double_t v = pad->AbsPixeltoY (py);
219 unsigned int color =
static_cast<unsigned int> ((
count-1)*step);
222 TPolyMarker* pm = pms[
color];
224 pm =
new TPolyMarker (ccounts[
color]);
226 pm->SetMarkerStyle (GetMarkerStyle());
227 pm->SetMarkerSize (GetMarkerSize());
229 pm->SetMarkerColor (TColor::GetColor (
color, 0, 0));
232 pm->SetPoint (ccounts[
color]++, u, v);
238 for (
unsigned int i = 0; i < NCOLOR; i++) {
359 int nx = GetXaxis()->GetNbins();
360 double xlo = GetXaxis()->GetXmin();
361 double xhi = GetXaxis()->GetXmax();
363 int ny = GetYaxis()->GetNbins();
364 double ylo = GetYaxis()->GetXmin();
365 double yhi = GetYaxis()->GetXmax();
369 nx, xscale*xlo, xscale*xhi,
370 ny, yscale*ylo, yscale*yhi);
375 hnew->GetXaxis()->Set (nx, xscale*xlo, xscale*xhi);
376 hnew->GetYaxis()->Set (ny, yscale*ylo, yscale*yhi);
377 size_t n = hnew->
m_vals.size();
378 for (
size_t i = 0; i < n; i++) {
379 hnew->
m_vals[i].first *= xscale;
380 hnew->
m_vals[i].second *= yscale;