Newer
Older
TB_Chris / TbUT / scripts / .svn / text-base / CMS.C.svn-base
  1. #define CMS_cxx
  2. #include "CMS.h"
  3. #include <TH2.h>
  4. #include <TStyle.h>
  5. #include <TCanvas.h>
  6.  
  7. void CMS::Loop()
  8. {
  9. // In a ROOT session, you can do:
  10. // Root > .L CMS.C
  11. // Root > CMS t
  12. // Root > t.GetEntry(12); // Fill t data members with entry number 12
  13. // Root > t.Show(); // Show values of entry 12
  14. // Root > t.Show(16); // Read and show values of entry 16
  15. // Root > t.Loop(); // Loop on all entries
  16. //
  17.  
  18. // This is the loop skeleton where:
  19. // jentry is the global entry number in the chain
  20. // ientry is the entry number in the current Tree
  21. // Note that the argument to GetEntry must be:
  22. // jentry for TChain::GetEntry
  23. // ientry for TTree::GetEntry and TBranch::GetEntry
  24. //
  25. // To read only selected branches, Insert statements like:
  26. // METHOD1:
  27. // fChain->SetBranchStatus("*",0); // disable all branches
  28. // fChain->SetBranchStatus("branchname",1); // activate branchname
  29. // METHOD2: replace line
  30. // fChain->GetEntry(jentry); //read all branches
  31. //by b_branchname->GetEntry(ientry); //read only this branch
  32. if (fChain == 0) return;
  33.  
  34. Long64_t nentries = fChain->GetEntriesFast();
  35.  
  36. Long64_t nbytes = 0, nb = 0;
  37. for (Long64_t jentry=0; jentry<nentries;jentry++) {
  38. Long64_t ientry = LoadTree(jentry);
  39. if (ientry < 0) break;
  40. nb = fChain->GetEntry(jentry); nbytes += nb;
  41. // if (Cut(ientry) < 0) continue;
  42. }
  43. }