res2.C 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. #include "TFile.h"
  2. #include "TString.h"
  3. #include "TH1F.h"
  4. #include "TCanvas.h"
  5. #include <iostream>
  6. #include "TLine.h"
  7. #include "TMath.h"
  8. #include <Math/SpecFuncMathMore.h>
  9. #include <TMath.h>
  10. #if ROOT_VERSION_CODE >= ROOT_VERSION(6, 0, 0)
  11. R__LOAD_LIBRARY(libMathMore.so);
  12. #endif
  13. // Resolution calculation
  14. //S----------------------------------------------------------------
  15. double GetRes(double _chi, double _harm){
  16. double con = TMath::Sqrt(TMath::Pi() / 2) / 2;
  17. double arg = _chi * _chi / 4.;
  18. double order1 = (_harm - 1) / 2.;
  19. double order2 = (_harm + 1) / 2.;
  20. double res = con * _chi * exp(-arg) * (ROOT::Math::cyl_bessel_i(order1, arg) + ROOT::Math::cyl_bessel_i(order2, arg));
  21. return res;
  22. }
  23. //E----------------------------------------------------------------
  24. // Chi2 calculation
  25. //S----------------------------------------------------------------
  26. double GetChi(double _res, double _harm, int accuracy){
  27. double chi = 2.0;
  28. double delta = 1.0;
  29. for (int i = 0; i < accuracy; i++){
  30. if(GetRes(chi, _harm) < _res) chi = chi + delta;
  31. else chi = chi - delta;
  32. delta = delta / 2.;
  33. }
  34. return chi;
  35. }
  36. //E----------------------------------------------------------------
  37. void res2(Int_t mEnergy = 6)
  38. {
  39. #if ROOT_VERSION_CODE < ROOT_VERSION(6, 0, 0)
  40. gSystem->Load(libMathMore.so);
  41. #endif
  42. //TFile *file = new TFile("sum.root");
  43. //TFile *file = new TFile("./out/res_11gev.root");
  44. //TFile *file = new TFile("./out/res_7gev_new.root");
  45. //TFile *file = new TFile("./OUT/7gev/urqmd_flow_7gev_check.root");
  46. TFile *file = new TFile("./OUT/urqmd/7.7gev/urqmd_flow_7gev_check.root");
  47. //TFile *file = new TFile("./OUT/ampt/7.7gev_melt_6mb/res_ampt_7.7gev.root");
  48. char hname1[800];
  49. char title[800];
  50. const int ncent = 8;
  51. float res2tpcEW[ncent];
  52. float res2rxnEW[ncent];
  53. float res2bbcEW[ncent];
  54. float res2fhcalEW[ncent];
  55. float res2fhcalFull[ncent];
  56. float res1fhcalFull[ncent];
  57. float cent[ncent]={5,15,25,35,45,55,65,75};
  58. float eres[ncent];
  59. float ecent[ncent];
  60. float chi, res, chiF, resF;
  61. for (int ic=0; ic<ncent; ic++) {
  62. (void) sprintf(hname1,"HRes_%i_%i_%i",0,0,ic);
  63. TH1F *h3 = (TH1F*) file->Get(hname1);
  64. res = sqrt(h3->GetMean());
  65. //chi = GetChi(res,1.,50);
  66. //chiF = TMath::Sqrt(2)*chi;
  67. //resF = GetRes(chiF,1.);
  68. resF=sqrt(h3->GetMean());
  69. res2tpcEW[ic]=resF;//sqrt(h3->GetMean());
  70. (void) sprintf(hname1,"HRes_%i_%i_%i",0,1,ic);
  71. TH1F *h4 = (TH1F*) file->Get(hname1);
  72. res2rxnEW[ic]=sqrt(h4->GetMean());
  73. (void) sprintf(hname1,"HRes_%i_%i_%i",0,2,ic);
  74. TH1F *h5 = (TH1F*) file->Get(hname1);
  75. res2bbcEW[ic]=sqrt(h5->GetMean());
  76. (void) sprintf(hname1,"HRes_%i_%i_%i",0,3,ic);
  77. TH1F *h6 = (TH1F*) file->Get(hname1);
  78. res = sqrt(h6->GetMean());
  79. chi = GetChi(res,1.,50);
  80. chiF = chi;//TMath::Sqrt(2)*chi;
  81. resF = GetRes(chiF,2.);
  82. res2fhcalEW[ic]=resF;
  83. chiF = TMath::Sqrt(2)*chi;
  84. resF = GetRes(chiF,2.);
  85. res2fhcalFull[ic]=resF;
  86. (void) sprintf(hname1,"HRes_%i_%i_%i",0,3,ic);
  87. TH1F *h7 = (TH1F*) file->Get(hname1);
  88. res = sqrt(h7->GetMean());
  89. chi = GetChi(res,1.,50);
  90. chiF = TMath::Sqrt(2)*chi;
  91. resF = GetRes(chiF,1.);
  92. res1fhcalFull[ic]=resF;
  93. eres[ic]=0.01;
  94. ecent[ic]=0.03;
  95. //cout << res2bbcEW[ic] <<",";
  96. }
  97. cout << endl;
  98. cout << "Resolution for the analysis:" << endl;
  99. cout << "float res2tpc[8] = {";
  100. for (int ic=0; ic<ncent; ic++) {
  101. cout << res2tpcEW[ic];
  102. if (ic < ncent-1) cout << ",";
  103. else cout << "};" << endl;
  104. }
  105. cout << "float res2rxn[8] = {";
  106. for (int ic=0; ic<ncent; ic++) {
  107. cout << res2rxnEW[ic];
  108. if (ic < ncent-1) cout << ",";
  109. else cout << "};" << endl;
  110. }
  111. cout << "float res2bbc[8] = {";
  112. for (int ic=0; ic<ncent; ic++) {
  113. cout << res2bbcEW[ic];
  114. if (ic < ncent-1) cout << ",";
  115. else cout << "};" << endl;
  116. }
  117. cout << "float res2fhcal[8] = {";
  118. for (int ic=0; ic<ncent; ic++) {
  119. cout << res2fhcalEW[ic];
  120. if (ic < ncent-1) cout << ",";
  121. else cout << "};" << endl;
  122. }
  123. cout << "float res2fhcalFull[8] = {";
  124. for (int ic=0; ic<ncent; ic++) {
  125. cout << res2fhcalFull[ic];
  126. if (ic < ncent-1) cout << ",";
  127. else cout << "};" << endl;
  128. }
  129. cout << "float res1fhcalFull[8] = {";
  130. for (int ic=0; ic<ncent; ic++) {
  131. cout << res1fhcalFull[ic];
  132. if (ic < ncent-1) cout << ",";
  133. else cout << "};" << endl;
  134. }
  135. cout << endl;
  136. TCanvas *c1;
  137. c1 = new TCanvas("c1","Flow analysis results",200,10,700,560);
  138. c1->GetFrame()->SetBorderSize(12);
  139. c1->cd();
  140. gStyle->SetOptStat(0);
  141. c1->GetFrame()->SetFillColor(21);
  142. c1->GetFrame()->SetBorderSize(12);
  143. gStyle->SetOptStat(0);
  144. gStyle->SetPalette(0);
  145. gStyle->SetCanvasColor(0);
  146. gStyle->SetHistFillColor(10);
  147. gStyle->SetHistFillStyle(0);
  148. gStyle->SetOptTitle(1);
  149. gStyle->SetOptStat(0);
  150. c1->SetBorderMode(0);
  151. c1->SetFillColor(0);
  152. float xmin1=0.0;
  153. float xmax1=60;
  154. float ymin1=0.0;
  155. float ymax1=1.0;
  156. sprintf(title,"PHSD: #sigma_{RP} vs centrality for v_{2} , Au+Au #sqrt{s_{NN}}=200 GeV");
  157. TH2F *hr2 = new TH2F("hr2",title, 2,xmin1,xmax1,2,ymin1,ymax1);
  158. hr2->SetXTitle("Centrality %");
  159. hr2->SetYTitle("#sigma_{RP}");
  160. hr2->Draw();
  161. TGraphErrors *gr1;
  162. TGraphErrors *gr2;
  163. TGraphErrors *gr3;
  164. TGraphErrors *gr4;
  165. TGraphErrors *gr5;
  166. // const int npt=12;
  167. gr1 = new TGraphErrors(6,cent,res2tpcEW,ecent,eres);
  168. gr1->SetTitle("TGraphErrors Example ");
  169. gr1->SetMarkerColor(kRed);
  170. gr1->SetMarkerStyle(20);
  171. gr1->SetMarkerSize(1.2);
  172. gr1->Draw("P");
  173. // const int npt=12;
  174. gr2 = new TGraphErrors(6,cent,res2rxnEW,ecent,eres);
  175. gr2->SetTitle("TGraphErrors Example ");
  176. gr2->SetMarkerColor(kRed);
  177. gr2->SetMarkerStyle(24);
  178. gr2->SetMarkerSize(1.2);
  179. gr2->Draw("P");
  180. // const int npt=12;
  181. gr3 = new TGraphErrors(6,cent,res2bbcEW,ecent,eres);
  182. gr3->SetTitle("TGraphErrors Example ");
  183. gr3->SetMarkerColor(kBlue);
  184. gr3->SetMarkerStyle(21);
  185. gr3->SetMarkerSize(1.2);
  186. gr3->Draw("P");
  187. // const int npt=12;
  188. gr4 = new TGraphErrors(6,cent,res2fhcalEW,ecent,eres);
  189. gr4->SetTitle("TGraphErrors Example ");
  190. gr4->SetMarkerColor(kBlue);
  191. gr4->SetMarkerStyle(25);
  192. gr4->SetMarkerSize(1.2);
  193. gr4->Draw("P");
  194. // const int npt=12;
  195. gr5 = new TGraphErrors(6,cent,res2fhcalFull,ecent,eres);
  196. gr5->SetTitle("TGraphErrors Example ");
  197. gr5->SetMarkerColor(kBlue);
  198. gr5->SetMarkerStyle(26);
  199. gr5->SetMarkerSize(1.2);
  200. gr5->Draw("P");
  201. TF1 *f1 = new TF1("f1","[0]+[1]*(x)+[2]/x+[3]*x*x",5,55);
  202. gr3->Fit("f1","R+");
  203. gr3->Draw("P");
  204. TLegend *legC12 = new TLegend(0.17,.75,0.27,.87);
  205. legC12->SetFillColor(0);
  206. legC12->SetBorderSize(0);
  207. legC12->Draw();
  208. legC12->AddEntry(gr1,"TPC","lp");
  209. legC12->AddEntry(gr2,"RXN","lp");
  210. legC12->AddEntry(gr3,"BBC","lp");
  211. legC12->AddEntry(gr4,"FHCal","lp");
  212. legC12->SetFillColor(0);
  213. legC12->SetBorderSize(0);
  214. legC12->Draw();
  215. }