StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
MinvCorrFctnY_vs_Pt.cxx
1 /***************************************************************************
2  *
3  * $Id: MinvCorrFctnY_vs_Pt.cxx,v 1.2 2000/06/15 18:52:42 willson 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  * $Log: MinvCorrFctnY_vs_Pt.cxx,v $
14  * Revision 1.2 2000/06/15 18:52:42 willson
15  * HbtAnalysis() method must be cast to specific analysis
16  * rotateEventCut installed
17  *
18  * Revision 1.1 2000/02/28 14:39:30 laue
19  * Correlation function to fill phasespace rapidity vs pt
20  *
21  * Revision 1.2 1999/07/06 22:33:19 lisa
22  * Adjusted all to work in pro and new - dev itself is broken
23  *
24  * Revision 1.1.1.1 1999/06/29 16:02:57 lisa
25  * Installation of StHbtMaker
26  *
27  **************************************************************************/
28 
29 
30 #include "StHbtMaker/CorrFctn/MinvCorrFctnY_vs_Pt.h"
31 //#include "StHbtMaker/Infrastructure/StHbtHisto.hh"
32 #include <cstdio>
33 
34 #ifdef __ROOT__
35 ClassImp(MinvCorrFctnY_vs_Pt)
36 #endif
37 //____________________________
38 MinvCorrFctnY_vs_Pt::MinvCorrFctnY_vs_Pt(char* title,
39  const int& nbins1, const float& MinvLo1, const float& MinvHi1,
40  const int& nbins2, const float& MinvLo2, const float& MinvHi2){
41  char theTitle[100];
42  // set up numerator
43  const char* TitNum = "MinvCorrFctnY_vs_Pt_Num";
44  sprintf(theTitle,"Num %s",title);
45  mNumerator = new StHbt2DHisto(TitNum,theTitle,nbins1,MinvLo1,MinvHi1,nbins2,MinvLo2,MinvHi2);
46  // set up denominator
47  const char* TitDen = "MinvCorrFctnY_vs_Pt_Den";
48  sprintf(theTitle,"Den %s",title);
49  mDenominator = new StHbt2DHisto(TitDen,theTitle,nbins1,MinvLo1,MinvHi1,nbins2,MinvLo2,MinvHi2);
50  // set up difference
51  const char* TitDif = "MinvCorrFctnY_vs_Pt_Dif";
52  sprintf(theTitle,"Dif %s",title);
53  mDifference = new StHbt2DHisto(TitDif,theTitle,nbins1,MinvLo1,MinvHi1,nbins2,MinvLo2,MinvHi2);
54  // this next bit is unfortunately needed so that we can have many histos of same "title"
55  // it is neccessary if we typedef StHbt1DHisto to TH1d (which we do)
56  mNumerator->SetDirectory(0);
57  mDenominator->SetDirectory(0);
58  mDifference->SetDirectory(0);
59  mNumerator->Sumw2();
60  mDenominator->Sumw2();
61  mDifference->Sumw2();
62 }
63 
64 //____________________________
65 MinvCorrFctnY_vs_Pt::~MinvCorrFctnY_vs_Pt(){
66  delete mNumerator;
67  delete mDenominator;
68  delete mDifference;
69 }
70 //_________________________
71 void MinvCorrFctnY_vs_Pt::Finish(){
72  // here is where we should normalize, fit, etc...
73  // we should NOT Draw() the histos (as I had done it below),
74  // since we want to insulate ourselves from root at this level
75  // of the code. Do it instead at root command line with browser.
76  // mNumerator->Draw();
77  // mDenominator->Draw();
78  //mRatio->Draw();
79 
80  // normalized by number of events
81  int NEvents = 1;
82  if ( dynamic_cast<StHbtAnalysis*>( HbtAnalysis() ) ) {
83  if ( dynamic_cast<mikesEventCut*>( ((StHbtAnalysis*)HbtAnalysis())->EventCut() ) )
84  NEvents = ((mikesEventCut*)((StHbtAnalysis*)HbtAnalysis())->EventCut())->NEventsPassed();
85  }
86 
87  mNumerator->Scale(1./NEvents);
88  mDenominator->Scale(1./NEvents);
89  mDifference->Scale(1./NEvents);
90 
91  // scale numerator and denominator
92  //double NumeratorInt = mNumerator->Integral();
93  //double DenominatorInt = mDenominator->Integral();
94  double NumeratorInt = mRealPairs;
95  double DenominatorInt = mMixedPairs;
96  mDifference->Add(mNumerator,mDenominator,1.0,-1*NumeratorInt/DenominatorInt);
97 
98 }
99 
100 //____________________________
101 StHbtString MinvCorrFctnY_vs_Pt::Report(){
102  string stemp = "Minv Correlation Function Report:\n";
103  char ctemp[100];
104  sprintf(ctemp,"Number of entries in numerator:\t%E\n",mNumerator->GetEntries());
105  stemp += ctemp;
106  sprintf(ctemp,"Number of entries in denominator:\t%E\n",mDenominator->GetEntries());
107  stemp += ctemp;
108  sprintf(ctemp,"Number of entries in difference:\t%E\n",mDifference->GetEntries());
109  stemp += ctemp;
110  StHbtString returnThis = stemp;
111  return returnThis;
112 }
113 //____________________________
114 void MinvCorrFctnY_vs_Pt::AddRealPair(const StHbtPair* pair){
115  if ( fabs( pair->mInv()-1.02 ) < .01 )
116  mNumerator->Fill( pair->fourMomentumSum().rapidity(), pair->fourMomentumSum().perp(), 1.);
117  else
118  mRealPairs++;
119 }
120 //____________________________
121 void MinvCorrFctnY_vs_Pt::AddMixedPair(const StHbtPair* pair){
122  if ( fabs( pair->mInv()-1.02 ) < .01 )
123  mDenominator->Fill( pair->fourMomentumSum().rapidity(), pair->fourMomentumSum().perp(), 1.);
124  else
125  mMixedPairs++;
126 }
127 
128