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);
35 for (
Int_t i = 0; i < 25000; i++) {
36 if (i%1000 == 0) printf(
"at entry: %d\n",i);
50 auto f =
new TFile(
"ht.root");
51 auto T = (
TTree*)f->Get(
"T");
53 TH2F *hpxpy =
nullptr;
55 T->SetBranchAddress(
"hpx",&hpx);
56 T->SetBranchAddress(
"hpxpy",&hpxpy);
57 T->SetBranchAddress(
"hprof",&hprof);
59 auto c1 =
new TCanvas(
"c1",
"test",10,10,600,1000);
67 c1->Print(
"htr1.png");
72 auto f =
new TFile(
"ht.root");
73 auto T = (
TTree*)f->Get(
"T");
74 auto c1 =
new TCanvas(
"c1",
"test",10,10,600,1000);
77 T->Draw(
"hpx.Draw()",
"",
"goff",1,12345);
79 T->Draw(
"hpxpy.Draw()",
"",
"goff",1,12345);
81 T->Draw(
"hprof.Draw()",
"",
"goff",1,12345);
82 c1->Print(
"htr2.png");
88 auto f =
new TFile(
"ht.root");
89 auto T = (
TTree*)f->Get(
"T");
90 T->Draw(
"hpx.GetRMS():hprof.GetMean()");
91 gPad->Print(
"htr3.png");
virtual void Rannor(Float_t &a, Float_t &b)
Return 2 numbers distributed following a gaussian with mean=0 and sigma=1.
THist< 1, float, THistStatContent, THistStatUncertainty > TH1F
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
virtual void Show(const char *name)
Stops Benchmark name and Prints results.
1-D histogram with a float per channel (see TH1 documentation)}
virtual void Start(const char *name)
Starts Benchmark with the specified name.
virtual void Draw(Option_t *option="")
Draw this histogram with options.
R__EXTERN TBenchmark * gBenchmark
2-D histogram with a float per channel (see TH1 documentation)}
R__EXTERN TRandom * gRandom
A TTree object has a header with a name and a title.
THist< 2, float, THistStatContent, THistStatUncertainty > TH2F