StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ExitSepCorrFctn.cxx
1 /***************************************************************************
2  *
3  * Author: Mike Lisa, Ohio State, lisa@mps.ohio-state.edu
4  ***************************************************************************
5  *
6  * Description: part of STAR HBT Framework: StHbtMaker package
7  * a simple opening-angle correlation function used for studying 2-track cuts
8  *
9  ***************************************************************************
10  *
11  **************************************************************************/
12 
13 #include "StHbtMaker/CorrFctn/ExitSepCorrFctn.h"
14 #include <cstdio>
15 
16 #ifdef __ROOT__
17 ClassImp(ExitSepCorrFctn)
18 #endif
19 
20  // following function (found at bottom of this file) is obsolete - MALisa July2000
21  // StHbtThreeVector FindExitPoint(const StPhysicalHelixD& pHelix);
22 
23 //____________________________
24 ExitSepCorrFctn::ExitSepCorrFctn(char* title, const int& nbinsQ, const float& QLo, const float& QHi,
25  const int& nbinsExSep, const float& ExSepLo, const float& ExSepHi){
26  // set up numeratorS
27  char Tit[100];
28  sprintf(Tit,"2D Num");
29  strcat(Tit,title);
30  mNumerator2D = new StHbt2DHisto(Tit,title,nbinsQ,QLo,QHi,nbinsExSep,ExSepLo,ExSepHi);
31 
32  // set up denominatorS
33  sprintf(Tit,"2D Den");
34  strcat(Tit,title);
35  mDenominator2D = new StHbt2DHisto(Tit,title,nbinsQ,QLo,QHi,nbinsExSep,ExSepLo,ExSepHi);
36 
37  // set up ratioS
38  sprintf(Tit,"2D Rat");
39  strcat(Tit,title);
40  mRatio2D = new StHbt2DHisto(Tit,title,nbinsQ,QLo,QHi,nbinsExSep,ExSepLo,ExSepHi);
41 
42  // these histograms should have errors associated with them...
43  mNumerator2D->Sumw2();
44  mDenominator2D->Sumw2();
45  mRatio2D->Sumw2();
46 
47 }
48 
49 //____________________________
50 ExitSepCorrFctn::~ExitSepCorrFctn(){
51  delete mNumerator2D;
52  delete mDenominator2D;
53  delete mRatio2D;
54 }
55 //_________________________
56 void ExitSepCorrFctn::Finish(){
57  mRatio2D->Divide(mNumerator2D,mDenominator2D,1.0,1.0);
58 }
59 
60 //____________________________
61 StHbtString ExitSepCorrFctn::Report(){
62  string stemp = "Exit Seperation Correlation Function Report:\n";
63  char ctemp[100];
64  sprintf(ctemp,"Number of entries in numerator:\t%E\n",
65  mNumerator2D->GetEntries());
66  stemp += ctemp;
67  sprintf(ctemp,"Number of entries in denominator:\t%E\n",
68  mDenominator2D->GetEntries());
69  stemp += ctemp;
70  StHbtString returnThis = stemp;
71  return returnThis;
72 }
73 //____________________________
74 void ExitSepCorrFctn::AddRealPair(const StHbtPair* pair){
75 
76  // MALisa July2000 - take explicit calculation of exit points and exit separation out of this
77  // class and put it into StHbtParticle and StHbtPair where they belong
78  // StHbtThreeVector exitPt1 = FindExitPoint(pair->track1()->Helix());
79  // StHbtThreeVector exitPt2 = FindExitPoint(pair->track2()->Helix());
80  // StHbtThreeVector diff = exitPt1 - exitPt2;
81  // double exitSep = diff.mag();
82 
83  double exitSep = pair->NominalTpcExitSeparation();
84  double Qinv = fabs(pair->qInv()); // note - qInv() will be negative for identical pairs...
85 
86  mNumerator2D->Fill(Qinv,exitSep,1.0);
87 }
88 //____________________________
89 void ExitSepCorrFctn::AddMixedPair(const StHbtPair* pair){
90 
91  double exitSep = pair->NominalTpcExitSeparation();
92  double Qinv = fabs(pair->qInv()); // note - qInv() will be negative for identical pairs...
93 
94  mDenominator2D->Fill(Qinv,exitSep,1.0);
95 }
96 
97 
98 // The following functionality has been moved to StHbtParticle (for exit point)
99 // and StHbtPair (for exit separation). It is kept here (commented out) for reference
100 //_______________ seperate function for calculating the exit point...
101 // StHbtThreeVector FindExitPoint(const StPhysicalHelixD& pHelix){
102 // static StHbtThreeVector ZeroVec(0.,0.,0.);
103 // double dip, curv, phase;
104 // int h;
105 // curv = pHelix.curvature();
106 // dip = pHelix.dipAngle();
107 // phase= pHelix.phase();
108 // h = pHelix.h();
109 // StHelixD hel(curv,dip,phase,ZeroVec,h);
110 
111 // pairD candidates;
112 // double sideLength; // this is how much length to go to leave through sides of TPC
113 // double endLength; // this is how much length to go to leave through endcap of TPC
114 // // figure out how far to go to leave through side...
115 // candidates = hel.pathLength(200.0); // bugfix MAL jul00 - 200cm NOT 2cm
116 // sideLength = (candidates.first > 0) ? candidates.first : candidates.second;
117 
118 // static StHbtThreeVector WestEnd(0.,0.,200.); // bugfix MAL jul00 - 200cm NOT 2cm
119 // static StHbtThreeVector EastEnd(0.,0.,-200.); // bugfix MAL jul00 - 200cm NOT 2cm
120 // static StHbtThreeVector EndCapNormal(0.,0.,1.0);
121 
122 // endLength = hel.pathLength(WestEnd,EndCapNormal);
123 // if (endLength < 0.0) endLength = hel.pathLength(EastEnd,EndCapNormal);
124 
125 // if (endLength < 0.0) cout << "FindExitPoint: Hey-- I cannot find an exit point out endcaps" << endl;
126 
127 // // OK, firstExitLength will be the shortest way out of the detector...
128 // double firstExitLength = (endLength < sideLength) ? endLength : sideLength;
129 
130 // // now then, let's return the POSITION at which particle leaves TPC...
131 // return hel.at(firstExitLength);
132 // }