43 #include "StHbtMaker/CorrFctn/NonIdPurityCorrFctn.h"
51 NonIdPurityCorrFctn::NonIdPurityCorrFctn(
char* title,
const int& nbins,
const float& QinvLo,
const float& QinvHi,
int p1Type,
int p2Type){
53 char TitNumP[100] =
"NumP";
54 strcat(TitNumP,title);
55 mNumP =
new StHbt1DHisto(TitNumP,title,nbins,QinvLo,QinvHi);
57 char TitDenP[100] =
"DenP";
58 strcat(TitDenP,title);
59 mDenP =
new StHbt1DHisto(TitDenP,title,nbins,QinvLo,QinvHi);
61 char TitRatP[100] =
"RatP";
62 strcat(TitRatP,title);
63 mRatP =
new StHbt1DHisto(TitRatP,title,nbins,QinvLo,QinvHi);
65 char TitNumN[100] =
"NumN";
66 strcat(TitNumN,title);
67 mNumN =
new StHbt1DHisto(TitNumN,title,nbins,QinvLo,QinvHi);
69 char TitDenN[100] =
"DenN";
70 strcat(TitDenN,title);
71 mDenN =
new StHbt1DHisto(TitDenN,title,nbins,QinvLo,QinvHi);
73 char TitRatN[100] =
"RatN";
74 strcat(TitRatN,title);
75 mRatN =
new StHbt1DHisto(TitRatN,title,nbins,QinvLo,QinvHi);
77 char TitRat[100] =
"Rat";
79 mRat =
new StHbt1DHisto(TitRat,title,nbins,QinvLo,QinvHi);
81 char TitRatNOverP[100] =
"RatNOverP";
82 strcat(TitRatNOverP,title);
83 mRatNOverP =
new StHbt1DHisto(TitRatNOverP,title,nbins,QinvLo,QinvHi);
125 char TitPairPurity[100];
126 strcpy(TitPairPurity,
"PairPurityOut");
127 strcat(TitPairPurity,title);
128 mPairPurityOut =
new TProfile(TitPairPurity,title,2*nbins,-QinvHi,QinvHi);
129 strcpy(TitPairPurity,
"PairPuritySide");
130 strcat(TitPairPurity,title);
131 mPairPuritySide =
new TProfile(TitPairPurity,title,2*nbins,-QinvHi,QinvHi);
132 strcpy(TitPairPurity,
"PairPurityLong");
133 strcat(TitPairPurity,title);
134 mPairPurityLong =
new TProfile(TitPairPurity,title,2*nbins,-QinvHi,QinvHi);
169 NonIdPurityCorrFctn::~NonIdPurityCorrFctn(){
196 delete mPairPurityOut;
197 delete mPairPuritySide;
198 delete mPairPurityLong;
202 void NonIdPurityCorrFctn::Finish(){
204 int tLastNormBin = mNumP->GetNbinsX();
205 int tFirstNormBin = tLastNormBin/2+1;
207 mRatP->Divide(mNumP,mDenP,1.0,1.0);
208 tScale = mRatP->Integral(tFirstNormBin,tLastNormBin);
209 tScale/= (tLastNormBin-tFirstNormBin+1);
210 mRatP->Scale(1./tScale);
211 mRatN->Divide(mNumN,mDenN,1.0,1.0);
212 tScale = mRatN->Integral(tFirstNormBin,tLastNormBin);
213 tScale/= (tLastNormBin-tFirstNormBin+1);
214 mRatN->Scale(1./tScale);
215 mRatNOverP->Divide(mRatN,mRatP,1.0,1.0);
223 tHNum.SetName(
"tHNum");
226 tHDen.SetName(
"tHDen");
228 mRat->Divide(&tHNum,&tHDen);
229 tScale = mRat->Integral(tFirstNormBin,tLastNormBin);
230 tScale/= (tLastNormBin-tFirstNormBin+1);
231 mRat->Scale(1./tScale);
249 void NonIdPurityCorrFctn::Write(){
275 mPairPurityOut->Write();
276 mPairPuritySide->Write();
277 mPairPurityLong->Write();
281 StHbtString NonIdPurityCorrFctn::Report(){
282 string stemp =
"Qinv Correlation Function Report:\n";
284 sprintf(ctemp,
"Number of entries in numerator:\t%E\n",mNumP->GetEntries());
286 sprintf(ctemp,
"Number of entries in denominator:\t%E\n",mDenP->GetEntries());
288 sprintf(ctemp,
"Number of entries in ratio:\t%E\n",mRatP->GetEntries());
290 StHbtString returnThis = stemp;
294 void NonIdPurityCorrFctn::AddRealPair(
const StHbtPair* pair){
295 double tKStar = fabs(pair->KStar());
297 double tCVK = pair->CVK();
298 double pPurity = 0.0;
299 double tKOut = pair->dKOut();
300 double tKSide = pair->dKSide();
301 double tKLong = pair->dKLong();
327 pPurity = pair->track1()->GetPionPurity();
330 pPurity = pair->track1()->GetKaonPurity();
333 pPurity = pair->track1()->GetProtonPurity();
336 pPurity = pair->track1()->Track()->PidProbElectron();
345 pPurity *= pair->track2()->GetPionPurity();
348 pPurity *= pair->track2()->GetKaonPurity();
351 pPurity *= pair->track2()->GetProtonPurity();
354 pPurity *= pair->track2()->Track()->PidProbElectron();
359 mPairPurityOut->Fill(((tKOut>0)*2-1) *tKStar, pPurity);
360 mPairPuritySide->Fill(((tKSide>0)*2-1)*tKStar, pPurity);
361 mPairPurityLong->Fill(((tKLong>0)*2-1)*tKStar, pPurity);
365 void NonIdPurityCorrFctn::AddMixedPair(
const StHbtPair* pair){
366 double tKStar = 2*fabs(pair->KStar());
368 double tCVK = pair->CVK();