4 #include "HnSparseStress.h"
7 int main(
int argc,
char ** argv)
9 Printf(
"%s v%d.%d.%d-%s", NDMSPC_NAME, NDMSPC_VERSION_MAJOR(NDMSPC_VERSION), NDMSPC_VERSION_MINOR(NDMSPC_VERSION),
10 NDMSPC_VERSION_PATCH(NDMSPC_VERSION), NDMSPC_VERSION_RELEASE);
14 std::string filename =
"/tmp/HnSparse.root";
15 bool projections =
false;
19 double min = -(double)nBins / 2;
20 double max = (double)nBins / 2;
21 Long64_t chunkSize = 1024 * 1024;
26 for (Int_t i = 0; i < nDim; i++) {
36 TStopwatch timeStress;
38 stress.
Stress(h, size, bytes);
40 timeStress.Print(
"m");
42 Long64_t nBinsSizeBytes =
sizeof(Double_t) * h->GetNbins();
43 Printf(
"size : %03.2f MB (%lld B)", (
double)nBinsSizeBytes / (1024 * 1024), nBinsSizeBytes);
47 TFile * f = TFile::Open(filename.data(),
"RECREATE");
48 f->SetCompressionSettings(ROOT::RCompressionSetting::EDefaults::kUseAnalysis);
49 Printf(
"Writing histogram ...");
52 Printf(
"Creating and writing projections ...");
53 for (Int_t i = 0; i < nDim; i++) {
54 ((TH1 *)h->Projection(i))->Write();
55 for (Int_t j = 0; j < nDim; j++) {
57 ((TH2 *)h->Projection(j, i))->Write();
64 Printf(
"Output was saved in '%s' size : %.2f MB (%lld B)", filename.data(),
65 (
double)f->GetBytesWritten() / (1024 * 1024), f->GetBytesWritten());
virtual Bool_t Stress(HnSparse *h, Long64_t size=1e3, bool bytes=false)