StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
MinvLikeSignCorrFctn_Minv_vs_Pt.cxx
1 /***************************************************************************
2  *
3  * $Id: MinvLikeSignCorrFctn_Minv_vs_Pt.cxx,v 1.4 2003/01/31 19:21:09 magestro 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_Pt.h"
21 #include <cstdio>
22 
23 #ifdef __ROOT__
25 #endif
26 
27 //____________________________
28 MinvLikeSignCorrFctn_Minv_vs_Pt::MinvLikeSignCorrFctn_Minv_vs_Pt(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_Pt_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_Pt_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_Pt_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_Pt_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_Pt_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_Pt_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_Pt::~MinvLikeSignCorrFctn_Minv_vs_Pt(){
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_Pt::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_Pt::Report(){
104  string stemp = "MinvLikeSignCorrFctn_Minv_vs_Pt 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_Pt::AddRealPair(const StHbtPair* pair){
123  mNumerator->Fill(pair->mInv(),pair->fourMomentumSum().vect().perp());
124 }
125 //____________________________
126 inline void MinvLikeSignCorrFctn_Minv_vs_Pt::AddMixedPair(const StHbtPair* pair){
127  mMixedEventDenominator->Fill(pair->mInv(),pair->fourMomentumSum().vect().perp());
128 }
129 //____________________________
130 inline void MinvLikeSignCorrFctn_Minv_vs_Pt::AddLikeSignPositivePair(const StHbtPair* pair){
131  mPositiveDenominator->Fill(pair->mInv(),pair->fourMomentumSum().vect().perp());
132 }
133 //____________________________
134 inline void MinvLikeSignCorrFctn_Minv_vs_Pt::AddLikeSignNegativePair(const StHbtPair* pair){
135  mNegativeDenominator->Fill(pair->mInv(),pair->fourMomentumSum().vect().perp());
136 }
137 
138