StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
MinvLikeSignCorrFctn_MinvYPt.cxx
1 /***************************************************************************
2  *
3  * $Id: MinvLikeSignCorrFctn_MinvYPt.cxx,v 1.2 2003/09/02 17:58:20 perev Exp $
4  *
5  * Author: Frank Laue, Ohio State, laue@mps.ohio-state.edu
6  ***************************************************************************
7  *
8  * Description: part of STAR HBT Framework: StHbtMaker package
9  * A simple invariant-mass correlation function
10  *
11  ***************************************************************************
12  *
13  **************************************************************************/
14 //#ifndef __CINT__
15 //#include "fortranc.h"
16 //#define fortrantest F77_NAME(fortrantest,FORTRANTEST)
17 //extern "C" {int type_of_call F77_NAME(fortrantest,FORTRANTEST)(int*);}
18 //#endif
19 
20 #include "StHbtMaker/CorrFctn/MinvLikeSignCorrFctn_MinvYPt.h"
21 #include <cstdio>
22 
23 #ifdef __ROOT__
25 #endif
26 
27 //____________________________
28 MinvLikeSignCorrFctn_MinvYPt::MinvLikeSignCorrFctn_MinvYPt(char* title1, char* title2,
29  const int& nxbins, const double& xLo, const double& xHi,
30  const int& nybins, const double& yLo, const double& yHi,
31  const int& nzbins, const double& zLo, const double& zHi,
32  const double& m0){
33 
34  mM0 = m0;
35 
36  char theTitle1[100];
37  char theTitle2[100];
38  sprintf(theTitle2,"%s",title2);
39 
40  // set up numerator
41  sprintf(theTitle1,"MinvLikeSignCorrFctn_MinvYPt_Num_%s",title1);
42  mNumeratorPt = new StHbt3DHisto(theTitle1,theTitle2,nxbins,xLo,xHi,nybins,yLo,yHi, nybins,zLo,zHi);
43  // set up denominator
44  sprintf(theTitle1,"MinvLikeSignCorrFctn_MinvYPt_MixedEventDen_%s",title1);
45  mMixedEventDenominatorPt = new StHbt3DHisto(theTitle1,theTitle2,nxbins,xLo,xHi,nybins,yLo,yHi, nzbins,zLo,zHi);
46  // set up denominator
47  sprintf(theTitle1,"MinvLikeSignCorrFctn_MinvYPt_PositiveDen_%s",title1);
48  mPositiveDenominatorPt = new StHbt3DHisto(theTitle1,theTitle2,nxbins,xLo,xHi,nybins,yLo,yHi, nzbins,zLo,zHi);
49  // set up denominato6r
50  sprintf(theTitle1,"MinvLikeSignCorrFctn_MinvYPt_NegativeDen_%s",title1);
51  mNegativeDenominatorPt = new StHbt3DHisto(theTitle1,theTitle2,nxbins,xLo,xHi,nybins,yLo,yHi, nzbins,zLo,zHi);
52  // set up difference
53  sprintf(theTitle1,"MinvLikeSignCorrFctn_MinvYPt_MixedEventDif_%s",title1);
54  mMixedEventDifferencePt = new StHbt3DHisto(theTitle1,theTitle2,nxbins,xLo,xHi,nybins,yLo,yHi, nzbins,zLo,zHi);
55  // set up difference
56  sprintf(theTitle1,"MinvLikeSignCorrFctn_MinvYPt_LikeSignDif_%s",title1);
57  mLikeSignDifferencePt = new StHbt3DHisto(theTitle1,theTitle2,nxbins,xLo,xHi,nybins,yLo,yHi, nzbins,zLo,zHi);
58  // this next bit is unfortunately needed so that we can have many histos of same "title"
59  // it is neccessary if we typedef StHbt3DHisto to TH1d (which we do)
60  mNumeratorPt->SetDirectory(0);
61  mMixedEventDenominatorPt->SetDirectory(0);
62  mPositiveDenominatorPt->SetDirectory(0);
63  mNegativeDenominatorPt->SetDirectory(0);
64  mMixedEventDifferencePt->SetDirectory(0);
65  mLikeSignDifferencePt->SetDirectory(0);
66 
67  mNumeratorPt->Sumw2();
68  mMixedEventDenominatorPt->Sumw2();
69  mPositiveDenominatorPt->Sumw2();
70  mNegativeDenominatorPt->Sumw2();
71  mMixedEventDifferencePt->Sumw2();
72  mLikeSignDifferencePt->Sumw2();
73 
74  // set up numerator
75  sprintf(theTitle1,"MinvLikeSignCorrFctn_MinvYMt_Num_%s",title1);
76  mNumeratorMt = new StHbt3DHisto(theTitle1,theTitle2,nxbins,xLo,xHi,nybins,yLo,yHi, nybins,zLo,zHi);
77  // set up denominator
78  sprintf(theTitle1,"MinvLikeSignCorrFctn_MinvYMt_MixedEventDen_%s",title1);
79  mMixedEventDenominatorMt = new StHbt3DHisto(theTitle1,theTitle2,nxbins,xLo,xHi,nybins,yLo,yHi, nzbins,zLo,zHi);
80  // set up denominator
81  sprintf(theTitle1,"MinvLikeSignCorrFctn_MinvYMt_PositiveDen_%s",title1);
82  mPositiveDenominatorMt = new StHbt3DHisto(theTitle1,theTitle2,nxbins,xLo,xHi,nybins,yLo,yHi, nzbins,zLo,zHi);
83  // set up denominator
84  sprintf(theTitle1,"MinvLikeSignCorrFctn_MinvYMt_NegativeDen_%s",title1);
85  mNegativeDenominatorMt = new StHbt3DHisto(theTitle1,theTitle2,nxbins,xLo,xHi,nybins,yLo,yHi, nzbins,zLo,zHi);
86  // set up difference
87  sprintf(theTitle1,"MinvLikeSignCorrFctn_MinvYMt_MixedEventDif_%s",title1);
88  mMixedEventDifferenceMt = new StHbt3DHisto(theTitle1,theTitle2,nxbins,xLo,xHi,nybins,yLo,yHi, nzbins,zLo,zHi);
89  // set up difference
90  sprintf(theTitle1,"MinvLikeSignCorrFctn_MinvYMt_LikeSignDif_%s",title1);
91  mLikeSignDifferenceMt = new StHbt3DHisto(theTitle1,theTitle2,nxbins,xLo,xHi,nybins,yLo,yHi, nzbins,zLo,zHi);
92  // this next bit is unfortunately needed so that we can have many histos of same "title"
93  // it is neccessary if we typedef StHbt3DHisto to TH1d (which we do)
94  mNumeratorMt->SetDirectory(0);
95  mMixedEventDenominatorMt->SetDirectory(0);
96  mPositiveDenominatorMt->SetDirectory(0);
97  mNegativeDenominatorMt->SetDirectory(0);
98  mMixedEventDifferenceMt->SetDirectory(0);
99  mLikeSignDifferenceMt->SetDirectory(0);
100 
101  mNumeratorMt->Sumw2();
102  mMixedEventDenominatorMt->Sumw2();
103  mPositiveDenominatorMt->Sumw2();
104  mNegativeDenominatorMt->Sumw2();
105  mMixedEventDifferenceMt->Sumw2();
106  mLikeSignDifferenceMt->Sumw2();
107 
108 }
109 
110 //____________________________
111 MinvLikeSignCorrFctn_MinvYPt::~MinvLikeSignCorrFctn_MinvYPt(){
112  delete mNumeratorPt;
113  delete mMixedEventDenominatorPt;
114  delete mPositiveDenominatorPt;
115  delete mNegativeDenominatorPt;
116  delete mMixedEventDifferencePt;
117  delete mLikeSignDifferencePt;
118  delete mNumeratorMt;
119  delete mMixedEventDenominatorMt;
120  delete mPositiveDenominatorMt;
121  delete mNegativeDenominatorMt;
122  delete mMixedEventDifferenceMt;
123  delete mLikeSignDifferenceMt;
124 }
125 //_________________________
126 void MinvLikeSignCorrFctn_MinvYPt::Finish(){
127  int NEvents = 1;
128  if ( dynamic_cast<StHbtAnalysis*>( HbtAnalysis() ) ) {
129  if ( dynamic_cast<mikesEventCut*>( ((StHbtAnalysis*)HbtAnalysis())->EventCut() ) )
130  NEvents = ((mikesEventCut*)((StHbtAnalysis*)HbtAnalysis())->EventCut())->NEventsPassed();
131  }
132 
133  double NumeratorInt;
134  double MixedEventDenominatorInt;
135  double PositiveDenominatorInt;
136  double NegativeDenominatorInt;
137 
138  mNumeratorPt->Scale(1./NEvents);
139  mMixedEventDenominatorPt->Scale(1./NEvents);
140  mPositiveDenominatorPt->Scale(1./NEvents);
141  mNegativeDenominatorPt->Scale(1./NEvents);
142  mMixedEventDifferencePt->Scale(1./NEvents);
143  mLikeSignDifferencePt->Scale(1./NEvents);
144 
145 
146  NumeratorInt = mNumeratorPt->Integral();
147  MixedEventDenominatorInt = mMixedEventDenominatorPt->Integral();
148  PositiveDenominatorInt = mPositiveDenominatorPt->Integral();
149  NegativeDenominatorInt = mNegativeDenominatorPt->Integral();
150  mMixedEventDifferencePt->Add(mNumeratorPt,mMixedEventDenominatorPt,1.0,-1*NumeratorInt/MixedEventDenominatorInt);
151  mLikeSignDifferencePt->Add(mNumeratorPt,mPositiveDenominatorPt,1.,-1.);
152  mLikeSignDifferencePt->Add(mLikeSignDifferencePt,mNegativeDenominatorPt,1.,-1.);
153 
154  mNumeratorMt->Scale(1./NEvents);
155  mMixedEventDenominatorMt->Scale(1./NEvents);
156  mPositiveDenominatorMt->Scale(1./NEvents);
157  mNegativeDenominatorMt->Scale(1./NEvents);
158  mMixedEventDifferenceMt->Scale(1./NEvents);
159  mLikeSignDifferenceMt->Scale(1./NEvents);
160 
161 
162  NumeratorInt = mNumeratorMt->Integral();
163  MixedEventDenominatorInt = mMixedEventDenominatorMt->Integral();
164  PositiveDenominatorInt = mPositiveDenominatorMt->Integral();
165  NegativeDenominatorInt = mNegativeDenominatorMt->Integral();
166  mMixedEventDifferenceMt->Add(mNumeratorMt,mMixedEventDenominatorMt,1.0,-1*NumeratorInt/MixedEventDenominatorInt);
167  mLikeSignDifferenceMt->Add(mNumeratorMt,mPositiveDenominatorMt,1.,-1.);
168  mLikeSignDifferenceMt->Add(mLikeSignDifferenceMt,mNegativeDenominatorMt,1.,-1.);
169 
170 }
171 //____________________________
172 StHbtString MinvLikeSignCorrFctn_MinvYPt::Report(){
173  string stemp = "MinvLikeSignCorrFctn_MinvYPt Report():\n";
174  char ctemp[100];
175  sprintf(ctemp,"Number of entries in numerator:\t%E\n",mNumeratorPt->GetEntries());
176  stemp += ctemp;
177  sprintf(ctemp,"Number of entries in mixed event denominator:\t%E\n",mMixedEventDenominatorPt->GetEntries());
178  stemp += ctemp;
179  sprintf(ctemp,"Number of entries in like sign positive denominator:\t%E\n",mPositiveDenominatorPt->GetEntries());
180  stemp += ctemp;
181  sprintf(ctemp,"Number of entries in like sign negative denominator:\t%E\n",mNegativeDenominatorPt->GetEntries());
182  stemp += ctemp;
183  sprintf(ctemp,"Number of entries in mixed event difference:\t%E\n",mMixedEventDifferencePt->GetEntries());
184  stemp += ctemp;
185  sprintf(ctemp,"Number of entries in like sign difference:\t%E\n",mLikeSignDifferencePt->GetEntries());
186  stemp += ctemp;
187  sprintf(ctemp,"Number of entries in numerator:\t%E\n",mNumeratorMt->GetEntries());
188  stemp += ctemp;
189  sprintf(ctemp,"Number of entries in mixed event denominator:\t%E\n",mMixedEventDenominatorMt->GetEntries());
190  stemp += ctemp;
191  sprintf(ctemp,"Number of entries in like sign positive denominator:\t%E\n",mPositiveDenominatorMt->GetEntries());
192  stemp += ctemp;
193  sprintf(ctemp,"Number of entries in like sign negative denominator:\t%E\n",mNegativeDenominatorMt->GetEntries());
194  stemp += ctemp;
195  sprintf(ctemp,"Number of entries in mixed event difference:\t%E\n",mMixedEventDifferenceMt->GetEntries());
196  stemp += ctemp;
197  sprintf(ctemp,"Number of entries in like sign difference:\t%E\n",mLikeSignDifferenceMt->GetEntries());
198  stemp += ctemp;
199  StHbtString returnThis = stemp;
200  return returnThis;
201 }
202 //____________________________
203 inline void MinvLikeSignCorrFctn_MinvYPt::AddRealPair(const StHbtPair* pair){
204  mMinv = pair->mInv(); mY = pair->fourMomentumSum().rapidity();
205  mPt = pair->fourMomentumSum().vect().perp(); mMt = ::sqrt(::pow(mMinv,2.)+::pow(mPt,2.));
206  mNumeratorPt->Fill(mMinv,mY,mPt);
207  mNumeratorMt->Fill(mMinv,mY,mMt-mM0);
208 }
209 //____________________________
210 inline void MinvLikeSignCorrFctn_MinvYPt::AddMixedPair(const StHbtPair* pair){
211  mMinv = pair->mInv(); mY = pair->fourMomentumSum().rapidity();
212  mPt = pair->fourMomentumSum().vect().perp(); mMt = ::sqrt(::pow(mMinv,2.)+::pow(mPt,2.));
213  mMixedEventDenominatorPt->Fill(mMinv,mY,mPt);
214  mMixedEventDenominatorMt->Fill(mMinv,mY,mMt-mM0);
215 }
216 //____________________________
217 inline void MinvLikeSignCorrFctn_MinvYPt::AddLikeSignPositivePair(const StHbtPair* pair){
218  mMinv = pair->mInv(); mY = pair->fourMomentumSum().rapidity();
219  mPt = pair->fourMomentumSum().vect().perp(); mMt = ::sqrt(::pow(mMinv,2.)+::pow(mPt,2.));
220  mPositiveDenominatorPt->Fill(mMinv,mY,mPt);
221  mPositiveDenominatorMt->Fill(mMinv,mY,mMt-mM0);
222 }
223 //____________________________
224 inline void MinvLikeSignCorrFctn_MinvYPt::AddLikeSignNegativePair(const StHbtPair* pair){
225  mMinv = pair->mInv(); mY = pair->fourMomentumSum().rapidity();
226  mPt = pair->fourMomentumSum().vect().perp(); mMt = ::sqrt(::pow(mMinv,2.)+::pow(mPt,2.));
227  mNegativeDenominatorPt->Fill(mMinv,mY,mPt);
228  mNegativeDenominatorMt->Fill(mMinv,mY,mMt-mM0);
229 }
230 
231