Dear Rooters, I really do not understand what's going on while I create and write a TTree. Cf the snipped pippo.C and pippo.h below. The problem is that whhen I open the root file I've created, the branches do not contain what it was supposed to be inserted (To check that I fill some histos with the BB_* variables and draw them) Thanks alot, Cheers, Antonio P.S. Using 3.02/07 Here are the pippo.C and pippo.h (the usual stuff generated by MakeClass): // pippo.h typedef struct { Float_t vars[20][3000]; Float_t pat[3000]; Float_t evt; } PAT; class Myanal { public : ... }; //----------- pippo.C #include "pippo.h" #include "TH2.h" #include "TStyle.h" #include "TCanvas.h" void MyAnal::Loop() { PAT patn; TH1F *h_pat = new TH1F("h_pat","pat",50,0,1); TFile f1("pip.root","RECREATE"); TTree *tree = new TTree("tree", "xxxx"); Int_t nc; tree->Branch("nc",&nc,"nc/I"); tree->Branch("Comb",&patn,"var[20][nc]/F:cpat[nc]/F:evt/F"); (...) for (Int_t jentry=0; jentry<nentries;jentry++) { Int_t ientry = LoadTree(jentry); nb = fChain->GetEntry(jentry); if(BB_nc==0) continue; nc = BB_nc; for(Int_t it = 0; it<BB_nc;++it){ patn.vars[0][it] = BB_v1[it]; patn.vars[1][it] = BB_v2[it]; // etc... patn.cpat[it] = BB_p[it]; } patn.evt = BB_a; h_pat->Fill(BB_a); tree->Fill(); } tree->Write(); } _______________________________________________________________________________ a n t o n i o s i d o t i e-mail sidoti@science.unitn.it sidoti@fnal.gov www http://higgs.tn.infn.it/~sidoti/ _______________________________________________________________________________ "Il meglio e` nemico del buono"
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:54 MET