utility.C 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #include "utility.h"
  2. FlowParticle::FlowParticle()
  3. {
  4. Eta = 0. , Pt = 0., Phi = 0., Rapidity = 0.;
  5. };
  6. FlowParticle::FlowParticle(double Eta, double Pt, double Phi, double Rapidity)
  7. {
  8. this->Eta = Eta, this->Pt = Pt, this->Phi = Phi, this->Rapidity = Rapidity;
  9. };
  10. EPParticle::EPParticle()
  11. {
  12. Eta = 0., Pt = 0., Phi = 0.;
  13. }
  14. EPParticle::EPParticle(double Eta, double Pt, double Phi)
  15. {
  16. this->Eta = Eta, this->Pt = Pt, this->Phi = Phi;
  17. }
  18. Double_t ResEventPlane(Double_t chi, Int_t harm) //harm = 1 or 2 for our case
  19. {
  20. Double_t con = TMath::Sqrt(TMath::Pi()/2)/2 ;
  21. Double_t arg = chi * chi / 4.;
  22. Double_t res = -999.;
  23. if (harm == 1) { res = con * chi * exp(-arg) * (TMath::BesselI0(arg) + TMath::BesselI1(arg)); return res; }
  24. else if (harm == 2) { res = con * chi * exp(-arg) * (ROOT::Math::cyl_bessel_i(0.5,arg) + ROOT::Math::cyl_bessel_i(1.5,arg)); return res; }
  25. else cout << "Wrong harmonic in resolution extrapolation! " <<endl;
  26. return res;
  27. }
  28. Double_t Chi(Double_t res, Int_t harm) //harm = 1 or 2 for our case
  29. {
  30. Double_t chi = 2.0;
  31. Double_t delta = 1.0;
  32. for(int i = 0; i < 15; i++)
  33. {
  34. if(ResEventPlane(chi, harm) < res) { chi = chi + delta ; }
  35. else { chi = chi - delta ; }
  36. delta = delta / 2.;
  37. }
  38. return chi ;
  39. }
  40. Double_t* GetAngles()
  41. {
  42. Double_t *phi_angle_of_module = new Double_t[_N_MODULES_TOTAL];
  43. for (int i = 0; i < _N_ARM; ++i)
  44. {
  45. Int_t x_axis_switch;
  46. if (i == 0) x_axis_switch = 1;
  47. else if (i == 1) x_axis_switch = -1;
  48. for (Int_t j = 0; j < _N_MODULES_TOTAL/2; ++j)
  49. {
  50. Double_t y = 0, x = 0;
  51. if ((j>=0) && (j<=4))
  52. {
  53. y = 45., x = (j-2)*15.;
  54. phi_angle_of_module[j + i*_N_MODULES_TOTAL/2] = ATan2(y,x_axis_switch*x);
  55. }
  56. else if ((j>=5) && (j<=39))
  57. {
  58. y = (3-(j+2)/7)*15, x = (3-(j+2)%7)*15;
  59. phi_angle_of_module[j + i*_N_MODULES_TOTAL/2] = ATan2(y,x_axis_switch*x);
  60. }
  61. else if ((j>=40) && (j<=44))
  62. {
  63. y = -45. , x = (j-42)*15.;
  64. phi_angle_of_module[j + i*_N_MODULES_TOTAL/2] = ATan2(y,x_axis_switch*x);
  65. }
  66. }
  67. }
  68. return phi_angle_of_module;
  69. }
  70. Float_t Unfold(Float_t phiEP_mc, Float_t psi_N_FULL, Int_t harm)
  71. {
  72. Float_t values[10] , absvalues[10];
  73. values[0] = phiEP_mc - psi_N_FULL;
  74. absvalues[0] = Abs(values[0]);
  75. values[1] = phiEP_mc + 2. * Pi() / harm - psi_N_FULL;
  76. absvalues[1] = Abs(values[1]);
  77. values[2] = phiEP_mc - 2. * Pi() / harm - psi_N_FULL;
  78. absvalues[2] = Abs(values[2]);
  79. return values[LocMin(3, absvalues)];
  80. }