45 TFile f(
"tree1.root",
"recreate");
46 TTree t1(
"t1",
"a simple Tree with simple variables");
50 t1.Branch(
"px",&px,
"px/F");
51 t1.Branch(
"py",&py,
"py/F");
52 t1.Branch(
"pz",&pz,
"pz/F");
53 t1.Branch(
"random",&random,
"random/D");
54 t1.Branch(
"ev",&ev,
"ev/I");
57 for (Int_t i=0;i<10000;i++) {
58 gRandom->Rannor(px,py);
60 random = gRandom->Rndm();
76 TFile *f =
new TFile(
"tree1.root");
77 TTree *t1 = (TTree*)f->Get(
"t1");
81 t1->SetBranchAddress(
"px",&px);
82 t1->SetBranchAddress(
"py",&py);
83 t1->SetBranchAddress(
"pz",&pz);
84 t1->SetBranchAddress(
"random",&random);
85 t1->SetBranchAddress(
"ev",&ev);
88 TH1F *hpx =
new TH1F(
"hpx",
"px distribution",100,-3,3);
89 TH2F *hpxpy =
new TH2F(
"hpxpy",
"py vs px",30,-3,3,30,-3,3);
92 Long64_t nentries = t1->GetEntries();
93 for (Long64_t i=0;i<nentries;i++) {
101 if (gROOT->IsBatch())
return;
109 t1->ResetBranchAddresses();