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