44 TFile f(
"tree1.root",
"recreate");
45 TTree t1(
"t1",
"a simple Tree with simple variables");
49 t1.
Branch(
"px",&px,
"px/F");
50 t1.
Branch(
"py",&py,
"py/F");
51 t1.
Branch(
"pz",&pz,
"pz/F");
52 t1.
Branch(
"random",&random,
"random/D");
53 t1.
Branch(
"ev",&ev,
"ev/I");
56 for (
Int_t i=0;i<10000;i++) {
87 TH1F *hpx =
new TH1F(
"hpx",
"px distribution",100,-3,3);
88 TH2F *hpxpy =
new TH2F(
"hpxpy",
"py vs px",30,-3,3,30,-3,3);
100 if (
gROOT->IsBatch())
return;
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 Double_t Rndm(Int_t i=0)
Machine independent random number generator.
virtual Int_t Fill()
Fill all branches.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
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 StartViewer()
Start the TTreeViewer on this tree.
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr=0)
Change branch address, dealing with clone trees properly.
Using a TBrowser one can browse all ROOT objects.
virtual Int_t Write(const char *name=0, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
2-D histogram with a float per channel (see TH1 documentation)}
R__EXTERN TRandom * gRandom
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 Long64_t GetEntries() const
A TTree object has a header with a name and a title.
Int_t Fill(Double_t)
Invalid Fill method.