6 #include "TProfile2D.h"
7 #include "TClonesArray.h"
16 EpFinder::EpFinder(
int nEventTypeBins,
char const* OutFileName,
char const* CorrectionFile,
int pbinsx,
int pbinsy) : mThresh(0.3), mMax(2.0)
19 cout <<
"\n**********\n* Welcome to the Event Plane finder.\n"
20 <<
"* Please note that when you specify 'order' as an argument to a method,\n"
21 <<
"* then 1=first-order plane, 2=second-order plane, etc.\n"
22 <<
"* This code is currently configured to go up to order=" <<
_EpOrderMax <<
"\n";
23 cout <<
"**********\n";
31 std::cout <<
"EPFinder: Error opening file with Correction Histograms" << std::endl;
32 std::cout <<
"EPFinder: I will use no weighting at all." << std::endl;
33 for (
int order=1; order<_EpOrderMax+1; order++){
40 for (
int order=1; order<_EpOrderMax+1; order++){
49 for (
int order=1; order<_EpOrderMax+1; order++){
50 mEpShiftOutput_sin[order-1] =
new TProfile2D(Form(
"EpShiftPsi%d_sin",order),Form(
"EpShiftPsi%d_sin",order),
52 mEpShiftOutput_cos[order-1] =
new TProfile2D(Form(
"EpShiftPsi%d_cos",order),Form(
"EpShiftPsi%d_cos",order),
56 if(pbinsx<=0) pbinsx = 1;
57 if(pbinsy<=0) pbinsy = 1;
61 mPhiWeightOutput =
new TH2D(Form(
"PhiWeight"),Form(
"Phi Weight"),pbinsx,-0.5,(pbinsx-0.5),pbinsy,-0.5,(pbinsy-0.5));
63 mPhiAveraged =
new TH2D(Form(
"PhiAveraged"),Form(
"Phi Average"),pbinsx,-0.5,(pbinsx-0.5),pbinsy,-0.5,(pbinsy-0.5));
77 cout <<
"EpFinder is finished!\n\n";
84 cout <<
"You are asking for an undefined EventType - fail!\n";
90 double pi = TMath::Pi();
94 for (
int phiWeightedOrNo=0; phiWeightedOrNo<2; phiWeightedOrNo++){
96 TotalWeight4Side[order-1][phiWeightedOrNo] = 0;
101 for (
unsigned int hit=0; hit<EpdHits->size(); hit++){
103 float nMip = EpdHits->at(hit).nMip;
105 double TileWeight = (nMip<
mMax)?nMip:
mMax;
106 int idx_x = EpdHits->at(hit).ix;
107 int idx_y = EpdHits->at(hit).iy;
108 double phi = EpdHits->at(hit).phi;
115 if(EpdHits->at(hit).samePhi){
117 for(
unsigned int i = 0;
i<EpdHits->at(hit).samePhi->size();
i++){
118 float x = EpdHits->at(hit).samePhi->at(
i).first;
119 float y = EpdHits->at(hit).samePhi->at(
i).second;
120 mPhiAveraged->Fill(x,y,TileWeight/EpdHits->at(hit).samePhi->size());
128 double PhiWeightedTileWeight = TileWeight;
132 double etaWeight = 1.0;
133 TotalWeight4Side[order-1][0] += fabs(etaWeight) * TileWeight;
134 TotalWeight4Side[order-1][1] += fabs(etaWeight) * PhiWeightedTileWeight;
136 double Cosine = cos(phi*(
double)order);
137 double Sine = sin(phi*(
double)order);
139 result.
QrawOneSide[order-1][0] += etaWeight * TileWeight * Cosine;
140 result.
QrawOneSide[order-1][1] += etaWeight * TileWeight * Sine;
159 for (
int order=1; order<_EpOrderMax+1; order++){
160 if (TotalWeight4Side[order-1][0]>0.0001){
161 result.
QrawOneSide[order-1][0] /= TotalWeight4Side[order-1][0];
162 result.
QrawOneSide[order-1][1] /= TotalWeight4Side[order-1][0];
164 if (TotalWeight4Side[order-1][1]>0.0001){
175 for (
int order=1; order<_EpOrderMax+1; order++){
183 for (
int order=1; order<_EpOrderMax+1; order++){
193 double AngleWrapAround = 2.0*pi/(
double)order;
203 for (
int order=1; order<_EpOrderMax+1; order++){
215 if ((Qx==0.0)||(Qy==0.0)) temp=-999;
217 temp = atan2(Qy,Qx)/((
double)order);
218 double AngleWrapAround = 2.0*TMath::Pi()/(
double)order;
219 if (temp<0.0) temp+= AngleWrapAround;
220 else if (temp>AngleWrapAround) temp -= AngleWrapAround;
227 cout <<
"\n*** Invalid order specified ***\n";
228 cout <<
"order must be 1 (for first-order plane) or higher\n";
232 cout <<
"\n*** Invalid order specified ***\n";
233 cout <<
"Maximum order=" <<
_EpOrderMax <<
". To change, edit StEpdUtil/StEpdEpInfo.h\n";
240 TString rep = Form(
"This is the EpFinder Report:\n");
242 rep += Form(
"Threshold (in MipMPV units) = %f and MAX weight = %f\n",
mThresh,
mMax);