FemtoDstAnalyzer_ShiftCorr.C 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797
  1. /**
  2. * \brief Example of how to read a file (list of files) using StFemtoEvent classes
  3. *
  4. * RunFemtoDstAnalyzer.C is an example of reading FemtoDst format.
  5. * One can use either FemtoDst file or a list of femtoDst files (inFile.lis or
  6. * inFile.list) as an input, and preform physics analysis
  7. *
  8. * \author Grigory Nigmatkulov
  9. * \date May 29, 2018
  10. */
  11. // This is needed for calling standalone classes
  12. #define _VANILLA_ROOT_
  13. // C++ headers
  14. #include <iostream>
  15. #include <vector>
  16. #include <map>
  17. // ROOT headers
  18. #include "TROOT.h"
  19. #include "TFile.h"
  20. #include "TChain.h"
  21. #include "TVector2.h"
  22. #include "TVector3.h"
  23. #include "TTree.h"
  24. #include "TSystem.h"
  25. #include "TH1.h"
  26. #include "TH2.h"
  27. #include "TMath.h"
  28. #include "TProfile2D.h"
  29. #include "TStopwatch.h"
  30. // FemtoDst headers
  31. #include "StFemtoDstReader.h"
  32. #include "StFemtoDst.h"
  33. #include "StFemtoEvent.h"
  34. #include "StFemtoTrack.h"
  35. // Load libraries (for ROOT_VERSTION_CODE >= 393215)
  36. #if ROOT_VERSION_CODE >= ROOT_VERSION(6, 0, 0)
  37. R__LOAD_LIBRARY(/mnt/pool/rhic/4/parfenovpeter/STAR/build/libStFemtoDst.so)
  38. #endif
  39. #include "Constants.h"
  40. // inFile - is a name of name.FemtoDst.root file or a name
  41. // of a name.lis(t) files, that contains a list of
  42. // name1.FemtoDst.root, name2.FemtoDst.root, ... files
  43. //Used functions (see them below)
  44. Bool_t isGoodEvent(StFemtoEvent *const &event);
  45. Bool_t isGoodTrack(StFemtoTrack *const &track, Float_t _energy, TVector3 pVtx);
  46. Double_t GetWeight(StFemtoTrack *const &track);
  47. TVector2 CalcQvector(StFemtoTrack *const &track, Int_t _harm);
  48. Int_t GetVzBin(Double_t vtxZ);
  49. //_________________
  50. void FemtoDstAnalyzer_ShiftCorr(const Char_t *inFile = "st_physics_12150008_raw_4030001.femtoDst.root",
  51. const Char_t *outFile = "./oShiftTest.root",
  52. const Char_t *reCentFile = "")
  53. {
  54. std::cout << "Hi! Lets do some physics, Master!" << std::endl;
  55. TStopwatch timer;
  56. timer.Start();
  57. #if ROOT_VERSION_CODE < ROOT_VERSION(6, 0, 0)
  58. gSystem->Load("../libStFemtoDst.so");
  59. #endif
  60. StFemtoDstReader *femtoReader = new StFemtoDstReader(inFile);
  61. femtoReader->Init();
  62. // This is a way if you want to spead up IO
  63. std::cout << "Explicit read status for some branches" << std::endl;
  64. femtoReader->SetStatus("*", 0);
  65. femtoReader->SetStatus("Event", 1);
  66. femtoReader->SetStatus("Track", 1);
  67. std::cout << "Status has been set" << std::endl;
  68. std::cout << "Now I know what to read, Master!" << std::endl;
  69. if (!femtoReader->chain())
  70. {
  71. std::cout << "No chain has been found." << std::endl;
  72. }
  73. Long64_t eventsInTree = femtoReader->tree()->GetEntries();
  74. std::cout << "eventsInTree: " << eventsInTree << std::endl;
  75. Long64_t events2read = femtoReader->chain()->GetEntries();
  76. std::cout << "Number of events to read: " << events2read << std::endl;
  77. //Read ReCentering <Q> vectors
  78. TFile *fiReCent = new TFile(reCentFile, "read");
  79. /* TProfile2D *p_Qx_FULL_EP[fNharmonics][fArraySize];
  80. TProfile2D *p_Qy_FULL_EP[fNharmonics][fArraySize];
  81. TProfile2D *p_Qx_FULL_SP[fNharmonics][fArraySize];
  82. TProfile2D *p_Qy_FULL_SP[fNharmonics][fArraySize];
  83. TProfile2D *p_Qx_EAST_EP[fNharmonics][fArraySize][NEtaGaps];
  84. TProfile2D *p_Qy_EAST_EP[fNharmonics][fArraySize][NEtaGaps];
  85. TProfile2D *p_Qx_EAST_SP[fNharmonics][fArraySize][NEtaGaps];
  86. TProfile2D *p_Qy_EAST_SP[fNharmonics][fArraySize][NEtaGaps];
  87. TProfile2D *p_Qx_WEST_EP[fNharmonics][fArraySize][NEtaGaps];
  88. TProfile2D *p_Qy_WEST_EP[fNharmonics][fArraySize][NEtaGaps];
  89. TProfile2D *p_Qx_WEST_SP[fNharmonics][fArraySize][NEtaGaps];
  90. TProfile2D *p_Qy_WEST_SP[fNharmonics][fArraySize][NEtaGaps];
  91. */
  92. std::map<Double_t,Double_t> p_Qx_FULL_EP[fNharmonics][fArraySize][fNCent];
  93. std::map<Double_t,Double_t> p_Qy_FULL_EP[fNharmonics][fArraySize][fNCent];
  94. std::map<Double_t,Double_t> p_Qx_FULL_SP[fNharmonics][fArraySize][fNCent];
  95. std::map<Double_t,Double_t> p_Qy_FULL_SP[fNharmonics][fArraySize][fNCent];
  96. std::map<Double_t,Double_t> p_Qx_EAST_EP[fNharmonics][fArraySize][fNCent][NEtaGaps];
  97. std::map<Double_t,Double_t> p_Qy_EAST_EP[fNharmonics][fArraySize][fNCent][NEtaGaps];
  98. std::map<Double_t,Double_t> p_Qx_EAST_SP[fNharmonics][fArraySize][fNCent][NEtaGaps];
  99. std::map<Double_t,Double_t> p_Qy_EAST_SP[fNharmonics][fArraySize][fNCent][NEtaGaps];
  100. std::map<Double_t,Double_t> p_Qx_WEST_EP[fNharmonics][fArraySize][fNCent][NEtaGaps];
  101. std::map<Double_t,Double_t> p_Qy_WEST_EP[fNharmonics][fArraySize][fNCent][NEtaGaps];
  102. std::map<Double_t,Double_t> p_Qx_WEST_SP[fNharmonics][fArraySize][fNCent][NEtaGaps];
  103. std::map<Double_t,Double_t> p_Qy_WEST_SP[fNharmonics][fArraySize][fNCent][NEtaGaps];
  104. TProfile2D *prof;
  105. double binCont;
  106. for (int iHarm = 0; iHarm < fNharmonics; iHarm++)
  107. {
  108. for (int iVtx = 0; iVtx < fArraySize; iVtx++)
  109. {
  110. std::cout << "iHarm: " << iHarm << " iVtx: " << iVtx << std::endl;
  111. prof = (TProfile2D *)fiReCent->Get(Form("p_Q%ix_FULL_EP%i", iHarm, iVtx));
  112. for (int i=0; i<fNBins; i++)
  113. {
  114. for (int iCent=0; iCent<fNCent; iCent++)
  115. {
  116. binCont = prof->GetBinContent(prof->FindBin((Double_t) (runId_min+i),(Double_t) iCent));
  117. if (binCont == 0.) continue;
  118. p_Qx_FULL_EP[iHarm][iVtx][iCent][(Double_t) (runId_min+i)] = binCont;
  119. }
  120. }
  121. delete prof;
  122. prof = (TProfile2D *)fiReCent->Get(Form("p_Q%iy_FULL_EP%i", iHarm, iVtx));
  123. for (int i=0; i<fNBins; i++)
  124. {
  125. for (int iCent=0; iCent<fNCent; iCent++)
  126. {
  127. binCont = prof->GetBinContent(prof->FindBin((Double_t) (runId_min+i),(Double_t) iCent));
  128. if (binCont == 0.) continue;
  129. p_Qy_FULL_EP[iHarm][iVtx][iCent][(Double_t) (runId_min+i)] = binCont;
  130. }
  131. }
  132. delete prof;
  133. prof = (TProfile2D *)fiReCent->Get(Form("p_Q%ix_FULL_SP%i", iHarm, iVtx));
  134. for (int i=0; i<fNBins; i++)
  135. {
  136. for (int iCent=0; iCent<fNCent; iCent++)
  137. {
  138. binCont = prof->GetBinContent(prof->FindBin((Double_t) (runId_min+i),(Double_t) iCent));
  139. if (binCont == 0.) continue;
  140. p_Qx_FULL_SP[iHarm][iVtx][iCent][(Double_t) (runId_min+i)] = binCont;
  141. }
  142. }
  143. delete prof;
  144. prof = (TProfile2D *)fiReCent->Get(Form("p_Q%iy_FULL_SP%i", iHarm, iVtx));
  145. for (int i=0; i<fNBins; i++)
  146. {
  147. for (int iCent=0; iCent<fNCent; iCent++)
  148. {
  149. binCont = prof->GetBinContent(prof->FindBin((Double_t) (runId_min+i),(Double_t) iCent));
  150. if (binCont == 0.) continue;
  151. p_Qy_FULL_SP[iHarm][iVtx][iCent][(Double_t) (runId_min+i)] = binCont;
  152. }
  153. }
  154. delete prof;
  155. for (int iEtaGap = 0; iEtaGap < NEtaGaps; iEtaGap++)
  156. {
  157. prof = (TProfile2D *)fiReCent->Get(Form("p_Q%ix_EAST_EP%i_gap%i", iHarm, iVtx, iEtaGap));
  158. for (int i=0; i<fNBins; i++)
  159. {
  160. for (int iCent=0; iCent<fNCent; iCent++)
  161. {
  162. binCont = prof->GetBinContent(prof->FindBin((Double_t) (runId_min+i),(Double_t) iCent));
  163. if (binCont == 0.) continue;
  164. p_Qx_EAST_EP[iHarm][iVtx][iCent][iEtaGap][(Double_t) (runId_min+i)] = binCont;
  165. }
  166. }
  167. delete prof;
  168. prof = (TProfile2D *)fiReCent->Get(Form("p_Q%iy_EAST_EP%i_gap%i", iHarm, iVtx, iEtaGap));
  169. for (int i=0; i<fNBins; i++)
  170. {
  171. for (int iCent=0; iCent<fNCent; iCent++)
  172. {
  173. binCont = prof->GetBinContent(prof->FindBin((Double_t) (runId_min+i),(Double_t) iCent));
  174. if (binCont == 0.) continue;
  175. p_Qy_EAST_EP[iHarm][iVtx][iCent][iEtaGap][(Double_t) (runId_min+i)] = binCont;
  176. }
  177. }
  178. delete prof;
  179. prof = (TProfile2D *)fiReCent->Get(Form("p_Q%ix_EAST_SP%i_gap%i", iHarm, iVtx, iEtaGap));
  180. for (int i=0; i<fNBins; i++)
  181. {
  182. for (int iCent=0; iCent<fNCent; iCent++)
  183. {
  184. binCont = prof->GetBinContent(prof->FindBin((Double_t) (runId_min+i),(Double_t) iCent));
  185. if (binCont == 0.) continue;
  186. p_Qx_EAST_SP[iHarm][iVtx][iCent][iEtaGap][(Double_t) (runId_min+i)] = binCont;
  187. }
  188. }
  189. delete prof;
  190. prof = (TProfile2D *)fiReCent->Get(Form("p_Q%iy_EAST_SP%i_gap%i", iHarm, iVtx, iEtaGap));
  191. for (int i=0; i<fNBins; i++)
  192. {
  193. for (int iCent=0; iCent<fNCent; iCent++)
  194. {
  195. binCont = prof->GetBinContent(prof->FindBin((Double_t) (runId_min+i),(Double_t) iCent));
  196. if (binCont == 0.) continue;
  197. p_Qy_EAST_SP[iHarm][iVtx][iCent][iEtaGap][(Double_t) (runId_min+i)] = binCont;
  198. }
  199. }
  200. delete prof;
  201. prof = (TProfile2D *)fiReCent->Get(Form("p_Q%ix_WEST_EP%i_gap%i", iHarm, iVtx, iEtaGap));
  202. for (int i=0; i<fNBins; i++)
  203. {
  204. for (int iCent=0; iCent<fNCent; iCent++)
  205. {
  206. binCont = prof->GetBinContent(prof->FindBin((Double_t) (runId_min+i),(Double_t) iCent));
  207. if (binCont == 0.) continue;
  208. p_Qx_WEST_EP[iHarm][iVtx][iCent][iEtaGap][(Double_t) (runId_min+i)] = binCont;
  209. }
  210. }
  211. delete prof;
  212. prof = (TProfile2D *)fiReCent->Get(Form("p_Q%iy_WEST_EP%i_gap%i", iHarm, iVtx, iEtaGap));
  213. for (int i=0; i<fNBins; i++)
  214. {
  215. for (int iCent=0; iCent<fNCent; iCent++)
  216. {
  217. binCont = prof->GetBinContent(prof->FindBin((Double_t) (runId_min+i),(Double_t) iCent));
  218. if (binCont == 0.) continue;
  219. p_Qy_WEST_EP[iHarm][iVtx][iCent][iEtaGap][(Double_t) (runId_min+i)] = binCont;
  220. }
  221. }
  222. delete prof;
  223. prof = (TProfile2D *)fiReCent->Get(Form("p_Q%ix_WEST_SP%i_gap%i", iHarm, iVtx, iEtaGap));
  224. for (int i=0; i<fNBins; i++)
  225. {
  226. for (int iCent=0; iCent<fNCent; iCent++)
  227. {
  228. binCont = prof->GetBinContent(prof->FindBin((Double_t) (runId_min+i),(Double_t) iCent));
  229. if (binCont == 0.) continue;
  230. p_Qx_WEST_SP[iHarm][iVtx][iCent][iEtaGap][(Double_t) (runId_min+i)] = binCont;
  231. }
  232. }
  233. delete prof;
  234. prof = (TProfile2D *)fiReCent->Get(Form("p_Q%iy_WEST_SP%i_gap%i", iHarm, iVtx, iEtaGap));
  235. for (int i=0; i<fNBins; i++)
  236. {
  237. for (int iCent=0; iCent<fNCent; iCent++)
  238. {
  239. binCont = prof->GetBinContent(prof->FindBin((Double_t) (runId_min+i),(Double_t) iCent));
  240. if (binCont == 0.) continue;
  241. p_Qy_WEST_SP[iHarm][iVtx][iCent][iEtaGap][(Double_t) (runId_min+i)] = binCont;
  242. }
  243. }
  244. delete prof;
  245. }
  246. }
  247. }
  248. //Manage output
  249. TProfile2D *p_Cos2_FULL_EP[fArraySize][NShiftOrderMax];
  250. TProfile2D *p_Sin2_FULL_EP[fArraySize][NShiftOrderMax];
  251. TProfile2D *p_Cos2_FULL_SP[fArraySize][NShiftOrderMax];
  252. TProfile2D *p_Sin2_FULL_SP[fArraySize][NShiftOrderMax];
  253. TProfile2D *p_Cos2_EAST_EP[fArraySize][NShiftOrderMax][NEtaGaps];
  254. TProfile2D *p_Sin2_EAST_EP[fArraySize][NShiftOrderMax][NEtaGaps];
  255. TProfile2D *p_Cos2_EAST_SP[fArraySize][NShiftOrderMax][NEtaGaps];
  256. TProfile2D *p_Sin2_EAST_SP[fArraySize][NShiftOrderMax][NEtaGaps];
  257. TProfile2D *p_Cos2_WEST_EP[fArraySize][NShiftOrderMax][NEtaGaps];
  258. TProfile2D *p_Sin2_WEST_EP[fArraySize][NShiftOrderMax][NEtaGaps];
  259. TProfile2D *p_Cos2_WEST_SP[fArraySize][NShiftOrderMax][NEtaGaps];
  260. TProfile2D *p_Sin2_WEST_SP[fArraySize][NShiftOrderMax][NEtaGaps];
  261. TProfile2D *p_Cos3_FULL_EP[fArraySize][NShiftOrderMax];
  262. TProfile2D *p_Sin3_FULL_EP[fArraySize][NShiftOrderMax];
  263. TProfile2D *p_Cos3_FULL_SP[fArraySize][NShiftOrderMax];
  264. TProfile2D *p_Sin3_FULL_SP[fArraySize][NShiftOrderMax];
  265. TProfile2D *p_Cos3_EAST_EP[fArraySize][NShiftOrderMax][NEtaGaps];
  266. TProfile2D *p_Sin3_EAST_EP[fArraySize][NShiftOrderMax][NEtaGaps];
  267. TProfile2D *p_Cos3_EAST_SP[fArraySize][NShiftOrderMax][NEtaGaps];
  268. TProfile2D *p_Sin3_EAST_SP[fArraySize][NShiftOrderMax][NEtaGaps];
  269. TProfile2D *p_Cos3_WEST_EP[fArraySize][NShiftOrderMax][NEtaGaps];
  270. TProfile2D *p_Sin3_WEST_EP[fArraySize][NShiftOrderMax][NEtaGaps];
  271. TProfile2D *p_Cos3_WEST_SP[fArraySize][NShiftOrderMax][NEtaGaps];
  272. TProfile2D *p_Sin3_WEST_SP[fArraySize][NShiftOrderMax][NEtaGaps];
  273. for (int iVtx = 0; iVtx < 10; iVtx++)
  274. {
  275. for (int iShift = 0; iShift < NShiftOrderMax; iShift++)
  276. {
  277. p_Cos2_FULL_EP[iVtx][iShift] = new TProfile2D(Form("p_Cos%i_FULL_EP%i_shiftOrder_%i", 2, iVtx, iShift), Form("p_Cos%i_FULL_EP%i_shiftOrder_%i", 2, iVtx, iShift), fNBins, runId_min - 0.5, runId_max + 0.5, 16, -0.5, 15.5);
  278. p_Sin2_FULL_EP[iVtx][iShift] = new TProfile2D(Form("p_Sin%i_FULL_EP%i_shiftOrder_%i", 2, iVtx, iShift), Form("p_Sin%i_FULL_EP%i_shiftOrder_%i", 2, iVtx, iShift), fNBins, runId_min - 0.5, runId_max + 0.5, 16, -0.5, 15.5);
  279. p_Cos2_FULL_SP[iVtx][iShift] = new TProfile2D(Form("p_Cos%i_FULL_SP%i_shiftOrder_%i", 2, iVtx, iShift), Form("p_Cos%i_FULL_SP%i_shiftOrder_%i", 2, iVtx, iShift), fNBins, runId_min - 0.5, runId_max + 0.5, 16, -0.5, 15.5);
  280. p_Sin2_FULL_SP[iVtx][iShift] = new TProfile2D(Form("p_Sin%i_FULL_SP%i_shiftOrder_%i", 2, iVtx, iShift), Form("p_Sin%i_FULL_SP%i_shiftOrder_%i", 2, iVtx, iShift), fNBins, runId_min - 0.5, runId_max + 0.5, 16, -0.5, 15.5);
  281. p_Cos3_FULL_EP[iVtx][iShift] = new TProfile2D(Form("p_Cos%i_FULL_EP%i_shiftOrder_%i", 3, iVtx, iShift), Form("p_Cos%i_FULL_EP%i_shiftOrder_%i", 3, iVtx, iShift), fNBins, runId_min - 0.5, runId_max + 0.5, 16, -0.5, 15.5);
  282. p_Sin3_FULL_EP[iVtx][iShift] = new TProfile2D(Form("p_Sin%i_FULL_EP%i_shiftOrder_%i", 3, iVtx, iShift), Form("p_Sin%i_FULL_EP%i_shiftOrder_%i", 3, iVtx, iShift), fNBins, runId_min - 0.5, runId_max + 0.5, 16, -0.5, 15.5);
  283. p_Cos3_FULL_SP[iVtx][iShift] = new TProfile2D(Form("p_Cos%i_FULL_SP%i_shiftOrder_%i", 3, iVtx, iShift), Form("p_Cos%i_FULL_SP%i_shiftOrder_%i", 3, iVtx, iShift), fNBins, runId_min - 0.5, runId_max + 0.5, 16, -0.5, 15.5);
  284. p_Sin3_FULL_SP[iVtx][iShift] = new TProfile2D(Form("p_Sin%i_FULL_SP%i_shiftOrder_%i", 3, iVtx, iShift), Form("p_Sin%i_FULL_SP%i_shiftOrder_%i", 3, iVtx, iShift), fNBins, runId_min - 0.5, runId_max + 0.5, 16, -0.5, 15.5);
  285. for (int iGap = 0; iGap < NEtaGaps; iGap++)
  286. {
  287. p_Cos2_EAST_EP[iVtx][iShift][iGap] = new TProfile2D(Form("p_Cos%i_EAST_EP%i_shiftOrder_%i_gap%i", 2, iVtx, iShift, iGap), Form("p_Cos%i_EAST_EP%i_shiftOrder_%i_gap%i", 2, iVtx, iShift, iGap), fNBins, runId_min - 0.5, runId_max + 0.5, 16, -0.5, 15.5);
  288. std::cout << "Init [" << iVtx << "][" << iShift << "][" << iGap << "] p_Cos2_EAST_EP[0][0][0] Name: " << p_Cos2_EAST_EP[0][0][0]->GetName() << std::endl;
  289. std::cout << "\t p_Cos2_EAST_EP[0][0][0] address: " << &p_Cos2_EAST_EP[0][0][0] << std::endl;
  290. p_Sin2_EAST_EP[iVtx][iShift][iGap] = new TProfile2D(Form("p_Sin%i_EAST_EP%i_shiftOrder_%i_gap%i", 2, iVtx, iShift, iGap), Form("p_Sin%i_EAST_EP%i_shiftOrder_%i_gap%i", 2, iVtx, iShift, iGap), fNBins, runId_min - 0.5, runId_max + 0.5, 16, -0.5, 15.5);
  291. p_Cos2_EAST_SP[iVtx][iShift][iGap] = new TProfile2D(Form("p_Cos%i_EAST_SP%i_shiftOrder_%i_gap%i", 2, iVtx, iShift, iGap), Form("p_Cos%i_EAST_SP%i_shiftOrder_%i_gap%i", 2, iVtx, iShift, iGap), fNBins, runId_min - 0.5, runId_max + 0.5, 16, -0.5, 15.5);
  292. p_Sin2_EAST_SP[iVtx][iShift][iGap] = new TProfile2D(Form("p_Sin%i_EAST_SP%i_shiftOrder_%i_gap%i", 2, iVtx, iShift, iGap), Form("p_Sin%i_EAST_SP%i_shiftOrder_%i_gap%i", 2, iVtx, iShift, iGap), fNBins, runId_min - 0.5, runId_max + 0.5, 16, -0.5, 15.5);
  293. p_Cos2_WEST_EP[iVtx][iShift][iGap] = new TProfile2D(Form("p_Cos%i_WEST_EP%i_shiftOrder_%i_gap%i", 2, iVtx, iShift, iGap), Form("p_Cos%i_WEST_EP%i_shiftOrder_%i_gap%i", 2, iVtx, iShift, iGap), fNBins, runId_min - 0.5, runId_max + 0.5, 16, -0.5, 15.5);
  294. p_Sin2_WEST_EP[iVtx][iShift][iGap] = new TProfile2D(Form("p_Sin%i_WEST_EP%i_shiftOrder_%i_gap%i", 2, iVtx, iShift, iGap), Form("p_Sin%i_WEST_EP%i_shiftOrder_%i_gap%i", 2, iVtx, iShift, iGap), fNBins, runId_min - 0.5, runId_max + 0.5, 16, -0.5, 15.5);
  295. p_Cos2_WEST_SP[iVtx][iShift][iGap] = new TProfile2D(Form("p_Cos%i_WEST_SP%i_shiftOrder_%i_gap%i", 2, iVtx, iShift, iGap), Form("p_Cos%i_WEST_SP%i_shiftOrder_%i_gap%i", 2, iVtx, iShift, iGap), fNBins, runId_min - 0.5, runId_max + 0.5, 16, -0.5, 15.5);
  296. p_Sin2_WEST_SP[iVtx][iShift][iGap] = new TProfile2D(Form("p_Sin%i_WEST_SP%i_shiftOrder_%i_gap%i", 2, iVtx, iShift, iGap), Form("p_Sin%i_WEST_SP%i_shiftOrder_%i_gap%i", 2, iVtx, iShift, iGap), fNBins, runId_min - 0.5, runId_max + 0.5, 16, -0.5, 15.5);
  297. p_Cos3_EAST_EP[iVtx][iShift][iGap] = new TProfile2D(Form("p_Cos%i_EAST_EP%i_shiftOrder_%i_gap%i", 3, iVtx, iShift, iGap), Form("p_Cos%i_EAST_EP%i_shiftOrder_%i_gap%i", 3, iVtx, iShift, iGap), fNBins, runId_min - 0.5, runId_max + 0.5, 16, -0.5, 15.5);
  298. p_Sin3_EAST_EP[iVtx][iShift][iGap] = new TProfile2D(Form("p_Sin%i_EAST_EP%i_shiftOrder_%i_gap%i", 3, iVtx, iShift, iGap), Form("p_Sin%i_EAST_EP%i_shiftOrder_%i_gap%i", 3, iVtx, iShift, iGap), fNBins, runId_min - 0.5, runId_max + 0.5, 16, -0.5, 15.5);
  299. p_Cos3_EAST_SP[iVtx][iShift][iGap] = new TProfile2D(Form("p_Cos%i_EAST_SP%i_shiftOrder_%i_gap%i", 3, iVtx, iShift, iGap), Form("p_Cos%i_EAST_SP%i_shiftOrder_%i_gap%i", 3, iVtx, iShift, iGap), fNBins, runId_min - 0.5, runId_max + 0.5, 16, -0.5, 15.5);
  300. p_Sin3_EAST_SP[iVtx][iShift][iGap] = new TProfile2D(Form("p_Sin%i_EAST_SP%i_shiftOrder_%i_gap%i", 3, iVtx, iShift, iGap), Form("p_Sin%i_EAST_SP%i_shiftOrder_%i_gap%i", 3, iVtx, iShift, iGap), fNBins, runId_min - 0.5, runId_max + 0.5, 16, -0.5, 15.5);
  301. p_Cos3_WEST_EP[iVtx][iShift][iGap] = new TProfile2D(Form("p_Cos%i_WEST_EP%i_shiftOrder_%i_gap%i", 3, iVtx, iShift, iGap), Form("p_Cos%i_WEST_EP%i_shiftOrder_%i_gap%i", 3, iVtx, iShift, iGap), fNBins, runId_min - 0.5, runId_max + 0.5, 16, -0.5, 15.5);
  302. p_Sin3_WEST_EP[iVtx][iShift][iGap] = new TProfile2D(Form("p_Sin%i_WEST_EP%i_shiftOrder_%i_gap%i", 3, iVtx, iShift, iGap), Form("p_Sin%i_WEST_EP%i_shiftOrder_%i_gap%i", 3, iVtx, iShift, iGap), fNBins, runId_min - 0.5, runId_max + 0.5, 16, -0.5, 15.5);
  303. p_Cos3_WEST_SP[iVtx][iShift][iGap] = new TProfile2D(Form("p_Cos%i_WEST_SP%i_shiftOrder_%i_gap%i", 3, iVtx, iShift, iGap), Form("p_Cos%i_WEST_SP%i_shiftOrder_%i_gap%i", 3, iVtx, iShift, iGap), fNBins, runId_min - 0.5, runId_max + 0.5, 16, -0.5, 15.5);
  304. p_Sin3_WEST_SP[iVtx][iShift][iGap] = new TProfile2D(Form("p_Sin%i_WEST_SP%i_shiftOrder_%i_gap%i", 3, iVtx, iShift, iGap), Form("p_Sin%i_WEST_SP%i_shiftOrder_%i_gap%i", 3, iVtx, iShift, iGap), fNBins, runId_min - 0.5, runId_max + 0.5, 16, -0.5, 15.5);
  305. }
  306. }
  307. }
  308. //Counters
  309. Int_t fUsedTracks = 0;
  310. Int_t fQcountFull = 0;
  311. Int_t fQcountFullEast = 0;
  312. Int_t fQcountFullWest = 0;
  313. Int_t fQcountWest[NEtaGaps];
  314. Int_t fQcountEast[NEtaGaps];
  315. //Q-vectors
  316. TVector2 fQv2FullEP;
  317. TVector2 fQv2FullSP;
  318. TVector2 fQv3FullEP;
  319. TVector2 fQv3FullSP;
  320. TVector2 fQv2WestEP[NEtaGaps];
  321. TVector2 fQv2EastEP[NEtaGaps];
  322. TVector2 fQv2WestSP[NEtaGaps];
  323. TVector2 fQv2EastSP[NEtaGaps];
  324. TVector2 fQv3WestEP[NEtaGaps];
  325. TVector2 fQv3EastEP[NEtaGaps];
  326. TVector2 fQv3WestSP[NEtaGaps];
  327. TVector2 fQv3EastSP[NEtaGaps];
  328. TVector2 QvTMP;
  329. Double_t weight;
  330. Int_t VtxSign;
  331. Double_t psiShiftedTMP;
  332. Double_t PsiSin;
  333. Double_t PsiCos;
  334. Long64_t goodEventCounter = 0;
  335. Long64_t events2Fill = 0;
  336. Long64_t events2FillArms[NEtaGaps];
  337. for (int i=0; i<NEtaGaps; i++)
  338. {
  339. events2FillArms[i] = 0;
  340. }
  341. // Loop over events
  342. for (Long64_t iEvent = 0; iEvent < events2read; iEvent++)
  343. {
  344. if ((iEvent+1) % 1000 == 0){
  345. std::cout << "Working on event #[" << (iEvent + 1)
  346. << "/" << events2read << "]" << std::endl;
  347. }
  348. Bool_t readEvent = femtoReader->readFemtoEvent(iEvent);
  349. if (!readEvent)
  350. {
  351. std::cout << "Something went wrong, Master! Nothing to analyze..." << std::endl;
  352. break;
  353. }
  354. // Retrieve femtoDst
  355. StFemtoDst *dst = femtoReader->femtoDst();
  356. // Retrieve event information
  357. StFemtoEvent *event = dst->event();
  358. if (!event)
  359. {
  360. std::cout << "Something went wrong, Master! Event is hiding from me..." << std::endl;
  361. break;
  362. }
  363. // Event selection
  364. if ( !isGoodEvent(event) ) continue;
  365. goodEventCounter++;
  366. TVector3 pVtx = event->primaryVertex();
  367. // Track analysis
  368. Int_t nTracks = dst->numberOfTracks();
  369. //Counters
  370. fUsedTracks = 0;
  371. fQcountFull = 0;
  372. fQcountFullEast = 0;
  373. fQcountFullWest = 0;
  374. psiShiftedTMP = 0.;
  375. PsiSin = 0.;
  376. PsiCos = 0.;
  377. fQv2FullEP.Set(0.,0.);
  378. fQv2FullSP.Set(0.,0.);
  379. fQv3FullEP.Set(0.,0.);
  380. fQv3FullSP.Set(0.,0.);
  381. QvTMP.Set(0.,0.);
  382. for (int i=0; i<NEtaGaps; i++)
  383. {
  384. fQcountWest[i] = 0;
  385. fQcountEast[i] = 0;
  386. fQv2WestEP[i].Set(0.,0.);
  387. fQv2EastEP[i].Set(0.,0.);
  388. fQv2WestSP[i].Set(0.,0.);
  389. fQv2EastSP[i].Set(0.,0.);
  390. fQv3WestEP[i].Set(0.,0.);
  391. fQv3EastEP[i].Set(0.,0.);
  392. fQv3WestSP[i].Set(0.,0.);
  393. fQv3EastSP[i].Set(0.,0.);
  394. }
  395. // Vertex sign
  396. VtxSign = GetVzBin(pVtx.Z());
  397. if (VtxSign == -1) continue;
  398. // Track loop
  399. for (Int_t iTrk = 0; iTrk < nTracks; iTrk++)
  400. {
  401. // Retrieve i-th femto track
  402. StFemtoTrack *femtoTrack = dst->track(iTrk);
  403. if (!femtoTrack)
  404. continue;
  405. // Must be a primary track
  406. if (!femtoTrack->isPrimary())
  407. continue;
  408. //Track selection
  409. if (!isGoodTrack(femtoTrack, energy, pVtx)) continue;
  410. fUsedTracks++;
  411. //Fill recentered Q-vectors for all TPC (FULL)
  412. weight = GetWeight(femtoTrack);
  413. QvTMP.SetX(p_Qx_FULL_EP[0][VtxSign][(Int_t)event->cent16()][(Double_t)event->runId()]);
  414. QvTMP.SetY(p_Qy_FULL_EP[0][VtxSign][(Int_t)event->cent16()][(Double_t)event->runId()]);
  415. fQv2FullEP += weight*(CalcQvector(femtoTrack,2) - QvTMP);
  416. QvTMP.Set(0.,0.);
  417. QvTMP.SetX(p_Qx_FULL_EP[1][VtxSign][(Int_t)event->cent16()][(Double_t)event->runId()]);
  418. QvTMP.SetY(p_Qy_FULL_EP[1][VtxSign][(Int_t)event->cent16()][(Double_t)event->runId()]);
  419. fQv3FullEP += weight*(CalcQvector(femtoTrack,3) - QvTMP);
  420. QvTMP.Set(0.,0.);
  421. QvTMP.SetX(p_Qx_FULL_SP[0][VtxSign][(Int_t)event->cent16()][(Double_t)event->runId()]);
  422. QvTMP.SetY(p_Qy_FULL_SP[0][VtxSign][(Int_t)event->cent16()][(Double_t)event->runId()]);
  423. fQv2FullSP += 1.*(CalcQvector(femtoTrack,2) - QvTMP);
  424. QvTMP.Set(0.,0.);
  425. QvTMP.SetX(p_Qx_FULL_SP[1][VtxSign][(Int_t)event->cent16()][(Double_t)event->runId()]);
  426. QvTMP.SetY(p_Qy_FULL_SP[1][VtxSign][(Int_t)event->cent16()][(Double_t)event->runId()]);
  427. fQv3FullSP += 1.*(CalcQvector(femtoTrack,3) - QvTMP);
  428. QvTMP.Set(0.,0.);
  429. fQcountFull++;
  430. if (femtoTrack->eta() >= 0.)
  431. {
  432. fQcountFullWest++;
  433. }
  434. else
  435. {
  436. fQcountFullEast++;
  437. }
  438. for (int iGap=0; iGap<NEtaGaps; iGap++)
  439. {
  440. //fill Qvectors from EAST arm
  441. if (femtoTrack->eta() > -1.*cutEta && femtoTrack->eta() < 0.)//cutEtaGap[iGap])
  442. {
  443. QvTMP.SetX(p_Qx_EAST_EP[0][VtxSign][(Int_t)event->cent16()][iGap][(Double_t)event->runId()]);
  444. QvTMP.SetY(p_Qy_EAST_EP[0][VtxSign][(Int_t)event->cent16()][iGap][(Double_t)event->runId()]);
  445. fQv2EastEP[iGap] += weight*(CalcQvector(femtoTrack,2) - QvTMP);
  446. QvTMP.Set(0.,0.);
  447. QvTMP.SetX(p_Qx_EAST_EP[1][VtxSign][(Int_t)event->cent16()][iGap][(Double_t)event->runId()]);
  448. QvTMP.SetY(p_Qy_EAST_EP[1][VtxSign][(Int_t)event->cent16()][iGap][(Double_t)event->runId()]);
  449. fQv3EastEP[iGap] += weight*(CalcQvector(femtoTrack,3) - QvTMP);
  450. QvTMP.Set(0.,0.);
  451. QvTMP.SetX(p_Qx_EAST_SP[0][VtxSign][(Int_t)event->cent16()][iGap][(Double_t)event->runId()]);
  452. QvTMP.SetY(p_Qy_EAST_SP[0][VtxSign][(Int_t)event->cent16()][iGap][(Double_t)event->runId()]);
  453. fQv2EastSP[iGap] += 1.*(CalcQvector(femtoTrack,2) - QvTMP);
  454. QvTMP.Set(0.,0.);
  455. QvTMP.SetX(p_Qx_EAST_SP[1][VtxSign][(Int_t)event->cent16()][iGap][(Double_t)event->runId()]);
  456. QvTMP.SetY(p_Qy_EAST_SP[1][VtxSign][(Int_t)event->cent16()][iGap][(Double_t)event->runId()]);
  457. fQv3EastSP[iGap] += 1.*(CalcQvector(femtoTrack,3) - QvTMP);
  458. QvTMP.Set(0.,0.);
  459. fQcountEast[iGap]++;
  460. }
  461. //fill Qvectors from WEST arm
  462. if (femtoTrack->eta() < 1.*cutEta && femtoTrack->eta() > 0.)//cutEtaGap[iGap])
  463. {
  464. QvTMP.SetX(p_Qx_WEST_EP[0][VtxSign][(Int_t)event->cent16()][iGap][(Double_t)event->runId()]);
  465. QvTMP.SetY(p_Qy_WEST_EP[0][VtxSign][(Int_t)event->cent16()][iGap][(Double_t)event->runId()]);
  466. fQv2WestEP[iGap] += weight*(CalcQvector(femtoTrack,2) - QvTMP);
  467. QvTMP.Set(0.,0.);
  468. QvTMP.SetX(p_Qx_WEST_EP[1][VtxSign][(Int_t)event->cent16()][iGap][(Double_t)event->runId()]);
  469. QvTMP.SetY(p_Qy_WEST_EP[1][VtxSign][(Int_t)event->cent16()][iGap][(Double_t)event->runId()]);
  470. fQv3WestEP[iGap] += weight*(CalcQvector(femtoTrack,3) - QvTMP);
  471. QvTMP.Set(0.,0.);
  472. QvTMP.SetX(p_Qx_WEST_SP[0][VtxSign][(Int_t)event->cent16()][iGap][(Double_t)event->runId()]);
  473. QvTMP.SetY(p_Qy_WEST_SP[0][VtxSign][(Int_t)event->cent16()][iGap][(Double_t)event->runId()]);
  474. fQv2WestSP[iGap] += 1.*(CalcQvector(femtoTrack,2) - QvTMP);
  475. QvTMP.Set(0.,0.);
  476. QvTMP.SetX(p_Qx_WEST_SP[1][VtxSign][(Int_t)event->cent16()][iGap][(Double_t)event->runId()]);
  477. QvTMP.SetY(p_Qy_WEST_SP[1][VtxSign][(Int_t)event->cent16()][iGap][(Double_t)event->runId()]);
  478. fQv3WestSP[iGap] += 1.*(CalcQvector(femtoTrack,3) - QvTMP);
  479. QvTMP.Set(0.,0.);
  480. fQcountWest[iGap]++;
  481. }
  482. }
  483. // Check if track has TOF signal
  484. if (femtoTrack->isTofTrack())
  485. {
  486. } //if( isTofTrack() )
  487. } //for(Int_t iTrk=0; iTrk<nTracks; iTrk++)
  488. //Filling Shift coefficents for FULL
  489. if (fQcountFull > cutNcountQvFull &&
  490. fQcountFullEast > cutNcountQvFullEast &&
  491. fQcountFullWest > cutNcountQvFullWest)
  492. {
  493. events2Fill++;
  494. for (int iK=0; iK<NShiftOrderMax; iK++)
  495. {
  496. psiShiftedTMP = TMath::ATan2(fQv2FullEP.Y(),fQv2FullEP.X())/2.;
  497. PsiSin = TMath::Sin(shiftOrderCoeff2.at(iK)*psiShiftedTMP);
  498. PsiCos = TMath::Cos(shiftOrderCoeff2.at(iK)*psiShiftedTMP);
  499. p_Cos2_FULL_EP[VtxSign][iK]->Fill((Double_t) event->runId(),(Double_t) event->cent16(),PsiCos);
  500. p_Sin2_FULL_EP[VtxSign][iK]->Fill((Double_t) event->runId(),(Double_t) event->cent16(),PsiSin);
  501. psiShiftedTMP = TMath::ATan2(fQv3FullEP.Y(),fQv3FullEP.X())/3.;
  502. PsiSin = TMath::Sin(shiftOrderCoeff3.at(iK)*psiShiftedTMP);
  503. PsiCos = TMath::Cos(shiftOrderCoeff3.at(iK)*psiShiftedTMP);
  504. p_Cos3_FULL_EP[VtxSign][iK]->Fill((Double_t) event->runId(),(Double_t) event->cent16(),PsiCos);
  505. p_Sin3_FULL_EP[VtxSign][iK]->Fill((Double_t) event->runId(),(Double_t) event->cent16(),PsiSin);
  506. psiShiftedTMP = TMath::ATan2(fQv2FullSP.Y(),fQv2FullSP.X())/2.;
  507. PsiSin = TMath::Sin(shiftOrderCoeff2.at(iK)*psiShiftedTMP);
  508. PsiCos = TMath::Cos(shiftOrderCoeff2.at(iK)*psiShiftedTMP);
  509. p_Cos2_FULL_SP[VtxSign][iK]->Fill((Double_t) event->runId(),(Double_t) event->cent16(),PsiCos);
  510. p_Sin2_FULL_SP[VtxSign][iK]->Fill((Double_t) event->runId(),(Double_t) event->cent16(),PsiSin);
  511. psiShiftedTMP = TMath::ATan2(fQv3FullSP.Y(),fQv3FullSP.X())/3.;
  512. PsiSin = TMath::Sin(shiftOrderCoeff3.at(iK)*psiShiftedTMP);
  513. PsiCos = TMath::Cos(shiftOrderCoeff3.at(iK)*psiShiftedTMP);
  514. p_Cos3_FULL_SP[VtxSign][iK]->Fill((Double_t) event->runId(),(Double_t) event->cent16(),PsiCos);
  515. p_Sin3_FULL_SP[VtxSign][iK]->Fill((Double_t) event->runId(),(Double_t) event->cent16(),PsiSin);
  516. }
  517. }
  518. for (int iGap=0; iGap<NEtaGaps; iGap++)
  519. {
  520. if (fQcountEast[iGap] > cutNcountQvGap &&
  521. fQcountWest[iGap] > cutNcountQvGap)
  522. {
  523. events2FillArms[iGap]++;
  524. for (int iK=0; iK<NShiftOrderMax; iK++)
  525. {
  526. //EAST arm
  527. psiShiftedTMP = TMath::ATan2(fQv2EastEP[iGap].Y(),fQv2EastEP[iGap].X())/2.;
  528. PsiSin = TMath::Sin(shiftOrderCoeff2.at(iK)*psiShiftedTMP);
  529. PsiCos = TMath::Cos(shiftOrderCoeff2.at(iK)*psiShiftedTMP);
  530. p_Cos2_EAST_EP[VtxSign][iK][iGap]->Fill((Double_t) event->runId(),(Double_t) event->cent16(),PsiCos);
  531. p_Sin2_EAST_EP[VtxSign][iK][iGap]->Fill((Double_t) event->runId(),(Double_t) event->cent16(),PsiSin);
  532. psiShiftedTMP = TMath::ATan2(fQv3EastEP[iGap].Y(),fQv3EastEP[iGap].X())/3.;
  533. PsiSin = TMath::Sin(shiftOrderCoeff3.at(iK)*psiShiftedTMP);
  534. PsiCos = TMath::Cos(shiftOrderCoeff3.at(iK)*psiShiftedTMP);
  535. p_Cos3_EAST_EP[VtxSign][iK][iGap]->Fill((Double_t) event->runId(),(Double_t) event->cent16(),PsiCos);
  536. p_Sin3_EAST_EP[VtxSign][iK][iGap]->Fill((Double_t) event->runId(),(Double_t) event->cent16(),PsiSin);
  537. psiShiftedTMP = TMath::ATan2(fQv2EastSP[iGap].Y(),fQv2EastSP[iGap].X())/2.;
  538. PsiSin = TMath::Sin(shiftOrderCoeff2.at(iK)*psiShiftedTMP);
  539. PsiCos = TMath::Cos(shiftOrderCoeff2.at(iK)*psiShiftedTMP);
  540. p_Cos2_EAST_SP[VtxSign][iK][iGap]->Fill((Double_t) event->runId(),(Double_t) event->cent16(),PsiCos);
  541. p_Sin2_EAST_SP[VtxSign][iK][iGap]->Fill((Double_t) event->runId(),(Double_t) event->cent16(),PsiSin);
  542. psiShiftedTMP = TMath::ATan2(fQv3EastSP[iGap].Y(),fQv3EastSP[iGap].X())/3.;
  543. PsiSin = TMath::Sin(shiftOrderCoeff3.at(iK)*psiShiftedTMP);
  544. PsiCos = TMath::Cos(shiftOrderCoeff3.at(iK)*psiShiftedTMP);
  545. p_Cos3_EAST_SP[VtxSign][iK][iGap]->Fill((Double_t) event->runId(),(Double_t) event->cent16(),PsiCos);
  546. p_Sin3_EAST_SP[VtxSign][iK][iGap]->Fill((Double_t) event->runId(),(Double_t) event->cent16(),PsiSin);
  547. //WEST arm
  548. psiShiftedTMP = TMath::ATan2(fQv2WestEP[iGap].Y(),fQv2WestEP[iGap].X())/2.;
  549. PsiSin = TMath::Sin(shiftOrderCoeff2.at(iK)*psiShiftedTMP);
  550. PsiCos = TMath::Cos(shiftOrderCoeff2.at(iK)*psiShiftedTMP);
  551. p_Cos2_WEST_EP[VtxSign][iK][iGap]->Fill((Double_t) event->runId(),(Double_t) event->cent16(),PsiCos);
  552. p_Sin2_WEST_EP[VtxSign][iK][iGap]->Fill((Double_t) event->runId(),(Double_t) event->cent16(),PsiSin);
  553. psiShiftedTMP = TMath::ATan2(fQv3WestEP[iGap].Y(),fQv3WestEP[iGap].X())/3.;
  554. PsiSin = TMath::Sin(shiftOrderCoeff3.at(iK)*psiShiftedTMP);
  555. PsiCos = TMath::Cos(shiftOrderCoeff3.at(iK)*psiShiftedTMP);
  556. p_Cos3_WEST_EP[VtxSign][iK][iGap]->Fill((Double_t) event->runId(),(Double_t) event->cent16(),PsiCos);
  557. p_Sin3_WEST_EP[VtxSign][iK][iGap]->Fill((Double_t) event->runId(),(Double_t) event->cent16(),PsiSin);
  558. psiShiftedTMP = TMath::ATan2(fQv2WestSP[iGap].Y(),fQv2WestSP[iGap].X())/2.;
  559. PsiSin = TMath::Sin(shiftOrderCoeff2.at(iK)*psiShiftedTMP);
  560. PsiCos = TMath::Cos(shiftOrderCoeff2.at(iK)*psiShiftedTMP);
  561. p_Cos2_WEST_SP[VtxSign][iK][iGap]->Fill((Double_t) event->runId(),(Double_t) event->cent16(),PsiCos);
  562. p_Sin2_WEST_SP[VtxSign][iK][iGap]->Fill((Double_t) event->runId(),(Double_t) event->cent16(),PsiSin);
  563. psiShiftedTMP = TMath::ATan2(fQv3WestSP[iGap].Y(),fQv3WestSP[iGap].X())/3.;
  564. PsiSin = TMath::Sin(shiftOrderCoeff3.at(iK)*psiShiftedTMP);
  565. PsiCos = TMath::Cos(shiftOrderCoeff3.at(iK)*psiShiftedTMP);
  566. p_Cos3_WEST_SP[VtxSign][iK][iGap]->Fill((Double_t) event->runId(),(Double_t) event->cent16(),PsiCos);
  567. p_Sin3_WEST_SP[VtxSign][iK][iGap]->Fill((Double_t) event->runId(),(Double_t) event->cent16(),PsiSin);
  568. }
  569. }
  570. }
  571. } //for(Long64_t iEvent=0; iEvent<events2read; iEvent++)
  572. femtoReader->Finish();
  573. TFile *output = new TFile(outFile,"recreate");
  574. for (int iVtx = 0; iVtx < fArraySize; iVtx++)
  575. {
  576. for (int iShift = 0; iShift < NShiftOrderMax; iShift++)
  577. {
  578. p_Cos2_FULL_EP[iVtx][iShift]->Write();
  579. p_Sin2_FULL_EP[iVtx][iShift]->Write();
  580. p_Cos2_FULL_SP[iVtx][iShift]->Write();
  581. p_Sin2_FULL_SP[iVtx][iShift]->Write();
  582. p_Cos3_FULL_EP[iVtx][iShift]->Write();
  583. p_Sin3_FULL_EP[iVtx][iShift]->Write();
  584. p_Cos3_FULL_SP[iVtx][iShift]->Write();
  585. p_Sin3_FULL_SP[iVtx][iShift]->Write();
  586. for (int iGap = 0; iGap < NEtaGaps; iGap++)
  587. {
  588. p_Cos2_EAST_EP[iVtx][iShift][iGap]->Write();
  589. p_Sin2_EAST_EP[iVtx][iShift][iGap]->Write();
  590. p_Cos2_EAST_SP[iVtx][iShift][iGap]->Write();
  591. p_Sin2_EAST_SP[iVtx][iShift][iGap]->Write();
  592. p_Cos2_WEST_EP[iVtx][iShift][iGap]->Write();
  593. p_Sin2_WEST_EP[iVtx][iShift][iGap]->Write();
  594. p_Cos2_WEST_SP[iVtx][iShift][iGap]->Write();
  595. p_Sin2_WEST_SP[iVtx][iShift][iGap]->Write();
  596. p_Cos3_EAST_EP[iVtx][iShift][iGap]->Write();
  597. p_Sin3_EAST_EP[iVtx][iShift][iGap]->Write();
  598. p_Cos3_EAST_SP[iVtx][iShift][iGap]->Write();
  599. p_Sin3_EAST_SP[iVtx][iShift][iGap]->Write();
  600. p_Cos3_WEST_EP[iVtx][iShift][iGap]->Write();
  601. p_Sin3_WEST_EP[iVtx][iShift][iGap]->Write();
  602. p_Cos3_WEST_SP[iVtx][iShift][iGap]->Write();
  603. p_Sin3_WEST_SP[iVtx][iShift][iGap]->Write();
  604. }
  605. }
  606. }
  607. output->Close();
  608. std::cout << "I'm done with analysis. We'll have a Nobel Prize, Master!"
  609. << std::endl;
  610. std::cout << "Good events: " << goodEventCounter << std::endl;
  611. std::cout << "Good events for TProfile2D fill: " << events2Fill << std::endl;
  612. std::cout << "Good events for TProfile2D fill arms: " << events2FillArms[0] << std::endl;
  613. timer.Stop();
  614. timer.Print();
  615. }
  616. Bool_t isGoodEvent(StFemtoEvent *const &event)
  617. {
  618. if (!event) return false;
  619. if (event == nullptr) return false;
  620. if (event->primaryVertex().Perp() > cutVtxR) return false;
  621. if (TMath::Abs(event->primaryVertex().Z()) > cutVtxZEnergy.at(energy)) return false;
  622. if ((energy == 200.) && TMath::Abs(event->primaryVertex().Z() - event->vpdVz()) > cutVpdVz) return false;
  623. return true;
  624. }
  625. Bool_t isGoodTrack(StFemtoTrack *const &track, Float_t _energy, TVector3 pVtx)
  626. {
  627. if (!track) return false;
  628. // if (!track->isPrimary()) return false;
  629. if (track->nHitsFit() < cutNhits) return false;
  630. if (track->nHitsPoss() <= cutNhitsPoss) return false;
  631. if ((Double_t) track->nHitsFit()/track->nHitsPoss() < cutNhitsRatio) return false;
  632. if (TMath::Abs(track->eta()) >= cutEta) return false;
  633. if (track->pt() <= cutPtMin.at(_energy)) return false;
  634. if (track->pt() > cutPtMax) return false;
  635. if (track->ptot() > cutPMax) return false;
  636. if (track->gDCA(pVtx).Mag() >= cutDCA.at(_energy)) return false;
  637. return true;
  638. }
  639. Double_t GetWeight(StFemtoTrack *const &track)
  640. {
  641. Double_t weight;
  642. if (track->pt() <= cutPtWeightEP)
  643. {
  644. weight = track->pt();
  645. }
  646. else
  647. {
  648. weight = cutPtWeightEP;
  649. }
  650. return weight;
  651. }
  652. TVector2 CalcQvector(StFemtoTrack *const &track, Int_t _harm)
  653. {
  654. TVector2 qv(0.,0.);
  655. qv.Set(TMath::Cos(_harm*track->phi()),TMath::Sin(_harm*track->phi()));
  656. return qv;
  657. }
  658. Int_t GetVzBin(Double_t vtxZ)
  659. {
  660. for (Int_t i=0; i<fArraySize;i++)
  661. {
  662. if (vtxZ >= VtxBins[i] && vtxZ < VtxBins[i+1]) return i;
  663. }
  664. return -1;
  665. }