AliPhysics  cc1c0ba (cc1c0ba)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliFMDCorrELossFit.h
Go to the documentation of this file.
1 // Object holding the Energy loss fit 'correction'
2 //
3 // These are generated from Monte-Carlo or real ESDs.
4 #ifndef ALIFMDCORRELOSSFIT_H
5 #define ALIFMDCORRELOSSFIT_H
6 
16 #include <TObject.h>
17 #include <TAxis.h>
18 #include <TObjArray.h>
19 #include <TArrayI.h>
20 class TF1;
21 class TH1;
22 class TBrowser;
23 
38 class AliFMDCorrELossFit : public TObject
39 {
40 public:
44  enum {
48  kHasShift = (1<<14),
52  kIsGoodAsserted = (1<<15),
56  kIsGood = (1<<16)
57  };
61  enum {
63  };
69  struct ELossFit : public TObject
70  {
71  Int_t fN; // Number of peaks fitted
72  UShort_t fNu; // Number degrees of freedom
73  Double_t fChi2; // Chi square from fit
74  Double_t fC; // Scaling constant
75  Double_t fDelta; // Most probable value
76  Double_t fXi; // Width parameter of Landau
77  Double_t fSigma; // Sigma on folded gaussian
78  Double_t fSigmaN; // Sigma of detector noise
79  Double_t* fA; // [fN] Weights
80  Double_t fEC; // Error on C
81  Double_t fEDelta; // Error on Delta
82  Double_t fEXi; // Error on Xi
83  Double_t fESigma; // Error on sigma
84  Double_t fESigmaN;// Error on sigma (noise)
85  Double_t* fEA; // [fN] Error on weights
86  Int_t fQuality;// Assigned quality
87  UShort_t fDet; // Detector
88  Char_t fRing; // Ring
89  UShort_t fBin; // Eta bin
90 
91  mutable UShort_t fMaxWeight;
92 
93  static Double_t fgMaxRelError; // Global default max relative error
94  static Double_t fgLeastWeight; // Global default least weight
95  static Double_t fgMaxChi2nu; // Global default maximum reduced chi^2
100  ELossFit();
107  ELossFit(Int_t quality,const TF1& f);
130  ELossFit(Int_t quality,UShort_t n,
131  Double_t chi2, UShort_t nu,
132  Double_t c, Double_t ec,
133  Double_t delta, Double_t edelta,
134  Double_t xi, Double_t exi,
135  Double_t sigma, Double_t esigma,
136  Double_t sigman, Double_t esigman,
137  const Double_t* a,const Double_t* ea);
143  ELossFit(const ELossFit& o);
151  ELossFit& operator=(const ELossFit& o);
155  ~ELossFit();
163  Int_t GetN() const { return fN; }
167  UShort_t GetNu() const { return fNu; }
171  Double_t GetChi2() const { return fChi2; }
175  Double_t GetC() const { return fC; }
179  Double_t GetDelta() const { return fDelta; }
183  Double_t GetXi() const { return fXi; }
187  Double_t GetSigma() const { return fSigma; }
191  Double_t GetSigmaN() const { return fSigmaN; }
195  Double_t* GetAs() const { return fA; }
201  Double_t GetA(UShort_t i) const;
205  Double_t GetEC() const { return fEC; }
209  Double_t GetEDelta() const { return fEDelta; }
213  Double_t GetEXi() const { return fEXi; }
217  Double_t GetESigma() const { return fESigma; }
221  Double_t GetESigmaN() const { return fESigmaN; }
225  Double_t* GetEAs() const { return fEA; }
231  Double_t GetEA(UShort_t i) const;
235  Int_t GetQuality() const { return fQuality; }
239  UShort_t GetDet() const { return fDet; }
243  Char_t GetRing() const { return fRing; }
247  UShort_t GetBin() const { return fBin; }
248  /* @} */
249 
270  UShort_t maxN=999) const;
293  UShort_t maxN=9999) const;
309  Int_t FindMaxWeight(Double_t maxRelError=2*fgMaxRelError,
310  Double_t leastWeight=fgLeastWeight,
311  UShort_t maxN=999) const;
333  TF1* GetF1(Int_t i=0, Double_t max=20) const;
334  /* @} */
344  Double_t GetMpvCut(Double_t f) const;
350  Double_t GetXiCut(Double_t f) const;
377  /* @} */
387  Bool_t IsSortable() const { return kTRUE; }
401  Int_t Compare(const TObject* o) const;
402  /* @} */
412  void Print(Option_t* option) const; // *MENU*
419  void Draw(Option_t* option="comp"); // *MENU*
425  void Browse(TBrowser* b);
432  const Char_t* GetName() const;
440  void CalculateQuality(Double_t maxChi2nu=fgMaxChi2nu,
441  Double_t maxRelError=fgMaxRelError,
442  Double_t leastWeight=fgLeastWeight);
443  /* @} */
444  ClassDef(ELossFit,2); // Result of fit
445  };
446 
460  virtual ~AliFMDCorrELossFit();
469 
485  Bool_t SetFit(UShort_t d, Char_t r, Double_t eta, Int_t quality,
486  const TF1& f);
497  Bool_t SetFit(UShort_t d, Char_t r, Double_t eta, ELossFit* f);
508  Bool_t SetFit(UShort_t d, Char_t r, Int_t etaBin, ELossFit* f);
536  Bool_t SetFit(UShort_t d, Char_t r, Double_t eta,
537  Int_t quality,UShort_t n,
538  Double_t chi2, UShort_t nu,
539  Double_t c, Double_t ec,
540  Double_t delta, Double_t edelta,
541  Double_t xi, Double_t exi,
542  Double_t sigma, Double_t esigma,
543  Double_t sigman, Double_t esigman,
544  Double_t* a, Double_t* ea);
545  /* @} */
546 
556  void SetEtaAxis(const TAxis& axis);
564  void SetEtaAxis(Int_t nBins, Double_t min, Double_t max);
570  const TAxis& GetEtaAxis() const { return fEtaAxis; }
576  void SetLowCut(Double_t cut) { fLowCut = cut; }
582  Double_t GetLowCut() const { return fLowCut; }
591  Int_t FindEtaBin(Double_t eta) const;
592  /* @} */
593 
610  ELossFit* FindFit(UShort_t d, Char_t r, Double_t eta,
611  UShort_t minQ) const;
624  ELossFit* FindFit(UShort_t d, Char_t r, Int_t etabin,
625  UShort_t minQ) const;
637  ELossFit* GetFit(UShort_t d, Char_t r, Double_t eta) const;
649  ELossFit* GetFit(UShort_t d, Char_t r, Int_t etabin) const;
650  /* @} */
651 
662  Char_t r,
663  Int_t etaBin,
664  Double_t f) const;
674  Char_t r,
675  Int_t etaBin,
676  Double_t f) const;
686  Char_t r,
687  Int_t etaBin,
688  Double_t f) const;
701  Char_t r,
702  Int_t etaBin,
703  Double_t f) const;
718  Char_t r,
719  Int_t etaBin,
720  Double_t f) const;
721 
749  Bool_t IsGood(Bool_t verbose=true,
750  Double_t minRate=.7,
751  Int_t maxGap=3,
752  Int_t minInner=25,
753  Int_t minOuter=15,
754  Int_t minQuality=kDefaultQuality);
755  /* @} */
756 
761  void CacheBins(UShort_t minQuality=kDefaultQuality) const;
770  TObjArray* GetRingArray(UShort_t d, Char_t r) const;
776  Bool_t IsFolder() const { return true; }
782  void Browse(TBrowser* b);
790  void Draw(Option_t* option=""); //*MENU*
798  void Print(Option_t* option="R") const; //*MENU*
814  TList* GetStacks(Bool_t err, Bool_t rel, Bool_t good, UShort_t maxN=5) const;
815  /* @} */
816 protected:
825  Int_t GetRingIndex(UShort_t d, Char_t r) const;
850  void UpdateStackHist(ELossFit* f, Bool_t rel,
851  Int_t used,
852  TH1* hChi, TH1* hN,
853  TH1* hC, TH1* hDelta,
854  TH1* hXi, TH1* hSigma,
855  Int_t maxN, TH1** hA) const;
856 
857  TObjArray fRings; // Array of rings
858  TAxis fEtaAxis; // Eta axis used
859  Double_t fLowCut; // Low cut used when fitting
860  mutable TArrayI fCache;
861 
862  ClassDef(AliFMDCorrELossFit,3);
863 };
864 
865 //____________________________________________________________________
866 inline void
868 {
869  fEtaAxis.Set(nBins, min, max);
870 }
871 //____________________________________________________________________
872 inline void
874 {
875  fEtaAxis.Set(e.GetNbins(), e.GetXmin(), e.GetXmax());
876 }
877 //____________________________________________________________________
878 inline Double_t
880 {
881  if (i < 1) return 0;
882  if (i > fN) return 0;
883  if (i == 1) return 1;
884  return fA[i-2];
885 }
886 //____________________________________________________________________
887 inline Double_t
889 {
890  if (i < 1) return 0;
891  if (i > fN) return 0;
892  if (i == 1) return 1;
893  return fEA[i-2];
894 }
895 
896 
897 #endif
898 // Local Variables:
899 // mode: C++
900 // End:
901 
void SetLowCut(Double_t cut)
Bool_t SetFit(UShort_t d, Char_t r, Double_t eta, Int_t quality, const TF1 &f)
double Double_t
Definition: External.C:58
void UpdateStackHist(ELossFit *f, Bool_t rel, Int_t used, TH1 *hChi, TH1 *hN, TH1 *hC, TH1 *hDelta, TH1 *hXi, TH1 *hSigma, Int_t maxN, TH1 **hA) const
TObjArray * GetOrMakeRingArray(UShort_t d, Char_t r)
Double_t GetXiCut(UShort_t d, Char_t r, Int_t etaBin, Double_t f) const
TH1D * hSigma
void Browse(TBrowser *b)
const TAxis & GetEtaAxis() const
char Char_t
Definition: External.C:18
ELossFit * FindFit(UShort_t d, Char_t r, Double_t eta, UShort_t minQ) const
void Print(Option_t *option="R") const
void CalculateQuality(Double_t maxChi2nu=fgMaxChi2nu, Double_t maxRelError=fgMaxRelError, Double_t leastWeight=fgLeastWeight)
TCanvas * c
Definition: TestFitELoss.C:172
void CacheBins(UShort_t minQuality=kDefaultQuality) const
void Draw(Option_t *option="comp")
Double_t Evaluate(Double_t x, UShort_t maxN=999) const
Double_t * sigma
Double_t FindProbabilityCut(Double_t low) const
int Int_t
Definition: External.C:63
Bool_t IsGood(Bool_t verbose=true, Double_t minRate=.7, Int_t maxGap=3, Int_t minInner=25, Int_t minOuter=15, Int_t minQuality=kDefaultQuality)
TObjArray * GetRingArray(UShort_t d, Char_t r) const
Int_t Compare(const TObject *o) const
Int_t FindEtaBin(Double_t eta) const
static Double_t fgMaxRelError
Cached maximum weight.
void Print(Option_t *option) const
ELossFit & operator=(const ELossFit &o)
Double_t GetAvgXiSigmaCut(UShort_t d, Char_t r, Int_t etaBin, Double_t f) const
Double_t GetXiSigmaCut(UShort_t d, Char_t r, Int_t etaBin, Double_t f) const
Double_t GetA(UShort_t i) const
Double_t GetProbabilityCut(UShort_t d, Char_t r, Int_t etaBin, Double_t f) const
Double_t GetXiSigmaCut(Double_t f) const
Bool_t IsFolder() const
void SetEtaAxis(const TAxis &axis)
Double_t GetMpvCut(Double_t f) const
TList * GetStacks(Bool_t err, Bool_t rel, Bool_t good, UShort_t maxN=5) const
const Char_t * GetName() const
ELossFit * GetFit(UShort_t d, Char_t r, Double_t eta) const
Double_t GetAvgXiSigmaCut(Double_t f) const
void Draw(Option_t *option="")
unsigned short UShort_t
Definition: External.C:28
Double_t GetMpvCut(UShort_t d, Char_t r, Int_t etaBin, Double_t f) const
const char Option_t
Definition: External.C:48
Double_t GetEA(UShort_t i) const
bool Bool_t
Definition: External.C:53
Double_t EvaluateWeighted(Double_t x, UShort_t maxN=9999) const
AliFMDCorrELossFit & operator=(const AliFMDCorrELossFit &o)
TF1 * GetF1(Int_t i=0, Double_t max=20) const
Int_t GetRingIndex(UShort_t d, Char_t r) const
Double_t GetXiCut(Double_t f) const
Definition: External.C:196
Int_t FindMaxWeight(Double_t maxRelError=2 *fgMaxRelError, Double_t leastWeight=fgLeastWeight, UShort_t maxN=999) const
Double_t GetLowCut() const