StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEpdEpInfo.cxx
1 #include "StEpdEpInfo.h"
2 #include "TMath.h"
3 #include <iostream>
4 
5 StEpdEpInfo::StEpdEpInfo(){
6  for (int iorder=0; iorder<_EpOrderMax; iorder++){
7  for (int ew=0; ew<2; ew++){
8  for (int xy=0; xy<2; xy++){
9  QrawOneSide[ew][iorder][xy] = 0.0;
10  QphiWeightedOneSide[ew][iorder][xy] = 0.0;
11  for (int ring=0; ring<16; ring++){
12  QringRaw[ew][iorder][xy][ring] = 0.0;
13  QringPhiWeighted[ew][iorder][xy][ring] = 0.0;
14  }
15  }
16  }
17  }
18 
19  for (int iorder=0; iorder<_EpOrderMax; iorder++){
20  for (int ewfull=0; ewfull<3; ewfull++){
21  PsiRaw[ewfull][iorder] = -999.0;
22  PsiPhiWeighted[ewfull][iorder] = -999.0;
23  PsiPhiWeightedAndShifted[ewfull][iorder] = -999.0;
24  }
25  }
26 }
27 
28 
29 // ===================== Access to Q-vectors ==========================
30 
31 //------------------------------ Raw Q --------------------------------
32 TVector2 StEpdEpInfo::RawQ(int ew, int order){
33  if (ArgumentOutOfBounds(order)){
34  TVector2 crap(-999,-999);
35  return crap;
36  }
37  TVector2 q(QrawOneSide[ew][order-1][0],QrawOneSide[ew][order-1][1]);
38  return q;
39 }
40 TVector2 StEpdEpInfo::EastRawQ(int order){return RawQ(0,order);} // public method
41 TVector2 StEpdEpInfo::WestRawQ(int order){return RawQ(1,order);} // public method
42 //-----------------------------------------------------------------------
43 
44 //------------------------ phi-weighted Q -------------------------------
45 TVector2 StEpdEpInfo::PhiWeightedQ(int ew, int order){
46  if (ArgumentOutOfBounds(order)){
47  TVector2 crap(-999,-999);
48  return crap;
49  }
50  TVector2 q(QphiWeightedOneSide[ew][order-1][0],QphiWeightedOneSide[ew][order-1][1]);
51  return q;
52 }
53 TVector2 StEpdEpInfo::EastPhiWeightedQ(int order){return PhiWeightedQ(0,order);} // public method
54 TVector2 StEpdEpInfo::WestPhiWeightedQ(int order){return PhiWeightedQ(1,order);} // public method
55 //-----------------------------------------------------------------------
56 
57 //---------------------- Raw Q for a single ring -----------------------
58 TVector2 StEpdEpInfo::RingRawQ(int ew, int order, int ring){
59  if (ArgumentOutOfBounds(order,ring)){
60  TVector2 crap(-999,-999);
61  return crap;
62  }
63  TVector2 q(QringRaw[ew][order-1][0][ring-1],QringRaw[ew][order-1][1][ring-1]);
64  return q;
65 }
66 TVector2 StEpdEpInfo::EastRingRawQ(int order, int ring){return RingRawQ(0,order,ring);} // public method
67 TVector2 StEpdEpInfo::WestRingRawQ(int order, int ring){return RingRawQ(1,order,ring);} // public method
68 //-----------------------------------------------------------------------
69 
70 //---------------- phi-weighted Q for a single ring----------------------
71 TVector2 StEpdEpInfo::RingPhiWeightedQ(int ew, int order, int ring){
72  if (ArgumentOutOfBounds(order,ring)){
73  TVector2 crap(-999,-999);
74  return crap;
75  }
76  TVector2 q(QringPhiWeighted[ew][order-1][0][ring-1],QringPhiWeighted[ew][order-1][1][ring-1]);
77  return q;
78 }
79 TVector2 StEpdEpInfo::EastRingPhiWeightedQ(int order, int ring){return RingPhiWeightedQ(0,order,ring);} // public method
80 TVector2 StEpdEpInfo::WestRingPhiWeightedQ(int order, int ring){return RingPhiWeightedQ(1,order,ring);} // public method
81 //-----------------------------------------------------------------------
82 
83 
84 // ===================== Access to sum-of-weights =======================
85 // --------------------- Ring sum-of-weights, raw ----------------------
86 double StEpdEpInfo::RingSW_Raw(int ew, int ring){
87  if (ArgumentOutOfBounds(1,ring)) return -999; // note. the dummy "1" as the first argument is just so we are only checking whether "ring" is out of bounds
88  return RingSumWeightsRaw[ew][ring-1];
89 }
90 double StEpdEpInfo::EastRingSumWeightsRaw(int ring){return RingSW_Raw(0,ring);} // public method
91 double StEpdEpInfo::WestRingSumWeightsRaw(int ring){return RingSW_Raw(1,ring);} // public method
92 // --------------------- Ring sum-of-weights, phi-weighted -------------
93 double StEpdEpInfo::RingSW_PhiWeighted(int ew, int ring){
94  if (ArgumentOutOfBounds(1,ring)) return -999; // note. the dummy "1" as the first argument is just so we are only checking whether "ring" is out of bounds
95  return RingSumWeightsPhiWeighted[ew][ring-1];
96 }
97 double StEpdEpInfo::EastRingSumWeightsPhiWeighted(int ring){return RingSW_PhiWeighted(0,ring);} // public method
98 double StEpdEpInfo::WestRingSumWeightsPhiWeighted(int ring){return RingSW_PhiWeighted(1,ring);} // public method
99 // --------------------- Wheel sum-of-weights, raw ----------------------
100 double StEpdEpInfo::WheelSW_Raw(int ew, int order){
101  if (ArgumentOutOfBounds(order)) return -999;
102  return WheelSumWeightsRaw[ew][order-1];
103 }
104 double StEpdEpInfo::EastSumWeightsRaw(int order){return WheelSW_Raw(0,order);} // public method
105 double StEpdEpInfo::WestSumWeightsRaw(int order){return WheelSW_Raw(1,order);} // public method
106 // --------------------- Wheel sum-of-weights, phi-weighted ---------------
107 double StEpdEpInfo::WheelSW_PhiWeighted(int ew, int order){
108  if (ArgumentOutOfBounds(order)) return -999;
109  return WheelSumWeightsPhiWeighted[ew][order-1];
110 }
111 double StEpdEpInfo::EastSumWeightsPhiWeighted(int order){return WheelSW_PhiWeighted(0,order);} // public method
112 double StEpdEpInfo::WestSumWeightsPhiWeighted(int order){return WheelSW_PhiWeighted(1,order);} // public method
113 
114 
115 
116 // ===================== Access to Event-plane angles ====================
117 
118 //------------------------- raw EP angles --------------------------------
119 double StEpdEpInfo::RawPsi(int ewfull, int order){
120  if (ArgumentOutOfBounds(order)) return -999;
121  return Range(PsiRaw[ewfull][order-1],order);
122 }
123 double StEpdEpInfo::EastRawPsi(int order){return RawPsi(0,order);} // public method
124 double StEpdEpInfo::WestRawPsi(int order){return RawPsi(1,order);} // public method
125 double StEpdEpInfo::FullRawPsi(int order){return RawPsi(2,order);} // public method
126 //-----------------------------------------------------------------------
127 
128 //-------------------- phi-weighted EP angles ---------------------------
129 double StEpdEpInfo::PhiWeightedPsi(int ewfull, int order){
130  if (ArgumentOutOfBounds(order)) return -999;
131  return Range(PsiPhiWeighted[ewfull][order-1],order);
132 }
133 double StEpdEpInfo::EastPhiWeightedPsi(int order){return PhiWeightedPsi(0,order);} // public method
134 double StEpdEpInfo::WestPhiWeightedPsi(int order){return PhiWeightedPsi(1,order);} // public method
135 double StEpdEpInfo::FullPhiWeightedPsi(int order){return PhiWeightedPsi(2,order);} // public method
136 //-----------------------------------------------------------------------
137 
138 //------------------- phi-weighted and shifted EP angles ----------------
139 double StEpdEpInfo::PhiWeightedAndShiftedPsi(int ewfull, int order){
140  if (ArgumentOutOfBounds(order)) return -999;
141  return Range(PsiPhiWeightedAndShifted[ewfull][order-1],order);
142 }
143 double StEpdEpInfo::EastPhiWeightedAndShiftedPsi(int order){return PhiWeightedAndShiftedPsi(0,order);} // public method
144 double StEpdEpInfo::WestPhiWeightedAndShiftedPsi(int order){return PhiWeightedAndShiftedPsi(1,order);} // public method
145 double StEpdEpInfo::FullPhiWeightedAndShiftedPsi(int order){return PhiWeightedAndShiftedPsi(2,order);} // public method
146 //-----------------------------------------------------------------------
147 
148 //--------------------- single-ring raw EP angles -----------------------
149 double StEpdEpInfo::RingRawPsi(int ew, int order, int ring){
150  if (ArgumentOutOfBounds(order,ring)) return -999;
151  return Range(PsiRingRaw[ew][order-1][ring-1],order);
152 }
153 double StEpdEpInfo::EastRingRawPsi(int order, int ring){return RingRawPsi(0,order,ring);} // public method
154 double StEpdEpInfo::WestRingRawPsi(int order, int ring){return RingRawPsi(1,order,ring);} // public method
155 //-----------------------------------------------------------------------
156 
157 //--------------------- single-ring raw EP angles -----------------------
158 double StEpdEpInfo::RingPhiWeightedPsi(int ew, int order, int ring){
159  if (ArgumentOutOfBounds(order,ring)) return -999;
160  return Range(PsiRingPhiWeighted[ew][order-1][ring-1],order);
161 }
162 double StEpdEpInfo::EastRingPhiWeightedPsi(int order, int ring){return RingPhiWeightedPsi(0,order,ring);} // public method
163 double StEpdEpInfo::WestRingPhiWeightedPsi(int order, int ring){return RingPhiWeightedPsi(1,order,ring);} // public method
164 //-----------------------------------------------------------------------
165 
166 
167 
168 //=================== Below here are just some internal private utility methods =====================
169 
170 //----- Simple method to put angles in a convenient range: (0,2pi/n) ----
171 double StEpdEpInfo::Range(double psi,int order){
172  if (ArgumentOutOfBounds(order)) return -999;
173  double wrap = 2.0*TMath::Pi()/(double)order;
174  if (psi<0.0) psi += (1.0+(int)(fabs(psi)/wrap))*wrap;
175  else{ if (psi>wrap) psi -= ((int)(psi/wrap))*wrap;}
176  return psi;
177 }
178 
179 //--------- protection against argument out-of-bounds -------
180 bool StEpdEpInfo::ArgumentOutOfBounds(int order){
181  if ((order<1)||(order>_EpOrderMax)){
182  std::cout << "\n *** Invalid order requested ***\n";
183  std::cout << " order must be between 1 (for first-order EP) and " << _EpOrderMax
184  << ". To change the upuper limit, edit StEpdUtil/StEpdEpInfo.h\n";
185  std::cout << " I will now return you an invalid result. Have a nice day\n";
186  return true;
187  }
188  return false;
189 }
190 
191 bool StEpdEpInfo::ArgumentOutOfBounds(int order, int ring){
192  if (ArgumentOutOfBounds(order)) return true;
193  if ((ring<1)||(ring>16)){
194  std::cout << "\n *** Invalid ring requested. Ring must be between 1 and 16\n";
195  std::cout << " I will now return you an invalid result. Have a nice day\n";
196  return true;
197  }
198  return false;
199 }
200 
double EastRawPsi(int order)
double EastSumWeightsPhiWeighted(int order)
TVector2 EastRingPhiWeightedQ(int order, int ring)
Definition: StEpdEpInfo.cxx:79
double FullPhiWeightedAndShiftedPsi(int order)
double WestRingSumWeightsRaw(int ring)
Definition: StEpdEpInfo.cxx:91
double WestPhiWeightedAndShiftedPsi(int order)
double FullRawPsi(int order)
double EastRingSumWeightsPhiWeighted(int ring)
Definition: StEpdEpInfo.cxx:97
TVector2 WestRingPhiWeightedQ(int order, int ring)
Definition: StEpdEpInfo.cxx:80
double EastPhiWeightedPsi(int order)
double WestRingPhiWeightedPsi(int order, int ring)
double EastPhiWeightedAndShiftedPsi(int order)
double WestPhiWeightedPsi(int order)
double EastRingRawPsi(int order, int ring)
TVector2 EastPhiWeightedQ(int order)
Definition: StEpdEpInfo.cxx:53
TVector2 WestPhiWeightedQ(int order)
Definition: StEpdEpInfo.cxx:54
TVector2 EastRingRawQ(int order, int ring)
Definition: StEpdEpInfo.cxx:66
double FullPhiWeightedPsi(int order)
double EastSumWeightsRaw(int order)
double WestRawPsi(int order)
TVector2 WestRingRawQ(int order, int ring)
Definition: StEpdEpInfo.cxx:67
TVector2 WestRawQ(int order)
Definition: StEpdEpInfo.cxx:41
TVector2 EastRawQ(int order)
Definition: StEpdEpInfo.cxx:40
double WestRingSumWeightsPhiWeighted(int ring)
Definition: StEpdEpInfo.cxx:98
double WestRingRawPsi(int order, int ring)
double WestSumWeightsPhiWeighted(int order)
double EastRingSumWeightsRaw(int ring)
Definition: StEpdEpInfo.cxx:90
double EastRingPhiWeightedPsi(int order, int ring)
double WestSumWeightsRaw(int order)