fmcLoopProcess.cxx 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. #include "fmcLoopProcess.h"
  2. #include "fmcConstants.h"
  3. #include <TMath.h>
  4. ClassImp(fmcLoopProcess);
  5. fmcLoopProcess::fmcLoopProcess() : fOptions(),
  6. fHeader(),
  7. fParticle()
  8. {
  9. }
  10. fmcLoopProcess::~fmcLoopProcess()
  11. {
  12. delete fOptions;
  13. delete fHeader;
  14. delete fParticle;
  15. delete fReader;
  16. }
  17. fmcParticleLoopInfo *fmcLoopProcess::ProcessParticleLoop(fmcLong iev)
  18. {
  19. if (!fReader)
  20. return nullptr;
  21. if (!fOptions)
  22. return nullptr;
  23. fmcInt refMultSTAR = 0, refMultEastPHENIX = 0, refMultWestPHENIX = 0;
  24. fmcInt refMultPHENIX = 0;
  25. fmcDouble eta, pt, phi;
  26. fmcDouble qvTpcEastX[fmc::nTpcEtaGaps], qvTpcEastY[fmc::nTpcEtaGaps];
  27. fmcDouble qvTpcWestX[fmc::nTpcEtaGaps], qvTpcWestY[fmc::nTpcEtaGaps];
  28. fmcDouble qvFHCalEastX, qvFHCalEastY;
  29. fmcDouble qvFHCalWestX, qvFHCalWestY;
  30. fmcDouble qvRXNEastX, qvRXNEastY;
  31. fmcDouble qvRXNWestX, qvRXNWestY;
  32. fmcDouble qvWeight;
  33. fmcQvector *qv = nullptr;
  34. if (fOptions->qv())
  35. {
  36. qvFHCalEastX = 0.; qvFHCalEastY = 0.;
  37. qvFHCalWestX = 0.; qvFHCalWestY = 0.;
  38. qvRXNEastX = 0.; qvRXNEastY = 0.;
  39. qvRXNWestX = 0.; qvRXNWestY = 0.;
  40. for (int i = 0; i < fmc::nTpcEtaGaps; i++)
  41. {
  42. qvTpcEastX[i] = 0.;
  43. qvTpcEastY[i] = 0.;
  44. qvTpcWestX[i] = 0.;
  45. qvTpcWestY[i] = 0.;
  46. }
  47. }
  48. fmcParticleLoopInfo *info = new fmcParticleLoopInfo();
  49. fHeader = fReader->ReadEventHeader(iev);
  50. if (!fHeader)
  51. return nullptr;
  52. // Start main particle loop
  53. for (int iTr = 0; iTr < fHeader->GetNparts(); iTr++)
  54. {
  55. fParticle = fReader->ReadParticle(iTr);
  56. if (!fParticle)
  57. continue;
  58. if (fParticle->GetCharge() == 0)
  59. {
  60. delete fParticle;
  61. continue;
  62. }
  63. if (fOptions->refMult() || fOptions->qv())
  64. {
  65. eta = fParticle->GetEta();
  66. pt = fParticle->GetPt();
  67. }
  68. if (fOptions->qv())
  69. {
  70. phi = fParticle->GetPhi();
  71. }
  72. // Calculate refMult
  73. if (fOptions->refMult())
  74. {
  75. if (TMath::Abs(eta) <= fmc::refMultSTAREtaCut && pt >= fmc::ptMinCut)
  76. refMultSTAR++;
  77. if (TMath::Abs(eta) >= fmc::refMultRXNEtaCut.first &&
  78. TMath::Abs(eta) <= fmc::refMultRXNEtaCut.second &&
  79. eta < 0)
  80. refMultEastPHENIX++;
  81. if (TMath::Abs(eta) >= fmc::refMultRXNEtaCut.first &&
  82. TMath::Abs(eta) <= fmc::refMultRXNEtaCut.second &&
  83. eta > 0)
  84. refMultWestPHENIX++;
  85. }
  86. // Calculate Q-vectors
  87. if (fOptions->qv())
  88. {
  89. qvWeight = 1.;
  90. // Qv from TPC East
  91. if (TMath::Abs(eta) <= fmc::TpcEtaCut &&
  92. eta < 0 && pt < fmc::ptMaxCutEP &&
  93. pt > fmc::ptMinCut)
  94. {
  95. for (int i = 0; i < fmc::nTpcEtaGaps; i++)
  96. {
  97. if (TMath::Abs(eta) >= fmc::TpcEtaGap.at(i))
  98. {
  99. qvTpcEastX[i] += qvWeight * TMath::Cos(2 * phi);
  100. qvTpcEastY[i] += qvWeight * TMath::Sin(2 * phi);
  101. }
  102. }
  103. }
  104. // Qv from TPC West
  105. if (TMath::Abs(eta) <= fmc::TpcEtaCut &&
  106. eta > 0 && pt < fmc::ptMaxCutEP &&
  107. pt > fmc::ptMinCut)
  108. {
  109. for (int i = 0; i < fmc::nTpcEtaGaps; i++)
  110. {
  111. if (TMath::Abs(eta) >= fmc::TpcEtaGap.at(i))
  112. {
  113. qvTpcWestX[i] += qvWeight * TMath::Cos(2 * phi);
  114. qvTpcWestY[i] += qvWeight * TMath::Sin(2 * phi);
  115. }
  116. }
  117. }
  118. // Qv from RXN East
  119. if (TMath::Abs(eta) >= fmc::refMultRXNEtaCut.first &&
  120. TMath::Abs(eta) <= fmc::refMultRXNEtaCut.second &&
  121. eta < 0)
  122. {
  123. qvRXNEastX += qvWeight * TMath::Cos(2 * phi);
  124. qvRXNEastY += qvWeight * TMath::Sin(2 * phi);
  125. }
  126. // Qv from RXN West
  127. if (TMath::Abs(eta) >= fmc::refMultRXNEtaCut.first &&
  128. TMath::Abs(eta) <= fmc::refMultRXNEtaCut.second &&
  129. eta > 0)
  130. {
  131. qvRXNWestX += qvWeight * TMath::Cos(2 * phi);
  132. qvRXNWestY += qvWeight * TMath::Sin(2 * phi);
  133. }
  134. // Qv from FHCal East
  135. if (TMath::Abs(eta) >= fmc::refMultFHCalEtaCut.first &&
  136. TMath::Abs(eta) <= fmc::refMultFHCalEtaCut.second &&
  137. eta < 0)
  138. {
  139. qvFHCalEastX += qvWeight * TMath::Cos(1 * phi);
  140. qvFHCalEastY += qvWeight * TMath::Sin(1 * phi);
  141. }
  142. // Qv from FHCal West
  143. if (TMath::Abs(eta) >= fmc::refMultFHCalEtaCut.first &&
  144. TMath::Abs(eta) <= fmc::refMultFHCalEtaCut.second &&
  145. eta > 0)
  146. {
  147. qvFHCalWestX += -1 * qvWeight * TMath::Cos(1 * phi);
  148. qvFHCalWestY += -1 * qvWeight * TMath::Sin(1 * phi);
  149. }
  150. }
  151. delete fParticle;
  152. } // end of particle loop
  153. if (fOptions->refMult())
  154. {
  155. refMultPHENIX = (refMultEastPHENIX >= 2 && refMultWestPHENIX >= 2) ?
  156. refMultEastPHENIX + refMultWestPHENIX : 0;
  157. info->SetMultSTAR(refMultSTAR);
  158. info->SetMultPHENIX(refMultPHENIX);
  159. }
  160. if (fOptions->qv())
  161. {
  162. qv = new fmcQvector();
  163. for (int i = 0; i < fmc::nTpcEtaGaps; i++)
  164. {
  165. qv->Set(qvTpcEastX[i], qvTpcEastY[i]);
  166. qv->SetHarmonic(2.);
  167. info->AddQv(qv);
  168. qv->Set(qvTpcWestX[i], qvTpcWestY[i]);
  169. qv->SetHarmonic(2.);
  170. info->AddQv(qv);
  171. }
  172. qv->Set(qvRXNEastX, qvRXNEastY);
  173. qv->SetHarmonic(2.);
  174. info->AddQv(qv);
  175. qv->Set(qvRXNWestX, qvRXNWestY);
  176. qv->SetHarmonic(2.);
  177. info->AddQv(qv);
  178. qv->Set(qvFHCalEastX, qvFHCalEastY);
  179. qv->SetHarmonic(1.);
  180. info->AddQv(qv);
  181. qv->Set(qvFHCalWestX, qvFHCalWestY);
  182. qv->SetHarmonic(1.);
  183. info->AddQv(qv);
  184. delete qv;
  185. }
  186. delete fHeader;
  187. return info;
  188. }