StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
BPLCMSFrame3DCorrFctnKt.cxx
1 /***************************************************************************
2  *
3  * $Id: BPLCMSFrame3DCorrFctnKt.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  * This one does 3D Bertsch-Pratt decomposition in the LCMS frame,
10  * for kt between ktLo and ktHi max for a given number of bins (nCFs)
11  * kt is the transverse four-momentum of the pair
12  *
13  ***************************************************************************
14  *
15  * $Log: BPLCMSFrame3DCorrFctnKt.cxx,v $
16  * Revision 1.3 2003/09/02 17:58:20 perev
17  * gcc 3.2 updates + WarnOff
18  *
19  * Revision 1.2 2003/01/31 19:21:09 magestro
20  * Cleared up simple compiler warnings on i386_linux24
21  *
22  * Revision 1.1 2002/05/17 14:25:31 mercedes
23  * N 3D Bertsch-Pratt decomposition (kt bins) between ktmin and ktmax (LCMSFrame)
24  *
25  *
26  **************************************************************************/
27 
28 #include "StHbtMaker/CorrFctn/BPLCMSFrame3DCorrFctnKt.h"
29 #include <cstdio>
30 
31 #ifdef __ROOT__
33 #endif
34 
35 //____________________________
36 BPLCMSFrame3DCorrFctnKt::BPLCMSFrame3DCorrFctnKt(char* title, const int& nbins, const float& QLo, const float& QHi,
37  const int& nCFs, const float& KtLo, const float& KtHi){
38 
39  // set some stuff...
40 
41  mNumberCFs = nCFs;
42  mKtMin = KtLo;
43  mKtMax = KtHi;
44  mDeltaKt = (mKtMax-mKtMin)/mNumberCFs;
45 
46  mQinvNormLo = 0.15;
47  mQinvNormHi = 0.18;
48  mNumRealsNorm = 0;
49  mNumMixedNorm = 0;
50  mCorrection = 0; // pointer to Coulomb Correction object
51 
52  // set up numerator
53  mNumerator = new StHbt3DHisto[mNumberCFs];
54 
55  // set up denominator
56  mDenominator = new StHbt3DHisto[mNumberCFs];
57 
58  // set up ratio
59  mRatio = new StHbt3DHisto[mNumberCFs];
60 
61  // set up ave qInv
62  mQinvHisto = new StHbt3DHisto[mNumberCFs];
63 
64  char TitNum[100] = "Num";
65  strcat(TitNum,title);
66  char TitDen[100] = "Den";
67  strcat(TitDen,title);
68  char TitRat[100] = "Rat";
69  strcat(TitRat,title);
70  char TitQinv[100] = "Qinv";
71  strcat(TitQinv,title);
72 
73  for (int i=0; i<mNumberCFs; i++){
74 
75  sprintf(TitNum,"NumBPLCMSFrameCFKtBin%d",i);
76  mNumerator[i].SetName(TitNum);
77  mNumerator[i].SetTitle(title);
78  mNumerator[i].SetBins(nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
79  mNumerator[i].SetDirectory(0);
80  mNumerator[i].Sumw2();
81 
82  sprintf(TitDen,"DenBPLCMSFrameCFKtBin%d",i);
83  mDenominator[i].SetName(TitDen);
84  mDenominator[i].SetTitle(title);
85  mDenominator[i].SetBins(nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
86  mDenominator[i].SetDirectory(0);
87  mDenominator[i].Sumw2();
88 
89  sprintf(TitRat,"RatBPLCMSFrameCFKtBin%d",i);
90  mRatio[i].SetName(TitRat);
91  mRatio[i].SetTitle(title);
92  mRatio[i].SetBins(nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
93  mRatio[i].SetDirectory(0);
94  mRatio[i].Sumw2();
95 
96  sprintf(TitQinv,"QInvHistoKtBin%d",i);
97  mQinvHisto[i].SetName(TitRat);
98  mQinvHisto[i].SetTitle(title);
99  mQinvHisto[i].SetBins(nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
100  mQinvHisto[i].SetDirectory(0);
101  mQinvHisto[i].Sumw2();
102  }
103 }
104 //____________________________
105 BPLCMSFrame3DCorrFctnKt::~BPLCMSFrame3DCorrFctnKt(){
106  delete [] mNumerator;
107  delete [] mDenominator;
108  delete [] mRatio;
109  delete [] mQinvHisto;
110 }
111 //_________________________
112 void BPLCMSFrame3DCorrFctnKt::Finish(){
113  // here is where we should normalize, fit, etc...
114 
115  for (int i=0; i<mNumberCFs; i++){
116  double NumFact,DenFact;
117  if ((mNumRealsNorm !=0) && (mNumMixedNorm !=0)){
118  NumFact = double(mNumRealsNorm);
119  DenFact = double(mNumMixedNorm);
120  }
121  // can happen that the mNumRealsNorm and mNumMixedNorm = 0 if you do non-standard
122  // things like making a new CorrFctn and just setting the Numerator and Denominator
123  // from OTHER CorrFctns which you read in (like when doing parallel processing)
124  else{
125  cout << "Warning! - no normalization constants defined - I do the best I can..." << endl;
126  int nbins = mNumerator[i].GetNbinsX();
127  int half_way = nbins/2;
128  NumFact = mNumerator[i].Integral(half_way,nbins,half_way,nbins,half_way,nbins);
129  DenFact = mDenominator[i].Integral(half_way,nbins,half_way,nbins,half_way,nbins);
130  }
131 
132  mRatio[i].Divide(&mNumerator[i],&mDenominator[i],DenFact,NumFact);
133  mQinvHisto[i].Divide(&mDenominator[i]);
134  }
135 }
136 
137 //____________________________
138 StHbtString BPLCMSFrame3DCorrFctnKt::Report(){
139  int mNumeratorEntries=0;
140  int mDenominatorEntries=0;
141  int mRatioEntries=0;
142  int mQinvHistoEntries=0;
143 
144  for (int i=0; i<mNumberCFs; i++){
145  mNumeratorEntries += (int)mNumerator[i].GetEntries();
146  mDenominatorEntries += (int)mDenominator[i].GetEntries();
147  mRatioEntries += (int)mRatio[i].GetEntries();
148  mQinvHistoEntries += (int)mQinvHisto[i].GetEntries();
149  }
150 
151  string stemp = "LCMS Frame Bertsch-Pratt 3D Correlation Function Report:\n";
152  char ctemp[100];
153  sprintf(ctemp,"Number of entries in numerator:\t%i\n",mNumeratorEntries);
154  stemp += ctemp;
155  sprintf(ctemp,"Number of entries in denominator:\t%i\n",mDenominatorEntries);
156  stemp += ctemp;
157  sprintf(ctemp,"Number of entries in ratio:\t%i\n",mRatioEntries);
158  stemp += ctemp;
159  if (mCorrection)
160  {
161  float radius = mCorrection->GetRadius();
162  sprintf(ctemp,"Coulomb correction used radius of\t%E\n",radius);
163  }
164  else
165  {
166  sprintf(ctemp,"No Coulomb Correction applied to this CorrFctn\n");
167  }
168  stemp += ctemp;
169 
170  StHbtString returnThis = stemp;
171  return returnThis;
172 }
173 //____________________________
174 void BPLCMSFrame3DCorrFctnKt::AddRealPair(const StHbtPair* pair){
175  int mIndex = (int)(((fabs(pair->kT())-mKtMin)/mDeltaKt));
176  if ((mIndex>=0)&&(mIndex<mNumberCFs)){
177  double Qinv = fabs(pair->qInv()); // note - qInv() will be negative for identical pairs...
178  if ((Qinv < mQinvNormHi) && (Qinv > mQinvNormLo)) mNumRealsNorm++;
179  double qOut = fabs(pair->qOutCMS());
180  double qSide = fabs(pair->qSideCMS());
181  double qLong = fabs(pair->qLongCMS());
182 
183  mNumerator[mIndex].Fill(qOut,qSide,qLong);
184  }
185 }
186 
187 //____________________________
188 void BPLCMSFrame3DCorrFctnKt::AddMixedPair(const StHbtPair* pair){
189  int mIndex = (int)(((fabs(pair->kT())-mKtMin)/mDeltaKt));
190  if ((mIndex>=0)&&(mIndex<mNumberCFs)){
191  double CoulombWeight = (mCorrection ? mCorrection->CoulombCorrect(pair) : 1.0);
192 
193  double Qinv = fabs(pair->qInv()); // note - qInv() will be negative for identical pairs...
194  if ((Qinv < mQinvNormHi) && (Qinv > mQinvNormLo)) mNumMixedNorm++;
195  double qOut = fabs(pair->qOutCMS());
196  double qSide = fabs(pair->qSideCMS());
197  double qLong = fabs(pair->qLongCMS());
198 
199  mDenominator[mIndex].Fill(qOut,qSide,qLong,CoulombWeight);
200  mQinvHisto[mIndex].Fill(qOut,qSide,qLong,Qinv);
201  }
202 }
203