]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/AliFMDCorrELossFit.h
Updates
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliFMDCorrELossFit.h
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 /**
7  * @file   AliFMDCorrELossFit.h
8  * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
9  * @date   Wed Mar 23 14:01:15 2011
10  * 
11  * @brief  
12  * 
13  * @ingroup pwglf_forward_eloss
14  * 
15  */
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
24 /** 
25  * @defgroup pwglf_forward_corr Corrections 
26  * 
27  * Correction objects used 
28  *
29  * @ingroup pwglf_forward
30  */
31 /** 
32  * Object holding the Energy loss fit 'correction'
33  * 
34  * These are generated from Monte-Carlo or real ESDs. 
35  *
36  * @ingroup pwglf_forward_corr
37  * @ingroup pwglf_forward_eloss
38  */
39 class AliFMDCorrELossFit : public TObject 
40 {
41 public:
42   enum { 
43     kHasShift = (1<<14)
44   };
45   /** 
46    * POD structure to hold data from fits 
47    * 
48    * @ingroup pwglf_forward_corr
49    */
50   struct ELossFit : public TObject 
51   {
52     Int_t     fN;      // Number of peaks fitted
53     UShort_t  fNu;     // Number degrees of freedom
54     Double_t  fChi2;   // Chi square from fit
55     Double_t  fC;      // Scaling constant 
56     Double_t  fDelta;  // Most probable value 
57     Double_t  fXi;     // Width parameter of Landau 
58     Double_t  fSigma;  // Sigma on folded gaussian 
59     Double_t  fSigmaN; // Sigma of detector noise 
60     Double_t* fA;      // [fN] Weights 
61     Double_t  fEC;     // Error on C 
62     Double_t  fEDelta; // Error on Delta 
63     Double_t  fEXi;    // Error on Xi
64     Double_t  fESigma; // Error on sigma 
65     Double_t  fESigmaN;// Error on sigma (noise)
66     Double_t* fEA;     // [fN] Error on weights
67     Int_t     fQuality;// Assigned quality 
68     UShort_t  fDet;    // Detector 
69     Char_t    fRing;   // Ring
70     UShort_t  fBin;    // Eta bin
71
72     mutable UShort_t fMaxWeight; //!Cached maximum weight
73
74     static Double_t fgMaxRelError;  // Global default max relative error
75     static Double_t fgLeastWeight;  // Global default least weight 
76     static Double_t fgMaxChi2nu;    // Global default maximum reduced chi^2
77     /**
78      * Default constructor 
79      * 
80      */
81     ELossFit();
82     /** 
83      * Construct from a function
84      * 
85      * @param quality Quality flag
86      * @param f       Function
87      */
88     ELossFit(Int_t quality,const TF1& f);
89     /** 
90      * Constructor with full parameter set
91      * 
92      * @param quality   Quality flag
93      * @param n         @f$ N@f$ - Number of fitted peaks
94      * @param chi2      @f$ \chi^2 @f$
95      * @param nu        @f$ \nu @f$ - number degrees of freedom
96      * @param c         @f$ C@f$ - scale constant
97      * @param ec        @f$ \delta C@f$ - error on @f$ C@f$ 
98      * @param delta     @f$ \Delta@f$ - Most probable value               
99      * @param edelta    @f$ \delta\Delta@f$ - error on @f$\Delta@f$ 
100      * @param xi        @f$ \xi@f$ - width  
101      * @param exi       @f$ \delta\xi@f$ - error on @f$\xi@f$ 
102      * @param sigma     @f$ \sigma@f$ - Width of Gaussian                  
103      * @param esigma    @f$ \delta\sigma@f$ - error on @f$\sigma@f$ 
104      * @param sigman    @f$ \sigma_n@f$ - Noise width             
105      * @param esigman   @f$ \delta\sigma_n@f$ - error on @f$\sigma_n@f$ 
106      * @param a         Array of @f$ N-1@f$ weights @f$ a_i@f$ for 
107      *                  @f$ i=2,\ldots@f$ 
108      * @param ea        Array of @f$ N-1@f$ error on the weights @f$ a_i@f$ for 
109      *                  @f$ i=2,\ldots@f$ 
110      */
111     ELossFit(Int_t     quality,UShort_t  n, 
112              Double_t  chi2,   UShort_t  nu, 
113              Double_t  c,      Double_t  ec, 
114              Double_t  delta,  Double_t  edelta, 
115              Double_t  xi,     Double_t  exi,
116              Double_t  sigma,  Double_t  esigma, 
117              Double_t  sigman, Double_t  esigman, 
118              const Double_t* a,const Double_t* ea);
119     /** 
120      * Copy constructor 
121      * 
122      * @param o Object to copy from 
123      */
124     ELossFit(const ELossFit& o);
125     /** 
126      * Assignment operator 
127      * 
128      * @param o Object to assign from 
129      * 
130      * @return Reference to this object 
131      */
132     ELossFit& operator=(const ELossFit& o);
133     /** 
134      * Destructor 
135      */
136     ~ELossFit();
137     /**
138      * @{
139      * @name Access to parameters 
140      */
141     /**
142      * @return Number of peaks fitted
143      */
144     Int_t GetN() const { return fN; }
145     /**
146      * @return Number degrees of freedom
147      */
148     UShort_t GetNu() const { return fNu; }
149     /**
150      * @return Chi square from fit
151      */
152     Double_t GetChi2() const { return fChi2; }
153     /**
154      * @return Scaling constant 
155      */
156     Double_t GetC() const { return fC; }
157     /**
158      * @return Most probable value 
159      */
160     Double_t GetDelta() const { return fDelta; }
161     /**
162      * @return Width parameter of Landau 
163      */
164     Double_t GetXi() const { return fXi; }
165     /**
166      * @return Sigma on folded gaussian 
167      */
168     Double_t GetSigma() const { return fSigma; }
169     /**
170      * @return Sigma of detector noise 
171      */
172     Double_t GetSigmaN() const { return fSigmaN; }
173     /**
174      * @return Weights 
175      */
176     Double_t* GetAs() const { return fA; }
177     /**
178      * @param i Which weight to get 
179      *
180      * @return Weights 
181      */
182     Double_t GetA(UShort_t i) const;    
183     /**
184      * @return Error on C 
185      */
186     Double_t GetEC() const { return fEC; }
187     /**
188      * @return Error on Delta 
189      */
190     Double_t GetEDelta() const { return fEDelta; }
191     /**
192      * @return Error on Xi
193      */
194     Double_t GetEXi() const { return fEXi; }
195     /**
196      * @return Error on sigma 
197      */
198     Double_t GetESigma() const { return fESigma; }
199     /**
200      * @return Error on sigma (noise)
201      */
202     Double_t GetESigmaN() const { return fESigmaN; }
203     /**
204      * @return Error on weights
205      */
206     Double_t* GetEAs() const { return fEA; }
207     /**
208      * @param i Which weight to get 
209      *
210      * @return Error on weights
211      */
212     Double_t GetEA(UShort_t i) const;
213     /**
214      * @return Assigned quality 
215      */
216     Int_t GetQuality() const { return fQuality; }
217     /**
218      * @return Detector 
219      */
220     UShort_t GetDet() const { return fDet; }
221     /**
222      * @return Ring
223      */
224     Char_t GetRing() const { return fRing; }
225     /**
226      * @return Eta bin
227      */
228     UShort_t GetBin() const { return fBin; }
229     /* @} */
230
231     /** 
232      * @{ 
233      * @name Evaluation 
234      */
235     /** 
236      * Evaluate 
237      * @f[ 
238      *  f_N(x;\Delta,\xi,\sigma') = 
239      *     \sum_{i=1}^{n} a_i f(x;\Delta_i,\xi_i,\sigma_i')
240      * @f] 
241      *
242      * (see AliForwardUtil::NLandauGaus) for the maximum @f$ N @f$
243      * that fulfills the requirements 
244      *
245      * @param x           Where to evaluate 
246      * @param maxN        @f$ \max{N}@f$    
247      * 
248      * @return @f$ f_N(x;\Delta,\xi,\sigma')@f$ 
249      */
250     Double_t Evaluate(Double_t x, 
251                       UShort_t maxN=999) const;
252     /** 
253      * Evaluate 
254      * @f[ 
255      *   f_W(x;\Delta,\xi,\sigma') = 
256      *   \frac{\sum_{i=1}^{n} i a_i f_i(x;\Delta,\xi,\sigma')}{
257      *     f_N(x;\Delta,\xi,\sigma')} = 
258      *   \frac{\sum_{i=1}^{n} i a_i f(x;\Delta_i,\xi_i,\sigma_i')}{
259      *     \sum_{i=1}^{n} a_i f(x;\Delta_i,\xi_i,\sigma_i')}
260      * @f] 
261      * where @f$ n@f$ fulfills the requirements (see FindMaxWeight). 
262      *
263      * If the denominator is zero, then 1 is returned. 
264      *
265      * See also AliForwardUtil::ILandauGaus and AliForwardUtil::NLandauGaus
266      * for more information on the evaluated functions. 
267      * 
268      * @param x           Where to evaluate 
269      * @param maxN        @f$ \max{N}@f$      
270      * 
271      * @return @f$ f_W(x;\Delta,\xi,\sigma')@f$.  
272      */
273     Double_t EvaluateWeighted(Double_t x, 
274                               UShort_t maxN=9999) const;
275     /** 
276      * Find the maximum weight to use.  The maximum weight is the
277      * largest i for which 
278      * 
279      * - @f$ i \leq \max{N}@f$ 
280      * - @f$ a_i > \min{a}@f$ 
281      * - @f$ \delta a_i/a_i > \delta_{max}@f$ 
282      * 
283      * @param maxRelError @f$ \min{a}@f$ 
284      * @param leastWeight @f$ \delta_{max}@f$ 
285      * @param maxN        @f$ \max{N}@f$      
286      * 
287      * @return The largest index @f$ i@f$ for which the above
288      * conditions hold.  Will never return less than 1. 
289      */
290     Int_t FindMaxWeight(Double_t maxRelError=2*fgMaxRelError, 
291                         Double_t leastWeight=fgLeastWeight, 
292                         UShort_t maxN=999) const;
293     /** 
294      * Get a function that expresses this fit.
295      * 
296      * @f[ 
297      *  f_N(x;\Delta,\xi,\sigma') = 
298      *     \sum_{i=1}^{n} a_i f(x;\Delta_i,\xi_i,\sigma_i')
299      * @f] 
300      * (see AliForwardUtil::NLandauGaus) or, if @a i is 1 or larger 
301      * @f[ 
302      *  f_i(x;\Delta,\xi,\sigma') = a_i f(x;\Delta_i,\xi_i,\sigma_i')
303      * @f] 
304      * (see AliForwardUtil::ILandauGaus).
305      *
306      * @param i Component to get.  If @a i is 0 or less, then the full
307      * function is returned, otherwise the specified component (if
308      * valid).
309      * @param max Upper bound on function 
310      *
311      * @return Pointer to newly allocated function.  The caller owns
312      * this object, and must clean it up.
313      */
314     TF1* GetF1(Int_t i=0, Double_t max=20) const;
315     /** 
316      * Find the x value that corresponds to a (normalized) probability
317      * of @a low or less.  That is, we can use this to say: "Give me
318      * the x value under which it is unlikely that a particle gave a
319      * signal".
320      * 
321      * @param low Threshold (between 0 and 1)
322      * 
323      * @return Cut value, or 1000 in case of problems 
324      */
325     Double_t FindProbabilityCut(Double_t low) const;
326     /* @} */
327     /** 
328      * @{
329      * @name TObject Sortable interface 
330      */
331     /** 
332      * Declare this object as sortable 
333      * 
334      * @return Always true 
335      */
336     Bool_t IsSortable() const { return kTRUE; }
337     /** 
338      * Compare to another ELossFit object. 
339      * 
340      * - +1, if this quality is better (larger) than other objects quality
341      * - -1, if this quality is worse (smaller) than other objects quality
342      * - +1, if this @f$|\chi^2/\nu-1|@f$ is smaller than the same for other
343      * - -1, if this @f$|\chi^2/\nu-1|@f$ is larger than the same for other
344      * - 0 otherwise 
345      * 
346      * @param o Other object to compare to 
347      *
348      * @return See above
349      */
350     Int_t Compare(const TObject* o) const;
351     /* @} */
352     /** 
353      * @{ 
354      * name Auxiliary member functions  
355      */
356     /** 
357      * Information to standard output 
358      * 
359      * @param option Not used 
360      */
361     void Print(Option_t* option) const; // *MENU*
362     /** 
363      * Draw this fit 
364      * 
365      * @param option Options 
366      *  - COMP  Draw components too 
367      */
368     void Draw(Option_t* option="comp"); // *MENU*
369     /** 
370      * Browse this object 
371      * 
372      * @param b Browser
373      */
374     void Browse(TBrowser* b);
375     /** 
376      * Get the name of this object 
377      * 
378      * 
379      * @return 
380      */
381     const Char_t* GetName() const;
382     /** 
383      * Calculate the lower bound 
384      * 
385      * @param f             Width factor
386      * @param includeSigma  Whether to include sigma
387      * 
388      * @return @f$ \Delta - f (\xi + \sigma)@f$
389      */
390     Double_t GetLowerBound(Double_t f, Bool_t includeSigma) const;
391     /** 
392      * Calculate the lower bound 
393      * 
394      * @param f             fraction of @f$\Delta@f$
395      * 
396      * @return @f$ f\Delta@f$
397      */
398     Double_t GetLowerBound(Double_t f) const;
399     /** 
400      * Calculate the quality 
401      * 
402      * @param maxChi2nu   Maximum reduced @f$\chi^2@f$
403      * @param maxRelError Maximum relative error 
404      * @param leastWeight Least weight to use 
405      */
406     void CalculateQuality(Double_t maxChi2nu=fgMaxChi2nu, 
407                           Double_t maxRelError=fgMaxRelError, 
408                           Double_t leastWeight=fgLeastWeight);
409     /* @} */
410     ClassDef(ELossFit,2); // Result of fit 
411   };
412
413   /** 
414    * Default constructor 
415    */
416   AliFMDCorrELossFit();
417   /** 
418    * Copy constructor 
419    * 
420    * @param o Object to copy from 
421    */
422   AliFMDCorrELossFit(const AliFMDCorrELossFit& o);
423   /** 
424    * Destructor 
425    */
426   virtual ~AliFMDCorrELossFit(); 
427   /** 
428    * Assignment operator 
429    * 
430    * @param o Object to assign from 
431    * 
432    * @return Reference to this object 
433    */
434   AliFMDCorrELossFit& operator=(const AliFMDCorrELossFit& o);
435
436   /** 
437    * @{ 
438    * @name Set fits 
439    */
440   /** 
441    * Set the fit parameters from a function 
442    * 
443    * @param d        Detector
444    * @param r        Ring 
445    * @param eta      Eta 
446    * @param quality  Quality flag
447    * @param f        Function from fit 
448    *
449    * @return true on success
450    */  
451   Bool_t SetFit(UShort_t d, Char_t r, Double_t eta, Int_t quality, 
452                 const TF1& f);
453   /** 
454    * Set the fit parameters from a function 
455    * 
456    * @param d    Detector
457    * @param r    Ring 
458    * @param eta  Eta 
459    * @param f    ELoss fit result - note, the object will take ownership
460    *
461    * @return true on success
462    */  
463   Bool_t SetFit(UShort_t d, Char_t r, Double_t eta, ELossFit* f);
464   /** 
465    * Set the fit parameters from a function 
466    * 
467    * @param d       Detector
468    * @param r       Ring 
469    * @param etaBin  Eta (bin number, 1->nBins)
470    * @param f       ELoss fit result - note, the object will take ownership
471    *
472    * @return true on success
473    */  
474   Bool_t SetFit(UShort_t d, Char_t r, Int_t etaBin, ELossFit* f);
475   /** 
476    * Set the fit parameters from a function 
477    * 
478    * @param d         Detector number
479    * @param r         Ring identifier 
480    * @param eta       Eta value
481    * @param quality   Quality flag
482    * @param n         @f$ N@f$ - Number of fitted peaks
483    * @param chi2      @f$ \chi^2 @f$
484    * @param nu        @f$ \nu @f$ - number degrees of freedom
485    * @param c         @f$ C@f$ - scale constant
486    * @param ec        @f$ \delta C@f$ - error on @f$ C@f$ 
487    * @param delta     @f$ \Delta@f$ - most probable value
488    * @param edelta    @f$ \delta\Delta@f$ - error on @f$\Delta@f$ 
489    * @param xi        @f$ \xi@f$ - Landau width           
490    * @param exi       @f$ \delta\xi@f$ - error on @f$\xi@f$ 
491    * @param sigma     @f$ \sigma@f$ - Gaussian width
492    * @param esigma    @f$ \delta\sigma@f$ - error on @f$\sigma@f$ 
493    * @param sigman    @f$ \sigma_n@f$ - Noise width               
494    * @param esigman   @f$ \delta\sigma_n@f$ - error on @f$\sigma_n@f$ 
495    * @param a         Array of @f$ N-1@f$ weights @f$ a_i@f$ for 
496    *                  @f$ i=2,\ldots@f$ 
497    * @param ea        Array of @f$ N-1@f$ errors on weights @f$ a_i@f$ for 
498    *                  @f$ i=2,\ldots@f$ 
499    *
500    * @return true on success
501    */
502   Bool_t SetFit(UShort_t  d,      Char_t    r, Double_t eta, 
503                 Int_t     quality,UShort_t  n, 
504                 Double_t  chi2,   UShort_t  nu, 
505                 Double_t  c,      Double_t  ec, 
506                 Double_t  delta,  Double_t  edelta, 
507                 Double_t  xi,     Double_t  exi,
508                 Double_t  sigma,  Double_t  esigma, 
509                 Double_t  sigman, Double_t  esigman, 
510                 Double_t* a,      Double_t* ea);
511   /* @} */
512   
513   /** 
514    * @{
515    * @name Set and get eta axis
516    */
517   /** 
518    * Set the eta axis to use 
519    * 
520    * @param axis Eta axis 
521    */
522   void SetEtaAxis(const TAxis& axis);
523   /** 
524    * Set the eta axis to use 
525    * 
526    * @param nBins Number of bins 
527    * @param min   Minimum @f$ \eta@f$
528    * @param max   maximum @f$ \eta@f$
529    */
530   void SetEtaAxis(Int_t nBins, Double_t min, Double_t max);
531   /** 
532    * Get the eta axis used
533    * 
534    * @return 
535    */
536   const TAxis& GetEtaAxis() const { return fEtaAxis; }
537   /** 
538    * Set the low cut used when fitting 
539    * 
540    * @param cut Cut value 
541    */
542   void SetLowCut(Double_t cut) { fLowCut = cut; }
543   /** 
544    * Get the low cut used when fitting 
545    * 
546    * @return Low cut used for fitting 
547    */
548   Double_t GetLowCut() const { return fLowCut; }
549   /** 
550    * Find the eta bin corresponding to the given eta 
551    * 
552    * @param eta  Eta value 
553    * 
554    * @return Bin (in @f$[1,N_{bins}]@f$) corresponding to the given
555    * eta, or 0 if out of range.
556    */
557   Int_t FindEtaBin(Double_t eta) const;
558   /* @} */
559
560   /**
561    * @{                                         
562    * @name Find fits 
563    */
564   /** 
565    * Find the fit corresponding to the specified parameters.  This
566    * uses the cache map of good fits for the look-up.  For un-cached
567    * look-up see GetFit.
568    * 
569    * @param d      Detector 
570    * @param r      Ring 
571    * @param eta    Eta value 
572    * @param minQ   Minimum quality
573    * 
574    * @return Fit parameters or null in case of problems 
575    */
576   ELossFit* FindFit(UShort_t d, Char_t r, Double_t eta,
577                     UShort_t minQ) const;
578   /** 
579    * Find the fit corresponding to the specified parameters.  This
580    * uses the cache map of good fits for the look-up.  For un-cached
581    * look-up see GetFit. 
582    * 
583    * @param d      Detector 
584    * @param r      Ring 
585    * @param etabin Eta bin (1 based)
586    * @param minQ   Minimum quality
587    * 
588    * @return Fit parameters or null in case of problems 
589    */
590   ELossFit* FindFit(UShort_t d, Char_t r, Int_t etabin,
591                     UShort_t minQ) const;
592   /** 
593    * Find the fit corresponding to the specified parameters.  Note,
594    * the a cache-map of good fits isn't used for this look-up.  To use
595    * the cache, use FindFit.
596    * 
597    * @param d   Detector 
598    * @param r   Ring 
599    * @param eta Eta value 
600    * 
601    * @return Fit parameters or null in case of problems 
602    */
603   ELossFit* GetFit(UShort_t d, Char_t r, Double_t eta) const;
604   /** 
605    * Find the fit corresponding to the specified parameters. Note,
606    * the a cache-map of good fits isn't used for this look-up.  To use
607    * the cache, use FindFit.
608    * 
609    * @param d      Detector 
610    * @param r      Ring 
611    * @param etabin Eta bin (1 based)
612    * 
613    * @return Fit parameters or null in case of problems 
614    */
615   ELossFit* GetFit(UShort_t d, Char_t r, Int_t etabin) const;
616   /* @} */
617
618   /** 
619    * @{ 
620    * @name Lower bounds on fits 
621    */
622   /** 
623    * Get the lower validity bound of the fit. 
624    * 
625    * @param d            Detector
626    * @param r            Ring
627    * @param etaBin       Eta bin (1-based)
628    * @param f            Fraction of @f$\Delta_{mp}@f$
629    * 
630    * @return @f$ f\Delta_{mp}@f$ 
631    */
632   Double_t GetLowerBound(UShort_t d, Char_t r, Int_t etaBin, 
633                          Double_t f) const;
634   /** 
635    * Get the lower validity bound of the fit.
636    * 
637    * @param d            Detector
638    * @param r            Ring
639    * @param eta          Eta value
640    * @param f            Fraction of @f$\Delta_{mp}@f$
641    * 
642    * @return @f$ f\Delta_{mp}@f$ 
643    */
644   Double_t GetLowerBound(UShort_t d, Char_t r, Double_t eta, 
645                          Double_t f) const;
646   /** 
647    * Get the lower validity bound of the fit. 
648    * 
649    * @param d            Detector
650    * @param r            Ring
651    * @param etaBin       Eta bin (1-based)
652    * @param p            Probability cut
653    * @param dummy        Not used
654    * 
655    * @return @f$ x@f$ for which @f$ P(x>p)@f$
656    */
657   Double_t GetLowerBound(UShort_t d, Char_t r, Int_t etaBin, 
658                          Double_t p, Bool_t dummy) const;
659   /** 
660    * Get the lower validity bound of the fit.
661    * 
662    * @param d            Detector
663    * @param r            Ring
664    * @param eta          Eta value
665    * @param p            Probability cut
666    * @param dummy        Not used
667    * 
668    * @return @f$ x@f$ for which @f$ P(x>p)@f$
669    */
670   Double_t GetLowerBound(UShort_t d, Char_t r, Double_t eta, 
671                          Double_t p, Bool_t dummy) const;
672   /** 
673    * Get the lower validity bound of the fit
674    * 
675    * @param d            Detector
676    * @param r            Ring
677    * @param etaBin       Eta bin (1-based)
678    * @param f            Factor on xi (and sigma)
679    * @param showErrors   Show errors
680    * @param includeSigma Whether to include sigma 
681    * 
682    * @return @f$ \Delta_{mp} - f(\xi+\sigma)@f$ 
683    */
684   Double_t GetLowerBound(UShort_t d, Char_t r, Int_t etaBin, 
685                          Double_t f, Bool_t showErrors,
686                          Bool_t includeSigma) const;
687   /** 
688    * Get the lower validity bound of the fit
689    * 
690    * @param d            Detector
691    * @param r            Ring
692    * @param eta          Eta value
693    * @param f            Factor on xi (and sigma)
694    * @param showErrors   Show errors
695    * @param includeSigma Whether to include sigma 
696    * 
697    * @return @f$ \Delta_{mp} - f(\xi+\sigma)@f$ 
698    */
699   Double_t GetLowerBound(UShort_t d, Char_t r, Double_t eta, 
700                          Double_t f, Bool_t showErrors,
701                          Bool_t includeSigma) const;
702   /* @} */
703   
704   /**                                           
705    * @{ 
706    * @name Miscellaneous
707    */
708   void CacheBins(UShort_t minQuality) const;
709   /** 
710    * Get the ring array corresponding to the specified ring
711    * 
712    * @param d Detector 
713    * @param r Ring 
714    * 
715    * @return Pointer to ring array, or null in case of problems
716    */
717   TObjArray* GetRingArray(UShort_t d, Char_t r) const;
718   /** 
719    * Signal that this is a folder
720    * 
721    * @return Always true 
722    */
723   Bool_t IsFolder() const { return true; }
724   /** 
725    * Browse this object 
726    * 
727    * @param b 
728    */
729   void Browse(TBrowser* b);
730   /** 
731    * Draw this object 
732    *
733    * @param option Options.  Possible values are 
734    *  - error Plot error bars 
735    *  - relative Plot relative errors
736    */
737   void Draw(Option_t* option=""); //*MENU*
738   /** 
739    * Print this object.  
740    * 
741    * @param option Options 
742    *   - R   Print recursive  
743    *
744    */
745   void Print(Option_t* option="R") const; //*MENU*
746   /** 
747    * Get a list of THStack - one for each parameter.  
748    *
749    * If @a err is true, then error bars are set too.  If @a rel is
750    * true, then the relative error (rather than the absolute value) is
751    * filled into the histograms.  If @a good is true, then we use the
752    * cache-map of good fits rather than all fits.
753    * 
754    * @param err  Show errors
755    * @param rel  Show relative errors 
756    * @param good Only show good fits
757    * @param maxN Maximum weight to use 
758    * 
759    * @return List of THStack
760    */
761   TList* GetStacks(Bool_t err, Bool_t rel, Bool_t good, UShort_t maxN=5) const;
762   /* @} */
763 protected:
764   /** 
765    * Get the ring array corresponding to the specified ring
766    * 
767    * @param d Detector 
768    * @param r Ring 
769    * 
770    * @return Pointer to ring array, or newly created container 
771    */
772   TObjArray* GetOrMakeRingArray(UShort_t d, Char_t r);
773   /** 
774    * Fill fit values into stack histograms 
775    * 
776    * @param f         Fit
777    * @param rel       If true, fill in relative errors
778    * @param used      The bin begin used for this fit 
779    * @param hChi      @f$\chi^2/\nu@f$ histogram 
780    * @param hN        @f$ N_{a}@f$ - number of components - histogram
781    * @param hC        @f$ C@f$ - prefactor - histogram
782    * @param hDelta    @f$ \Delta_p@f$ - most-probably value - histogram
783    * @param hXi       @f$ \xi@f$ - Landau 'width' - histogram 
784    * @param hSigma    @f$ \sigma@f$ - Gaussian smear - histogram 
785    * @param maxN      @f$ N_{a,max}@f$ Largest possible @f$ N@f$ 
786    * @param hA        @f$ a_{i}, i=\{2,..,N_{a,max}\}@f$ - histogram
787    */
788   void UpdateStackHist(ELossFit* f,     Bool_t rel, 
789                        Int_t     used, 
790                        TH1*      hChi, TH1*   hN, 
791                        TH1*      hC,   TH1*   hDelta, 
792                        TH1*      hXi,  TH1*   hSigma, 
793                        Int_t     maxN, TH1**  hA) const;
794                        
795   TObjArray  fRings;    // Array of rings
796   TAxis      fEtaAxis;  // Eta axis used
797   Double_t   fLowCut;   // Low cut used when fitting 
798   mutable TArrayI    fCache;
799
800   ClassDef(AliFMDCorrELossFit,3); 
801 };
802
803 //____________________________________________________________________
804 inline void 
805 AliFMDCorrELossFit::SetEtaAxis(Int_t nBins, Double_t min, Double_t max)
806 {
807   fEtaAxis.Set(nBins, min, max);
808 }
809 //____________________________________________________________________
810 inline void 
811 AliFMDCorrELossFit::SetEtaAxis(const TAxis& e)
812 {
813   fEtaAxis.Set(e.GetNbins(), e.GetXmin(), e.GetXmax());
814 }
815 //____________________________________________________________________
816 inline Double_t
817 AliFMDCorrELossFit::ELossFit::GetA(UShort_t i) const
818 {
819   if (i <  1)   return 0;
820   if (i >  fN)  return 0;
821   if (i == 1)   return 1;
822   return fA[i-2];
823 }
824 //____________________________________________________________________
825 inline Double_t
826 AliFMDCorrELossFit::ELossFit::GetEA(UShort_t i) const
827 {
828   if (i <  1)   return 0;
829   if (i >  fN)  return 0;
830   if (i == 1)   return 1;
831   return fEA[i-2];
832 }
833
834
835 #endif
836 // Local Variables:
837 //   mode: C++ 
838 // End:
839