12void hist000_TH1_first()
15 auto outFile = std::unique_ptr<TFile>(
TFile::Open(
"outfile.root",
"RECREATE"));
21 double rangeMin = 0.0;
22 double rangeMax = 10.0;
23 TH1D histogram(
"histogram",
"My first ROOT histogram", nBins, rangeMin, rangeMax);
29 const std::array values{1, 2, 3, 3, 3, 4, 3, 2, 1, 0};
30 for (
double val : values) {
35 outFile->WriteObject(&histogram, histogram.GetName());
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.
1-D histogram with a double per channel (see TH1 documentation)