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.

206 lines
6.4 KiB

  1. {
  2. gROOT->Reset();
  3. gROOT->ProcessLine(".x /work/leverington/beamprofilemonitor/hitdata/Scripts/Scripts_20161126/lhcbStyle.C");
  4. TFile *_file0_p = TFile::Open("../../HIT_26-11-2016/with_timestamp/SAVE_PiN_run8.root");
  5. TH2D * g_0p = 0;
  6. _file0_p->GetObject("th2d_beamSignal_channel",g_0p);
  7. TProfile* g_0p_pfx = g_0p->ProfileX();
  8. TFile *_file1_p = TFile::Open("../../HIT_26-11-2016/with_timestamp/SAVE_PiN_run32.root");
  9. TH2D * g_1p = 0;
  10. _file1_p->GetObject("th2d_beamSignal_channel",g_1p);
  11. TProfile* g_1p_pfx = g_1p->ProfileX();
  12. TFile *_file0_he = TFile::Open("../../HIT_26-11-2016/with_timestamp/SAVE_PiN_run35.root");
  13. TH2D * g_0he = 0;
  14. _file0_he->GetObject("th2d_beamSignal_channel",g_0he);
  15. TProfile* g_0he_pfx = g_0he->ProfileX();
  16. TFile *_file1_he = TFile::Open("../../HIT_26-11-2016/with_timestamp/SAVE_PiN_run60.root");
  17. TH2D * g_1he = 0;
  18. _file1_he->GetObject("th2d_beamSignal_channel",g_1he);
  19. TProfile* g_1he_pfx = g_1he->ProfileX();
  20. TFile *_file0_c = TFile::Open("../../HIT_26-11-2016/with_timestamp/SAVE_PiN_run63.root");
  21. TH2D * g_0c = 0;
  22. _file0_c->GetObject("th2d_beamSignal_channel",g_0c);
  23. TProfile* g_0c_pfx = g_0c->ProfileX();
  24. TFile *_file1_c = TFile::Open("../../HIT_26-11-2016/with_timestamp/SAVE_PiN_run86.root");
  25. TH2D * g_1c = 0;
  26. _file1_c->GetObject("th2d_beamSignal_channel",g_1c);
  27. TProfile* g_1c_pfx = g_1c->ProfileX();
  28. TFile *_file0_o = TFile::Open("../../HIT_26-11-2016/with_timestamp/SAVE_PiN_run89.root");
  29. TH2D * g_0o = 0;
  30. _file0_o->GetObject("th2d_beamSignal_channel",g_0o);
  31. TProfile* g_0o_pfx = g_0o->ProfileX();
  32. TFile *_file1_o = TFile::Open("../../HIT_26-11-2016/with_timestamp/SAVE_PiN_run108.root");
  33. TH2D * g_1o = 0;
  34. _file1_o->GetObject("th2d_beamSignal_channel",g_1o);
  35. TProfile* g_1o_pfx = g_1o->ProfileX();
  36. TCanvas *c1 = new TCanvas("c1", "canvaspad1", 800, 800);
  37. gStyle->SetPadBorderMode(0);
  38. gStyle->SetFrameBorderMode(0);
  39. Float_t small = 1e-5;
  40. c1->Divide(2,2,small,small);
  41. c1->cd(1);
  42. gPad->SetBottomMargin(small);
  43. gPad->SetRightMargin(small);
  44. gPad->SetLeftMargin(0.2);
  45. g_0p_pfx->SetMarkerStyle(20);g_0p_pfx->SetMarkerColor(kGray);
  46. g_1p_pfx->SetMarkerStyle(20);
  47. g_0p_pfx->SetTitle("");
  48. // mg_p->GetXaxis()->SetTitle("Stopping Power / MeV#upointcm^{2}g^{-1}");
  49. g_0p_pfx->GetYaxis()->SetTitle("A_{BPM} / a.u./312#mus"); g_0p_pfx->GetYaxis()->SetTitleOffset(1.5);
  50. g_0p_pfx->GetXaxis()->SetRangeUser(4,64);
  51. g_0p_pfx->GetYaxis()->SetRangeUser(-200,3200);
  52. g_0p_pfx->SetMinimum(-200.);
  53. g_0p_pfx->SetMaximum(3200.);
  54. g_0p_pfx->Draw();
  55. g_1p_pfx->Draw("same");
  56. TLegend * mylegend = new TLegend(0.25,0.8,0.9,0.9);
  57. mylegend->SetFillColor(0); // white background
  58. mylegend->SetTextFont(22);
  59. mylegend->SetBorderSize(0); // get rid of the box
  60. mylegend->SetTextSize(0.045); // set text size
  61. mylegend->AddEntry(g_0p_pfx,"Protons: 70 MeV/u, 1.2#upoint10^{9} s^{-1}","p"); // options: p,l,f
  62. mylegend->AddEntry(g_1p_pfx,"Protons: 221 MeV/u, 1.2#upoint10^{9} s^{-1}","p"); // options: p,l,f
  63. mylegend->Draw();
  64. gPad->Modified();
  65. c1->cd(2);
  66. gPad->SetBottomMargin(small);
  67. gPad->SetRightMargin(0.2);
  68. gPad->SetLeftMargin(small);
  69. g_0he_pfx->SetMarkerStyle(20);g_0he_pfx->SetMarkerColor(kGray);
  70. g_1he_pfx->SetMarkerStyle(20);
  71. g_0he_pfx->SetTitle("");
  72. g_0he_pfx->GetYaxis()->SetTitle("A_{BHEM} / a.u./312#mus"); g_0he_pfx->GetYaxis()->SetTitleOffset(1.5);
  73. g_0he_pfx->GetXaxis()->SetRangeUser(4,64);
  74. g_0he_pfx->GetYaxis()->SetRangeUser(-200,3200);
  75. g_0he_pfx->SetMinimum(-200.);
  76. g_0he_pfx->SetMaximum(3200.);
  77. g_0he_pfx->Draw();
  78. g_1he_pfx->Draw("same");
  79. TLegend * mylegend2 = new TLegend(0.05,0.8,0.7,0.9);
  80. mylegend2->SetFillColor(0); // white background
  81. mylegend2->SetTextFont(22);
  82. mylegend2->SetBorderSize(0); // get rid of the box
  83. mylegend2->SetTextSize(0.045); // set text size
  84. mylegend2->AddEntry(g_0he_pfx,"Helium: 72 MeV/u, 3.0#upoint10^{8} s^{-1}","p"); // options: p,l,f
  85. mylegend2->AddEntry(g_1he_pfx,"Helium: 221 MeV/u, 3.0#upoint10^{8} s^{-1}","p"); // options: p,l,f
  86. mylegend2->Draw();
  87. gPad->Modified();
  88. c1->cd(3);
  89. gPad->SetTopMargin(small);
  90. gPad->SetRightMargin(small);
  91. gPad->SetLeftMargin(0.2);
  92. gPad->SetTickx();
  93. g_0c_pfx->SetMarkerStyle(20);g_0c_pfx->SetMarkerColor(kGray);
  94. g_1c_pfx->SetMarkerStyle(20);
  95. g_0c_pfx->SetTitle("");
  96. g_0c_pfx->GetYaxis()->SetTitle("A_{BCM} / a.u./312#mus"); g_0c_pfx->GetYaxis()->SetTitleOffset(1.5);
  97. g_0c_pfx->GetXaxis()->SetRangeUser(4,64); g_0c_pfx->GetXaxis()->SetTitle("Channel");
  98. g_0c_pfx->GetYaxis()->SetRangeUser(-200,3200);
  99. g_0c_pfx->SetMinimum(-200.);
  100. g_0c_pfx->SetMaximum(3200.);
  101. g_0c_pfx->Draw();
  102. g_1c_pfx->Draw("same");
  103. TLegend * mylegend3 = new TLegend(0.25,0.85,0.9,0.95);
  104. mylegend3->SetFillColor(0); // white background
  105. mylegend3->SetTextFont(22);
  106. mylegend3->SetBorderSize(0); // get rid of the box
  107. mylegend3->SetTextSize(0.045); // set text size
  108. mylegend3->AddEntry(g_0c_pfx,"Carbon: 130 MeV/u, 3.0#upoint10^{7} s^{-1}","p"); // options: p,l,f
  109. mylegend3->AddEntry(g_1c_pfx,"Carbon: 430 MeV/u, 3.0#upoint10^{7} s^{-1}","p"); // options: p,l,f
  110. mylegend3->Draw();
  111. gPad->Modified();
  112. c1->cd(4);
  113. gPad->SetTopMargin(small);
  114. gPad->SetRightMargin(0.2);
  115. gPad->SetLeftMargin(small);
  116. gPad->SetTickx();
  117. g_0o_pfx->SetMarkerStyle(20);g_0o_pfx->SetMarkerColor(kGray);
  118. g_1o_pfx->SetMarkerStyle(20);
  119. g_0o_pfx->SetTitle("");
  120. g_0o_pfx->GetYaxis()->SetTitle("A_{BOM} / a.u./312#mus"); g_0o_pfx->GetYaxis()->SetTitleOffset(1.5);
  121. g_0o_pfx->GetXaxis()->SetRangeUser(4,64); g_0o_pfx->GetXaxis()->SetTitle("Channel");
  122. g_0o_pfx->GetYaxis()->SetRangeUser(-200,3200);
  123. g_0o_pfx->SetMinimum(-200.);
  124. g_0o_pfx->SetMaximum(3200.);
  125. g_0o_pfx->Draw();
  126. g_1o_pfx->Draw("same");
  127. TLegend * mylegend4 = new TLegend(0.05,0.85,0.7,0.95);
  128. mylegend4->SetFillColor(0); // white background
  129. mylegend4->SetTextFont(22);
  130. mylegend4->SetBorderSize(0); // get rid of the box
  131. mylegend4->SetTextSize(0.045); // set text size
  132. mylegend4->AddEntry(g_0o_pfx,"Oxygen: 152 MeV/u, 1.5#upoint10^{7} s^{-1}","p"); // options: p,l,f
  133. mylegend4->AddEntry(g_1o_pfx,"Oxygen: 423 MeV/u, 1.5#upoint10^{7} s^{-1}","p"); // options: p,l,f
  134. mylegend4->Draw();
  135. gPad->Modified();
  136. c1->cd();
  137. gPad->Modified();
  138. c1->SaveAs("figs/beamprofileexamples_avg.pdf");
  139. c1->SaveAs("figs/beamprofileexamples_avg.png");
  140. }