AliPhysics  51e3ab4 (51e3ab4)
 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;
345  /* @} */
355  Bool_t IsSortable() const { return kTRUE; }
369  Int_t Compare(const TObject* o) const;
370  /* @} */
380  void Print(Option_t* option) const; // *MENU*
387  void Draw(Option_t* option="comp"); // *MENU*
393  void Browse(TBrowser* b);
400  const Char_t* GetName() const;
409  Double_t GetLowerBound(Double_t f, Bool_t includeSigma) const;
425  void CalculateQuality(Double_t maxChi2nu=fgMaxChi2nu,
426  Double_t maxRelError=fgMaxRelError,
427  Double_t leastWeight=fgLeastWeight);
428  /* @} */
429  ClassDef(ELossFit,2); // Result of fit
430  };
431 
445  virtual ~AliFMDCorrELossFit();
454 
470  Bool_t SetFit(UShort_t d, Char_t r, Double_t eta, Int_t quality,
471  const TF1& f);
482  Bool_t SetFit(UShort_t d, Char_t r, Double_t eta, ELossFit* f);
493  Bool_t SetFit(UShort_t d, Char_t r, Int_t etaBin, ELossFit* f);
521  Bool_t SetFit(UShort_t d, Char_t r, Double_t eta,
522  Int_t quality,UShort_t n,
523  Double_t chi2, UShort_t nu,
524  Double_t c, Double_t ec,
525  Double_t delta, Double_t edelta,
526  Double_t xi, Double_t exi,
527  Double_t sigma, Double_t esigma,
528  Double_t sigman, Double_t esigman,
529  Double_t* a, Double_t* ea);
530  /* @} */
531 
541  void SetEtaAxis(const TAxis& axis);
549  void SetEtaAxis(Int_t nBins, Double_t min, Double_t max);
555  const TAxis& GetEtaAxis() const { return fEtaAxis; }
561  void SetLowCut(Double_t cut) { fLowCut = cut; }
567  Double_t GetLowCut() const { return fLowCut; }
576  Int_t FindEtaBin(Double_t eta) const;
577  /* @} */
578 
595  ELossFit* FindFit(UShort_t d, Char_t r, Double_t eta,
596  UShort_t minQ) const;
609  ELossFit* FindFit(UShort_t d, Char_t r, Int_t etabin,
610  UShort_t minQ) const;
622  ELossFit* GetFit(UShort_t d, Char_t r, Double_t eta) const;
634  ELossFit* GetFit(UShort_t d, Char_t r, Int_t etabin) const;
635  /* @} */
636 
652  Double_t f) const;
664  Double_t f) const;
677  Double_t p, Bool_t dummy) const;
690  Double_t p, Bool_t dummy) const;
704  Double_t f, Bool_t showErrors,
705  Bool_t includeSigma) const;
719  Double_t f, Bool_t showErrors,
720  Bool_t includeSigma) const;
748  Bool_t IsGood(Bool_t verbose=true,
749  Double_t minRate=.7,
750  Int_t maxGap=3,
751  Int_t minInner=25,
752  Int_t minOuter=15,
753  Int_t minQuality=kDefaultQuality);
754  /* @} */
755 
760  void CacheBins(UShort_t minQuality=kDefaultQuality) const;
769  TObjArray* GetRingArray(UShort_t d, Char_t r) const;
775  Bool_t IsFolder() const { return true; }
781  void Browse(TBrowser* b);
789  void Draw(Option_t* option=""); //*MENU*
797  void Print(Option_t* option="R") const; //*MENU*
813  TList* GetStacks(Bool_t err, Bool_t rel, Bool_t good, UShort_t maxN=5) const;
814  /* @} */
815 protected:
824  Int_t GetRingIndex(UShort_t d, Char_t r) const;
849  void UpdateStackHist(ELossFit* f, Bool_t rel,
850  Int_t used,
851  TH1* hChi, TH1* hN,
852  TH1* hC, TH1* hDelta,
853  TH1* hXi, TH1* hSigma,
854  Int_t maxN, TH1** hA) const;
855 
856  TObjArray fRings; // Array of rings
857  TAxis fEtaAxis; // Eta axis used
858  Double_t fLowCut; // Low cut used when fitting
859  mutable TArrayI fCache;
860 
862 };
863 
864 //____________________________________________________________________
865 inline void
867 {
868  fEtaAxis.Set(nBins, min, max);
869 }
870 //____________________________________________________________________
871 inline void
873 {
874  fEtaAxis.Set(e.GetNbins(), e.GetXmin(), e.GetXmax());
875 }
876 //____________________________________________________________________
877 inline Double_t
879 {
880  if (i < 1) return 0;
881  if (i > fN) return 0;
882  if (i == 1) return 1;
883  return fA[i-2];
884 }
885 //____________________________________________________________________
886 inline Double_t
888 {
889  if (i < 1) return 0;
890  if (i > fN) return 0;
891  if (i == 1) return 1;
892  return fEA[i-2];
893 }
894 
895 
896 #endif
897 // Local Variables:
898 // mode: C++
899 // End:
900 
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
Double_t GetLowerBound(Double_t f, Bool_t includeSigma) const
TObjArray * GetOrMakeRingArray(UShort_t d, Char_t r)
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
Double_t GetLowerBound(UShort_t d, Char_t r, Int_t etaBin, Double_t f) 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 GetA(UShort_t i) const
Bool_t IsFolder() const
void SetEtaAxis(const TAxis &axis)
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
void Draw(Option_t *option="")
unsigned short UShort_t
Definition: External.C:28
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
ClassDef(AliFMDCorrELossFit, 3)
Int_t GetRingIndex(UShort_t d, Char_t r) 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