26 TFile f(
"ht.root",
"recreate");
27 auto T =
new TTree(
"T",
"test");
28 auto hpx =
new TH1F(
"hpx",
"This is the px distribution",100,-4,4);
29 auto hpxpy =
new TH2F(
"hpxpy",
"py vs px",40,-4,4,40,-4,4);
30 auto hprof =
new TProfile(
"hprof",
"Profile of pz versus px",100,-4,4,0,20);
31 T->Branch(
"hpx",
"TH1F",&hpx,32000,0);
32 T->Branch(
"hpxpy",
"TH2F",&hpxpy,32000,0);
33 T->Branch(
"hprof",
"TProfile",&hprof,32000,0);
36 if (
i%1000 == 0) printf(
"at entry: %d\n",
i);
51 auto f =
new TFile(
"ht.root");
52 auto T = (
TTree*)
f->Get(
"T");
54 TH2F *hpxpy =
nullptr;
56 T->SetBranchAddress(
"hpx",&hpx);
57 T->SetBranchAddress(
"hpxpy",&hpxpy);
58 T->SetBranchAddress(
"hprof",&hprof);
60 auto c1 =
new TCanvas(
"c1",
"test",10,10,600,1000);
68 c1->Print(
"htr1.png");
74 auto f =
new TFile(
"ht.root");
75 auto T = (
TTree*)
f->Get(
"T");
76 auto c1 =
new TCanvas(
"c1",
"test",10,10,600,1000);
79 T->Draw(
"hpx.Draw()",
"",
"goff",1,12345);
81 T->Draw(
"hpxpy.Draw()",
"",
"goff",1,12345);
83 T->Draw(
"hprof.Draw()",
"",
"goff",1,12345);
84 c1->Print(
"htr2.png");
91 auto f =
new TFile(
"ht.root");
92 auto T = (
TTree*)
f->Get(
"T");
93 auto c1 =
new TCanvas(
"c1",
"test",10,10,600,400);
94 T->Draw(
"hpx.GetRMS():hprof.GetMean()");
95 c1->Print(
"htr3.png");
R__EXTERN TBenchmark * gBenchmark
R__EXTERN TRandom * gRandom
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
1-D histogram with a float per channel (see TH1 documentation)
void Draw(Option_t *option="") override
Draw this histogram with options.
2-D histogram with a float per channel (see TH1 documentation)
A TTree represents a columnar dataset.