StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
MinvLikeSignCorrFctn_Minv_vs_Phi.cxx
1 /***************************************************************************
2  *
3  * $Id: MinvLikeSignCorrFctn_Minv_vs_Phi.cxx,v 1.5 2015/11/02 20:10:24 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_Minv_vs_Phi.h"
21 #include <cstdio>
22 
23 #ifdef __ROOT__
25 #endif
26 
27 //____________________________
28 MinvLikeSignCorrFctn_Minv_vs_Phi::MinvLikeSignCorrFctn_Minv_vs_Phi(char* title1, char* title2,
29  const int& nxbins, const float& xLo, const float& xHi,
30  const int& nybins, const float& yLo, const float& yHi){
31 
32  char theTitle1[100];
33  char theTitle2[100];
34  sprintf(theTitle2,"%s",title2);
35  // set up numerator
36  sprintf(theTitle1,"MinvLikeSignCorrFctn_Minv_vs_Phi_Num_%s",title1);
37  mNumerator = new StHbt2DHisto(theTitle1,theTitle2,nxbins,xLo,xHi,nybins,yLo,yHi);
38  // set up denominator
39  sprintf(theTitle1,"MinvLikeSignCorrFctn_Minv_vs_Phi_MixedEventDen_%s",title1);
40  mMixedEventDenominator = new StHbt2DHisto(theTitle1,theTitle2,nxbins,xLo,xHi,nybins,yLo,yHi);
41  // set up denominator
42  sprintf(theTitle1,"MinvLikeSignCorrFctn_Minv_vs_Phi_PositiveDen_%s",title1);
43  mPositiveDenominator = new StHbt2DHisto(theTitle1,theTitle2,nxbins,xLo,xHi,nybins,yLo,yHi);
44  // set up denominator
45  sprintf(theTitle1,"MinvLikeSignCorrFctn_Minv_vs_Phi_NegativeDen_%s",title1);
46  mNegativeDenominator = new StHbt2DHisto(theTitle1,theTitle2,nxbins,xLo,xHi,nybins,yLo,yHi);
47  // set up difference
48  sprintf(theTitle1,"MinvLikeSignCorrFctn_Minv_vs_Phi_MixedEventDif_%s",title1);
49  mMixedEventDifference = new StHbt2DHisto(theTitle1,theTitle2,nxbins,xLo,xHi,nybins,yLo,yHi);
50  // set up difference
51  sprintf(theTitle1,"MinvLikeSignCorrFctn_Minv_vs_Phi_LikeSignDif_%s",title1);
52  mLikeSignDifference = new StHbt2DHisto(theTitle1,theTitle2,nxbins,xLo,xHi,nybins,yLo,yHi);
53  // this next bit is unfortunately needed so that we can have many histos of same "title"
54  // it is neccessary if we typedef StHbt2DHisto to TH1d (which we do)
55  mNumerator->SetDirectory(0);
56  mMixedEventDenominator->SetDirectory(0);
57  mPositiveDenominator->SetDirectory(0);
58  mNegativeDenominator->SetDirectory(0);
59  mMixedEventDifference->SetDirectory(0);
60  mLikeSignDifference->SetDirectory(0);
61 
62  mNumerator->Sumw2();
63  mMixedEventDenominator->Sumw2();
64  mPositiveDenominator->Sumw2();
65  mNegativeDenominator->Sumw2();
66  mMixedEventDifference->Sumw2();
67  mLikeSignDifference->Sumw2();
68 
69 }
70 
71 //____________________________
72 MinvLikeSignCorrFctn_Minv_vs_Phi::~MinvLikeSignCorrFctn_Minv_vs_Phi(){
73  delete mNumerator;
74  delete mMixedEventDenominator;
75  delete mPositiveDenominator;
76  delete mNegativeDenominator;
77  delete mMixedEventDifference;
78  delete mLikeSignDifference;
79 }
80 //_________________________
81 void MinvLikeSignCorrFctn_Minv_vs_Phi::Finish(){
82  int NEvents = 1;
83  if ( dynamic_cast<StHbtAnalysis*>( HbtAnalysis() ) ) {
84  if ( dynamic_cast<mikesEventCut*>( ((StHbtAnalysis*)HbtAnalysis())->EventCut() ) )
85  NEvents = ((mikesEventCut*)((StHbtAnalysis*)HbtAnalysis())->EventCut())->NEventsPassed();
86  }
87 
88  mNumerator->Scale(1./NEvents);
89  mMixedEventDenominator->Scale(1./NEvents);
90  mPositiveDenominator->Scale(1./NEvents);
91  mNegativeDenominator->Scale(1./NEvents);
92  mMixedEventDifference->Scale(1./NEvents);
93  mLikeSignDifference->Scale(1./NEvents);
94 
95  double NumeratorInt = mNumerator->Integral();
96  double MixedEventDenominatorInt = mMixedEventDenominator->Integral();
97  mMixedEventDifference->Add(mNumerator,mMixedEventDenominator,1.0,-1.*NumeratorInt/MixedEventDenominatorInt);
98  mLikeSignDifference->Add(mNumerator,mPositiveDenominator,1.,-1.);
99  mLikeSignDifference->Add(mLikeSignDifference,mNegativeDenominator,1.,-1.);
100 
101 }
102 //____________________________
103 StHbtString MinvLikeSignCorrFctn_Minv_vs_Phi::Report(){
104  string stemp = "MinvLikeSignCorrFctn_Minv_vs_Phi Report():\n";
105  char ctemp[100];
106  sprintf(ctemp,"Number of entries in numerator:\t%E\n",mNumerator->GetEntries());
107  stemp += ctemp;
108  sprintf(ctemp,"Number of entries in mixed event denominator:\t%E\n",mMixedEventDenominator->GetEntries());
109  stemp += ctemp;
110  sprintf(ctemp,"Number of entries in like sign positive denominator:\t%E\n",mPositiveDenominator->GetEntries());
111  stemp += ctemp;
112  sprintf(ctemp,"Number of entries in like sign negative denominator:\t%E\n",mNegativeDenominator->GetEntries());
113  stemp += ctemp;
114  sprintf(ctemp,"Number of entries in mixed event difference:\t%E\n",mMixedEventDifference->GetEntries());
115  stemp += ctemp;
116  sprintf(ctemp,"Number of entries in like sign difference:\t%E\n",mLikeSignDifference->GetEntries());
117  stemp += ctemp;
118  StHbtString returnThis = stemp;
119  return returnThis;
120 }
121 //____________________________
122 inline void MinvLikeSignCorrFctn_Minv_vs_Phi::AddRealPair(const StHbtPair* pair){
123  // if ( fabs(pair->mInv()-1.02)<0.01)
124  if ( !::isnan(mReactionPlaneError) && mReactionPlaneError!=0. ) {
125  double angle = pair->fourMomentumSum().vect().phi()-mReactionPlane;
126  angle = fabs(angle);
127  if (angle > M_PIl) angle = 2.*M_PIl-angle;
128  mNumerator->Fill(pair->mInv(),angle);
129  }
130 }
131 //____________________________
132 inline void MinvLikeSignCorrFctn_Minv_vs_Phi::AddMixedPair(const StHbtPair* pair){
133  // if ( fabs(pair->mInv()-1.02)<0.01)
134  if ( !::isnan(mReactionPlaneError) && mReactionPlaneError!=0. ) {
135  double angle = pair->fourMomentumSum().vect().phi()-mReactionPlane;
136  angle = fabs(angle);
137  if (angle > M_PIl) angle = 2.*M_PIl-angle;
138  mMixedEventDenominator->Fill(pair->mInv(),angle);
139  }
140 }
141 //____________________________
142 inline void MinvLikeSignCorrFctn_Minv_vs_Phi::AddLikeSignPositivePair(const StHbtPair* pair){
143  // if ( fabs(pair->mInv()-1.02)<0.01)
144  if ( !::isnan(mReactionPlaneError) && mReactionPlaneError!=0. ) {
145  double angle = pair->fourMomentumSum().vect().phi()-mReactionPlane;
146  angle = fabs(angle);
147  if (angle > M_PIl) angle = 2.*M_PIl-angle;
148  mPositiveDenominator->Fill(pair->mInv(),angle);
149  }
150 }
151 //____________________________
152 inline void MinvLikeSignCorrFctn_Minv_vs_Phi::AddLikeSignNegativePair(const StHbtPair* pair){
153  // if ( fabs(pair->mInv()-1.02)<0.01)
154  if ( !::isnan(mReactionPlaneError) && mReactionPlaneError!=0. ) {
155  double angle = pair->fourMomentumSum().vect().phi()-mReactionPlane;
156  angle = fabs(angle);
157  if (angle > M_PIl) angle = 2.*M_PIl-angle;
158  mNegativeDenominator->Fill(pair->mInv(),angle);
159  }
160 }
161 
162