StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
MinvCorrFctn.cxx
1 /***************************************************************************
2  *
3  * $Id: MinvCorrFctn.cxx,v 1.11 2011/04/03 15:46:42 fisyak 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: MinvCorrFctn.cxx,v $
14  * Revision 1.11 2011/04/03 15:46:42 fisyak
15  * Warn off
16  *
17  * Revision 1.10 2003/01/31 19:59:21 magestro
18  * Removed irrelevant include statement
19  *
20  * Revision 1.9 2000/08/08 23:39:21 laue
21  * Updated for standalone version
22  *
23  * Revision 1.8 2000/06/15 18:52:42 willson
24  * HbtAnalysis() method must be cast to specific analysis
25  * rotateEventCut installed
26  *
27  * Revision 1.7 2000/06/09 14:21:21 laue
28  * check of specific analysis type added
29  *
30  * Revision 1.6 2000/03/17 17:22:40 laue
31  * Roberts new three particle correlations implemented.
32  *
33  * Revision 1.4 2000/01/25 17:34:44 laue
34  * I. In order to run the stand alone version of the StHbtMaker the following
35  * changes have been done:
36  * a) all ClassDefs and ClassImps have been put into #ifdef __ROOT__ statements
37  * b) unnecessary includes of StMaker.h have been removed
38  * c) the subdirectory StHbtMaker/doc/Make has been created including everything
39  * needed for the stand alone version
40  *
41  * II. To reduce the amount of compiler warning
42  * a) some variables have been type casted
43  * b) some destructors have been declared as virtual
44  *
45  * Revision 1.3 1999/07/29 02:47:08 lisa
46  * 1) add OpeningAngle correlation function 2) add StHbtMcEventReader 3) make histos in CorrFctns do errors correctly
47  *
48  * Revision 1.2 1999/07/06 22:33:19 lisa
49  * Adjusted all to work in pro and new - dev itself is broken
50  *
51  * Revision 1.1.1.1 1999/06/29 16:02:57 lisa
52  * Installation of StHbtMaker
53  *
54  **************************************************************************/
55 //#ifndef __CINT__
56 //#include "fortranc.h"
57 //#define fortrantest F77_NAME(fortrantest,FORTRANTEST)
58 //extern "C" {int type_of_call F77_NAME(fortrantest,FORTRANTEST)(int*);}
59 //#endif
60 
61 #include "StHbtMaker/CorrFctn/MinvCorrFctn.h"
62 
63 #include "StHbtMaker/Infrastructure/StHbtAnalysis.h"
64 #include "StHbtMaker/Cut/mikesEventCut.h"
65 
66 #include <cstdio>
67 
68 #ifdef __ROOT__
69 ClassImp(MinvCorrFctn)
70 #endif
71 
72 //____________________________
73 MinvCorrFctn::MinvCorrFctn(char* title, const int& nbins, const float& MinvLo, const float& MinvHi){
74  //mTagWriter = StHbtTagWriter::Instance(); // get the singleton
75 
76  char theTitle[100];
77  // set up numerator
78  const char *TitNum = "MinvCorrFctn_Num";
79  sprintf(theTitle,"Num %s\n",title);
80  mNumerator = new StHbt1DHisto(TitNum,theTitle,nbins,MinvLo,MinvHi);
81  // set up denominator
82  const char *TitDen= "MinvCorrFctn_Den";
83  sprintf(theTitle,"Den %s\n",title);
84  mDenominator = new StHbt1DHisto(TitDen,theTitle,nbins,MinvLo,MinvHi);
85  // set up difference
86  const char *TitDif = "MinvCorrFctn_Dif";
87  sprintf(theTitle,"Dif %s\n",title);
88  mDifference = new StHbt1DHisto(TitDif,theTitle,nbins,MinvLo,MinvHi);
89  // this next bit is unfortunately needed so that we can have many histos of same "title"
90  // it is neccessary if we typedef StHbt1DHisto to TH1d (which we do)
91  mNumerator->SetDirectory(0);
92  mDenominator->SetDirectory(0);
93  mDifference->SetDirectory(0);
94 
95  mNumerator->Sumw2();
96  mDenominator->Sumw2();
97  mDifference->Sumw2();
98 
99  // for (int i=0; i < 100; i++) {
100  // int j = fortrantest( &i );
101  // }
102 }
103 
104 //____________________________
105 MinvCorrFctn::~MinvCorrFctn(){
106  delete mNumerator;
107  delete mDenominator;
108  delete mDifference;
109 }
110 //_________________________
111 void MinvCorrFctn::Finish(){
112  long NEvents = 1;
113  if ( dynamic_cast<StHbtAnalysis*>( HbtAnalysis() ) ) {
114  if ( dynamic_cast<mikesEventCut*>( ((StHbtAnalysis*)HbtAnalysis())->EventCut() ) )
115  NEvents = ((mikesEventCut*)((StHbtAnalysis*)HbtAnalysis())->EventCut())->NEventsPassed();
116  }
117 
118  mNumerator->Scale(1./NEvents);
119  mDenominator->Scale(1./NEvents);
120  mDifference->Scale(1./NEvents);
121 
122  double NumeratorInt = mNumerator->Integral();
123  double DenominatorInt = mDenominator->Integral();
124  mDifference->Add(mNumerator,mDenominator,1.0,-1*NumeratorInt/DenominatorInt);
125 
126 }
127 //____________________________
128 StHbtString MinvCorrFctn::Report(){
129  string stemp = "Minv Correlation Function Report:\n";
130  char ctemp[100];
131  sprintf(ctemp,"Number of entries in numerator:\t%E\n",mNumerator->GetEntries());
132  stemp += ctemp;
133  sprintf(ctemp,"Number of entries in denominator:\t%E\n",mDenominator->GetEntries());
134  stemp += ctemp;
135  sprintf(ctemp,"Number of entries in difference:\t%E\n",mDifference->GetEntries());
136  stemp += ctemp;
137  StHbtString returnThis = stemp;
138  return returnThis;
139 }
140 //____________________________
141 inline void MinvCorrFctn::AddRealPair(const StHbtPair* pair){
142  mNumerator->Fill(pair->mInv());
143  //mTagWriter->SetTag("positiveKaonsMeans",2, (float)pair->mInv() ); // <-- this is how to fill the tag
144 }
145 //____________________________
146 inline void MinvCorrFctn::AddMixedPair(const StHbtPair* pair){
147  mDenominator->Fill(pair->mInv());
148 }
149 
150