SHAIMA
May 10, 2013, 12:58pm
#1
{
TFile f2(“ht.root”, “recreate”);
TTree *mytree = new TTree(“mytree”, “Test Tree”);
Double_t val[5] = {0, 0, 0, 0, 0};
TBranch b2 = mytree->Branch(“b2”, val, “a/D:b:c:d:e”);
for (int i=0; i<8; i++) {
val[0] = 1; val[3] = -3.14; val[2] = i 1.;
mytree->Fill() ;
}
f2.Write() ;
mytree->Print();
mytree->Scan();
}
…
please if a =7 and also a=3 how can i fill branch for this condition that’s when open branch a i will see 7 and 3
please help me as you can and thanks so much
{
TFile f2("ht.root", "recreate");
TTree *mytree = new TTree("mytree", "Test Tree");
Double_t val[5] = {0, 0, 0, 0, 0};
TBranch *b2 = mytree->Branch("b2", val, "a/D:b:c:d:e");
for (int i = 0; i < 8; i++) {
val[0] = i * 1.0 + 100.0; // set "a"
val[1] = i * 2.0 + 200.0; // set "b"
val[2] = i * 3.0 + 300.0; // set "c"
val[3] = i * 4.0 + 400.0; // set "d"
val[4] = i * 5.0 + 500.0; // set "e"
mytree->Fill(); // fill "mytree" (will be entry number "i")
}
mytree->Write();
mytree->Print();
mytree->Scan();
}
SHAIMA
May 10, 2013, 5:51pm
#3
please i tried but not success
i have z=-1 and zz=1
how can i put the both in one branch Val[0] that when i open Val[0] i saw 1 and -1
pleaaaaaaaaaaaaaaaaaaaaase help me
The “val[0]” (the “a” in “mytree”) is a single number (double-precision floating-point).
For each “mytree” entry, you can only have a single “a” value.
SHAIMA
May 10, 2013, 7:00pm
#5
please forgive me
if Val[0]=1 and Val[0]=-1 i can’t putting in one branch( a ) that’s what i need
// ...
val[0] = 1;
mytree->Fill();
// ...
val[0] = -1;
mytree->Fill();
// ...
SHAIMA
May 11, 2013, 1:50pm
#7