StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
QinvCorrFctnPidProbWeight.cxx
1 /***************************************************************************
2  *
3  * $Id: QinvCorrFctnPidProbWeight.cxx,v 1.1 2001/09/05 20:41:14 laue Exp $
4  *
5  * Author: Frank Laue, BNL, laue@bnl.gov
6  ***************************************************************************
7  *
8  * Description: part of STAR HBT Framework: StHbtMaker package
9  * a simple Q-invariant correlation function with pid weighting
10  *
11  ***************************************************************************
12  *
13  * $Log: QinvCorrFctnPidProbWeight.cxx,v $
14  * Revision 1.1 2001/09/05 20:41:14 laue
15  * Updates of the hbtMuDstTree microDSTs
16  *
17  *
18  **************************************************************************/
19 
20 #include "StHbtMaker/CorrFctn/QinvCorrFctnPidProbWeight.h"
21 //#include "StHbtMaker/Infrastructure/StHbtHisto.hh"
22 #include <cstdio>
23 
24 #ifdef __ROOT__
26 #endif
27 
28 //____________________________
29 QinvCorrFctnPidProbWeight::QinvCorrFctnPidProbWeight(char* title1, char* title2, const int& nbins, const float& QinvLo, const float& QinvHi){
30  // set up numerator
31  // title = "Num Qinv (MeV/c)";
32  char TitNum[100] = "Num";
33  strcat(TitNum,title1);
34  mNumerator = new StHbt1DHisto(TitNum,title2,nbins,QinvLo,QinvHi);
35  // set up denominator
36  //title1 = "Den Qinv (MeV/c)";
37  char TitDen[100] = "Den";
38  strcat(TitDen,title1);
39  mDenominator = new StHbt1DHisto(TitDen,title2,nbins,QinvLo,QinvHi);
40  // set up ratio
41  //title1 = "Ratio Qinv (MeV/c)";
42  char TitRat[100] = "Rat";
43  strcat(TitRat,title1);
44  mRatio = new StHbt1DHisto(TitRat,title2,nbins,QinvLo,QinvHi);
45  // this next bit is unfortunately needed so that we can have many histos of same "title"
46  // it is neccessary if we typedef StHbt1DHisto to TH1d (which we do)
47  //mNumerator->SetDirectory(0);
48  //mDenominator->SetDirectory(0);
49  //mRatio->SetDirectory(0);
50 
51  // to enable error bar calculation...
52  mNumerator->Sumw2();
53  mDenominator->Sumw2();
54  mRatio->Sumw2();
55 
56 }
57 
58 //____________________________
59 QinvCorrFctnPidProbWeight::~QinvCorrFctnPidProbWeight(){
60  delete mNumerator;
61  delete mDenominator;
62  delete mRatio;
63 }
64 //_________________________
65 void QinvCorrFctnPidProbWeight::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  mRatio->Divide(mNumerator,mDenominator,1.0,1.0);
74 
75 }
76 
77 //____________________________
78 StHbtString QinvCorrFctnPidProbWeight::Report(){
79  string stemp = "Qinv Correlation Function Report:\n";
80  char ctemp[100];
81  sprintf(ctemp,"Number of entries in numerator:\t%E\n",mNumerator->GetEntries());
82  stemp += ctemp;
83  sprintf(ctemp,"Number of entries in denominator:\t%E\n",mDenominator->GetEntries());
84  stemp += ctemp;
85  sprintf(ctemp,"Number of entries in ratio:\t%E\n",mRatio->GetEntries());
86  stemp += ctemp;
87  // stemp += mCoulombWeight->Report();
88  StHbtString returnThis = stemp;
89  return returnThis;
90 }
91 //____________________________
92 void QinvCorrFctnPidProbWeight::AddRealPair(const StHbtPair* pair){
93  mNumerator->Fill(pair->qInv(),pair->track1()->Track()->PidProbKaon()*pair->track2()->Track()->PidProbKaon());
94 }
95 //____________________________
96 void QinvCorrFctnPidProbWeight::AddMixedPair(const StHbtPair* pair){
97  mDenominator->Fill(pair->qInv(),pair->track1()->Track()->PidProbKaon()*pair->track2()->Track()->PidProbKaon());
98 }
99 
100