StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
MinvCorrFctnArmenteros.cxx
1 /***************************************************************************
2  *
3  * $Id: MinvCorrFctnArmenteros.cxx,v 1.4 2003/09/02 17:58:20 perev 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: MinvCorrFctnArmenteros.cxx,v $
14  * Revision 1.4 2003/09/02 17:58:20 perev
15  * gcc 3.2 updates + WarnOff
16  *
17  * Revision 1.3 2000/06/15 18:52:42 willson
18  * HbtAnalysis() method must be cast to specific analysis
19  * rotateEventCut installed
20  *
21  * Revision 1.2 2000/03/16 01:56:36 laue
22  * Copy constructor added to some correlation functions
23  *
24  * Revision 1.1 2000/02/28 14:31:51 laue
25  * Correlation function to make the Armenteros-Podolanski plot.
26  *
27  * Revision 1.2 1999/07/06 22:33:19 lisa
28  * Adjusted all to work in pro and new - dev itself is broken
29  *
30  * Revision 1.1.1.1 1999/06/29 16:02:57 lisa
31  * Installation of StHbtMaker
32  *
33  **************************************************************************/
34 
35 
36 #include "StHbtMaker/CorrFctn/MinvCorrFctnArmenteros.h"
37 //#include "StHbtMaker/Infrastructure/StHbtHisto.hh"
38 #include <cstdio>
39 
40 #ifdef __ROOT__
41  ClassImp(MinvCorrFctnArmenteros)
42 #endif
43 
44 
45 
46 pairD armenteros(const StHbtPair*);
47 double ptArm(const StHbtPair*);
48 double alphaArm(const StHbtPair*);
49 
50 //___________________________
51 MinvCorrFctnArmenteros::MinvCorrFctnArmenteros(char* title,
52  const int& nbins1, const float& MinvLo1, const float& MinvHi1,
53  const int& nbins2, const float& MinvLo2, const float& MinvHi2){
54  char theTitle[100];
55  // set up numerator
56  char TitNum[100] = "NumArmenteros1 ";
57  sprintf(theTitle,"Num %s",title);
58  mNumerator = new StHbt2DHisto(TitNum,theTitle,nbins1,MinvLo1,MinvHi1,nbins2,MinvLo2,MinvHi2);
59  // set up denominator
60  char TitDen[100] = "DenArmenteros1";
61  sprintf(theTitle,"Den %s",title);
62  mDenominator = new StHbt2DHisto(TitDen,theTitle,nbins1,MinvLo1,MinvHi1,nbins2,MinvLo2,MinvHi2);
63  // set up difference
64  char TitDif[100] = "DifArmenteros1";
65  sprintf(theTitle,"Dif %s",title);
66  mDifference = new StHbt2DHisto(TitDif,theTitle,nbins1,MinvLo1,MinvHi1,nbins2,MinvLo2,MinvHi2);
67  // this next bit is unfortunately needed so that we can have many histos of same "title"
68  // it is neccessary if we typedef StHbt1DHisto to TH1d (which we do)
69  mNumerator->SetDirectory(0);
70  mDenominator->SetDirectory(0);
71  mDifference->SetDirectory(0);
72  // default for mass window, can be changed via SetMassWindow(double, double);
73  mRealPairs = 0;
74  mMixedPairs = 0;
75 }
76 
77 //____________________________
78 MinvCorrFctnArmenteros::~MinvCorrFctnArmenteros(){
79  delete mNumerator;
80  delete mDenominator;
81  delete mDifference;
82 }
83 //_________________________
84 void MinvCorrFctnArmenteros::Finish(){
85  int NEvents = 1;
86  if ( dynamic_cast<StHbtAnalysis*>( HbtAnalysis() ) ) {
87  if ( dynamic_cast<mikesEventCut*>( ((StHbtAnalysis*)HbtAnalysis())->EventCut() ) )
88  NEvents = ((mikesEventCut*)((StHbtAnalysis*)HbtAnalysis())->EventCut())->NEventsPassed();
89  }
90 
91  mNumerator->Scale(1./NEvents);
92  mDenominator->Scale(1./NEvents);
93  mDifference->Scale(1./NEvents);
94 
95  //double NumeratorInt = mNumerator->Integral();
96  //double DenominatorInt = mDenominator->Integral();
97 
98  mDifference->Add(mNumerator,mDenominator,1.0,-1.*mRealPairs/mMixedPairs);
99 
100 }
101 
102 //____________________________
103 StHbtString MinvCorrFctnArmenteros::Report(){
104  string stemp = "Minv 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 difference:\t%E\n",mDifference->GetEntries());
111  stemp += ctemp;
112  StHbtString returnThis = stemp;
113  return returnThis;
114 }
115 //____________________________
116 inline void MinvCorrFctnArmenteros::AddRealPair(const StHbtPair* pair){
117  if ( pair->mInv()>mLo && pair->mInv()<mHi || mHi == mLo) {
118  pairD ptArmAlpha = armenteros(pair);
119  mNumerator->Fill( ptArmAlpha.first, ptArmAlpha.second, 1.);
120  mRealPairs++;
121  }
122 }
123 //____________________________
124 inline void MinvCorrFctnArmenteros::AddMixedPair(const StHbtPair* pair){
125  if ( pair->mInv()>mLo && pair->mInv()<mHi || mHi == mLo) {
126  pairD ptArmAlpha = armenteros(pair);
127  mDenominator->Fill( ptArmAlpha.first, ptArmAlpha.second, 1.);
128  mMixedPairs++;
129  }
130 }
131 //____________________________
132 inline pairD armenteros(const StHbtPair* pair ) {
133  StHbtThreeVector pp = pair->track1()->FourMomentum().vect();
134  StHbtThreeVector pn = pair->track2()->FourMomentum().vect();
135  float pdotn = pp.dot(pn);
136  float ptotp2 = pp.mag2();
137  float ptotn2 = pn.mag2();
138 
139  float ptot = pair->fourMomentumSum().vect().mag();
140 
141  float ppp = ( ptotp2 + pdotn )/ptot;
142  float ppn = ( ptotn2 + pdotn )/ptot;
143 
144  return pairD( (ppp - ppn)/(ppp + ppn), ::sqrt(fabs(ptotp2 - ppp*ppp)) );
145 }