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.

170 lines
5.7 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. TGraphErrors * g_0p = 0;
  6. _file0_p->GetObject("example",g_0p);
  7. TFile *_file1_p = TFile::Open("../../HIT_26-11-2016/with_timestamp/SAVE_PiN_run32.root");
  8. TGraphErrors * g_1p = 0;
  9. _file1_p->GetObject("example",g_1p);
  10. TFile *_file0_he = TFile::Open("../../HIT_26-11-2016/with_timestamp/SAVE_PiN_run35.root");
  11. TGraphErrors * g_0he = 0;
  12. _file0_he->GetObject("example",g_0he);
  13. TFile *_file1_he = TFile::Open("../../HIT_26-11-2016/with_timestamp/SAVE_PiN_run60.root");
  14. TGraphErrors * g_1he = 0;
  15. _file1_he->GetObject("example",g_1he);
  16. TFile *_file0_c = TFile::Open("../../HIT_26-11-2016/with_timestamp/SAVE_PiN_run63.root");
  17. TGraphErrors * g_0c = 0;
  18. _file0_c->GetObject("example",g_0c);
  19. TFile *_file1_c = TFile::Open("../../HIT_26-11-2016/with_timestamp/SAVE_PiN_run86.root");
  20. TGraphErrors * g_1c = 0;
  21. _file1_c->GetObject("example",g_1c);
  22. TFile *_file0_o = TFile::Open("../../HIT_26-11-2016/with_timestamp/SAVE_PiN_run89.root");
  23. TGraphErrors * g_0o = 0;
  24. _file0_o->GetObject("example",g_0o);
  25. TFile *_file1_o = TFile::Open("../../HIT_26-11-2016/with_timestamp/SAVE_PiN_run108.root");
  26. TGraphErrors * g_1o = 0;
  27. _file1_o->GetObject("example",g_1o);
  28. TCanvas *c1 = new TCanvas("c1", "canvaspad1", 800, 800);
  29. gStyle->SetPadBorderMode(0);
  30. gStyle->SetFrameBorderMode(0);
  31. Float_t small = 1e-5;
  32. c1->Divide(2,2,small,small);
  33. c1->cd(1);
  34. gPad->SetBottomMargin(small);
  35. gPad->SetRightMargin(small);
  36. gPad->SetLeftMargin(0.2);
  37. TMultiGraph * mg_p = new TMultiGraph();
  38. mg_p->Add(g_0p,"pc"); g_0p->SetMarkerStyle(20);g_0p->SetMarkerColor(kGray);
  39. mg_p->Add(g_1p,"pc"); g_1p->SetMarkerStyle(20);
  40. mg_p->Draw("a");
  41. mg_p->SetTitle("");
  42. // mg_p->GetXaxis()->SetTitle("Stopping Power / MeV#upointcm^{2}g^{-1}");
  43. mg_p->GetYaxis()->SetTitle("A_{BPM} / a.u./312#mus"); mg_p->GetYaxis()->SetTitleOffset(1.5);
  44. mg_p->GetXaxis()->SetRangeUser(4,64);
  45. mg_p->GetYaxis()->SetRangeUser(-200,3200);
  46. mg_p->SetMinimum(-200.);
  47. mg_p->SetMaximum(3200.);
  48. TLegend * mylegend = new TLegend(0.60,0.8,0.9,0.9);
  49. mylegend->SetFillColor(0); // white background
  50. mylegend->SetTextFont(22);
  51. mylegend->SetBorderSize(0); // get rid of the box
  52. mylegend->SetTextSize(0.045); // set text size
  53. mylegend->AddEntry(g_0p,"Protons E21 I8","p"); // options: p,l,f
  54. mylegend->AddEntry(g_1p,"Protons E255 I8","p"); // options: p,l,f
  55. mylegend->Draw();
  56. gPad->Modified();
  57. c1->cd(2);
  58. gPad->SetBottomMargin(small);
  59. gPad->SetRightMargin(0.2);
  60. gPad->SetLeftMargin(small);
  61. TMultiGraph * mg_he = new TMultiGraph();
  62. mg_he->Add(g_0he,"pc"); g_0he->SetMarkerStyle(21);g_0he->SetMarkerColor(kGray);
  63. mg_he->Add(g_1he,"pc"); g_1he->SetMarkerStyle(21);
  64. mg_he->Draw("a");
  65. mg_he->SetTitle("");
  66. // mg_he->GetXaxis()->SetTitle("Stopping Power / MeV#upointcm^{2}g^{-1}");
  67. // mg_he->GetYaxis()->SetTitle("#A_{BPM} / [a.u./312#us]");
  68. mg_he->GetXaxis()->SetRangeUser(4,64);
  69. mg_he->GetYaxis()->SetRangeUser(-200,3200);
  70. mg_he->SetMinimum(-200.);
  71. mg_he->SetMaximum(3200.);
  72. TLegend * mylegend2 = new TLegend(0.40,0.8,0.7,0.9);
  73. mylegend2->SetFillColor(0); // white background
  74. mylegend2->SetTextFont(22);
  75. mylegend2->SetBorderSize(0); // get rid of the box
  76. mylegend2->SetTextSize(0.045); // set text size
  77. mylegend2->AddEntry(g_0he,"Helium E21 I8","p"); // options: p,l,f
  78. mylegend2->AddEntry(g_1he,"Helium E255 I8","p"); // options: p,l,f
  79. mylegend2->Draw();
  80. gPad->Modified();
  81. c1->cd(3);
  82. gPad->SetTopMargin(small);
  83. gPad->SetRightMargin(small);
  84. gPad->SetLeftMargin(0.2);
  85. gPad->SetTickx();
  86. TMultiGraph * mg_c = new TMultiGraph();
  87. mg_c->Add(g_0c,"pc"); g_0c->SetMarkerStyle(22);g_0c->SetMarkerColor(kGray);
  88. mg_c->Add(g_1c,"pc"); g_1c->SetMarkerStyle(22);
  89. mg_c->Draw("a");
  90. mg_c->SetTitle("");
  91. mg_c->GetXaxis()->SetTitle("Channel");
  92. mg_c->GetYaxis()->SetTitle("A_{BPM} / a.u./312#mus");mg_c->GetYaxis()->SetTitleOffset(1.5);
  93. mg_c->GetXaxis()->SetRangeUser(4,64);
  94. mg_c->GetYaxis()->SetRangeUser(-200,3200);
  95. mg_c->SetMinimum(-200.);
  96. mg_c->SetMaximum(3200.);
  97. TLegend * mylegend3 = new TLegend(0.60,0.85,0.9,0.95);
  98. mylegend3->SetFillColor(0); // white background
  99. mylegend3->SetTextFont(22);
  100. mylegend3->SetBorderSize(0); // get rid of the box
  101. mylegend3->SetTextSize(0.045); // set text size
  102. mylegend3->AddEntry(g_0c,"Carbon E21 I8","p"); // options: p,l,f
  103. mylegend3->AddEntry(g_1c,"Carbon E255 I8","p"); // options: p,l,f
  104. mylegend3->Draw();
  105. gPad->Modified();
  106. c1->cd(4);
  107. gPad->SetTopMargin(small);
  108. gPad->SetRightMargin(0.2);
  109. gPad->SetLeftMargin(small);
  110. gPad->SetTickx();
  111. TMultiGraph * mg_o = new TMultiGraph();
  112. mg_o->Add(g_0o,"pc"); g_0o->SetMarkerStyle(23);g_0o->SetMarkerColor(kGray);
  113. mg_o->Add(g_1o,"pc"); g_1o->SetMarkerStyle(23);
  114. mg_o->Draw("a");
  115. mg_o->SetTitle("");
  116. mg_o->GetXaxis()->SetTitle("Channel");
  117. //mg_o->GetYaxis()->SetTitle("#A_{BPM} / [a.u./312#us]");
  118. mg_o->GetXaxis()->SetRangeUser(4,64);
  119. mg_o->GetYaxis()->SetRangeUser(-200,3200);
  120. mg_o->SetMinimum(-200.);
  121. mg_o->SetMaximum(3200.);
  122. TLegend * mylegend4 = new TLegend(0.40,0.85,0.7,0.95);
  123. mylegend4->SetFillColor(0); // white background
  124. mylegend4->SetTextFont(22);
  125. mylegend4->SetBorderSize(0); // get rid of the box
  126. mylegend4->SetTextSize(0.045); // set text size
  127. mylegend4->AddEntry(g_0o,"Oxygen E21 I8","p"); // options: p,l,f
  128. mylegend4->AddEntry(g_1o,"Oxygen E201 I8","p"); // options: p,l,f
  129. mylegend4->Draw();
  130. gPad->Modified();
  131. c1->cd();
  132. gPad->Modified();
  133. c1->SaveAs("figs/beamprofileexamples.pdf");
  134. c1->SaveAs("figs/beamprofileexamples.png");
  135. }