00001 #ifndef __EEmcSectorFit_h__
00002 #define __EEmcSectorFit_h__
00003
00004 #include "TMinuit.h"
00005 #include <vector>
00006 class TH1F;
00007 class EEmcSectorFit : public TMinuit
00008 {
00009 public:
00012 EEmcSectorFit(Int_t maxGammas=10);
00013
00015 virtual ~EEmcSectorFit();
00016
00018 void print() const;
00019
00021 void SetHistograms(TH1F *u, TH1F *v){ mSMD[0]=u; mSMD[1]=v; }
00022
00024 Double_t FitFunc( Double_t x, Int_t plane ) const;
00025
00032 virtual Int_t Eval(Int_t np,Double_t* gr,Double_t& x2,Double_t* p,Int_t flg);
00033
00037 Double_t Residual( Int_t x, Int_t plane) const;
00044 Double_t Residual( Int_t x, Int_t plane, Int_t dx, Int_t side=0) const;
00045
00047 Int_t MaxStrip(Int_t plane) const;
00048
00050 void AddCandidate( Double_t yield, Double_t sigma, Double_t u, Double_t v );
00051
00053 void Draw(Option_t *opts);
00054
00056 void InitParameters();
00057
00060 void TryPermutations();
00061
00063 void Clear(Option_t *opts="");
00064
00066 Int_t numberOfCandidates(){ return (Int_t)yield.size(); }
00067
00069 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]; }
00071 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(); }
00072
00074 TH1F *histo(Int_t plane) { return mSMD[plane]; }
00076 Double_t chi2() const { return mChi2; }
00078 Int_t ndf() const { return mNDF; }
00079
00081 void AddFits(TH1F *u, TH1F *v);
00082
00084 Bool_t doPermutations;
00085
00086 protected:
00087
00089 TH1F *mSMD[2];
00090
00092 std::vector<Double_t> yield;
00094 std::vector<Double_t> sigma;
00096 std::vector<Double_t> umean;
00098 std::vector<Double_t> vmean;
00099
00101 Double_t mChi2;
00103 Int_t mNDF;
00104
00106 ClassDef(EEmcSectorFit,1);
00107
00108 };
00109
00110 #endif