The plot will contain one line for each filled bin, with the bin's coordinates on each axis, and the bin's content on the rightmost axis.
{
Int_t dim =
h->GetNdimensions();
TString title(
h->GetTitle()); title +=
" tree";
branchname += ":";
branchname += "/D";
}
tree->
Branch(
"coord",
x, branchname);
tree->
Branch(
"bincontent", &
x[dim],
"bincontent/D");
for (
Long64_t i = 0; i <
h->GetNbins(); ++i) {
x[dim] =
h->GetBinContent(i, bins);
x[
d] =
h->GetAxis(
d)->GetBinCenter(bins[
d]);
}
}
delete [] bins;
return tree;
}
{
const TLeaf* leaf =
nullptr;
while ((leaf = (
const TLeaf*)iLeaf())) {
whatToDraw += ":";
}
tree->
Draw(whatToDraw,
"",
"para");
}
}
void tree143_drawsparse()
{
Int_t bins[ndims] = {10, 10, 5, 30, 10, 4, 18, 12};
Double_t xmin[ndims] = {-5., -10., -1000., -3., 0., 0., 0., 0.};
Double_t xmax[ndims] = {10., 70., 3000., 3., 5., 2., 2., 5.};
for (
Long_t i = 0; i < 100000; ++i) {
case 0:
break;
case 1:
case 2:
case 3:
x[
d] = (
x[
d - 1] *
x[
d - 1] - 1.5) / 1.5 + (0.5 *
gRandom->Rndm());
break;
default:
}
}
}
auto canv =
new TCanvas(
"hDrawSparse",
"Drawing a sparse hist");
canv->Divide(2);
canv->cd(1);
drawsparse_draw(hs);
canv->cd(2);
TH3D* h3proj = hs->Projection(2, 3, 6);
canv->Write();
hs->Write();
}
int Int_t
Signed integer 4 bytes (int).
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
double Double_t
Double 8 bytes.
long long Long64_t
Portable signed long integer 8 bytes.
THnSparseT< TArrayD > THnSparseD
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Class to manage histogram axis.
const char * GetTitle() const override
Returns title of object.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
virtual void SetDirectory(TDirectory *dir)
By default, when a histogram is created, it is added to the list of histogram objects in the current ...
void Draw(Option_t *option="") override
Draw this histogram with options.
3-D histogram with a double per channel (see TH1 documentation)
Efficient multidimensional histogram.
A TLeaf describes individual elements of a TBranch See TBranch structure in TTree.
const char * GetName() const override
Returns name of object.
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
void SetTitle(const char *) override
Set the title of the TNamed.
void SetHistogramBinning(Int_t n=100)
Set the histogram binning.
void SetCurrentLimits(Double_t min, Double_t max)
Set the limits within which one the entries must be painted.
Parallel Coordinates class.
A TTree represents a columnar dataset.
virtual Int_t Fill()
Fill all branches.
virtual TObjArray * GetListOfLeaves()
void Draw(Option_t *opt) override
Default Draw method for all objects.
TBranch * Branch(const char *name, T *obj, Int_t bufsize=32000, Int_t splitlevel=99)
Add a new branch, and infer the data type from the type of obj being passed.
RVec< PromoteType< T > > sin(const RVec< T > &v)