94 DemoDouble32() =
default;
97 fD64 = fF32 = fI32 = fI30 = fI28 = fI26 = fI24 = fI22 = fI20 = fI18 = fI16 = fI14 = fI12 = fI10 = fI8 = fI6 =
98 fI4 = fI2 = fR14 = fR12 = fR10 = fR8 = fR6 = fR4 = fR2 = ref;
104 const auto nEntries = 40000;
111 DemoDouble32 demoInstance;
112 auto demoInstanceBranch =
tree.Branch(
"d",
"DemoDouble32", &demoInstance, 4000);
123 auto branches = demoInstanceBranch->GetListOfBranches();
124 const auto nb = branches->GetEntries();
125 auto br =
static_cast<TBranch *
>(branches->At(0));
128 auto h =
new TH1F(
"h",
"Double32_t compression and precision", nb, 0, nb);
135 gcx->SetMarkerColor(
kBlue);
137 auto gdrange =
new TGraph();
138 gdrange->SetName(
"gdrange");
140 gdrange->SetMarkerColor(
kRed);
142 auto gdval =
new TGraph();
143 gdval->SetName(
"gdval");
145 gdval->SetMarkerColor(
kBlack);
149 auto br =
static_cast<TBranch *
>(branches->At(i));
150 const auto brName = br->
GetName();
152 h->GetXaxis()->SetBinLabel(i + 1, brName);
153 const auto cx = double(zip64) / br->GetZipBytes();
154 gcx->SetPoint(i, i + 0.5, cx);
155 if (i == 0 )
continue;
160 gdrange->SetPoint(i-1, i + 0.5, drange);
162 tree.Draw(
Form(
"(fD64-%s)/fD64", brName),
"",
"goff");
165 gdval->SetPoint(i-1, i + 0.5, dval);
167 tree.Draw(
Form(
"(fD64-%s) >> hdvalabs_%s", brName, brName),
"",
"goff");
170 auto c =
new TCanvas(brName, brName, 800, 600);
176 auto c1 =
new TCanvas(
"c1",
"c1", 800, 600);
180 h->GetXaxis()->LabelsOption(
"v");
186 auto legend =
new TLegend(0.3, 0.6, 0.9, 0.9);
187 legend->SetHeader(
Form(
"%d entries within the [-#pi, #pi] range", nEntries));
188 legend->AddEntry(gcx,
"Compression factor",
"lp");
189 legend->AddEntry(gdrange,
"Log of precision wrt range: p = -Log_{10}( RMS( #frac{Ref - x}{range} ) ) ",
"lp");
190 legend->AddEntry(gdval,
"Log of precision wrt value: p = -Log_{10}( RMS( #frac{Ref - x}{Ref} ) ) ",
"lp");
char * Form(const char *fmt,...)
A pseudo container class which is a generator of indices.
A TTree is a list of TBranches.
Long64_t GetZipBytes(Option_t *option="") const
Return total number of zip bytes in the branch if option ="*" includes all sub-branches of this branc...
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.
A Graph is a graphics object made of two arrays X and Y with npoints each.
1-D histogram with a float per channel (see TH1 documentation)}
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...
This class displays a legend box (TPaveText) containing several legend entries.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual const char * GetName() const
Returns name of object.
Random number generator class based on M.
A TTree represents a columnar dataset.
Short_t Max(Short_t a, Short_t b)
Double_t RMS(Long64_t n, const T *a, const Double_t *w=0)
Return the Standard Deviation of an array a with length n.
Double_t Log10(Double_t x)