StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
dFitter3d.h
1 /***************************************************************************
2  *
3  * Author: Dominik Flierl, flierl@bnl.gov
4  ***************************************************************************
5  *
6  * Description: part of STAR HBT Framework: StHbtMaker package
7  * a object which uses TMinuit to fit correlationfunctions
8  *
9  **************************************************************************/
10 
11 #ifndef dFitter3d_hh
12 #define dFitter3d_hh
13 
14 
15 #include "TH3.h"
16 #include "TH1.h"
17 #include "TMinuit.h"
18 #include "TVector3.h"
19 #include "TString.h"
20 #include "TObject.h"
21 
22 class dFitter3d : public TObject
23 {
24  public :
26  // constructors
28  dFitter3d( TMinuit* gMinuit, TH3D* numerator, TH3D* denominator, TString opt, TString opt2 ) ;
29  ~dFitter3d() ;
30 
32  // essential members
34  // fill internal arrays
35  void FillInternalArrays() ;
36  // trigger minimazation using TMinuit
37  void doFit() ;
38 
40  // fit methods
42  // set fitting method to be used (MML or Chi2)
43  void setFitMethod(TString opt) ;
44  // the general fcn which will call fcnChi2 or fcnMML
45  void mfcn(Int_t &nParamters, Double_t *gin, Double_t &finalChi2, Double_t *parameterSet, Int_t iflag) ;
46  // define chi2 which will be mimized by TMinuit
47  void fcnChi2(Int_t &nParamters, Double_t *gin, Double_t &finalChi2, Double_t *parameterSet, Int_t iflag) ;
48  // define Maximum Likelihood which will be minimized by TMinuit
49  void fcnMml(Int_t &nParamters, Double_t *gin, Double_t &finalChi2, Double_t *parameterSet, Int_t iflag) ;
50  // ln of factorial value of arg : helper function for Maximum Likelihood
51  double lnfactorial(double arg) ;
52 
53 
55  // correlation function
57  // set correlation function to be fitted (YKP or BP)
58  void setCorrFctn(TString opt) ;
59  // return C2 at 'position' with 'parameterSet' for either ykp or bp
60  double mCorrelationFunction(TVector3& position, double* parameterSet ) ;
61  // return C2 for the YKP parametrization at 'position' with 'parameterSet'
62  double ykpCorrelationFunction(TVector3& position, double* parameterSet ) ;
63  // return C2 for the BP parametrization at 'position' with 'parameterSet'
64  double bpCorrelationFunction(TVector3& position, double* parameterSet ) ;
65 
66 
68  // general stuff
70  // get histos
71  TH3D* Numerator() ;
72  TH3D* Denominator() ;
73  TH3D* Ratio() ;
74  // get/set norm
75  void SetNormFactor(double norm) ;
76  double Norm() ;
77  // get/set thresholod
78  void SetThresholdNumerator(double thresN) ;
79  void SetThresholdDenominator(double thresD) ;
80  double ThresholdNumerator() ;
81  double ThresholdDenominator() ;
82  // set input histos
83  void SetHistos(TH3D* numerator, TH3D* denominator) ;
84  // get Minuit
85  TMinuit* getMinuit() { return mMinuit ; } ;
86  // options
87  void SetSphereLimit(double limit) { mSphereLimit = limit*limit ; } ;
88  double GetSphereLimit() { return mSphereLimit; } ;
89 
90 
91  private :
92 
93  // pointer to TMinuit itself ( it's already global, but well you know ... :) )
94  TMinuit* mMinuit ;
95 
96  // internal Arrays
97  int mInternalArraySize ;
98  double* mRatioInternalArray ;
99  double* mNumeratorInternalArray ;
100  double* mDenominatorInternalArray ;
101  double* mErrorInternalArray ;
102  TVector3* mVariablePositionArray ;
103 
104 
105  // options
106  // chi2 or mml
107  TString mFitMethod ;
108  // ykp or bp
109  TString mCorrFctnType ;
110  // spherelimit
111  double mSphereLimit ;
112 
113  // basic functions which are not yet provided by ROOT itself
114  void Bin1ToBin3(TH3D* histo, int bin, int& binx, int& biny, int& binz) ;
115 
116  // count how often we called fcn -> check minuit :)
117  int countMinuitCalls ;
118 
119  // the histos
120  // 3d authentic
121  TH3D* mNumerator ;
122  TH3D* mDenominator ;
123  TH3D* mRatio ;
124 
125  // parameters
126  double mNorm ;
127  double mThresholdNumerator ;
128  double mThresholdDenominator ;
129 
130  // constants
131  double mhc ; // 0.197 GeVfm
132  double mhc2 ; // 0.038 (GeVfm)^2
133 
134  // root dictionary
135 #ifdef __ROOT__
136  ClassDef(dFitter3d, 0)
137 #endif
138 
139 };
140 
142 // inline functions
144 // 3d-original
145 inline TH3D* dFitter3d::Numerator(){return mNumerator;}
146 inline TH3D* dFitter3d::Denominator(){return mDenominator;}
147 inline TH3D* dFitter3d::Ratio(){return mRatio;}
148 // norm
149 inline double dFitter3d::Norm(){return mNorm; }
150 inline void dFitter3d::SetNormFactor(double norm) { mNorm = norm ; }
151 // threshold
152 inline double dFitter3d::ThresholdNumerator(){return mThresholdNumerator; }
153 inline double dFitter3d::ThresholdDenominator(){return mThresholdDenominator; }
154 inline void dFitter3d::SetThresholdNumerator(double thresN) { mThresholdNumerator = thresN ; }
155 inline void dFitter3d::SetThresholdDenominator(double thresD) { mThresholdDenominator = thresD ; }
156 
157 // ifndef dFitter3d_hh
158 #endif