StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
QvecCorrFctn.cxx
1 /***************************************************************************
2  *
3  * $Id: QvecCorrFctn.cxx,v 1.5 2000/02/13 21:13:32 lisa 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 correlation function in the magnitude of 3-vector q
10  *
11  ***************************************************************************
12  *
13  * $Log: QvecCorrFctn.cxx,v $
14  * Revision 1.5 2000/02/13 21:13:32 lisa
15  * changed ambiguous StHbtPair::fourMomentum() to fourMomentumSum() and fourMomentumDiff() and fixed related bug in QvecCorrFctn
16  *
17  * Revision 1.4 2000/01/25 17:34:45 laue
18  * I. In order to run the stand alone version of the StHbtMaker the following
19  * changes have been done:
20  * a) all ClassDefs and ClassImps have been put into #ifdef __ROOT__ statements
21  * b) unnecessary includes of StMaker.h have been removed
22  * c) the subdirectory StHbtMaker/doc/Make has been created including everything
23  * needed for the stand alone version
24  *
25  * II. To reduce the amount of compiler warning
26  * a) some variables have been type casted
27  * b) some destructors have been declared as virtual
28  *
29  * Revision 1.3 1999/07/29 02:47:09 lisa
30  * 1) add OpeningAngle correlation function 2) add StHbtMcEventReader 3) make histos in CorrFctns do errors correctly
31  *
32  * Revision 1.2 1999/07/06 22:33:20 lisa
33  * Adjusted all to work in pro and new - dev itself is broken
34  *
35  * Revision 1.1.1.1 1999/06/29 16:02:57 lisa
36  * Installation of StHbtMaker
37  *
38  **************************************************************************/
39 
40 #include "StHbtMaker/CorrFctn/QvecCorrFctn.h"
41 //#include "StHbtMaker/Infrastructure/StHbtHisto.hh"
42 #include <cstdio>
43 // do I need these lines ?
44 //#ifndef StMaker_H
45 //#include "StMaker.h"
46 //#endif
47 
48 #ifdef __ROOT__
49 ClassImp(QvecCorrFctn)
50 #endif
51 //____________________________
52 QvecCorrFctn::QvecCorrFctn(char* title, const int& nbins, const float& QinvLo, const float& QinvHi){
53  // set up numerator
54  // title = "Num Qinv (MeV/c)";
55  char TitNum[100] = "Num";
56  strcat(TitNum,title);
57  mNumerator = new StHbt1DHisto(TitNum,title,nbins,QinvLo,QinvHi);
58  // set up denominator
59  //title = "Den Qinv (MeV/c)";
60  char TitDen[100] = "Den";
61  strcat(TitDen,title);
62  mDenominator = new StHbt1DHisto(TitDen,title,nbins,QinvLo,QinvHi);
63  // set up ratio
64  //title = "Ratio Qinv (MeV/c)";
65  char TitRat[100] = "Rat";
66  strcat(TitRat,title);
67  mRatio = new StHbt1DHisto(TitRat,title,nbins,QinvLo,QinvHi);
68  // this next bit is unfortunately needed so that we can have many histos of same "title"
69  // it is neccessary if we typedef StHbt1DHisto to TH1d (which we do)
70  //mNumerator->SetDirectory(0);
71  //mDenominator->SetDirectory(0);
72  //mRatio->SetDirectory(0);
73 
74  // to enable error bar calculation...
75  mNumerator->Sumw2();
76  mDenominator->Sumw2();
77  mRatio->Sumw2();
78 
79 
80 }
81 
82 //____________________________
83 QvecCorrFctn::~QvecCorrFctn(){
84  delete mNumerator;
85  delete mDenominator;
86  delete mRatio;
87 }
88 //_________________________
89 void QvecCorrFctn::Finish(){
90  // here is where we should normalize, fit, etc...
91  // we should NOT Draw() the histos (as I had done it below),
92  // since we want to insulate ourselves from root at this level
93  // of the code. Do it instead at root command line with browser.
94  // mNumerator->Draw();
95  // mDenominator->Draw();
96  int mTop = (int)mNumerator->GetBinContent(52);
97  int mBottom = (int)mDenominator->GetBinContent(52);
98  mRatio->Divide(mNumerator,mDenominator,mBottom,mTop,"PE");
99  //mRatio->Draw();
100 }
101 
102 //____________________________
103 StHbtString QvecCorrFctn::Report(){
104  string stemp = "Qvec Correlation Function 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 denominator:\t%E\n",mDenominator->GetEntries());
109  stemp += ctemp;
110  sprintf(ctemp,"Number of entries in ratio:\t%E\n",mRatio->GetEntries());
111  stemp += ctemp;
112  // stemp += mCoulombWeight->Report();
113  StHbtString returnThis = stemp;
114  return returnThis;
115 }
116 //____________________________
117 void QvecCorrFctn::AddRealPair(const StHbtPair* pair){
118  double Q = fabs(pair->fourMomentumDiff().vect().mag());
119  mNumerator->Fill(Q);
120 }
121 //____________________________
122 void QvecCorrFctn::AddMixedPair(const StHbtPair* pair){
123  double weight = 1.0;
124  double Q = fabs(pair->fourMomentumDiff().vect().mag());
125  mDenominator->Fill(Q,weight);
126 }
127 
128