StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
EEmcSectorFit.h
1 #ifndef __EEmcSectorFit_h__
2 #define __EEmcSectorFit_h__
3 
4 #include "TMinuit.h"
5 #include <vector>
6 class TH1F;
7 class EEmcSectorFit : public TMinuit
8 {
9 public:
12  EEmcSectorFit(Int_t maxGammas=10);
13 
15  virtual ~EEmcSectorFit();
16 
18  void print() const;
19 
21  void SetHistograms(TH1F *u, TH1F *v){ mSMD[0]=u; mSMD[1]=v; }
22 
24  Double_t FitFunc( Double_t x, Int_t plane ) const;
25 
32  virtual Int_t Eval(Int_t np,Double_t* gr,Double_t& x2,Double_t* p,Int_t flg);
33 
37  Double_t Residual( Int_t x, Int_t plane) const;
44  Double_t Residual( Int_t x, Int_t plane, Int_t dx, Int_t side=0) const;
45 
47  Int_t MaxStrip(Int_t plane) const;
48 
50  void AddCandidate( Double_t yield, Double_t sigma, Double_t u, Double_t v );
51 
53  void Draw(Option_t *opts);
54 
56  void InitParameters();
57 
60  void TryPermutations();
61 
63  void Clear(Option_t *opts="");
64 
66  Int_t numberOfCandidates(){ return (Int_t)yield.size(); }
67 
69  void GetCandidate( Int_t i, Double_t &nmips, Double_t &width, Double_t &u, Double_t &v ){ nmips=yield[i]; width=sigma[i]; u=umean[i]; v=vmean[i]; }
71  void GetLastCandidate( Double_t &nmips, Double_t &width, Double_t &u, Double_t &v ){ nmips=yield.back(); width=sigma.back(); u=umean.back(); v=vmean.back(); }
72 
74  TH1F *histo(Int_t plane) { return mSMD[plane]; }
76  Double_t chi2() const { return mChi2; }
78  Int_t ndf() const { return mNDF; }
79 
81  void AddFits(TH1F *u, TH1F *v);
82 
85 
86 protected:
87 
89  TH1F *mSMD[2];
90 
92  std::vector<Double_t> yield;
94  std::vector<Double_t> sigma;
96  std::vector<Double_t> umean;
98  std::vector<Double_t> vmean;
99 
101  Double_t mChi2;
103  Int_t mNDF;
104 
107 
108 };
109 
110 #endif
EEmcSectorFit(Int_t maxGammas=10)
Int_t mNDF
Degrees o&#39; freedom.
void print() const
print summary
void AddCandidate(Double_t yield, Double_t sigma, Double_t u, Double_t v)
Add a candidate to the list of candidate gammas.
void InitParameters()
Initialize parameters.
std::vector< Double_t > sigma
Width of N gammas.
Definition: EEmcSectorFit.h:94
void TryPermutations()
std::vector< Double_t > vmean
Mean V position of N gammas.
Definition: EEmcSectorFit.h:98
void GetCandidate(Int_t i, Double_t &nmips, Double_t &width, Double_t &u, Double_t &v)
Returns the parameters of the fit to the ith gamma candidate.
Definition: EEmcSectorFit.h:69
Double_t FitFunc(Double_t x, Int_t plane) const
Evaluate the N gamma fit for the specified plane.
Int_t MaxStrip(Int_t plane) const
Find maximum residual strip in specified plane. Returns strip index.
ClassDef(EEmcSectorFit, 1)
MAkes class available to root.
std::vector< Double_t > umean
Mean U position of N gammas.
Definition: EEmcSectorFit.h:96
virtual ~EEmcSectorFit()
Destructor.
Double_t chi2() const
Return the chisquared of the fit.
Definition: EEmcSectorFit.h:76
Int_t ndf() const
Return the number of degrees of freedom.
Definition: EEmcSectorFit.h:78
TH1F * mSMD[2]
The histograms we fit.
Definition: EEmcSectorFit.h:89
Double_t mChi2
Chi^2 of the fit.
void Draw(Option_t *opts)
Draws the current fit.
virtual Int_t Eval(Int_t np, Double_t *gr, Double_t &x2, Double_t *p, Int_t flg)
Double_t Residual(Int_t x, Int_t plane) const
void Clear(Option_t *opts="")
Clear the array of photon candidates.
void AddFits(TH1F *u, TH1F *v)
Adds TF1 to histogram.
void GetLastCandidate(Double_t &nmips, Double_t &width, Double_t &u, Double_t &v)
Returns the parameters of the last candidate found.
Definition: EEmcSectorFit.h:71
std::vector< Double_t > yield
Yield of N gammas.
Definition: EEmcSectorFit.h:92
void SetHistograms(TH1F *u, TH1F *v)
Set pointers to histograms which will be fit.
Definition: EEmcSectorFit.h:21
Int_t numberOfCandidates()
Returns the number of gamma candidates.
Definition: EEmcSectorFit.h:66
Bool_t doPermutations
Flag to determine if we test all permutations or not.
Definition: EEmcSectorFit.h:84
TH1F * histo(Int_t plane)
Return the histogram for the specified plane.
Definition: EEmcSectorFit.h:74
Simultaneous fit of two smd planes to N gammas.
Definition: EEmcSectorFit.h:7