38 #include "StHbtMaker/CorrFctn/BPLCMSFrame3DCorrFctn.h"
47 BPLCMSFrame3DCorrFctn::BPLCMSFrame3DCorrFctn(
char* title,
const int& nbins,
const float& QLo,
const float& QHi){
61 char TitNum[100] =
"Num";
63 mNumerator =
new StHbt3DHisto(TitNum,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
65 char TitDen[100] =
"Den";
67 mDenominator =
new StHbt3DHisto(TitDen,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
69 char TitDenUncoul[100] =
"DenNoCoul";
70 strcat(TitDenUncoul,title);
71 mUncorrectedDenominator =
new StHbt3DHisto(TitDenUncoul,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
73 char TitRat[100] =
"Rat";
75 mRatio =
new StHbt3DHisto(TitRat,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
77 char TitQinv[100] =
"Qinv";
78 strcat(TitQinv,title);
79 mQinvHisto =
new StHbt3DHisto(TitQinv,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
83 mDenominator->Sumw2();
84 mUncorrectedDenominator->Sumw2();
90 char TitNumID[100] =
"IDNum";
91 strcat(TitNumID,title);
92 mIDNumHisto =
new StHbt3DHisto(TitNumID,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
93 char TitDenID[100] =
"IDDen";
94 strcat(TitDenID,title);
95 mIDDenHisto =
new StHbt3DHisto(TitDenID,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
96 char TitRatID[100] =
"IDRat";
97 strcat(TitRatID,title);
98 mIDRatHisto =
new StHbt3DHisto(TitRatID,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
100 mIDNumHisto->Sumw2();
101 mIDDenHisto->Sumw2();
102 mIDRatHisto->Sumw2();
106 char TitNumSM[100] =
"SMNum";
107 strcat(TitNumSM,title);
108 mSMNumHisto =
new StHbt3DHisto(TitNumSM,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
109 char TitDenSM[100] =
"SMDen";
110 strcat(TitDenSM,title);
111 mSMDenHisto =
new StHbt3DHisto(TitDenSM,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
112 char TitRatSM[100] =
"SMRat";
113 strcat(TitRatSM,title);
114 mSMRatHisto =
new StHbt3DHisto(TitRatSM,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
116 mSMNumHisto->Sumw2();
117 mSMDenHisto->Sumw2();
118 mSMRatHisto->Sumw2();
121 char TitCorrection[100] =
"CorrectionFactor";
122 strcat(TitCorrection,title);
123 mCorrectionHisto =
new StHbt3DHisto(TitCorrection,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
124 mCorrectionHisto->Sumw2();
126 char TitCorrCF[100] =
"CorrectedCF";
127 strcat(TitCorrCF,title);
128 mCorrCFHisto =
new StHbt3DHisto(TitCorrCF,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
129 mCorrCFHisto->Sumw2();
140 BPLCMSFrame3DCorrFctn::~BPLCMSFrame3DCorrFctn(){
151 delete mCorrectionHisto;
156 void BPLCMSFrame3DCorrFctn::WriteOutHistos(){
159 mDenominator->Write();
160 mUncorrectedDenominator->Write();
165 mIDNumHisto->Write();
166 mIDDenHisto->Write();
167 mIDRatHisto->Write();
169 mSMNumHisto->Write();
170 mSMDenHisto->Write();
171 mSMRatHisto->Write();
173 mCorrectionHisto->Write();
174 mCorrCFHisto->Write();
179 void BPLCMSFrame3DCorrFctn::Finish(){
181 double NumFact,DenFact;
182 if ((mNumRealsNorm !=0) && (mNumMixedNorm !=0)){
183 NumFact = double(mNumRealsNorm);
184 DenFact = double(mNumMixedNorm);
190 cout <<
"Warning! - no normalization constants defined - I do the best I can..." << endl;
191 int nbins = mNumerator->GetNbinsX();
192 int half_way = nbins/2;
193 NumFact = mNumerator->Integral(half_way,nbins,half_way,nbins,half_way,nbins);
194 DenFact = mDenominator->Integral(half_way,nbins,half_way,nbins,half_way,nbins);
197 mRatio->Divide(mNumerator,mDenominator,DenFact,NumFact);
198 mQinvHisto->Divide(mUncorrectedDenominator);
202 mIDRatHisto->Divide(mIDNumHisto,mIDDenHisto);
203 mSMRatHisto->Divide(mSMNumHisto,mSMDenHisto);
204 mCorrectionHisto->Divide(mIDRatHisto,mSMRatHisto);
205 mCorrCFHisto->Multiply(mRatio,mCorrectionHisto);
211 StHbtString BPLCMSFrame3DCorrFctn::Report(){
212 string stemp =
"LCMS Frame Bertsch-Pratt 3D Correlation Function Report:\n";
214 sprintf(ctemp,
"Number of entries in numerator:\t%E\n",mNumerator->GetEntries());
216 sprintf(ctemp,
"Number of entries in denominator:\t%E\n",mDenominator->GetEntries());
218 sprintf(ctemp,
"Number of entries in ratio:\t%E\n",mRatio->GetEntries());
220 sprintf(ctemp,
"Normalization region in Qinv was:\t%E\t%E\n",mQinvNormLo,mQinvNormHi);
222 sprintf(ctemp,
"Number of pairs in Normalization region was:\n");
224 sprintf(ctemp,
"In numerator:\t%lu\t In denominator:\t%lu\n",mNumRealsNorm,mNumMixedNorm);
228 float radius = mCorrection->GetRadius();
229 sprintf(ctemp,
"Coulomb correction used radius of\t%E\n",radius);
233 sprintf(ctemp,
"No Coulomb Correction applied to this CorrFctn\n");
238 sprintf(ctemp,
"Here is the PairCut specific to this CorrFctn\n");
240 stemp += mPairCut->Report();
243 sprintf(ctemp,
"No PairCut specific to this CorrFctn\n");
248 StHbtString returnThis = stemp;
252 void BPLCMSFrame3DCorrFctn::AddRealPair(
const StHbtPair* pair){
255 if (!(mPairCut->Pass(pair)))
return;
258 double Qinv = fabs(pair->qInv());
259 if ((Qinv < mQinvNormHi) && (Qinv > mQinvNormLo)) mNumRealsNorm++;
260 double qOut = fabs(pair->qOutCMS());
261 double qSide = fabs(pair->qSideCMS());
262 double qLong = fabs(pair->qLongCMS());
264 mNumerator->Fill(qOut,qSide,qLong);
267 void BPLCMSFrame3DCorrFctn::AddMixedPair(
const StHbtPair* pair){
270 if (!(mPairCut->Pass(pair)))
return;
273 double CoulombWeight = (mCorrection ? mCorrection->CoulombCorrect(pair) : 1.0);
275 double Qinv = fabs(pair->qInv());
276 if ((Qinv < mQinvNormHi) && (Qinv > mQinvNormLo)) mNumMixedNorm++;
277 double qOut = fabs(pair->qOutCMS());
278 double qSide = fabs(pair->qSideCMS());
279 double qLong = fabs(pair->qLongCMS());
281 mDenominator->Fill(qOut,qSide,qLong,CoulombWeight);
282 mUncorrectedDenominator->Fill(qOut,qSide,qLong,1.0);
283 mQinvHisto->Fill(qOut,qSide,qLong,Qinv);
287 double CorrWeight = 1.0 +
288 mLambda*exp((-qOut*qOut*mRout2 -qSide*qSide*mRside2 -qLong*qLong*mRlong2)/0.038936366329);
289 CorrWeight *= CoulombWeight;
291 mIDNumHisto->Fill(qOut,qSide,qLong,CorrWeight);
292 mIDDenHisto->Fill(qOut,qSide,qLong,CoulombWeight);
294 mSmearPair->SetUnsmearedPair(pair);
295 double qOut_prime = fabs(mSmearPair->SmearedPair().qOutCMS());
296 double qSide_prime = fabs(mSmearPair->SmearedPair().qSideCMS());
297 double qLong_prime = fabs(mSmearPair->SmearedPair().qLongCMS());
299 mSMNumHisto->Fill(qOut_prime,qSide_prime,qLong_prime,CorrWeight);
301 double SmearedCoulombWeight = ( mCorrection ?
302 mCorrection->CoulombCorrect(&(mSmearPair->SmearedPair())) :
305 mSMDenHisto->Fill(qOut_prime,qSide_prime,qLong_prime,SmearedCoulombWeight);