StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Q3invCorrFctn.cxx
1 /***************************************************************************
2  *
3  * $Id: Q3invCorrFctn.cxx,v 1.4 2001/06/03 21:05:42 willson Exp $
4  *
5  * Author: Robert Willson, Ohio State, willson@bnl.gov
6  ***************************************************************************
7  *
8  * Description: part of STAR HBT Framework: StHbtMaker package
9  * A simple Q-invariant correlation function for three particle analyses.
10  *
11  ***************************************************************************
12  *
13  * $Log: Q3invCorrFctn.cxx,v $
14  * Revision 1.4 2001/06/03 21:05:42 willson
15  * Bins in entrance separation
16  *
17  * Revision 1.2 2000/04/12 01:53:28 willson
18  * Initial Installation - Comments Added
19  *
20  *
21  ***************************************************************************/
22 
23 #include "StHbtMaker/CorrFctn/Q3invCorrFctn.h"
24 //#include "StHbtMaker/Infrastructure/StHbtHisto.hh"
25 #include <cstdio>
26 
27 ClassImp(Q3invCorrFctn)
28 
29 //____________________________
30 Q3invCorrFctn::Q3invCorrFctn(char* title, const int& nbinsQ, const float& QinvLo, const float& QinvHi, const int& nbinsMerge, const float& MergeLo, const float& MergeHi, const float& Split){
31  // This one does not do a quality calulation
32  mSplit = Split;
33  mPHist = 0;
34  // set up numerator
35  // title = "Num Q3inv (MeV/c)";
36  char TitNum[100] = "Num";
37  strcat(TitNum,title);
38  mNumerator = new StHbt2DHisto(TitNum,title,nbinsQ,QinvLo,QinvHi,nbinsMerge,MergeLo,MergeHi);
39  // set up denominator
40  //title = "Den Q3inv (MeV/c)";
41  char TitDen[100] = "Den";
42  strcat(TitDen,title);
43  mDenominator = new StHbt2DHisto(TitDen,title,nbinsQ,QinvLo,QinvHi,nbinsMerge,MergeLo,MergeHi);
44  // set up ratio
45  //title = "Ratio Q3inv (MeV/c)";
46  char TitRat[100] = "Rat";
47  strcat(TitRat,title);
48  mRatio = new StHbt2DHisto(TitRat,title,nbinsQ,QinvLo,QinvHi,nbinsMerge,MergeLo,MergeHi);
49  // this next bit is unfortunately needed so that we can have many histos of same "title"
50  // it is neccessary if we typedef StHbt1DHisto to TH1d (which we do)
51  //mNumer->SetDirectory(0);
52  //mDenom->SetDirectory(0);
53  //mRatio->SetDirectory(0);
54 
55  // to enable error bar calculation...
56  mNumerator->Sumw2();
57  mDenominator->Sumw2();
58  mRatio->Sumw2();
59 
60 }
61 
62 //____________________________
63 Q3invCorrFctn::~Q3invCorrFctn(){
64  delete mNumerator;
65  delete mDenominator;
66  delete mRatio;
67 }
68 
69 //_________________________
70 void Q3invCorrFctn::Finish(){
71  mRatio->Divide(mNumerator,mDenominator,1.0,1.0);
72 }
73 
74 //____________________________
75 StHbtString Q3invCorrFctn::Report(){
76  string stemp = "Q3inv Correlation Function Report:\n";
77  char ctemp[100];
78  sprintf(ctemp,"Number of entries in numerator:\t%E\n",mNumerator->GetEntries());
79  stemp += ctemp;
80  sprintf(ctemp,"Number of entries in denominator:\t%E\n",mDenominator->GetEntries());
81  stemp += ctemp;
82  sprintf(ctemp,"Number of entries in ratio:\t%E\n",mRatio->GetEntries());
83  stemp += ctemp;
84  // stemp += mCoulombWeight->Report();
85  StHbtString returnThis = stemp;
86  return returnThis;
87 }
88 //____________________________
89 void Q3invCorrFctn::AddRealTriplet(const StHbtTriplet* triplet){
90  if (mPHist) {
91  mPHist->Fill(triplet->track1()->Track()->P().mag());
92  mPHist->Fill(triplet->track2()->Track()->P().mag());
93  mPHist->Fill(triplet->track3()->Track()->P().mag());
94  }
95  double Qual = triplet->quality();
96  double entSep = triplet->NominalTpcEntranceSeparation();
97  double Q3inv = fabs(triplet->qInv()); // note - qInv() will be negative for identical triplets...
98  if (Qual<mSplit) mNumerator->Fill(Q3inv, entSep, 1.0);
99 }
100 
101 //____________________________
102 void Q3invCorrFctn::AddMixedTriplet(const StHbtTriplet* triplet){
103  double weight = 1.0;
104  if (mCorrection.GetRadius()!=-1) {
105  StHbtPair pair1(triplet->track1(), triplet->track2());
106  StHbtPair pair2(triplet->track2(), triplet->track3());
107  StHbtPair pair3(triplet->track3(), triplet->track1());
108 
109  double weight1 = mCorrection.CoulombCorrect(&pair1);
110  double weight2 = mCorrection.CoulombCorrect(&pair2);
111  double weight3 = mCorrection.CoulombCorrect(&pair3);
112 
113  weight = weight1*weight2*weight3;
114  }
115  else
116  weight = 1.0;
117 
118  double Qual = triplet->quality();
119  double entSep = triplet->NominalTpcEntranceSeparation();
120  double Q3inv = fabs(triplet->qInv()); // note - qInv() will be negative for identical triplets...
121  if (Qual<mSplit) mDenominator->Fill(Q3inv, entSep, weight);
122 }
123 //____________________________
124 void Q3invCorrFctn::AddCorrection(StHbtCoulomb* correction) {
125  mCorrection = *correction;
126 }