File indexing completed on 2025-08-03 08:13:03
0001 #include "EpInfo.h"
0002 #include "TMath.h"
0003 #include <iostream>
0004
0005 EpInfo::EpInfo(){
0006 for (int iorder=0; iorder<_EpOrderMax; iorder++){
0007 for (int xy=0; xy<2; xy++){
0008 QrawOneSide[iorder][xy] = 0.0;
0009 QphiWeightedOneSide[iorder][xy] = 0.0;
0010 }
0011 }
0012
0013 for (int iorder=0; iorder<_EpOrderMax; iorder++){
0014 PsiRaw[iorder] = -999.0;
0015 PsiPhiWeighted[iorder] = -999.0;
0016 PsiPhiWeightedAndShifted[iorder] = -999.0;
0017 }
0018 }
0019
0020
0021
0022
0023
0024 TVector2 EpInfo::RawQ(int order){
0025 if (ArgumentOutOfBounds(order)){
0026 TVector2 crap(-999,-999);
0027 return crap;
0028 }
0029 TVector2 q(QrawOneSide[order-1][0],QrawOneSide[order-1][1]);
0030 return q;
0031 }
0032
0033
0034 TVector2 EpInfo::PhiWeightedQ(int order){
0035 if (ArgumentOutOfBounds(order)){
0036 TVector2 crap(-999,-999);
0037 return crap;
0038 }
0039 TVector2 q(QphiWeightedOneSide[order-1][0],QphiWeightedOneSide[order-1][1]);
0040 return q;
0041 }
0042
0043
0044 double EpInfo::SWRaw(int order){
0045 if (ArgumentOutOfBounds(order)) return -999;
0046 return WheelSumWeightsRaw[order-1];
0047 }
0048
0049
0050 double EpInfo::SWPhiWeighted(int order){
0051 if (ArgumentOutOfBounds(order)) return -999;
0052 return WheelSumWeightsPhiWeighted[order-1];
0053 }
0054
0055
0056
0057
0058 double EpInfo::RawPsi(int order){
0059 if (ArgumentOutOfBounds(order)) return -999;
0060 return Range(PsiRaw[order-1],order);
0061 }
0062
0063
0064
0065 double EpInfo::PhiWeightedPsi(int order){
0066 if (ArgumentOutOfBounds(order)) return -999;
0067 return Range(PsiPhiWeighted[order-1],order);
0068 }
0069
0070
0071
0072 double EpInfo::PhiWeightedAndShiftedPsi(int order){
0073 if (ArgumentOutOfBounds(order)) return -999;
0074 return Range(PsiPhiWeightedAndShifted[order-1],order);
0075 }
0076
0077
0078
0079
0080
0081 double EpInfo::Range(double psi,int order){
0082 if (ArgumentOutOfBounds(order)) return -999;
0083 double wrap = 2.0*TMath::Pi()/(double)order;
0084 if (psi<0.0) psi += (1.0+(int)(fabs(psi)/wrap))*wrap;
0085 else{ if (psi>wrap) psi -= ((int)(psi/wrap))*wrap;}
0086 return psi;
0087 }
0088
0089
0090 bool EpInfo::ArgumentOutOfBounds(int order){
0091 if ((order<1)||(order>_EpOrderMax)){
0092 std::cout << "\n *** Invalid order requested ***\n";
0093 std::cout << " order must be between 1 (for first-order EP) and " << _EpOrderMax
0094 << ". To change the upuper limit, edit StEpdUtil/EpInfo.h\n";
0095 std::cout << " I will now return you an invalid result. Have a nice day\n";
0096 return true;
0097 }
0098 return false;
0099 }
0100