16 #include "StHbtMaker/Base/StHbtRoot1DCF.hh"
24 StHbtRoot1DCF::StHbtRoot1DCF(
25 char* aHTitle,
int aHNBins,
double aHLo,
double aHHi)
28 StHbtNamed::SetName(aHTitle);
29 char* tName=
new char[strlen(GetName())+4];
30 strcpy(tName+3,GetName());
32 memcpy(tName,
"Num",3);
33 mNumerator =
new StHbt1DHisto(tName,GetName(),aHNBins,mHLo,mHHi);
35 memcpy(tName,
"Den",3);
36 mDenominator =
new StHbt1DHisto(tName,GetName(),aHNBins,mHLo,mHHi);
38 memcpy(tName,
"Rat",3);
39 mRatio =
new StHbt1DHisto(tName,GetName(),aHNBins,mHLo,mHHi);
43 mDenominator->Sumw2();
57 StHbtRoot1DCF::~StHbtRoot1DCF(){
63 void StHbtRoot1DCF::SetName(
const char* aName) {
64 StHbtNamed::SetName(aName);
65 int tLen=strlen(GetName());
67 char* tHName=
new char[tLen+4];
68 memcpy(tHName+3,GetName(),tLen+1);
70 memcpy(tHName,
"Num",3);
71 mNumerator->SetTitle(GetName());
72 mNumerator->SetName(tHName);
74 memcpy(tHName,
"Den",3);
75 mDenominator->SetTitle(GetName());
76 mDenominator->SetName(tHName);
78 memcpy(tHName,
"Rat",3);
79 mRatio->SetTitle(GetName());
80 mRatio->SetName(tHName);
87 void StHbtRoot1DCF::Finish(){
88 mRatio->Divide(mNumerator,mDenominator,1.0,1.0);
90 if ((
int)mNumerator->GetEntries()==(int)mDenominator->GetEntries()){
93 int tNcell=mRatio->GetNbinsX()*mRatio->GetNbinsY()*mRatio->GetNbinsZ();
94 for(i=0;i<tNcell;i++){
95 if (mDenominator->GetBinContent(i)) {
96 mRatio->SetBinError(i,
97 ::sqrt((::pow(mNumerator->GetBinError(i),2)/mDenominator->GetBinContent(i)-
98 ::pow(mRatio->GetBinContent(i),2))/mDenominator->GetBinContent(i)));
100 mRatio->SetBinError(i,0.);
107 StHbtString StHbtRoot1DCF::Report(){
108 std::ostringstream tStr;
109 tStr << GetName() <<
" Correlation Function Report:"<< endl;
110 tStr <<
"Number of entries in numerator: " << mNumerator->GetEntries() << endl;;
111 tStr <<
"Number of entries in denominator: " << mDenominator->GetEntries() << endl;
112 StHbtString returnThis = tStr.str();