27 TFile f(
"ht.root",
"recreate");
28 auto T =
new TTree(
"T",
"test");
29 auto hpx =
new TH1F(
"hpx",
"This is the px distribution", 100, -4, 4);
30 auto hpxpy =
new TH2F(
"hpxpy",
"py vs px", 40, -4, 4, 40, -4, 4);
31 auto hprof =
new TProfile(
"hprof",
"Profile of pz versus px", 100, -4, 4, 0, 20);
32 T->Branch(
"hpx",
"TH1F", &
hpx, 32000, 0);
33 T->Branch(
"hpxpy",
"TH2F", &
hpxpy, 32000, 0);
34 T->Branch(
"hprof",
"TProfile", &
hprof, 32000, 0);
36 for (
Int_t i = 0; i < 25000; i++) {
38 printf(
"at entry: %d\n", i);
40 pz = px * px + py * py;
55 auto T =
f->Get<
TTree>(
"T");
59 T->SetBranchAddress(
"hpx", &
hpx);
60 T->SetBranchAddress(
"hpxpy", &
hpxpy);
61 T->SetBranchAddress(
"hprof", &
hprof);
63 auto c1 =
new TCanvas(
"c1",
"test", 10, 10, 600, 1000);
71 c1->Print(
"htr1.png");
79 auto T =
f->Get<
TTree>(
"T");
80 auto c1 =
new TCanvas(
"c1",
"test", 10, 10, 600, 1000);
83 T->Draw(
"hpx.Draw()",
"",
"goff", 1, 12345);
85 T->Draw(
"hpxpy.Draw()",
"",
"goff", 1, 12345);
87 T->Draw(
"hprof.Draw()",
"",
"goff", 1, 12345);
88 c1->Print(
"htr2.png");
97 auto T =
f->Get<
TTree>(
"T");
98 auto c1 =
new TCanvas(
"c1",
"test", 10, 10, 600, 400);
99 T->Draw(
"hpx.GetRMS():hprof.GetMean()");
100 c1->Print(
"htr3.png");
R__EXTERN TBenchmark * gBenchmark
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
R__EXTERN TRandom * gRandom
virtual void Start(const char *name)
Starts Benchmark with the specified name.
virtual void Show(const char *name)
Stops Benchmark name and Prints results.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
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 float per channel (see TH1 documentation)
2-D histogram with a float per channel (see TH1 documentation)
virtual void Rannor(Float_t &a, Float_t &b)
Return 2 numbers distributed following a gaussian with mean=0 and sigma=1.
A TTree represents a columnar dataset.