24 TFile f(
"ht.root",
"recreate");
25 auto T =
new TTree(
"T",
"test");
26 auto hpx =
new TH1F(
"hpx",
"This is the px distribution",100,-4,4);
27 auto hpxpy =
new TH2F(
"hpxpy",
"py vs px",40,-4,4,40,-4,4);
28 auto hprof =
new TProfile(
"hprof",
"Profile of pz versus px",100,-4,4,0,20);
29 T->
Branch(
"hpx",
"TH1F",&hpx,32000,0);
30 T->
Branch(
"hpxpy",
"TH2F",&hpxpy,32000,0);
31 T->
Branch(
"hprof",
"TProfile",&hprof,32000,0);
33 for (
Int_t i = 0; i < 25000; i++) {
34 if (i%1000 == 0)
printf(
"at entry: %d\n",i);
48 auto f =
new TFile(
"ht.root");
51 TH2F *hpxpy =
nullptr;
57 auto c1 =
new TCanvas(
"c1",
"test",10,10,600,1000);
70 auto f =
new TFile(
"ht.root");
72 auto c1 =
new TCanvas(
"c1",
"test",10,10,600,1000);
75 T->
Draw(
"hpx.Draw()",
"",
"goff",1,12345);
77 T->
Draw(
"hpxpy.Draw()",
"",
"goff",1,12345);
79 T->
Draw(
"hprof.Draw()",
"",
"goff",1,12345);
86 auto f =
new TFile(
"ht.root");
88 T->
Draw(
"hpx.GetRMS():hprof.GetMean()");
89 gPad->Print(
"htr3.png");
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
virtual void Rannor(Float_t &a, Float_t &b)
Return 2 numbers distributed following a gaussian with mean=0 and sigma=1.
virtual Int_t Fill()
Fill all branches.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
TVirtualPad * cd(Int_t subpadnumber=0)
Set current canvas & pad.
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
virtual void Show(const char *name)
Stops Benchmark name and Prints results.
virtual Int_t GetEntry(Long64_t entry=0, Int_t getall=0)
Read all branches of entry and return total number of bytes read.
1-D histogram with a float per channel (see TH1 documentation)}
virtual void Print(const char *filename="") const
Save Pad contents in a file in one of various formats.
virtual void Print(Option_t *option="") const
Print a summary of the tree contents.
virtual void Start(const char *name)
Starts Benchmark with the specified name.
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr=0)
Change branch address, dealing with clone trees properly.
virtual void Draw(Option_t *option="")
Draw this histogram with options.
virtual Int_t Write(const char *name=0, Int_t opt=0, Int_t bufsiz=0)
Write memory objects to this file.
R__EXTERN TBenchmark * gBenchmark
2-D histogram with a float per channel (see TH1 documentation)}
Int_t Fill(const Double_t *v)
R__EXTERN TRandom * gRandom
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)
virtual void Draw(Option_t *opt)
Default Draw method for all objects.
virtual Int_t Branch(TCollection *list, Int_t bufsize=32000, Int_t splitlevel=99, const char *name="")
Create one branch for each element in the collection.
virtual void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0)
Automatic pad generation by division.
A TTree object has a header with a name and a title.
Int_t Fill(Double_t)
Invalid Fill method.