data analysis scripts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
3.2 KiB

  1. {
  2. gROOT->Reset();
  3. gROOT->ProcessLine(".x lhcbStyle.C");
  4. gStyle->SetOptTitle(1);
  5. gStyle->SetOptStat(1);
  6. TCanvas * c1 = new TCanvas("c1","b0",1200,1200);
  7. c1->Divide(7,7);
  8. TCanvas * c2 = new TCanvas("c2","b1",1200,1200);
  9. c2->Divide(7,7);
  10. TCanvas * c3 = new TCanvas("c3","b2",1200,1200);
  11. c3->Divide(7,7);
  12. TCanvas * c4 = new TCanvas("c4","b3",1200,1200);
  13. c4->Divide(7,7);
  14. // run map in 20 mm steps
  15. // y
  16. // 0,41,42,43,44,45, 0
  17. // 31,15,11, 7,17,23,26
  18. // 32,14,10, 6,16,22,27
  19. //x 33, 3, 2, 1, 4, 5,28
  20. // 34,18,12, 8,20,24,29
  21. // 35,19,13, 9,21,25,30
  22. // 0,36,37,38,39,40, 0
  23. Int_t fileorder[7][7] = {{0,41,42,43,44,45,0},{31,15,11,7,17,23,26},{32,14,10,6,16,22,27},{33,3,2,1,4,5,28},{34,18,12,8,20,24,29},{35,19,13,9,21,25,30},{0,36,37,38,39,40,0}};
  24. TFile * f1 = new TFile("diffout_calib.root","RECREATE");
  25. TObjArray *myhists = new TObjArray();
  26. TFile *runfile[49];
  27. TTree *tree[49];
  28. TH1D *h1[49];
  29. TH1D *h2[49];
  30. TH1D *h3[49];
  31. TH1D *h4[49];
  32. TLatex * label[49];
  33. char histname[10];
  34. char histtitle[10];
  35. Int_t counter = 0;
  36. TDirectory *where = gDirectory;
  37. for (int i = 0;i<7;i++){
  38. for (int j = 0;j<7;j++){
  39. if (fileorder[j][i]==0) {
  40. counter++;
  41. continue;
  42. }
  43. //cout << counter << endl;
  44. where->cd();
  45. sprintf(histname,"h1[%i]",counter);
  46. sprintf(histtitle,"Run_%i",fileorder[i][j]);
  47. h1[counter] = new TH1D(histname,histtitle,100,-5,5);
  48. myhists->AddLast(h1[counter]);
  49. runfile[counter] = new TFile(Form("/work/leverington/beamprofilemonitor/hitdata/HIT_17_12_2017/root/run%i.root",fileorder[i][j]),"");
  50. tree[counter] = (TTree*)runfile[counter]->Get("t");
  51. c1->cd(counter+1);
  52. where->cd();
  53. tree[counter]->Project(histname,"beamPosX_b0-beamPosX_b1","beamSignal_b0>7000&&beamSignal_b1>7000");
  54. h1[counter]->Draw();
  55. // label[counter]->DrawLatexNDC(0.5,0.95,Form("Run%i",fileorder[i][j]));
  56. c2->cd(counter+1);
  57. where->cd();
  58. sprintf(histname,"h2[%i]",counter);
  59. h2[counter] = new TH1D(histname,histtitle,100,-5,5);
  60. myhists->AddLast(h2[counter]);
  61. tree[counter]->Project(histname,"beamPosX_b2-beamPosX_b3","beamSignal_b2>7000&&beamSignal_b3>7000");
  62. h2[counter]->Draw();
  63. // label[counter]->DrawLatexNDC(0.5,0.95,Form("Run%i",fileorder[i][j]));
  64. c3->cd(counter+1);
  65. where->cd();
  66. sprintf(histname,"h3[%i]",counter);
  67. h3[counter] = new TH1D(histname,histtitle,100,-5,5);
  68. myhists->AddLast(h3[counter]);
  69. tree[counter]->Project(histname,"beamFocusX_b0-beamFocusX_b1","beamSignal_b0>7000&&beamSignal_b1>7000");
  70. h3[counter]->Draw();
  71. // label[counter]->DrawLatexNDC(0.5,0.95,Form("Run%i",fileorder[i][j]));
  72. c4->cd(counter+1);
  73. where->cd();
  74. sprintf(histname,"h4[%i]",counter);
  75. h4[counter] = new TH1D(histname,histtitle,100,-5,5);
  76. myhists->AddLast(h4[counter]);
  77. tree[counter]->Project(histname,"beamFocusX_b2-beamFocusX_b3","beamSignal_b2>7000&&beamSignal_b3>7000");
  78. h4[counter]->Draw();
  79. // label[counter]->DrawLatexNDC(0.5,0.95,Form("Run%i",fileorder[i][j]));
  80. runfile[counter]->Close();
  81. counter++;
  82. }
  83. }
  84. myhists->Write();
  85. // f1->Close();
  86. }