Newer
Older
TB_Chris / TbUT / scripts / .svn / text-base / CMS.h.svn-base
  1. //////////////////////////////////////////////////////////
  2. // This class has been automatically generated on
  3. // Fri Oct 16 18:02:17 2015 by ROOT version 5.34/32
  4. // from TTree CMS/TbUT nTuple
  5. // found on file: Run_Bias_Scan-B6-A-212-8358_Tuple.root
  6. //////////////////////////////////////////////////////////
  7.  
  8. #ifndef CMS_h
  9. #define CMS_h
  10.  
  11. #include <TROOT.h>
  12. #include <TChain.h>
  13. #include <TFile.h>
  14.  
  15. // Header file for the classes stored in the TTree if any.
  16.  
  17. // Fixed size dimensions of array or collections stored in the TTree if any.
  18.  
  19. class CMS {
  20. public :
  21. TTree *fChain; //!pointer to the analyzed TTree or TChain
  22. Int_t fCurrent; //!current Tree number in a TChain
  23.  
  24. // Declaration of leaf types
  25. Double_t cmsData[512];
  26.  
  27. // List of branches
  28. TBranch *b_cmsData; //!
  29.  
  30. CMS(TTree *tree=0);
  31. virtual ~CMS();
  32. virtual Int_t Cut(Long64_t entry);
  33. virtual Int_t GetEntry(Long64_t entry);
  34. virtual Long64_t LoadTree(Long64_t entry);
  35. virtual void Init(TTree *tree);
  36. virtual void Loop();
  37. virtual Bool_t Notify();
  38. virtual void Show(Long64_t entry = -1);
  39. };
  40.  
  41. #endif
  42.  
  43. #ifdef CMS_cxx
  44. CMS::CMS(TTree *tree) : fChain(0)
  45. {
  46. // if parameter tree is not specified (or zero), connect the file
  47. // used to generate this class and read the Tree.
  48. if (tree == 0) {
  49. TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("Run_Bias_Scan-B6-A-212-8358_Tuple.root");
  50. if (!f || !f->IsOpen()) {
  51. f = new TFile("Run_Bias_Scan-B6-A-212-8358_Tuple.root");
  52. }
  53. TDirectory * dir = (TDirectory*)f->Get("Run_Bias_Scan-B6-A-212-8358_Tuple.root:/TbUT");
  54. dir->GetObject("CMS",tree);
  55.  
  56. }
  57. Init(tree);
  58. }
  59.  
  60. CMS::~CMS()
  61. {
  62. if (!fChain) return;
  63. delete fChain->GetCurrentFile();
  64. }
  65.  
  66. Int_t CMS::GetEntry(Long64_t entry)
  67. {
  68. // Read contents of entry.
  69. if (!fChain) return 0;
  70. return fChain->GetEntry(entry);
  71. }
  72. Long64_t CMS::LoadTree(Long64_t entry)
  73. {
  74. // Set the environment to read one entry
  75. if (!fChain) return -5;
  76. Long64_t centry = fChain->LoadTree(entry);
  77. if (centry < 0) return centry;
  78. if (fChain->GetTreeNumber() != fCurrent) {
  79. fCurrent = fChain->GetTreeNumber();
  80. Notify();
  81. }
  82. return centry;
  83. }
  84.  
  85. void CMS::Init(TTree *tree)
  86. {
  87. // The Init() function is called when the selector needs to initialize
  88. // a new tree or chain. Typically here the branch addresses and branch
  89. // pointers of the tree will be set.
  90. // It is normally not necessary to make changes to the generated
  91. // code, but the routine can be extended by the user if needed.
  92. // Init() will be called many times when running on PROOF
  93. // (once per file to be processed).
  94.  
  95. // Set branch addresses and branch pointers
  96. if (!tree) return;
  97. fChain = tree;
  98. fCurrent = -1;
  99. fChain->SetMakeClass(1);
  100.  
  101. fChain->SetBranchAddress("cmsData", cmsData, &b_cmsData);
  102. Notify();
  103. }
  104.  
  105. Bool_t CMS::Notify()
  106. {
  107. // The Notify() function is called when a new file is opened. This
  108. // can be either for a new TTree in a TChain or when when a new TTree
  109. // is started when using PROOF. It is normally not necessary to make changes
  110. // to the generated code, but the routine can be extended by the
  111. // user if needed. The return value is currently not used.
  112.  
  113. return kTRUE;
  114. }
  115.  
  116. void CMS::Show(Long64_t entry)
  117. {
  118. // Print contents of entry.
  119. // If entry is not specified, print current entry
  120. if (!fChain) return;
  121. fChain->Show(entry);
  122. }
  123. Int_t CMS::Cut(Long64_t entry)
  124. {
  125. // This function may be called from Loop.
  126. // returns 1 if entry is accepted.
  127. // returns -1 otherwise.
  128. return 1;
  129. }
  130. #endif // #ifdef CMS_cxx