diff -rupN root-5.34.12-orig/config/Makefile.depend root-5.34.12-mod/config/Makefile.depend --- root-5.34.12-orig/config/Makefile.depend 2013-11-19 16:49:10.000000000 +0100 +++ root-5.34.12-mod/config/Makefile.depend 2014-09-17 09:06:07.009426921 +0200 @@ -417,7 +417,7 @@ else IOLIBEXTRA = -Llib -lThread NETLIBEXTRA = -Llib -lRIO -lMathCore MATRIXLIBEXTRA = -Llib -lMathCore -HISTLIBEXTRA = -Llib -lMatrix -lMathCore +HISTLIBEXTRA = -Llib -lMatrix -lMathCore -lTree -lGpad GRAFLIBEXTRA = -Llib -lHist -lMatrix -lRIO -lMathCore GPADLIBEXTRA = -Llib -lGraf -lHist -lMathCore G3DLIBEXTRA = -Llib -lGraf -lHist -lGpad -lMathCore diff -rupN root-5.34.12-orig/hist/hist/inc/TH3.h root-5.34.12-mod/hist/hist/inc/TH3.h --- root-5.34.12-orig/hist/hist/inc/TH3.h 2013-11-19 16:49:10.000000000 +0100 +++ root-5.34.12-mod/hist/hist/inc/TH3.h 2014-09-17 09:05:51.077426926 +0200 @@ -120,7 +120,8 @@ public: virtual TH3 *RebinZ(Int_t ngroup = 2, const char *newname = ""); virtual TH3 *Rebin3D(Int_t nxgroup = 2, Int_t nygroup = 2, Int_t nzgroup = 2, const char *newname = ""); virtual void Reset(Option_t *option=""); - virtual void SetShowProjection(const char *option="xy",Int_t nbins=1); // *MENU* + virtual void SetShowProjection(const char *option="xy col",Int_t nbins=1); // *MENU* + virtual void Make4DScatterPlot(Int_t points_per_bin=0, Double_t scale=1.0) const; // *MENU* protected: TH1D *DoProject1D(const char* name, const char * title, TAxis* projX, diff -rupN root-5.34.12-orig/hist/hist/src/TH3.cxx root-5.34.12-mod/hist/hist/src/TH3.cxx --- root-5.34.12-orig/hist/hist/src/TH3.cxx 2013-11-19 16:49:10.000000000 +0100 +++ root-5.34.12-mod/hist/hist/src/TH3.cxx 2014-09-17 09:05:51.137426923 +0200 @@ -23,6 +23,8 @@ #include "TError.h" #include "TMath.h" #include "TObjString.h" +#include "TNtupleD.h" +#include "TCanvas.h" ClassImp(TH3) @@ -3640,6 +3642,60 @@ void TH3::SetShowProjection(const char * if (fPainter) fPainter->SetShowProjection(option,nbins); } +void TH3::Make4DScatterPlot(Int_t points_per_bin, Double_t scale) const +{ +TH3* histo = (TH3*) this; + +TString varlist; //"valuex:valuey:valuez:weight" + +varlist = TString::Format("%s:%s:%s:weight", +histo->GetXaxis()->GetTitle(), +histo->GetYaxis()->GetTitle(), +histo->GetZaxis()->GetTitle()); + +char remove[] = " []()^+"; +for (UInt_t n=0; nGetName(), histo->GetTitle(), varlist); + +Double_t centerx, centery, centerz, widthx, widthy, widthz, valuex, valuey, valuez, weight; + +for(Int_t i=0; iGetXaxis()->GetNbins(); i++){ +for(Int_t j=0; jGetYaxis()->GetNbins(); j++){ +for(Int_t k=0; kGetZaxis()->GetNbins(); k++){ +if(histo->GetBinContent(i,j,k) > 0){ + centerx = histo->GetXaxis()->GetBinCenter(i); + centery = histo->GetYaxis()->GetBinCenter(j); + centerz = histo->GetZaxis()->GetBinCenter(k); + + widthx = histo->GetXaxis()->GetBinWidth(i); + widthy = histo->GetYaxis()->GetBinWidth(j); + widthz = histo->GetZaxis()->GetBinWidth(k); + + weight = histo->GetBinContent(i,j,k); + + if (points_per_bin == 0){ + points_per_bin = weight; + } + + for(Int_t n=0; nGaus(centerx, widthx); + valuey = gRandom->Gaus(centery, widthy); + valuez = gRandom->Gaus(centerz, widthz); + + temp->Fill(valuex, valuey, valuez, weight); + } +}}}} + +TCanvas *c1 = new TCanvas("c1","4D Scatter Plot"); +c1->cd(); + +temp->Draw(varlist); +delete temp; +} + //______________________________________________________________________________ void TH3C::Streamer(TBuffer &R__b) {