DataProcessing.cxx 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. #include "DataProcessing.h"
  2. #include "FemtoUtils.h"
  3. #include "HbtFitter.h"
  4. #include <TLegend.h>
  5. #include <TCanvas.h>
  6. #include <TMath.h>
  7. const Double_t MHC = 0.197326960277; // GeV * fm
  8. const Double_t MHC_SQR = 0.038937929230; // GeV^2 * fm^2
  9. const Double_t INVSQRTPI = 0.564189584; // 1/sqrt(pi)
  10. const Double_t PION_MASS = 0.13957;
  11. const Double_t PION_MASS_SQR = 0.0194797;
  12. const Double_t KAON_MASS = 0.493677;
  13. const Double_t KAON_MASS_SQR = 0.24371698;
  14. vector<double> DoFit(TH1* histo, Int_t PartType=4,
  15. Int_t SourceFunc=0, Int_t NonFemtoFunc=1,
  16. Bool_t DrawFitLegend=false, Bool_t ExcludePoints=false);
  17. //_________________
  18. DataProcessing::DataProcessing() {
  19. mExpFileName = "~/work/star/data/expKaonHBT_auau200_2011.root";
  20. mOutFileName = "~/work/star/soft/star_software/processing/auau/oKaonHBT_pp200.root";
  21. mQinvBins = 40;
  22. mQinvLow = 0.;
  23. mQinvHi = 0.4;
  24. mExpFile = NULL;
  25. mOutFile = NULL;
  26. mDetSelection = 2;
  27. mPartType = 4;
  28. mCorrFctnColor = 1;
  29. mCorrFctnLineWidth = 2;
  30. mCorrFctnMarkerStyle = 20;
  31. mCorrFctnMarkerSize = 1.5;
  32. mYaxisLo = 0.6;
  33. mYaxisHi = 1.6;
  34. mMultBins = 9;
  35. mKtBins = 24;
  36. mKtRanges = 6;
  37. mSourceFunc = 0;
  38. mNonFemtoFunc = 0;
  39. mDrawLegend = true;
  40. }
  41. //_________________
  42. DataProcessing::~DataProcessing() {
  43. /* noting to do */
  44. }
  45. //_________________
  46. void DataProcessing::SetCorrFctnStyle(Int_t color, Int_t width,
  47. Int_t style, Double_t size) {
  48. mCorrFctnColor = color;
  49. mCorrFctnLineWidth = width;
  50. mCorrFctnMarkerStyle = style;
  51. mCorrFctnMarkerSize = size;
  52. }
  53. //_________________
  54. void DataProcessing::SetHistoStyle(TH1 *h) {
  55. h->SetLineColor(mCorrFctnColor);
  56. h->SetLineWidth(mCorrFctnLineWidth);
  57. h->SetMarkerStyle(mCorrFctnMarkerStyle);
  58. h->SetMarkerSize(mCorrFctnMarkerSize);
  59. h->SetMarkerColor(mCorrFctnColor);
  60. h->GetYaxis()->SetRangeUser(mYaxisLo,mYaxisHi);
  61. }
  62. //_________________
  63. void DataProcessing::OpenFiles() {
  64. std::cout << "Opening file with experimental data: " << mExpFileName;
  65. mExpFile = TFile::Open(mExpFileName);
  66. std::cout << "\t [DONE]" << std::endl;
  67. std::cout << "Creating output file: " << mOutFileName;
  68. mOutFile = new TFile(mOutFileName,"recreate");
  69. std::cout << "\t [DONE]" << std::endl;
  70. }
  71. //_________________
  72. void DataProcessing::DoProcessing() {
  73. std::cout << "Start processing..." << std::endl;
  74. OpenFiles();
  75. ReadHistos();
  76. ProcessHistos();
  77. FitHistos();
  78. MakeTGraphs();
  79. Finish();
  80. std::cout << "Processing is finished" << std::endl;
  81. }
  82. //_________________
  83. void DataProcessing::ReadHistos() {
  84. std::cout << "Retrieving histograms from files...";
  85. for(Int_t iCharge=0; iCharge<2; iCharge++) {
  86. //for(Int_t iDet=0; iDet<5; iDet++) {
  87. for(Int_t iMult=0; iMult<mMultBins; iMult++) {
  88. for(Int_t iKt=0; iKt<mKtBins; iKt++) {
  89. if(mPartType == 4) {
  90. //Kaons
  91. TH1F *hExpKaonKtMixNum =
  92. (TH1F*)mExpFile->Get(Form("hKaonQinvMixKt_%d_%d_%d_Num_bin_%d",
  93. iCharge,mDetSelection,iMult,iKt));
  94. TH1F *hExpKaonKtMixDen =
  95. (TH1F*)mExpFile->Get(Form("hKaonQinvMixKt_%d_%d_%d_Den_bin_%d",
  96. iCharge,mDetSelection,iMult,iKt));
  97. hQinvMixNum.push_back(hExpKaonKtMixNum);
  98. hQinvMixDen.push_back(hExpKaonKtMixDen);
  99. }
  100. else if(mPartType == 3) {
  101. //Pions
  102. TH1F *hExpPionKtMixNum =
  103. (TH1F*)mExpFile->Get(Form("hPionQinvMixKt_%d_%d_%d_Num_bin_%d",
  104. iCharge,mDetSelection,iMult,iKt));
  105. TH1F *hExpPionKtMixDen =
  106. (TH1F*)mExpFile->Get(Form("hPionQinvMixKt_%d_%d_%d_Den_bin_%d",
  107. iCharge,mDetSelection,iMult,iKt));
  108. hQinvMixNum.push_back(hExpPionKtMixNum);
  109. hQinvMixDen.push_back(hExpPionKtMixDen);
  110. }
  111. } //for(Int_t iKt=0; iKt<20; iKt++)
  112. } //for(Int_t iMult=0; iMult<10; iMult++)
  113. //} //for(Int_t iDet=0; iDet<5; iDet++)
  114. } //for(Int_t iCharge=0; iCharge<2; iCharge++)
  115. std::cout << "\t [DONE]" << std::endl;
  116. std::cout << Form("Number of histos in numerator: %d", hQinvMixNum.size())
  117. << std::endl
  118. << Form("Number of histos in denominator: %d", hQinvMixDen.size())
  119. << std::endl;
  120. }
  121. //_________________
  122. void DataProcessing::ProcessHistos() {
  123. std::cout << "Processing multiplicity histograms...";
  124. ProcessMultHistos();
  125. std::cout << "\t [DONE]" << std::endl;
  126. std::cout << "Processing Mult vs kT histograms...";
  127. ProcessMultKtHistos();
  128. std::cout << "\t [DONE]" << std::endl;
  129. }
  130. //_________________
  131. TH1F* DataProcessing::BuildMultCF(Int_t charge, Int_t BinLo, Int_t BinHi) {
  132. if(charge<0 || charge>2) {
  133. std::cout << "DataProcessing::BuildMultCF [WARNING] - Wrong charge: " << charge
  134. << std::endl;
  135. return 0;
  136. }
  137. if(BinLo<0 || BinHi>=mMultBins) {
  138. std::cout << "DataProcessing::BuildMultCF [WARNING] - Wrong multiplicity bins: "
  139. << BinLo << "_" << BinHi << std::endl;
  140. return 0;
  141. }
  142. TH1F *hNumSum = new TH1F("hNumSum","",mQinvBins, mQinvLow, mQinvHi);
  143. TH1F *hDenSum = new TH1F("hDenSum","",mQinvBins, mQinvLow, mQinvHi);
  144. TH1F *hRatio;
  145. TString sName = "h";
  146. sName += "CentCF_";
  147. sName += charge;
  148. sName += "_";
  149. sName += BinLo;
  150. sName += "_";
  151. sName += BinHi;
  152. hRatio = new TH1F(sName.Data(),"",mQinvBins,mQinvLow,mQinvHi);
  153. if(charge<2) {
  154. for(Int_t iMult=BinLo; iMult<=BinHi; iMult++) {
  155. for(Int_t iKt=0; iKt<mKtBins; iKt++) {
  156. hNumSum->Add(hQinvMixNum[charge*mMultBins*mKtBins+iMult*mKtBins+iKt]);
  157. hDenSum->Add(hQinvMixDen[charge*mMultBins*mKtBins+iMult*mKtBins+iKt]);
  158. } //for(Int_t iKt=0; iKt<mKtBins; iKt++)
  159. std::cout << std::endl;
  160. } //for(Int_t iMult=BinLo; iMult<=BinHi; iMult++)
  161. } //if(charge<2)
  162. else {
  163. for(Int_t iCharge=0; iCharge<2; iCharge++) {
  164. for(Int_t iMult=BinLo; iMult<=BinHi; iMult++) {
  165. for(Int_t iKt=0; iKt<mKtBins; iKt++) {
  166. hNumSum->Add(hQinvMixNum[iCharge*mMultBins*mKtBins+iMult*mKtBins+iKt]);
  167. hDenSum->Add(hQinvMixDen[iCharge*mMultBins*mKtBins+iMult*mKtBins+iKt]);
  168. } //for(Int_t iKt=0; iKt<mKtBins; iKt++)
  169. } //for(Int_t iMult=BinLo; iMult<=BinHi; iMult++)
  170. } //for(Int_t iCharge=0; iCharge<2; iCharge++)
  171. } //if(charge==2)
  172. Make1DCorrFctn(hRatio,hNumSum,hDenSum);
  173. delete hNumSum;
  174. delete hDenSum;
  175. return hRatio;
  176. }
  177. //_________________
  178. TH1F* DataProcessing::BuildMultKtCF(Int_t charge, Int_t MultBinLo, Int_t MultBinHi,
  179. Int_t KtBinLo, Int_t KtBinHi) {
  180. if(charge<0 || charge>2) {
  181. std::cout << "DataProcessing::BuildMultKtCF [WARNING] - Wrong charge: " << charge
  182. << std::endl;
  183. return 0;
  184. }
  185. if(MultBinLo<0 || MultBinHi>=mMultBins) {
  186. std::cout << "DataProcessing::BuildMultKtCF [WARNING] - Wrong multiplicity bins: "
  187. << MultBinLo << "_" << MultBinHi << std::endl;
  188. return 0;
  189. }
  190. if(KtBinLo<0 || KtBinHi>=mKtBins) {
  191. std::cout << "DataProcessing::BuildMultKtCF [WARNING] - Wrong kT bins: "
  192. << KtBinLo << "_" << KtBinHi << std::endl;
  193. return 0;
  194. }
  195. TH1F *hNumSum = new TH1F("hNumSum","",mQinvBins, mQinvLow, mQinvHi);
  196. TH1F *hDenSum = new TH1F("hDenSum","",mQinvBins, mQinvLow, mQinvHi);
  197. TH1F *hRatio;
  198. TString sName = "h";
  199. sName += "MultKtCF_";
  200. sName += charge;
  201. sName += "_";
  202. sName += MultBinLo;
  203. sName += "_";
  204. sName += MultBinHi;
  205. sName += "_";
  206. sName += KtBinLo;
  207. sName += "_";
  208. sName += KtBinHi;
  209. hRatio = new TH1F(sName.Data(),"",mQinvBins,mQinvLow,mQinvHi);
  210. if(charge<2) {
  211. for(Int_t iMult=MultBinLo; iMult<=MultBinHi; iMult++) {
  212. for(Int_t iKt=KtBinLo; iKt<=KtBinHi; iKt++) {
  213. hNumSum->Add(hQinvMixNum[charge*mMultBins*mKtBins+iMult*mKtBins+iKt]);
  214. hDenSum->Add(hQinvMixDen[charge*mMultBins*mKtBins+iMult*mKtBins+iKt]);
  215. } //for(Int_t iKt=KtBinLo; iKt<=KtBinHi; iKt++)
  216. } //for(Int_t iMult=MultBinLo; iMult<=MultBinHi; iMult++)
  217. } //if(charge<2)
  218. else {
  219. for(Int_t iCharge=0; iCharge<2; iCharge++) {
  220. for(Int_t iMult=MultBinLo; iMult<=MultBinHi; iMult++) {
  221. for(Int_t iKt=KtBinLo; iKt<=KtBinHi; iKt++) {
  222. hNumSum->Add(hQinvMixNum[iCharge*mMultBins*mKtBins+iMult*mKtBins+iKt]);
  223. hDenSum->Add(hQinvMixDen[iCharge*mMultBins*mKtBins+iMult*mKtBins+iKt]);
  224. } //for(Int_t iKt=KtBinLo; iKt<=KtBinHi; iKt++)
  225. } //for(Int_t iMult=MultBinLo; iMult<=MultBinHi; iMult++)
  226. } //for(Int_t iCharge=0; iCharge<2; iCharge++)
  227. } //if(charge==2)
  228. Make1DCorrFctn(hRatio,hNumSum,hDenSum);
  229. delete hNumSum;
  230. delete hDenSum;
  231. return hRatio;
  232. }
  233. //_________________
  234. void DataProcessing::ProcessMultHistos() {
  235. Int_t multBinLo, multBinHi;
  236. for(Int_t iCharge=0; iCharge<3; iCharge++) {
  237. for(Int_t iMultBin=0; iMultBin<mMultBins; iMultBin++) {
  238. std::cout << Form("ProcessMultHistos - iCharge: %d iMultBin: %d ",
  239. iCharge, iMultBin) << std::endl;
  240. multBinLo = iMultBin; multBinHi = iMultBin;
  241. hMultMixCF.push_back( BuildMultCF(iCharge, multBinLo, multBinHi) );
  242. SetHistoStyle( hMultMixCF.back() );
  243. } //for(Int_t iMultBin=0; iMultBin<mMultBins; iMultBin++)
  244. } //for(Int_t iCharge=0; iCharge<3; iCharge++)
  245. }
  246. //_________________
  247. void DataProcessing::ProcessMultKtHistos() {
  248. Int_t multBinLo, multBinHi;
  249. Int_t ktBinLo, ktBinHi;
  250. for(Int_t iCharge=0; iCharge<3; iCharge++) {
  251. for(Int_t iMultBin=0; iMultBin<mMultBins; iMultBin++) {
  252. for(Int_t iKtBin=0; iKtBin<mKtRanges; iKtBin++) {
  253. multBinLo = iMultBin; multBinHi = iMultBin;
  254. switch(iKtBin) {
  255. case 0: ktBinLo = 0; ktBinHi = 5; break;
  256. case 1: ktBinLo = 6; ktBinHi = 7; break;
  257. case 2: ktBinLo = 8; ktBinHi = 9; break;
  258. //case 3: ktBinLo = 10; ktBinHi = 18; break;
  259. case 3: ktBinLo = 10; ktBinHi = 13; break;
  260. case 4: ktBinLo = 14; ktBinHi = 17; break;
  261. case 5: ktBinLo = 18; ktBinHi = 23; break;
  262. default: ktBinLo = 0; ktBinHi = 23; break;
  263. };
  264. hMultKtMixCF.push_back( BuildMultKtCF(iCharge, multBinLo, multBinHi,
  265. ktBinLo, ktBinHi) );
  266. SetHistoStyle( hMultKtMixCF.back() );
  267. } //for(Int_t iKtBin=0; iKtBin<mKtRanges; iKtBin++)
  268. } //for(Int_t iMultBin=0; iMultBin<mMultBins; iMultBin++)
  269. } //for(Int_t iCharge=0; iCharge<3; iCharge++)
  270. }
  271. //_________________
  272. void DataProcessing::Finish() {
  273. for(Int_t iCharge=0; iCharge<3; iCharge++) {
  274. gMultDepRadiiGrErr[iCharge]->Write();
  275. for(Int_t iCent=0; iCent<9; iCent++) {
  276. gMultKtDepRadiiGrErr[iCharge][iCent]->Write();
  277. gMultKtDepRadiiMtGrErr[iCharge][iCent]->Write();
  278. }
  279. }
  280. mOutFile->Write();
  281. mOutFile->Close();
  282. mExpFile->Close();
  283. }
  284. //_________________
  285. void DataProcessing::FitHistos() {
  286. vector<double> mFitParams;
  287. for(unsigned int i=0; i<hMultMixCF.size(); i++) {
  288. if(!mFitParams.empty()) {
  289. mFitParams.clear();
  290. }
  291. mFitParams = DoFit( hMultMixCF[i], mPartType, mSourceFunc,
  292. mNonFemtoFunc, mDrawLegend );
  293. mMultMixRadii.push_back(mFitParams.at(0));
  294. mMultMixRadiiErr.push_back(mFitParams.at(1));
  295. mMultMixLambda.push_back(mFitParams.at(3));
  296. mMultMixLambdaErr.push_back(mFitParams.at(4));
  297. } //for(unsigned int i=0; i<hMultMixCF.size(); i++)
  298. for(unsigned int i=0; i<hMultKtMixCF.size(); i++) {
  299. if(!mFitParams.empty()) {
  300. mFitParams.clear();
  301. }
  302. mFitParams = DoFit( hMultKtMixCF[i], mPartType, mSourceFunc,
  303. mNonFemtoFunc, mDrawLegend );
  304. mMultKtMixRadii.push_back(mFitParams.at(0));
  305. mMultKtMixRadiiErr.push_back(mFitParams.at(1));
  306. mMultKtMixLambda.push_back(mFitParams.at(3));
  307. mMultKtMixLambdaErr.push_back(mFitParams.at(4));
  308. } //for(unsigned int i=0; i<hMultKtMixCF.size(); i++)
  309. }
  310. //_________________
  311. void DataProcessing::MakeTGraphs() {
  312. Double_t mMultRadiiArr[3][9];
  313. Double_t mMultRadiiErrArr[3][9];
  314. Double_t mCentrality[9] = {15,31,58,98,157,234,335,430,482};
  315. Double_t mCentralityErr[9] = {0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1};
  316. Double_t mRadiiTmp[9];
  317. Double_t mRadiiErrTmp[9];
  318. //Double_t mKtVal[4] = {0.21, 0.35, 0.45, 0.66};
  319. //Double_t mKtErrVal[4] = {0.01, 0.01, 0.01, 0.01};
  320. //Double_t mKtRadiiTmp[4];
  321. //Double_t mKtRadiiErrTmp[4];
  322. //Double_t mMtVal[4];
  323. Double_t mKtRadiiTmp[6];
  324. Double_t mKtRadiiErrTmp[6];
  325. Double_t mKtVal[6] = {0.18, 0.31, 0.41, 0.55, 0.74, 0.97};
  326. Double_t mKtErrVal[6] = {0.01, 0.01, 0.01, 0.01, 0.01, 0.01};
  327. Double_t mMtVal[6];
  328. if(mPartType == 3) {
  329. for(Int_t i=0; i<mKtRanges; i++) {
  330. mMtVal[i] = TMath::Sqrt(PION_MASS_SQR + mKtVal[i]);
  331. }
  332. }
  333. else if(mPartType == 4) {
  334. for(Int_t i=0; i<mKtRanges; i++) {
  335. mMtVal[i] = TMath::Sqrt(KAON_MASS_SQR + mKtVal[i]);
  336. }
  337. }
  338. Int_t mMultDepColor[3] = {2, 4, 1};
  339. Int_t mMultDepMarkerStyle;
  340. Double_t mMultDepMarkerSize = 1.6;
  341. if(mPartType == 4) {
  342. mMultDepMarkerStyle = 20;
  343. }
  344. else {
  345. mMultDepMarkerStyle = 21;
  346. }
  347. Int_t mMultKtDepColor[7] = {2, 4, 6, 8, 9, 28, 30};
  348. Double_t mMultKtDepMarkerSize = 1.5;
  349. Int_t mMultKtDepMarkerStyle[3];
  350. if(mPartType == 4) {
  351. mMultKtDepMarkerStyle[0] = 20;
  352. mMultKtDepMarkerStyle[1] = 24;
  353. mMultKtDepMarkerStyle[2] = 34;
  354. }
  355. else if(mPartType == 3) {
  356. mMultKtDepMarkerStyle[0] = 21;
  357. mMultKtDepMarkerStyle[1] = 25;
  358. mMultKtDepMarkerStyle[2] = 28;
  359. }
  360. //Multiplicity dependence
  361. for(Int_t iCharge=0; iCharge<3; iCharge++) {
  362. if(iCharge==2) {
  363. std::cout << std::endl;
  364. std::cout << "Radii values (centrality) for sum of charges:" << std::endl;
  365. }
  366. for(Int_t iCent=0; iCent<mMultBins; iCent++) {
  367. if(iCent==9) continue; //Skip integrated values
  368. mMultRadiiArr[iCharge][iCent] = mMultMixRadii.at(iCharge*mMultBins+iCent);
  369. mRadiiTmp[iCent] = mMultMixRadii.at(iCharge*mMultBins+iCent);
  370. mMultRadiiErrArr[iCharge][iCent] = mMultMixRadiiErr.at(iCharge*mMultBins+iCent);
  371. mRadiiErrTmp[iCent] = mMultMixRadiiErr.at(iCharge*mMultBins+iCent);
  372. if(iCharge==2) {
  373. std::cout << " " << mMultRadiiArr[iCharge][iCent];
  374. }
  375. } //for(Int_t iCent=0; iCent<mMultBins; iCent++)
  376. gMultDepRadiiGrErr[iCharge] = new TGraphErrors(mMultBins,mCentrality,mRadiiTmp,
  377. mCentralityErr,mRadiiErrTmp);
  378. gMultDepRadiiGrErr[iCharge]->SetName(Form("gMultDepRadiiGrErr_%d",iCharge));
  379. gMultDepRadiiGrErr[iCharge]->SetMarkerColor(mMultDepColor[iCharge]);
  380. gMultDepRadiiGrErr[iCharge]->SetLineColor(mMultDepColor[iCharge]);
  381. gMultDepRadiiGrErr[iCharge]->SetMarkerStyle(mMultDepMarkerStyle);
  382. gMultDepRadiiGrErr[iCharge]->SetMarkerSize(mMultDepMarkerSize);
  383. } //for(Int_t iCharge=0; iCharge<3; iCharge++)
  384. //Multiplicity and kT depence
  385. for(Int_t iCharge=0; iCharge<3; iCharge++) {
  386. if(iCharge==2) {
  387. std::cout << std::endl;
  388. std::cout << "Radii values (kT) for sum of charges:" << std::endl;
  389. }
  390. for(Int_t iCent=0; iCent<mMultBins; iCent++) {
  391. if(iCharge==2) {
  392. std::cout << std::endl;
  393. std::cout << "Centrality bin: " << iCent << " ";
  394. }
  395. if(iCent==9) continue; //Skip integrated values
  396. for(Int_t iKt=0; iKt<mKtRanges; iKt++) {
  397. mKtRadiiTmp[iKt] = mMultKtMixRadii.at(iCharge*mMultBins*mKtRanges +
  398. iCent*mKtRanges + iKt);
  399. mKtRadiiErrTmp[iKt] = mMultKtMixRadiiErr.at(iCharge*mMultBins*mKtRanges +
  400. iCent*mKtRanges + iKt);
  401. if(iCharge==2) {
  402. std::cout << " " << mKtRadiiTmp[iKt];
  403. }
  404. } //for(Int_t iKt=0; iKt<mKtRanges; iKt++)
  405. gMultKtDepRadiiGrErr[iCharge][iCent] =
  406. new TGraphErrors(mKtRanges, mKtVal, mKtRadiiTmp, mKtErrVal, mKtRadiiErrTmp);
  407. gMultKtDepRadiiGrErr[iCharge][iCent]->SetName(Form("gMultKtDepRadiiGrErr_%d_%d",
  408. iCharge,iCent));
  409. gMultKtDepRadiiMtGrErr[iCharge][iCent] =
  410. new TGraphErrors(mKtRanges, mMtVal, mKtRadiiTmp, mKtErrVal, mKtRadiiErrTmp);
  411. gMultKtDepRadiiMtGrErr[iCharge][iCent]->SetName(Form("gMultKtDepRadiiMtGrErr_%d_%d",
  412. iCharge,iCent));
  413. if(iCent<2) continue; //Skip first 2 point due to the mistake.
  414. gMultKtDepRadiiGrErr[iCharge][iCent]->SetMarkerColor(mMultKtDepColor[iCent]);
  415. gMultKtDepRadiiGrErr[iCharge][iCent]->SetLineColor(mMultKtDepColor[iCent]);
  416. gMultKtDepRadiiGrErr[iCharge][iCent]->SetMarkerSize(mMultKtDepMarkerSize);
  417. gMultKtDepRadiiGrErr[iCharge][iCent]->SetMarkerStyle(mMultKtDepMarkerStyle[iCharge]);
  418. gMultKtDepRadiiMtGrErr[iCharge][iCent]->SetMarkerColor(mMultKtDepColor[iCent]);
  419. gMultKtDepRadiiMtGrErr[iCharge][iCent]->SetLineColor(mMultKtDepColor[iCent]);
  420. gMultKtDepRadiiMtGrErr[iCharge][iCent]->SetMarkerSize(mMultKtDepMarkerSize);
  421. gMultKtDepRadiiMtGrErr[iCharge][iCent]->SetMarkerStyle(mMultKtDepMarkerStyle[iCharge]);
  422. } //for(Int_t iCent=0; iCent<mMultBins; iCent++)
  423. } //for(Int_t iCharge=0; iCharge<3; iCharge++)
  424. }
  425. //_________________
  426. vector<double> DoFit(TH1* histo, Int_t PartType, Int_t SourceFunc,
  427. Int_t NonFemtoFunc, Bool_t DrawFitLegend, Bool_t mExcludePoints) {
  428. vector<double> mRetVect;
  429. Int_t mNbins = histo->GetXaxis()->GetNbins();
  430. Double_t mFitMinVal = 0.;
  431. Double_t mDeltaMaxFitVal = -0.009; // -0.005
  432. Double_t mFitMaxVal = histo->GetXaxis()->GetBinUpEdge(mNbins) + mDeltaMaxFitVal;
  433. Int_t mFemtoParNum = 2; //lambda, R
  434. Int_t mNonFemtoParNum = 0;
  435. if(NonFemtoFunc == 0)
  436. mNonFemtoParNum = 1;
  437. else if(NonFemtoFunc == 1)
  438. mNonFemtoParNum = 2;
  439. else if(NonFemtoFunc >= 2 && NonFemtoFunc<=3)
  440. mNonFemtoParNum = 3;
  441. else if(NonFemtoFunc >= 4)
  442. mNonFemtoParNum = 2;
  443. Int_t mFullParNum = mFemtoParNum + mNonFemtoParNum;
  444. HbtFitter* mHbtFitter = new HbtFitter(PartType,SourceFunc,NonFemtoFunc);
  445. mHbtFitter->Set1DMaxVal(histo->GetXaxis()->GetBinUpEdge(mNbins));
  446. mHbtFitter->Set1DBinsNum(mNbins);
  447. TF1* mCorrFit = new TF1("mCorrFit",mHbtFitter,&HbtFitter::FitFunction,
  448. mFitMinVal,mFitMaxVal,mFullParNum,"HbtFitter","FitFunction");
  449. mCorrFit->SetParameter(0, 0.5);
  450. mCorrFit->SetParLimits(0, 0., 1.05);
  451. mCorrFit->SetParameter(1, 15.);
  452. mCorrFit->SetParLimits(1, 0., 50.);
  453. mCorrFit->SetParameter(2, 1.);
  454. //mCorrFit->SetParLimits(2, 0.9, 1.1);
  455. mCorrFit->SetLineWidth(3);
  456. mCorrFit->SetLineColor(kRed);
  457. mCorrFit->SetNpx(40);
  458. histo->Fit("mCorrFit","MRQE","ep");
  459. mCorrFit->Draw("same");
  460. if(SourceFunc==0) {
  461. mRetVect.push_back(mCorrFit->GetParameter(1)*MHC); //0 R
  462. mRetVect.push_back(mCorrFit->GetParError(1)*MHC); //1 dR
  463. }
  464. else if(SourceFunc==1) {
  465. mRetVect.push_back(mCorrFit->GetParameter(1)*MHC*INVSQRTPI); //0 R
  466. mRetVect.push_back(mCorrFit->GetParError(1)*MHC*INVSQRTPI); //1 dR
  467. }
  468. mRetVect.push_back(mCorrFit->GetParameter(0)); //2 Lam
  469. mRetVect.push_back(mCorrFit->GetParError(0)); //3 dLam
  470. mRetVect.push_back(mCorrFit->GetChisquare()/mCorrFit->GetNDF()); //4 chi2/ndf
  471. mRetVect.push_back(mCorrFit->GetParameter(2)); //5 Norm
  472. mRetVect.push_back(mCorrFit->GetParError(2)); //6 dNorm
  473. if(DrawFitLegend) {
  474. TLegend* mLegend = new TLegend(0.4,0.5,0.9,0.9);
  475. mLegend->SetFillColor(kWhite);
  476. mLegend->SetHeader("Fit parameters:");
  477. mLegend->AddEntry("mCorrFit","Bowler-Sinyukov fit","l");
  478. mLegend->AddEntry((TObject*)0, Form( "#chi^{2}/n.d.f. = %4.3f / %2d",
  479. mCorrFit->GetChisquare(),mCorrFit->GetNDF() ),"");
  480. mLegend->AddEntry((TObject*)0, Form("N = %4.3f \\pm %4.3f",
  481. mRetVect.at(5),mRetVect.at(6) ), "");
  482. mLegend->AddEntry((TObject*)0, Form("#lambda = %4.2f \\pm %4.2f",
  483. mRetVect.at(2),mRetVect.at(3) ),"");
  484. mLegend->AddEntry((TObject*)0, Form("R = %4.2f \\pm %4.2f",
  485. mRetVect.at(0),mRetVect.at(1)), "");
  486. mLegend->Draw();
  487. }
  488. return mRetVect;
  489. }