#include "TFile.h" #include "TH1.h" #include "TH2.h" #include "TChain.h" #include "TTree.h" #include "TLeaf.h" #define UpdateEvents 2000 using namespace std; TLeaf *xpos; void GetValue(const char *filename = "eu152_11july_afterGlitch.001", const char *treename = "RoseNIAS") { const char* nmHis[20]; Int_t NoPara; Long64_t nentries; TChain *fChain = new TChain(treename); fChain->AddFile(filename); TObjArray*obj = fChain->GetListOfBranches(); NoPara = obj->GetEntries(); //Number of parameters in Tree and hence in experiment nentries = fChain->GetEntriesFast(); //Number of events in the Tree fChain->SetBranchStatus("*", 1); //Activate all branches //fChain->SetMakeClass(1); cout << "\n Total Number Entries in the TChain is:\t" << nentries << endl; for (Long64_t k = 0; k < nentries; ++k) { Long64_t ientry = fChain->LoadTree(k); if (ientry < 0) break; fChain->GetEntry(k); for (Int_t i=0; i(fChain->GetListOfBranches()->At(i)); nmHis[i] = br->GetName(); xpos = fChain->GetLeaf(nmHis[i]); fdata = xpos->GetValue(); // // Then Fill Histograms with name "nmHis[i]" with "fdata" // cout << nmHis[i] << " :\t" << fdata << endl; // // } if (k % UpdateEvents) continue; printf ("EVENTS = %8d\r", k); fflush (stdout); } printf ("EVENTS = %8d....\n", nentries); }