Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EpInfo.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file EpInfo.C
1 #include "EpInfo.h"
2 #include "TMath.h"
3 #include <iostream>
4 
6  for (int iorder=0; iorder<_EpOrderMax; iorder++){
7  for (int xy=0; xy<2; xy++){
8  QrawOneSide[iorder][xy] = 0.0;
9  QphiWeightedOneSide[iorder][xy] = 0.0;
10  }
11  }
12 
13  for (int iorder=0; iorder<_EpOrderMax; iorder++){
14  PsiRaw[iorder] = -999.0;
15  PsiPhiWeighted[iorder] = -999.0;
16  PsiPhiWeightedAndShifted[iorder] = -999.0;
17  }
18 }
19 
20 
21 // ===================== Access to Q-vectors ==========================
22 
23 //------------------------------ Raw Q --------------------------------
24 TVector2 EpInfo::RawQ(int order){
25  if (ArgumentOutOfBounds(order)){
26  TVector2 crap(-999,-999);
27  return crap;
28  }
29  TVector2 q(QrawOneSide[order-1][0],QrawOneSide[order-1][1]);
30  return q;
31 }
32 
33 //------------------------ phi-weighted Q -------------------------------
34 TVector2 EpInfo::PhiWeightedQ(int order){
35  if (ArgumentOutOfBounds(order)){
36  TVector2 crap(-999,-999);
37  return crap;
38  }
39  TVector2 q(QphiWeightedOneSide[order-1][0],QphiWeightedOneSide[order-1][1]);
40  return q;
41 }
42 
43 // --------------------- Wheel sum-of-weights, raw ----------------------
44 double EpInfo::SWRaw(int order){
45  if (ArgumentOutOfBounds(order)) return -999;
46  return WheelSumWeightsRaw[order-1];
47 }
48 
49 // --------------------- Wheel sum-of-weights, phi-weighted ---------------
50 double EpInfo::SWPhiWeighted(int order){
51  if (ArgumentOutOfBounds(order)) return -999;
52  return WheelSumWeightsPhiWeighted[order-1];
53 }
54 
55 // ===================== Access to Event-plane angles ====================
56 
57 //------------------------- raw EP angles --------------------------------
58 double EpInfo::RawPsi(int order){
59  if (ArgumentOutOfBounds(order)) return -999;
60  return Range(PsiRaw[order-1],order);
61 }
62 //-----------------------------------------------------------------------
63 
64 //-------------------- phi-weighted EP angles ---------------------------
65 double EpInfo::PhiWeightedPsi(int order){
66  if (ArgumentOutOfBounds(order)) return -999;
67  return Range(PsiPhiWeighted[order-1],order);
68 }
69 //-----------------------------------------------------------------------
70 
71 //------------------- phi-weighted and shifted EP angles ----------------
73  if (ArgumentOutOfBounds(order)) return -999;
74  return Range(PsiPhiWeightedAndShifted[order-1],order);
75 }
76 //-----------------------------------------------------------------------
77 
78 //=================== Below here are just some internal private utility methods =====================
79 
80 //----- Simple method to put angles in a convenient range: (0,2pi/n) ----
81 double EpInfo::Range(double psi,int order){
82  if (ArgumentOutOfBounds(order)) return -999;
83  double wrap = 2.0*TMath::Pi()/(double)order;
84  if (psi<0.0) psi += (1.0+(int)(fabs(psi)/wrap))*wrap;
85  else{ if (psi>wrap) psi -= ((int)(psi/wrap))*wrap;}
86  return psi;
87 }
88 
89 //--------- protection against argument out-of-bounds -------
91  if ((order<1)||(order>_EpOrderMax)){
92  std::cout << "\n *** Invalid order requested ***\n";
93  std::cout << " order must be between 1 (for first-order EP) and " << _EpOrderMax
94  << ". To change the upuper limit, edit StEpdUtil/EpInfo.h\n";
95  std::cout << " I will now return you an invalid result. Have a nice day\n";
96  return true;
97  }
98  return false;
99 }
100