StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
NonIdReal3DCorrFctn.cxx
1 /***************************************************************************
2  *
3  * $Id: NonIdReal3DCorrFctn.cxx,v 1.2 2003/01/31 19:21:09 magestro Exp $
4  *
5  * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
6  ***************************************************************************
7  *
8  * Description: part of STAR HBT Framework: StHbtMaker package
9  * 3D Bertsch-Pratt decomposition in the LAB (STAR c.m.) frame
10  *
11  ***************************************************************************
12  *
13  * $Log: NonIdReal3DCorrFctn.cxx,v $
14  * Revision 1.2 2003/01/31 19:21:09 magestro
15  * Cleared up simple compiler warnings on i386_linux24
16  *
17  * Revision 1.1 2002/12/12 17:02:49 kisiel
18  * Use KStar instead of 2*KStar for non-identical particles
19  *
20  * Revision 1.4 2000/10/26 19:48:50 rcwells
21  * Added functionality for Coulomb correction of <qInv> in 3D correltions
22  *
23  * Revision 1.3 2000/08/23 19:43:43 lisa
24  * added alternate normalization algorithm to 3d CorrFctns in case normal one fails
25  *
26  * Revision 1.2 2000/08/02 01:25:10 lisa
27  * Add Coulomb correction capability to 3D Bertsch-Pratt CorrFctn
28  *
29  * Revision 1.1 2000/07/31 01:19:23 lisa
30  * add PairCut which contains collection of PairCuts - also 3D bertsch-pratt CorrFctn
31  *
32  *
33  **************************************************************************/
34 
35 #include "StHbtMaker/CorrFctn/NonIdReal3DCorrFctn.h"
36 //#include "StHbtMaker/Infrastructure/StHbtHisto.hh"
37 #include <cstdio>
38 
39 #ifdef __ROOT__
40 ClassImp(NonIdReal3DCorrFctn)
41 #endif
42 
43 //____________________________
44 NonIdReal3DCorrFctn::NonIdReal3DCorrFctn(char* title, const int& nbins, const float& QLo, const float& QHi){
45 
46  // set some stuff...
47  mQinvNormLo = 0.15;
48  mQinvNormHi = 0.18;
49  mNumRealsNorm = 0;
50  mNumMixedNorm = 0;
51  // mCorrection = 0; // pointer to Coulomb Correction object
52 
53  // set up numerator
54  char TitNum[100] = "Num";
55  strcat(TitNum,title);
56  mNumerator = new StHbt3DHisto(TitNum,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
57  // set up denominator
58  char TitDen[100] = "Den";
59  strcat(TitDen,title);
60  mDenominator = new StHbt3DHisto(TitDen,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
61  // set up ratio
62  char TitRat[100] = "Rat";
63  strcat(TitRat,title);
64  mRatio = new StHbt3DHisto(TitRat,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
65  // set up qInv
66  char TitQinv[100] = "Qinv";
67  strcat(TitQinv,title);
68  mQinvHisto = new StHbt3DHisto(TitQinv,title,nbins,QLo,QHi,nbins,QLo,QHi,nbins,QLo,QHi);
69 
70  // to enable error bar calculation...
71  mNumerator->Sumw2();
72  mDenominator->Sumw2();
73  mRatio->Sumw2();
74 
75 }
76 
77 //____________________________
78 NonIdReal3DCorrFctn::~NonIdReal3DCorrFctn(){
79  delete mNumerator;
80  delete mDenominator;
81  delete mRatio;
82  delete mQinvHisto;
83 }
84 //_________________________
85 void NonIdReal3DCorrFctn::Finish(){
86  // here is where we should normalize, fit, etc...
87  double NumFact,DenFact;
88  if ((mNumRealsNorm !=0) && (mNumMixedNorm !=0)){
89  NumFact = double(mNumRealsNorm);
90  DenFact = double(mNumMixedNorm);
91  }
92  // can happen that the mNumRealsNorm and mNumMixedNorm = 0 if you do non-standard
93  // things like making a new CorrFctn and just setting the Numerator and Denominator
94  // from OTHER CorrFctns which you read in (like when doing parallel processing)
95  else{
96  cout << "Warning! - no normalization constants defined - I do the best I can..." << endl;
97  int nbins = mNumerator->GetNbinsX();
98  int half_way = nbins/2;
99  NumFact = mNumerator->Integral(half_way,nbins,half_way,nbins,half_way,nbins);
100  DenFact = mDenominator->Integral(half_way,nbins,half_way,nbins,half_way,nbins);
101  }
102 
103  mRatio->Divide(mNumerator,mDenominator,DenFact,NumFact);
104  mQinvHisto->Divide(mDenominator);
105 }
106 
107 //____________________________
108 StHbtString NonIdReal3DCorrFctn::Report(){
109  string stemp = "Labframe Bertsch-Pratt 3D Correlation Function Report:\n";
110  char ctemp[100];
111  sprintf(ctemp,"Number of entries in numerator:\t%E\n",mNumerator->GetEntries());
112  stemp += ctemp;
113  sprintf(ctemp,"Number of entries in denominator:\t%E\n",mDenominator->GetEntries());
114  stemp += ctemp;
115  sprintf(ctemp,"Number of entries in ratio:\t%E\n",mRatio->GetEntries());
116  stemp += ctemp;
117  sprintf(ctemp,"Normalization region in Qinv was:\t%E\t%E\n",mQinvNormLo,mQinvNormHi);
118  stemp += ctemp;
119  sprintf(ctemp,"Number of pairs in Normalization region was:\n");
120  stemp += ctemp;
121  sprintf(ctemp,"In numerator:\t%lu\t In denominator:\t%lu\n",mNumRealsNorm,mNumMixedNorm);
122  stemp += ctemp;
123 
124  stemp += ctemp;
125  //
126  StHbtString returnThis = stemp;
127  return returnThis;
128 }
129 //____________________________
130 void NonIdReal3DCorrFctn::AddRealPair(const StHbtPair* pair){
131  double tKStar = 2*fabs(pair->KStar());
132  double tKOut = pair->dKOut();
133  double tKSide = pair->dKSide();
134  double tKLong = pair->dKLong();
135 
136 // double Qinv = fabs(pair->qInv()); // note - qInv() will be negative for identical pairs...
137  if ((tKStar < mQinvNormHi) && (tKStar > mQinvNormLo)) mNumRealsNorm++;
138 // double qOut = fabs(pair->qOutBf());
139 // double qSide = fabs(pair->qSideBf());
140 // double qLong = fabs(pair->qLongBf());
141 
142  mNumerator->Fill(tKOut,tKSide,tKLong);
143 
144 }
145 
146 //____________________________
147 void NonIdReal3DCorrFctn::AddMixedPair(const StHbtPair* pair){
148  double tKStar = 2*fabs(pair->KStar());
149  double tKOut = pair->dKOut();
150  double tKSide = pair->dKSide();
151  double tKLong = pair->dKLong();
152 
153  double weight=1.0;
154 
155 // double Qinv = fabs(pair->qInv()); // note - qInv() will be negative for identical pairs...
156  if ((tKStar < mQinvNormHi) && (tKStar > mQinvNormLo)) mNumMixedNorm++;
157 // double qOut = fabs(pair->qOutBf());
158 // double qSide = fabs(pair->qSideBf());
159 // double qLong = fabs(pair->qLongBf());
160 
161  mDenominator->Fill(tKOut,tKSide,tKLong,weight);
162  mQinvHisto->Fill(tKOut,tKSide,tKLong,tKStar);
163 }
164 
165 
166 void NonIdReal3DCorrFctn::Write()
167 {
168  mNumerator->Write();
169  mDenominator->Write();
170  mRatio->Write();
171  mQinvHisto->Write();
172 }
173