36 TString filename =
"hsimple.root";
39 TFile *hfile =
nullptr;
43 TString fullPath = dir+
"hsimple.root";
46 if (hfile)
return hfile;
51 if (hfile)
return hfile;
57 printf(
"you must run the script in a directory with write access\n");
61 hfile =
new TFile(filename,
"RECREATE",
"Demo ROOT file with histograms");
65 hpx->SetDirectory(hfile);
66 hpx->SetFillColor(48);
67 TH2F *hpxpy =
new TH2F(
"hpxpy",
"py vs px",40,-4,4,40,-4,4);
69 TProfile *hprof =
new TProfile(
"hprof",
"Profile of pz versus px",100,-4,4,0,20);
74 const bool doBenchmark =
false;
82 c1->GetFrame()->SetFillColor(21);
83 c1->GetFrame()->SetBorderSize(6);
84 c1->GetFrame()->SetBorderMode(-1);
91 for (
Int_t i = 0; i < 25000; i++) {
98 ntuple->Fill(px,py,pz,rnd,i);
111 hpx->SetFillColor(0);
113 hpx->SetFillColor(48);
int Int_t
Signed integer 4 bytes (int).
float Float_t
Float 4 bytes (float).
externTBenchmark * gBenchmark
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
Int_t Write(const char *name=nullptr, Int_t opt=0, Int_t bufsize=0) override
Write memory objects to this file.
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.
void Close(Option_t *option="") override
Close a file.
1-D histogram with a float per channel (see TH1 documentation)
virtual void SetDirectory(TDirectory *dir)
By default, when a histogram is created, it is added to the list of histogram objects in the current ...
2-D histogram with a float per channel (see TH1 documentation)
Int_t Fill(Double_t) override
Invalid Fill method.
A simple TTree restricted to a list of float variables only.
Int_t Fill(const Double_t *v)
Random number generator class based on M.
Double_t Rndm() override
Machine independent random number generator.
virtual void Rannor(Float_t &a, Float_t &b)
Return 2 numbers distributed following a gaussian with mean=0 and sigma=1.
TString & ReplaceAll(const TString &s1, const TString &s2)