StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
QinvCorrFctnKt.cxx
1 /***************************************************************************
2  *
3  * $Id: QinvCorrFctnKt.cxx,v 1.3 2003/09/02 17:58:20 perev Exp $
4  *
5  * Author: Mercedes Lopez Noriega, OSU, mercedes@pacific.mps.ohio-state.edu
6  ***************************************************************************
7  *
8  * Description: part of STAR HBT Framework: StHbtMaker package
9  * QinvCFs for a given number of CFs (nCFs) between ktLo and ktHi
10  * where kt is the four-momentum of the pair
11  *
12  ***************************************************************************
13  *
14  * $Log: QinvCorrFctnKt.cxx,v $
15  * Revision 1.3 2003/09/02 17:58:20 perev
16  * gcc 3.2 updates + WarnOff
17  *
18  * Revision 1.2 2003/01/31 19:21:09 magestro
19  * Cleared up simple compiler warnings on i386_linux24
20  *
21  * Revision 1.1 2002/05/17 14:26:21 mercedes
22  * N Qinv CFs (kt bins) between ktmin and ktmax
23  *
24  *
25  **************************************************************************/
26 
27 #include "StHbtMaker/CorrFctn/QinvCorrFctnKt.h"
28 //#include "StHbtMaker/Infrastructure/StHbtHisto.hh"
29 #include <cstdio>
30 
31 #ifdef __ROOT__
32 ClassImp(QinvCorrFctnKt)
33 #endif
34 
35 //____________________________
36 QinvCorrFctnKt::QinvCorrFctnKt(char* title, const int& nbins, const float& QinvLo, const float& QinvHi,
37  const int& nCFs, const float& KtLo, const float& KtHi){
38  mNumberCFs = nCFs;
39  mKtMin = KtLo;
40  mKtMax = KtHi;
41  mDeltaKt = (mKtMax-mKtMin)/mNumberCFs;
42 
43  // set up numerators
44  mNumerator = new StHbt1DHisto[mNumberCFs];
45 
46  // set up denominators
47  mDenominator = new StHbt1DHisto[mNumberCFs];
48 
49  // set up ratios
50  mRatio = new StHbt1DHisto[mNumberCFs];
51 
52  char TitNum[100] = "Num";
53  strcat(TitNum,title);
54  char TitDen[100] = "Den";
55  strcat(TitDen,title);
56  char TitRat[100] = "Rat";
57  strcat(TitRat,title);
58 
59  for (int i=0; i<mNumberCFs; i++){
60 
61  sprintf(TitNum,"NumQInvCFKtBin%d",i);
62  mNumerator[i].SetName(TitNum);
63  mNumerator[i].SetTitle(title);
64  mNumerator[i].SetBins(nbins,QinvLo,QinvHi);
65  mNumerator[i].SetDirectory(0);
66  mNumerator[i].Sumw2();
67 
68  sprintf(TitDen,"DenQInvCFKtBin%d",i);
69  mDenominator[i].SetName(TitDen);
70  mDenominator[i].SetTitle(title);
71  mDenominator[i].SetBins(nbins,QinvLo,QinvHi);
72  mDenominator[i].SetDirectory(0);
73  mDenominator[i].Sumw2();
74 
75  sprintf(TitRat,"RatQInvCFKtBin%d",i);
76  mRatio[i].SetName(TitRat);
77  mRatio[i].SetTitle(title);
78  mRatio[i].SetBins(nbins,QinvLo,QinvHi);
79  mRatio[i].SetDirectory(0);
80  mRatio[i].Sumw2();
81  }
82 }
83 //____________________________
84 QinvCorrFctnKt::~QinvCorrFctnKt(){
85  delete [] mNumerator;
86  delete [] mDenominator;
87  delete [] mRatio;
88 }
89 //_________________________
90 void QinvCorrFctnKt::Finish(){
91  for (int i=0; i<mNumberCFs; i++){
92  mRatio[i].Divide(&mNumerator[i],&mDenominator[i],1.0,1.0);
93  }
94 }
95 //____________________________
96 StHbtString QinvCorrFctnKt::Report(){
97  int mNumeratorEntries=0;
98  int mDenominatorEntries=0;
99  int mRatioEntries=0;
100 
101  for (int i=0; i<mNumberCFs; i++){
102  mNumeratorEntries += (int)mNumerator[i].GetEntries();
103  mDenominatorEntries += (int)mDenominator[i].GetEntries();
104  mRatioEntries += (int)mRatio[i].GetEntries();
105  }
106  string stemp = "Qinv Correlation Function Report:\n";
107  char ctemp[100];
108  sprintf(ctemp,"Number of entries in all numerators:\t%i\n",mNumeratorEntries);
109  stemp += ctemp;
110  sprintf(ctemp,"Number of entries in all denominators:\t%i\n",mDenominatorEntries);
111  stemp += ctemp;
112  sprintf(ctemp,"Number of entries in all ratios:\t%i\n",mRatioEntries);
113  stemp += ctemp;
114  StHbtString returnThis = stemp;
115  return returnThis;
116 }
117 //____________________________
118 void QinvCorrFctnKt::AddRealPair(const StHbtPair* pair){
119  int mIndex = (int)(((fabs(pair->kT())-mKtMin)/mDeltaKt));
120  if ((mIndex>=0)&&(mIndex<mNumberCFs)){
121  mNumerator[mIndex].Fill(fabs(pair->qInv()),1.0);
122  }
123 }
124 //____________________________
125 void QinvCorrFctnKt::AddMixedPair(const StHbtPair* pair){
126  int mIndex = (int)(((fabs(pair->kT())-mKtMin)/mDeltaKt));
127  if ((mIndex>=0)&&(mIndex<mNumberCFs)){
128  mDenominator[mIndex].Fill(fabs(pair->qInv()),1.0);
129  }
130 }
131 
132