StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
MinvCorrFctnM_vs_Pt.cxx
1 /***************************************************************************
2  *
3  * $Id: MinvCorrFctnM_vs_Pt.cxx,v 1.1 2000/03/16 21:16:26 laue 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: MinvCorrFctnM_vs_Pt.cxx,v $
14  * Revision 1.1 2000/03/16 21:16:26 laue
15  * Correlation function added
16  *
17  * Revision 1.2 1999/07/06 22:33:19 lisa
18  * Adjusted all to work in pro and new - dev itself is broken
19  *
20  * Revision 1.1.1.1 1999/06/29 16:02:57 lisa
21  * Installation of StHbtMaker
22  *
23  **************************************************************************/
24 
25 
26 #include "StHbtMaker/CorrFctn/MinvCorrFctnM_vs_Pt.h"
27 //#include "StHbtMaker/Infrastructure/StHbtHisto.hh"
28 #include <cstdio>
29 
30 #ifdef __ROOT__
31 ClassImp(MinvCorrFctnM_vs_Pt)
32 #endif
33 
34 //____________________________
35 MinvCorrFctnM_vs_Pt::MinvCorrFctnM_vs_Pt(char* title,
36  const int& nbins1, const float& MinvLo1, const float& MinvHi1,
37  const int& nbins2, const float& MinvLo2, const float& MinvHi2){
38  // set up numerator
39  char theTitle[100];
40  const char* TitNum = "MinvCorrFctnM_vs_Pt_Num";
41  sprintf(theTitle,"Num %s",title);
42  mNumerator = new StHbt2DHisto(TitNum,theTitle,nbins1,MinvLo1,MinvHi1,nbins2,MinvLo2,MinvHi2);
43  // set up denominator
44  const char* TitDen = "MinvCorrFctnM_vs_Pt_Den";
45  sprintf(theTitle,"Den %s",title);
46  mDenominator = new StHbt2DHisto(TitDen,theTitle,nbins1,MinvLo1,MinvHi1,nbins2,MinvLo2,MinvHi2);
47  // set up difference
48  const char* TitDif = "MinvCorrFctnM_vs_Pt_Dif";
49  sprintf(theTitle,"Dif %s",title);
50  mDifference = new StHbt2DHisto(TitDif,theTitle,nbins1,MinvLo1,MinvHi1,nbins2,MinvLo2,MinvHi2);
51  // this next bit is unfortunately needed so that we can have many histos of same "title"
52  // it is neccessary if we typedef StHbt1DHisto to TH1d (which we do)
53  mNumerator->SetDirectory(0);
54  mDenominator->SetDirectory(0);
55  mDifference->SetDirectory(0);
56 }
57 
58 //____________________________
59 MinvCorrFctnM_vs_Pt::~MinvCorrFctnM_vs_Pt(){
60  delete mNumerator;
61  delete mDenominator;
62  delete mDifference;
63 }
64 //_________________________
65 void MinvCorrFctnM_vs_Pt::Finish(){
66  // here is where we should normalize, fit, etc...
67  // we should NOT Draw() the histos (as I had done it below),
68  // since we want to insulate ourselves from root at this level
69  // of the code. Do it instead at root command line with browser.
70  // mNumerator->Draw();
71  // mDenominator->Draw();
72  //mRatio->Draw();
73  double NumeratorInt = mNumerator->Integral();
74  double DenominatorInt = mDenominator->Integral();
75  mDifference->Add(mNumerator,mDenominator,1.0,-1*NumeratorInt/DenominatorInt);
76 
77 }
78 
79 //____________________________
80 StHbtString MinvCorrFctnM_vs_Pt::Report(){
81  string stemp = "Minv Correlation Function Report:\n";
82  char ctemp[100];
83  sprintf(ctemp,"Number of entries in numerator:\t%E\n",mNumerator->GetEntries());
84  stemp += ctemp;
85  sprintf(ctemp,"Number of entries in denominator:\t%E\n",mDenominator->GetEntries());
86  stemp += ctemp;
87  sprintf(ctemp,"Number of entries in difference:\t%E\n",mDifference->GetEntries());
88  stemp += ctemp;
89  StHbtString returnThis = stemp;
90  return returnThis;
91 }
92 //____________________________
93 void MinvCorrFctnM_vs_Pt::AddRealPair(const StHbtPair* pair){
94  mNumerator->Fill( pair->mInv(), pair->fourMomentumSum().vect().perp(), 1.);
95 }
96 //____________________________
97 void MinvCorrFctnM_vs_Pt::AddMixedPair(const StHbtPair* pair){
98  mDenominator->Fill( pair->mInv(), pair->fourMomentumSum().vect().perp(), 1.);
99 }
100 
101