StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
QinvCorrFctnC.cxx
1 /***************************************************************************
2  *
3  * $Id: QinvCorrFctnC.cxx,v 1.3 2000/03/20 16:42:48 laue Exp $
4  *
5  * Author: Randy Wells, Ohio State, rcwells@mps.ohio-state.edu
6  ***************************************************************************
7  *
8  * Description: part of STAR HBT Framework: StHbtMaker package
9  * a simple Q-invariant correlation function with Coulomb correction
10  * does HBT for pi- pi-
11  * Can be changed -> double charge = -1.0 to do pi+ pi- HBT
12  *
13  ***************************************************************************
14  *
15  * $Log: QinvCorrFctnC.cxx,v $
16  * Revision 1.3 2000/03/20 16:42:48 laue
17  * Bug fix by Randy
18  *
19  * Revision 1.2 2000/01/25 17:34:45 laue
20  * I. In order to run the stand alone version of the StHbtMaker the following
21  * changes have been done:
22  * a) all ClassDefs and ClassImps have been put into #ifdef __ROOT__ statements
23  * b) unnecessary includes of StMaker.h have been removed
24  * c) the subdirectory StHbtMaker/doc/Make has been created including everything
25  * needed for the stand alone version
26  *
27  * II. To reduce the amount of compiler warning
28  * a) some variables have been type casted
29  * b) some destructors have been declared as virtual
30  *
31  * Revision 1.1 1999/09/23 23:28:01 lisa
32  * add helensV0Cut AND rename mikes and franks ParticleCuts to TrackCuts AND update documentation
33  *
34  * Revision 1.3 1999/07/29 02:47:09 lisa
35  * 1) add OpeningAngle correlation function 2) add StHbtMcEventReader 3) make histos in CorrFctns do errors correctly
36  *
37  * Revision 1.2 1999/07/06 22:33:20 lisa
38  * Adjusted all to work in pro and new - dev itself is broken
39  *
40  * Revision 1.1.1.1 1999/06/29 16:02:57 lisa
41  * Installation of StHbtMaker
42  *
43  **************************************************************************/
44 
45 #include "StHbtMaker/CorrFctn/QinvCorrFctnC.h"
46 //#include "StHbtMaker/Infrastructure/StHbtHisto.hh"
47 #include <cstdio>
48 
49 #ifdef __ROOT__
50 ClassImp(QinvCorrFctnC)
51 #endif
52 
53 //____________________________
54 QinvCorrFctnC::QinvCorrFctnC(char* title, const int& nbins, const float& QinvLo, const float& QinvHi){
55  // set up numerator
56  // title = "Num Qinv (MeV/c)";
57  char TitNum[100] = "Num";
58  strcat(TitNum,title);
59  mNumerator = new StHbt1DHisto(TitNum,title,nbins,QinvLo,QinvHi);
60  // set up denominator
61  //title = "Den Qinv (MeV/c)";
62  char TitDen[100] = "Den";
63  strcat(TitDen,title);
64  mDenominator = new StHbt1DHisto(TitDen,title,nbins,QinvLo,QinvHi);
65  // set up ratio
66  //title = "Ratio Qinv (MeV/c)";
67  char TitRat[100] = "Rat";
68  strcat(TitRat,title);
69  mRatio = new StHbt1DHisto(TitRat,title,nbins,QinvLo,QinvHi);
70  // this next bit is unfortunately needed so that we can have many histos of same "title"
71  // it is neccessary if we typedef StHbt1DHisto to TH1d (which we do)
72  //mNumerator->SetDirectory(0);
73  //mDenominator->SetDirectory(0);
74  //mRatio->SetDirectory(0);
75 
76  // to enable error bar calculation...
77  mNumerator->Sumw2();
78  mDenominator->Sumw2();
79  mRatio->Sumw2();
80 
81 }
82 
83 //____________________________
84 QinvCorrFctnC::~QinvCorrFctnC(){
85  delete mNumerator;
86  delete mDenominator;
87  delete mRatio;
88 }
89 //_________________________
90 void QinvCorrFctnC::Finish(){
91  // here is where we should normalize, fit, etc...
92  // we should NOT Draw() the histos (as I had done it below),
93  // since we want to insulate ourselves from root at this level
94  // of the code. Do it instead at root command line with browser.
95  // mNumerator->Draw();
96  //mDenominator->Draw();
97  //mRatio->Draw();
98  double qInvTop = mNumerator->GetBinContent(50);
99  double qInvBottom = mDenominator->GetBinContent(50);
100  mRatio->Divide(mNumerator,mDenominator,qInvBottom,qInvTop);
101 }
102 
103 //____________________________
104 StHbtString QinvCorrFctnC::Report(){
105  string stemp = "Qinv Coulomb corrected Correlation Function Report:\n";
106  char ctemp[100];
107  sprintf(ctemp,"Number of entries in numerator:\t%E\n",mNumerator->GetEntries());
108  stemp += ctemp;
109  sprintf(ctemp,"Number of entries in denominator:\t%E\n",mDenominator->GetEntries());
110  stemp += ctemp;
111  sprintf(ctemp,"Number of entries in ratio:\t%E\n",mRatio->GetEntries());
112  stemp += ctemp;
113  // stemp += mCoulombWeight->Report();
114  StHbtString returnThis = stemp;
115  return returnThis;
116 }
117 //____________________________
118 void QinvCorrFctnC::AddRealPair(const StHbtPair* pair){
119  double Qinv = fabs(pair->qInv()); // note - qInv() will be negative for identical pairs...
120  mNumerator->Fill(Qinv);
121  // cout << "QinvCorrFctnC::AddRealPair : " << pair->qInv() << " " << Qinv <<
122  //" " << pair->track1().FourMomentum() << " " << pair->track2().FourMomentum() << endl;
123 }
124 //____________________________
125 void QinvCorrFctnC::AddMixedPair(const StHbtPair* pair){
126  double Qinv = fabs(pair->qInv()); // note - qInv() will be negative for identical pairs...
127  // I call SetRadius(7.0) in my macro so don't need to use it here.
128  // double weight = mCorrection.CoulombCorrect(pair,radius);
129  double weight = mCorrection.CoulombCorrect(pair);
130  mDenominator->Fill(Qinv,weight);
131 }
132 
133 void QinvCorrFctnC::AddCorrection(const StHbtCoulomb* coulomb) {
134  mCorrection = *coulomb;
135 }
136 
137