17 #include "StHbtMaker/ThCorrFctn/ThBPCorrFctn.h"
26 double tQinv = 2 * fabs(aThPair->GetMeasPair()->KStar());
27 if ((tQinv < mQinvNormHi) && (tQinv > mQinvNormLo)) mNumRealsNorm++;
28 double qOut = aThPair->GetMeasPair()->qOutCMS();
29 double qSide = aThPair->GetMeasPair()->qSideCMS();
30 double qLong = fabs(aThPair->GetMeasPair()->qLongCMS());
33 mNumerator->Fill(qOut,qSide,qLong,aThPair->GetWeightNum());
37 double tQinv= 2 * fabs(aThPair->GetMeasPair()->KStar());
38 if ((tQinv < mQinvNormHi) && (tQinv > mQinvNormLo)) mNumMixedNorm++;
39 double qOut = aThPair->GetMeasPair()->qOutCMS();
40 double qSide = aThPair->GetMeasPair()->qSideCMS();
41 double qLong = fabs(aThPair->GetMeasPair()->qLongCMS());
43 if ((addedHistos == 1) && (tQinv < 0.1)) {
44 add2DHistos[0]->Fill(fabs(qOut), -(fabs(qOut) - fabs(aThPair->RealqOutCMS())), 1.0);
45 add2DHistos[1]->Fill(fabs(qSide), -(fabs(qSide) - fabs(aThPair->RealqSideCMS())), 1.0);
46 add2DHistos[2]->Fill(fabs(qLong), -(fabs(qLong) - fabs(aThPair->RealqLongCMS())), 1.0);
50 mDenominator->Fill(qOut,qSide,qLong,aThPair->GetWeightDen());
51 mQinvHisto->Fill(qOut,qSide,qLong,tQinv);
54 void ThBPCorrFctn::Finish(){
56 double NumFact,DenFact;
57 if ((mNumRealsNorm !=0) && (mNumMixedNorm !=0)){
58 NumFact = double(mNumRealsNorm);
59 DenFact = double(mNumMixedNorm);
65 cout <<
"Warning! - no normalization constants defined - I do the best I can..." << endl;
66 int nbins = mNumerator->GetNbinsX();
67 int half_way = nbins/2;
68 NumFact = mNumerator->Integral(half_way,nbins,half_way,nbins,half_way,nbins);
69 DenFact = mDenominator->Integral(half_way,nbins,half_way,nbins,half_way,nbins);
72 mRatio->Divide(mNumerator,mDenominator,DenFact,NumFact);
73 mQinvHisto->Divide(mDenominator);
76 ThBPCorrFctn::ThBPCorrFctn(
char* aTitle,
int aNBins,
77 double aHLo,
double aHHi,
int addHistos)
86 char TitNum[100] =
"Num";
87 strcat(TitNum,aTitle);
88 mNumerator =
new StHbt3DHisto(TitNum,aTitle,aNBins,aHLo,aHHi,aNBins,aHLo,aHHi,aNBins/2,0.0,aHHi);
90 char TitDen[100] =
"Den";
91 strcat(TitDen,aTitle);
92 mDenominator =
new StHbt3DHisto(TitDen,aTitle,aNBins,aHLo,aHHi,aNBins,aHLo,aHHi,aNBins/2,0.0,aHHi);
94 char TitRat[100] =
"Rat";
95 strcat(TitRat,aTitle);
96 mRatio =
new StHbt3DHisto(TitRat,aTitle,aNBins,aHLo,aHHi,aNBins,aHLo,aHHi,aNBins/2,0.0,aHHi);
98 char TitQinv[100] =
"Qinv";
99 strcat(TitQinv,aTitle);
100 mQinvHisto =
new StHbt3DHisto(TitQinv,aTitle,aNBins,aHLo,aHHi,aNBins,aHLo,aHHi,aNBins/2,0.0,aHHi);
104 mDenominator->Sumw2();
107 addedHistos = addHistos;
108 if (addHistos == 1) {
109 Int_t qdepNBins = 10;
110 Int_t qdiffNBins = 50;
111 Float_t qdepMin = 0.0, qdepMax=0.1;
112 Float_t qdiffMin = -0.025, qdiffMax = 0.025;
115 add2DHistos =
new StHbt2DHistoP[3];
116 char Tit1add[100] =
"Qout";
117 strcat(Tit1add,aTitle);
118 add2DHistos[0] =
new StHbt2DHisto(Tit1add,aTitle,qdepNBins, qdepMin, qdepMax, qdiffNBins, qdiffMin, qdiffMax);
119 char Tit2add[100] =
"Qside";
120 strcat(Tit2add,aTitle);
121 add2DHistos[1] =
new StHbt2DHisto(Tit2add,aTitle,qdepNBins, qdepMin, qdepMax, qdiffNBins, qdiffMin, qdiffMax);
122 char Tit3add[100] =
"Qlong";
123 strcat(Tit3add,aTitle);
124 add2DHistos[2] =
new StHbt2DHisto(Tit3add,aTitle,qdepNBins, qdepMin, qdepMax, qdiffNBins, qdiffMin, qdiffMax);
130 mQinvNormLo = ThCf.mQinvNormLo;
131 mQinvNormHi = ThCf.mQinvNormHi;
132 mNumRealsNorm = ThCf.mNumRealsNorm;
133 mNumMixedNorm = ThCf.mNumMixedNorm;
135 mNumerator =
new StHbt3DHisto(*ThCf.mNumerator);
136 mDenominator =
new StHbt3DHisto(*ThCf.mDenominator);
137 mRatio =
new StHbt3DHisto(*ThCf.mRatio);
138 mQinvHisto =
new StHbt3DHisto(*ThCf.mQinvHisto);
141 StHbtString ThBPCorrFctn::Report()
143 std::ostringstream *out =
new std::ostringstream();
144 (*out) <<
"Report form the ThBPLCMS Correlation function" << endl;
148 ThBPCorrFctn::~ThBPCorrFctn()
154 if (addedHistos > 0) {
155 for (
int i=0; i<numAdd2DHistos; i++)
156 delete add2DHistos[i];
161 void ThBPCorrFctn::Write() {
162 mNumerator->Write();mDenominator->Write();mRatio->Write();
163 if (addedHistos > 0) {
164 for (
int i=0; i<numAdd2DHistos; i++)
165 add2DHistos[i]->Write();
169 inline StHbt3DHisto* ThBPCorrFctn::Numerator()
const {
return mNumerator;};
170 inline StHbt3DHisto* ThBPCorrFctn::Denominator()
const {
return mDenominator;};
171 inline StHbt3DHisto* ThBPCorrFctn::Ratio()
const {
return mRatio;};