StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StGammaFitter.h
1 // -*- mode: C++ -*-
2 
3 //
4 // Pibero Djawotho <pibero@indiana.edu>
5 // Indiana University
6 // 28 July 2007
7 //
8 // StGammaFitter: Computes maximal sided residual of SMD response in u- and v-plane
9 // for gamma candidate.
10 //
11 // This class is based on C++ code developed by Jason Webb from the original
12 // FORTRAN code by Les Bland. The algorithm follows the steps below:
13 //
14 // 1. The SMD response, which is SMD strips with hits in MeV, in each plane (U and V)
15 // is stored in histogram hU and hV.
16 // 2. Fit functions fU and fV are created. The functional form of the SMD peak is
17 // a double-Gaussian with common mean and fixed widths. The widths were obtained by
18 // fitting the SMD response of single photons from the EEMC slow simulator. As such,
19 // the only free parameters are the common mean and the total yield.
20 // The actual formula used is:
21 //
22 // [0]*(0.69*exp(-0.5*((x-[1])/0.87)**2)/(sqrt(2*pi)*0.87)+0.31*exp(-0.5*((x-[1])/3.3)**2)/(sqrt(2*pi)*3.3))
23 //
24 // 3. The centroid of the gamma candidate is used to determine the tower at that
25 // position. The fitting range will be restricted to those SMD strips under the
26 // tower.
27 // 4. Guesses used in fit for the mean and yield are the strip with the highest signal
28 // and the integral within +/- 2 strips of the mean, respectively.
29 // 5. After obtaining the fit, the residual for each side of the peak is calculated
30 // by subtracting the fit from the data (residual = data - fit) from 2 strips beyond
31 // the mean out to 40 strips.
32 // 6. The maximal sided residual is simply the greater residual of each side.
33 //
34 
35 #ifndef ST_GAMMA_FITTER_H
36 #define ST_GAMMA_FITTER_H
37 
38 // ROOT
39 class TH1;
40 class TF1;
41 class TFile;
42 class TCanvas;
43 
44 // Local
45 class StGammaEvent;
46 class StGammaCandidate;
47 class StGammaTrack;
49 
50 // ROOT
51 #include "TObject.h"
52 
53 class StGammaFitter : public TObject {
54 public:
57 
60  static StGammaFitter* instance();
61 
62  virtual const char* GetCVS() const
63  {static const char cvs[]="Tag $Name: $ $Id: StGammaFitter.h,v 1.7 2014/08/06 11:43:18 jeromel Exp $ built " __DATE__ " " __TIME__; return cvs;}
64 
65 
84  int fit(StGammaCandidate* candidate, StGammaFitterResult* fits, Int_t plane=0);
85 
88  static double distanceToQuadraticCut(double x, double y);
89 
90  static TH1* getUhistogram();
91  static TH1* getVhistogram();
92  static TF1* getUfunction();
93  static TF1* getVfunction();
94 
95 protected:
98  StGammaFitter();
99 
100 private:
102  static StGammaFitter* mInstance;
103 
104  void estimateYieldMean(TH1* h1, float& yield, float& mean);
105 
110  float residual(TH1* h1, TF1* f1);
111 
113  static float GetMaximum(TH1* h1, float xmin, float xmax);
114 
115  static TH1* hU;
116  static TH1* hV;
117  static TF1* fFit[2];
118  static TF1* fResidualCut;
119  static int mNdf;
120  static TCanvas* mCanvas;
121  static TF1* mShowerShapes[3];
122 
123  ClassDef(StGammaFitter, 1);
124 };
125 
126 inline TH1* StGammaFitter::getUhistogram() { return hU; }
127 inline TH1* StGammaFitter::getVhistogram() { return hV; }
128 inline TF1* StGammaFitter::getUfunction() { return fFit[0]; }
129 inline TF1* StGammaFitter::getVfunction() { return fFit[1]; }
130 
131 #endif
~StGammaFitter()
Destructor.
static StGammaFitter * instance()
Access to single instance of this singleton class.
StGammaFitter()
Constructor in protected section to prevent user from creating instances of this singleton class...
static double distanceToQuadraticCut(double x, double y)
distance in yield vs. maximal-sided residual plane between the quadratic residual cut and the point (...
int fit(StGammaCandidate *candidate, StGammaFitterResult *fits, Int_t plane=0)
Fit transverse SMD profile to predetermined peak in u- and v-plane.