Newer
Older
TB_Chris / TbUT / scripts / .svn / text-base / ExampleAnalysis.h.svn-base
  1. /////////////////////////////////////////////////////////
  2. // This class has been automatically generated on
  3. // Thu Oct 1 20:13:36 2015 by ROOT version 5.34/10
  4. // from TTree Clusters/TbUT nTuple
  5. //////////////////////////////////////////////////////////
  6.  
  7. #ifndef ExampleAnalysis_h
  8. #define ExampleAnalysis_h
  9.  
  10. #include <TROOT.h>
  11. #include <TChain.h>
  12. #include <TFile.h>
  13. #include <TProfile.h>
  14. #include <TH1F.h>
  15. #include <TH2F.h>
  16. #include <TLegend.h>
  17. #include <TBox.h>
  18. #include <TLine.h>
  19.  
  20. #include "AnalysisBase.h"
  21. #include "CMS.h"
  22.  
  23. //#include "ExampleAnalysis_Inputs.h"
  24.  
  25. // Header file for the classes stored in the TTree if any.
  26. #include <vector>
  27. #include <iostream>
  28. #include <algorithm>
  29.  
  30. // Fixed size dimensions of array or collections stored in the TTree if any.
  31.  
  32. class ExampleAnalysis : public AnalysisBase{
  33. public :
  34. CMS *fCMS;
  35.  
  36. ExampleAnalysis(TTree *tree=0);
  37. virtual ~ExampleAnalysis();
  38. virtual void Loop();
  39. virtual TString getFileBase(TString scan="Bias", TString board="", TString bias="", TString angle="0", TString sector="1");
  40.  
  41. TFile *fout;
  42. };
  43.  
  44. #endif
  45.  
  46. #ifdef ExampleAnalysis_cxx
  47. ExampleAnalysis::ExampleAnalysis(TTree *tree){
  48. // if parameter tree is not specified (or zero), connect the file
  49. // used to generate this class and read the Tree.
  50. TString filename;
  51. if (tree == 0) {
  52. //
  53. // lhcb-dev
  54. //
  55. filename = m_fileIndir+"Board"+m_board+"/Run_Bias_Scan-"+getFileBase("Bias",m_board, m_bias, "0",m_sector)+"_Tuple_Tracks.root";
  56.  
  57. // lxplus
  58. //
  59. //filename = "/afs/cern.ch/work/s/sblusk/public/TB/2015/BoardA8/Run_Bias_Scan-B8-A-296-13332_Tuple_Tracks.root"; // A8 - s1
  60. //filename = "/afs/cern.ch/work/s/sblusk/public/TB/2015/BoardA8/Run_Bias_Scan-B8-A-324-13355_Tuple_Tracks.root"; // A8 - s2
  61. //filename = "/afs/cern.ch/work/s/sblusk/public/TB/2015/BoardA8/Run_Bias_Scan-B8-A-359-13386_Tuple_Tracks.root"; // A8 - s3
  62. //filename = "/afs/cern.ch/work/s/sblusk/public/TB/2015/BoardA6/Run_Bias_Scan-B6-A-212-8358_Tuple_Tracks.root"; // A6
  63. //
  64.  
  65. TFile *f = new TFile(filename);
  66. tree = (TTree*)f->Get("Clusters");
  67.  
  68. // Get mean noise and width
  69. hMeanNoise = (TH1F*)f->Get("hMeanNoise");
  70. hWidthNoise = (TH1F*)f->Get("hWidthNoise");
  71.  
  72. TString filename2 = filename.ReplaceAll("_Tracks","");
  73. TFile * f2 = new TFile(filename2);
  74. if(f2) {
  75. TTree * tree2 = (TTree*) f2->Get("TbUT/CMS");
  76. if(tree2) {
  77. tree->AddFriend(tree2);
  78. fCMS = new CMS(tree2);
  79. }else{
  80. fCMS=0;
  81. }
  82. } else {
  83. cout << "WARNING: Could not find CMS data file: " << filename2 << endl;
  84. fCMS =0 ;
  85. }
  86. }
  87. Init(tree);
  88. }
  89.  
  90. ExampleAnalysis::~ExampleAnalysis()
  91. {
  92. if (!fChain) return;
  93. delete fChain->GetCurrentFile();
  94. }
  95. TString ExampleAnalysis::getFileBase(TString scan, TString board, TString bias, TString angle, TString sector) {
  96.  
  97. TString tag = "";
  98.  
  99. if(board == "A6"){
  100. if(sector == "1") {
  101. if ( bias == "300" ) tag = "B6-A-212-8358";
  102. } else if(sector == "2"){
  103. if ( bias == "300" ) tag = "B6-A-242-8389";
  104. } else if(sector == "3"){
  105. if ( bias == "300" ) tag = "B6-A-293-8425";
  106. } else if(sector == "4"){
  107. if ( bias == "300" ) tag = "B6-A-326-8452";
  108. } else if(sector == "5"){
  109. if ( bias == "300" ) tag = "B6-A-377-8494";
  110. } else if(sector == "6"){
  111. if ( bias == "250" ) tag = "B6-A-409-8524";
  112. }
  113. } else if (board == "A4") {
  114. if(sector == "1") {
  115. if(bias == "400" ) tag = "B4-A-210-8552";
  116. } else if(sector == "3"){
  117. if(bias == "400" ) tag = "B4-A-275-8615";
  118. }
  119. } else if (board == "A8") {
  120. if(sector == "1"){
  121. if(bias == "500") tag = "B8-A-296-13332";
  122. }else if (sector == "2"){
  123. if(bias == "400") tag = "B8-A-324-13355";
  124. }else if (sector == "3"){
  125. if(bias == "400") tag = "B8-A-359-13386";
  126. }
  127. }
  128.  
  129. return tag;
  130. }
  131.  
  132.  
  133. #endif // #ifdef ExampleAnalysis_cxx