40 Int_t dim =
h->GetNdimensions();
42 TString title(
h->GetTitle()); title +=
" tree";
46 memset(
x, 0,
sizeof(
Double_t) * (dim + 1));
56 tree->Branch(
"coord",
x, branchname);
57 tree->Branch(
"bincontent", &
x[dim],
"bincontent/D");
60 for (
Long64_t i = 0; i <
h->GetNbins(); ++i) {
61 x[dim] =
h->GetBinContent(i, bins);
63 x[
d] =
h->GetAxis(
d)->GetBinCenter(bins[
d]);
83 const TLeaf* leaf =
nullptr;
84 while ((leaf = (
const TLeaf*)iLeaf())) {
89 tree->Draw(whatToDraw,
"",
"para");
107 const Int_t ndims = 8;
108 Int_t bins[ndims] = {10, 10, 5, 30, 10, 4, 18, 12};
109 Double_t xmin[ndims] = {-5., -10., -1000., -3., 0., 0., 0., 0.};
110 Double_t xmax[ndims] = {10., 70., 3000., 3., 5., 2., 2., 5.};
115 for (
Long_t i = 0; i < 100000; ++i) {
129 TFile*
f =
new TFile(
"drawsparse.root",
"RECREATE");
131 TCanvas* canv =
new TCanvas(
"hDrawSparse",
"Drawing a sparse hist");
143 h3proj->
Draw(
"lego1");
THnSparseT< TArrayD > THnSparseD
R__EXTERN TRandom * gRandom
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Class to manage histogram axis.
const char * GetTitle() const override
Returns title of object.
TVirtualPad * cd(Int_t subpadnumber=0) override
Set current canvas & pad.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
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)
Long64_t Fill(const Double_t *x, Double_t w=1.)
Efficient multidimensional histogram.
TH1D * Projection(Int_t xDim, Option_t *option="") const
Forwards to THnBase::Projection().
A TLeaf describes individual elements of a TBranch See TBranch structure in TTree.
const char * GetName() const override
Returns name of object.
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0) override
Automatic pad generation by division.
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.
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
Double_t Rndm() override
Machine independent random number generator.
A TTree represents a columnar dataset.
RVec< PromoteType< T > > sin(const RVec< T > &v)