]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/AliForwardUtil.h
Maker scripts now use TrainSetup exclusively.
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AliForwardUtil.h
1 // 
2 // Utilities used in the forward multiplcity analysis 
3 // 
4 //
5 #ifndef ALIFORWARDUTIL_H
6 #define ALIFORWARDUTIL_H
7 /**
8  * @file   AliForwardUtil.h
9  * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
10  * @date   Wed Mar 23 14:06:54 2011
11  * 
12  * @brief  
13  * 
14  * 
15  * @ingroup pwglf_forward 
16  */
17 #include <TObject.h>
18 #include <TString.h>
19 #include <TObjArray.h>
20 class TH2D;
21 class TH1I;
22 class TH1;
23 class TF1;
24 class TAxis;
25 class AliESDEvent;
26 class AliAODEvent;
27 class AliAnalysisTaskSE;
28
29 /** 
30  * Utilities used in the forward multiplcity analysis 
31  * 
32  * @ingroup pwglf_forward 
33  */
34 class AliForwardUtil : public TObject
35 {
36 public:
37   /** 
38    * Get the standard color for a ring  
39    *
40    * @param d Detector
41    * @param r Ring 
42    * 
43    * @return 
44    */
45   static Color_t RingColor(UShort_t d, Char_t r)
46   { 
47     return ((d == 1 ? kRed : (d == 2 ? kGreen : kBlue))
48             + ((r == 'I' || r == 'i') ? 2 : -3));
49   }
50   //==================================================================
51   /** 
52    * @{ 
53    * @name Collision/run parameters 
54    */
55   /**                                           
56    * Defined collision types 
57    */
58   enum ECollisionSystem {
59     kUnknown, 
60     kPP, 
61     kPbPb,
62     kPPb
63   };
64   //__________________________________________________________________
65   /** 
66    * Parse a collision system spec given in a string.   Known values are 
67    * 
68    *  - "pp", "p-p" which returns kPP 
69    *  - "PbPb", "Pb-Pb", "A-A", which returns kPbPb
70    *  - "pPb", "p-Pb", "pA", p-A" which returns kPPb
71    *  - Everything else gives kUnknown 
72    * 
73    * @param sys Collision system spec 
74    * 
75    * @return Collision system id 
76    */
77   static UShort_t ParseCollisionSystem(const char* sys);
78   /** 
79    * Get a string representation of the collision system 
80    * 
81    * @param sys  Collision system 
82    * - kPP -> "pp"
83    * - kPbPb -> "PbPb" 
84    * - kPPb -> "pPb"
85    * - anything else gives "unknown"
86    * 
87    * @return String representation of the collision system 
88    */
89   static const char* CollisionSystemString(UShort_t sys);
90   //__________________________________________________________________
91   /** 
92    * Parse the center of mass energy given as a float and return known 
93    * values as a unsigned integer
94    * 
95    * @param sys  Collision system (needed for AA)
96    * @param cms  Center of mass energy * total charge 
97    * 
98    * @return Center of mass energy per nucleon
99    */
100   static UShort_t ParseCenterOfMassEnergy(UShort_t sys, Float_t cms);
101   /** 
102    * Get a string representation of the center of mass energy per nuclean
103    * 
104    * @param cms  Center of mass energy per nucleon
105    * 
106    * @return String representation of the center of mass energy per nuclean
107    */
108   static const char* CenterOfMassEnergyString(UShort_t cms);
109   //__________________________________________________________________
110   /** 
111    * Parse the magnetic field (in kG) as given by a floating point number
112    * 
113    * @param field  Magnetic field in kG 
114    * 
115    * @return Short integer value of magnetic field in kG 
116    */
117   static Short_t ParseMagneticField(Float_t field);
118   /** 
119    * Get eta from strip
120    * 
121    * @param det, ring, sec, strip, zvtx
122    * 
123    * @return eta
124    */
125   static Double_t GetEtaFromStrip(UShort_t det, Char_t ring, UShort_t sec, UShort_t strip, Double_t zvtx) ;
126   /** 
127    * Get a string representation of the magnetic field
128    * 
129    * @param field Magnetic field in kG
130    * 
131    * @return String representation of the magnetic field
132    */
133    static const char* MagneticFieldString(Short_t field);
134   /* @} */
135
136   //__________________________________________________________________
137   /** 
138    * Get the AOD event - either from the input (AOD analysis) or the
139    * output (ESD analysis)
140    * 
141    * @param task Task to do the investigation for
142    * 
143    * @return Found AOD event or null
144    */
145   static AliAODEvent* GetAODEvent(AliAnalysisTaskSE* task);
146   /** 
147    * Check if we have something that will provide and AOD event 
148    * 
149    * @return 0 if there's nothing that provide an AOD event, 1 if it
150    * is provided on the input (AOD analysis) or 2 if it is provided on
151    * the output (ESD analysis)
152    */
153   static UShort_t CheckForAOD();
154   /** 
155    * Check if we have a particular (kind) of task in our train
156    * 
157    * @param clsOrName  Class name or name of task 
158    * @param cls If true, look for a task of a particular class -
159    * otherwise search for a speficially name task
160    * 
161    * @return true if the needed task was found 
162    */
163   static Bool_t CheckForTask(const char* clsOrName, Bool_t cls=true);
164
165   /** 
166    * @{ 
167    * @name Energy stragling functions 
168    */
169   //__________________________________________________________________
170   /**
171    * Number of steps to do in the Landau, Gaussiam convolution 
172    */
173   static Int_t fgConvolutionSteps; // Number of convolution steps
174   //------------------------------------------------------------------
175   /** 
176    * How many sigma's of the Gaussian in the Landau, Gaussian
177    * convolution to integrate over
178    */
179   static Double_t fgConvolutionNSigma; // Number of convolution sigmas 
180   //------------------------------------------------------------------
181   /** 
182    * Calculate the shifted Landau
183    * @f[
184    *    f'_{L}(x;\Delta,\xi) = f_L(x;\Delta+0.22278298\xi)
185    * @f]
186    *
187    * where @f$ f_{L}@f$ is the ROOT implementation of the Landau
188    * distribution (known to have @f$ \Delta_{p}=-0.22278298@f$ for
189    * @f$\Delta=0,\xi=1@f$. 
190    *
191    * @param x      Where to evaluate @f$ f'_{L}@f$ 
192    * @param delta  Most probable value 
193    * @param xi     The 'width' of the distribution 
194    *
195    * @return @f$ f'_{L}(x;\Delta,\xi) @f$
196    */
197   static Double_t Landau(Double_t x, Double_t delta, Double_t xi);
198   
199   //------------------------------------------------------------------
200   /** 
201    * Calculate the value of a Landau convolved with a Gaussian 
202    * 
203    * @f[ 
204    * f(x;\Delta,\xi,\sigma') = \frac{1}{\sigma' \sqrt{2 \pi}}
205    *    \int_{-\infty}^{+\infty} d\Delta' f'_{L}(x;\Delta',\xi)
206    *    \exp{-\frac{(\Delta-\Delta')^2}{2\sigma'^2}}
207    * @f]
208    * 
209    * where @f$ f'_{L}@f$ is the Landau distribution, @f$ \Delta@f$ the
210    * energy loss, @f$ \xi@f$ the width of the Landau, and 
211    * @f$ \sigma'^2=\sigma^2-\sigma_n^2 @f$.  Here, @f$\sigma@f$ is the
212    * variance of the Gaussian, and @f$\sigma_n@f$ is a parameter modelling 
213    * noise in the detector.  
214    *
215    * Note that this function uses the constants fgConvolutionSteps and
216    * fgConvolutionNSigma
217    * 
218    * References: 
219    *  - <a href="http://dx.doi.org/10.1016/0168-583X(84)90472-5">Nucl.Instrum.Meth.B1:16</a>
220    *  - <a href="http://dx.doi.org/10.1103/PhysRevA.28.615">Phys.Rev.A28:615</a>
221    *  - <a href="http://root.cern.ch/root/htmldoc/tutorials/fit/langaus.C.html">ROOT implementation</a>
222    * 
223    * @param x         where to evaluate @f$ f@f$
224    * @param delta     @f$ \Delta@f$ of @f$ f(x;\Delta,\xi,\sigma')@f$
225    * @param xi        @f$ \xi@f$ of @f$ f(x;\Delta,\xi,\sigma')@f$
226    * @param sigma     @f$ \sigma@f$ of @f$\sigma'^2=\sigma^2-\sigma_n^2 @f$
227    * @param sigma_n   @f$ \sigma_n@f$ of @f$\sigma'^2=\sigma^2-\sigma_n^2 @f$
228    * 
229    * @return @f$ f@f$ evaluated at @f$ x@f$.  
230    */
231   static Double_t LandauGaus(Double_t x, Double_t delta, Double_t xi, 
232                              Double_t sigma, Double_t sigma_n);
233
234   //------------------------------------------------------------------
235   /** 
236    * Evaluate 
237    * @f[ 
238    *    f_i(x;\Delta,\xi,\sigma') = f(x;\Delta_i,\xi_i,\sigma_i')
239    * @f] 
240    * corresponding to @f$ i@f$ particles i.e., with the substitutions 
241    * @f{eqnarray*}{ 
242    *    \Delta    \rightarrow \Delta_i    &=& i(\Delta + \xi\log(i))\\
243    *    \xi       \rightarrow \xi_i       &=& i \xi\\
244    *    \sigma    \rightarrow \sigma_i    &=& \sqrt{i}\sigma\\
245    *    \sigma'^2 \rightarrow \sigma_i'^2 &=& \sigma_n^2 + \sigma_i^2
246    * @f} 
247    * 
248    * @param x        Where to evaluate 
249    * @param delta    @f$ \Delta@f$ 
250    * @param xi       @f$ \xi@f$ 
251    * @param sigma    @f$ \sigma@f$ 
252    * @param sigma_n  @f$ \sigma_n@f$
253    * @param i        @f$ i @f$
254    * 
255    * @return @f$ f_i @f$ evaluated
256    */  
257   static Double_t ILandauGaus(Double_t x, Double_t delta, Double_t xi, 
258                               Double_t sigma, Double_t sigma_n, Int_t i);
259
260   //------------------------------------------------------------------
261   /** 
262    * Numerically evaluate 
263    * @f[ 
264    *    \left.\frac{\partial f_i}{\partial p_i}\right|_{x}
265    * @f] 
266    * where @f$ p_i@f$ is the @f$ i^{\mbox{th}}@f$ parameter.  The mapping 
267    * of the parameters is given by 
268    *
269    * - 0: @f$\Delta@f$ 
270    * - 1: @f$\xi@f$ 
271    * - 2: @f$\sigma@f$ 
272    * - 3: @f$\sigma_n@f$ 
273    *
274    * This is the partial derivative with respect to the parameter of
275    * the response function corresponding to @f$ i@f$ particles i.e.,
276    * with the substitutions
277    * @f[ 
278    *    \Delta    \rightarrow \Delta_i    = i(\Delta + \xi\log(i))\\
279    *    \xi       \rightarrow \xi_i       = i \xi\\
280    *    \sigma    \rightarrow \sigma_i    = \sqrt{i}\sigma\\
281    *    \sigma'^2 \rightarrow \sigma_i'^2 = \sigma_n^2 + \sigma_i^2
282    * @f] 
283    * 
284    * @param x        Where to evaluate 
285    * @param ipar     Parameter number 
286    * @param dp       @f$ \epsilon\delta p_i@f$ for some value of @f$\epsilon@f$
287    * @param delta    @f$ \Delta@f$ 
288    * @param xi       @f$ \xi@f$ 
289    * @param sigma    @f$ \sigma@f$ 
290    * @param sigma_n  @f$ \sigma_n@f$
291    * @param i        @f$ i@f$
292    * 
293    * @return @f$ f_i@f$ evaluated
294    */  
295   static Double_t IdLandauGausdPar(Double_t x, UShort_t ipar, Double_t dp,
296                                    Double_t delta, Double_t xi, 
297                                    Double_t sigma, Double_t sigma_n, Int_t i);
298
299   //------------------------------------------------------------------
300   /** 
301    * Evaluate 
302    * @f[ 
303    *   f_N(x;\Delta,\xi,\sigma') = \sum_{i=1}^N a_i f_i(x;\Delta,\xi,\sigma'a)
304    * @f] 
305    * 
306    * where @f$ f(x;\Delta,\xi,\sigma')@f$ is the convolution of a
307    * Landau with a Gaussian (see LandauGaus).  Note that 
308    * @f$ a_1 = 1@f$, @f$\Delta_i = i(\Delta_1 + \xi\log(i))@f$, 
309    * @f$\xi_i=i\xi_1@f$, and @f$\sigma_i'^2 = \sigma_n^2 + i\sigma_1^2@f$. 
310    *  
311    * References: 
312    *  - <a href="http://dx.doi.org/10.1016/0168-583X(84)90472-5">Nucl.Instrum.Meth.B1:16</a>
313    *  - <a href="http://dx.doi.org/10.1103/PhysRevA.28.615">Phys.Rev.A28:615</a>
314    *  - <a href="http://root.cern.ch/root/htmldoc/tutorials/fit/langaus.C.html">ROOT implementation</a>
315    * 
316    * @param x        Where to evaluate @f$ f_N@f$
317    * @param delta    @f$ \Delta_1@f$ 
318    * @param xi       @f$ \xi_1@f$
319    * @param sigma    @f$ \sigma_1@f$ 
320    * @param sigma_n  @f$ \sigma_n@f$ 
321    * @param n        @f$ N@f$ in the sum above.
322    * @param a        Array of size @f$ N-1@f$ of the weights @f$ a_i@f$ for 
323    *                 @f$ i > 1@f$ 
324    * 
325    * @return @f$ f_N(x;\Delta,\xi,\sigma')@f$ 
326    */
327   static Double_t NLandauGaus(Double_t x, Double_t delta, Double_t xi, 
328                               Double_t sigma, Double_t sigma_n, Int_t n, 
329                               const Double_t* a);
330   /** 
331    * Generate a TF1 object of @f$ f_I@f$ 
332    * 
333    * @param c        Constant
334    * @param delta    @f$ \Delta@f$ 
335    * @param xi       @f$ \xi_1@f$              
336    * @param sigma    @f$ \sigma_1@f$           
337    * @param sigma_n  @f$ \sigma_n@f$           
338    * @param i        @f$ i@f$ - the number of particles
339    * @param xmin     Least value of range
340    * @param xmax     Largest value of range
341    * 
342    * @return Newly allocated TF1 object
343    */
344   static TF1* MakeILandauGaus(Double_t c, 
345                               Double_t delta, Double_t xi, 
346                               Double_t sigma, Double_t sigma_n,
347                               Int_t    i, 
348                               Double_t xmin,  Double_t  xmax);
349   /** 
350    * Generate a TF1 object of @f$ f_N@f$ 
351    * 
352    * @param c         Constant                         
353    * @param delta     @f$ \Delta@f$                    
354    * @param xi        @f$ \xi_1@f$                     
355    * @param sigma     @f$ \sigma_1@f$                  
356    * @param sigma_n   @f$ \sigma_n@f$                  
357    * @param n         @f$ N@f$ - how many particles to sum to
358    * @param a         Array of size @f$ N-1@f$ of the weights @f$ a_i@f$ for 
359    *                  @f$ i > 1@f$ 
360    * @param xmin      Least value of range  
361    * @param xmax      Largest value of range
362    * 
363    * @return Newly allocated TF1 object
364    */
365   static TF1* MakeNLandauGaus(Double_t c, 
366                               Double_t delta, Double_t  xi, 
367                               Double_t sigma, Double_t  sigma_n,
368                               Int_t    n,     const Double_t* a, 
369                               Double_t xmin,  Double_t  xmax);
370                                                     
371   //__________________________________________________________________
372   /** 
373    * Structure to do fits to the energy loss spectrum 
374    * 
375    * @ingroup pwglf_forward 
376    */
377   struct ELossFitter 
378   {
379     enum { 
380       kC     = 0,
381       kDelta, 
382       kXi, 
383       kSigma, 
384       kSigmaN, 
385       kN, 
386       kA
387     };
388     /** 
389      * Constructor 
390      * 
391      * @param lowCut     Lower cut of spectrum - data below this cuts is ignored
392      * @param maxRange   Maximum range to fit to 
393      * @param minusBins  The number of bins below maximum to use 
394      */
395     ELossFitter(Double_t lowCut, Double_t maxRange, UShort_t minusBins); 
396     /** 
397      * Destructor
398      * 
399      */
400     virtual ~ELossFitter();
401     /** 
402      * Clear internal arrays 
403      * 
404      */
405     void Clear();
406     /** 
407      * Fit a 1-particle signal to the passed energy loss distribution 
408      * 
409      * Note that this function clears the internal arrays first 
410      *
411      * @param dist    Data to fit the function to 
412      * @param sigman If larger than zero, the initial guess of the
413      *               detector induced noise. If zero or less, then this 
414      *               parameter is ignored in the fit (fixed at 0)
415      * 
416      * @return The function fitted to the data 
417      */
418     TF1* Fit1Particle(TH1* dist, Double_t sigman=-1);
419     /** 
420      * Fit a N-particle signal to the passed energy loss distribution 
421      *
422      * If there's no 1-particle fit present, it does that first 
423      *
424      * @param dist   Data to fit the function to 
425      * @param n      Number of particle signals to fit 
426      * @param sigman If larger than zero, the initial guess of the
427      *               detector induced noise. If zero or less, then this 
428      *               parameter is ignored in the fit (fixed at 0)
429      * 
430      * @return The function fitted to the data 
431      */
432     TF1* FitNParticle(TH1* dist, UShort_t n, Double_t sigman=-1);
433     /**
434      * Get Lower cut on data 
435      *
436      * @return Lower cut on data 
437      */
438     Double_t GetLowCut() const { return fLowCut; }
439     /**
440      * Get Maximum range to fit 
441      *
442      * @return Maximum range to fit 
443      */
444     Double_t GetMaxRange() const { return fMaxRange; }
445     /**
446      * Get Number of bins from maximum to fit 1st peak
447      *
448      * @return Number of bins from maximum to fit 1st peak
449      */
450     UShort_t GetMinusBins() const { return fMinusBins; }
451     /**
452      * Get Array of fit results 
453      *
454      * @return Array of fit results 
455      */
456     const TObjArray& GetFitResults() const { return fFitResults; }
457     /** 
458      * Get Array of fit results  
459      *
460      * @return Array of fit results 
461      */
462     TObjArray& GetFitResults() { return fFitResults; }
463     /**
464      * Get Array of functions 
465      *
466      * @return Array of functions 
467      */
468     const TObjArray& GetFunctions() const { return fFunctions; }
469     /** 
470      * Get Array of functions  
471      *
472      * @return Array of functions 
473      */
474     TObjArray& GetFunctions() { return fFunctions; }
475   private:
476     const Double_t fLowCut;     // Lower cut on data 
477     const Double_t fMaxRange;   // Maximum range to fit 
478     const UShort_t fMinusBins;  // Number of bins from maximum to fit 1st peak
479     TObjArray fFitResults;      // Array of fit results 
480     TObjArray fFunctions;       // Array of functions 
481   };
482   /* @} */
483       
484
485   //==================================================================
486   /** 
487    * @{
488    * @name Convenience containers 
489    */
490   /** 
491    * Structure to hold histograms 
492    *
493    * @ingroup pwglf_forward 
494    */
495   struct Histos : public TObject
496   {     
497     /** 
498      * Constructor 
499      * 
500      * 
501      */
502     Histos() : fFMD1i(0), fFMD2i(0), fFMD2o(0), fFMD3i(0), fFMD3o(0) {}
503     /** 
504      * Copy constructor 
505      * 
506      * @param o Object to copy from 
507      */
508     Histos(const Histos& o) 
509       : TObject(o), 
510         fFMD1i(o.fFMD1i), 
511         fFMD2i(o.fFMD2i), 
512         fFMD2o(o.fFMD2o), 
513         fFMD3i(o.fFMD3i), 
514         fFMD3o(o.fFMD3o)
515     {}
516     /** 
517      * Assignement operator 
518      * 
519      * @return Reference to this 
520      */
521     Histos& operator=(const Histos&) { return *this;}
522     /** 
523      * Destructor
524      */
525     ~Histos();
526     /** 
527      * Initialize the object 
528      * 
529      * @param etaAxis Eta axis to use 
530      */
531     void Init(const TAxis& etaAxis);
532     /** 
533      * Make a histogram 
534      * 
535      * @param d        Detector
536      * @param r        Ring 
537      * @param etaAxis  Eta axis to use
538      * 
539      * @return Newly allocated histogram 
540      */
541     TH2D* Make(UShort_t d, Char_t r, const TAxis& etaAxis) const;
542     /** 
543      * Clear data 
544      * 
545      * @param option Not used 
546      */
547     void  Clear(Option_t* option="");
548     // const TH2D* Get(UShort_t d, Char_t r) const;
549     /** 
550      * Get the histogram for a particular detector,ring
551      * 
552      * @param d Detector 
553      * @param r Ring 
554      * 
555      * @return Histogram for detector,ring or nul 
556      */
557     TH2D* Get(UShort_t d, Char_t r) const;
558     TH2D* fFMD1i; // Histogram for FMD1i
559     TH2D* fFMD2i; // Histogram for FMD2i
560     TH2D* fFMD2o; // Histogram for FMD2o
561     TH2D* fFMD3i; // Histogram for FMD3i
562     TH2D* fFMD3o; // Histogram for FMD3o
563
564     ClassDef(Histos,1) 
565   };
566
567   //__________________________________________________________________
568   /**
569    * Base class for structure holding ring specific histograms
570    * 
571    * @ingroup pwglf_forward 
572    */
573   struct RingHistos : public TObject
574   {
575     /** 
576      * Constructor
577      * 
578      */
579     RingHistos() : fDet(0), fRing('\0'), fName("") {}
580     /** 
581      * 
582      * 
583      * @param d Detector
584      * @param r Ring 
585      */
586     RingHistos(UShort_t d, Char_t r) 
587       : fDet(d), fRing(r), fName(TString::Format("FMD%d%c", d, r)) 
588     {}
589     /** 
590      * Copy constructor
591      * 
592      * @param o Object to copy from 
593      */
594     RingHistos(const RingHistos& o) 
595       : TObject(o), fDet(o.fDet), fRing(o.fRing), fName(o.fName)
596     {}
597     /** 
598      * 
599      */
600     virtual ~RingHistos() {}
601     /** 
602      * Assignement operator
603      * 
604      * @param o Object to assign from
605      * 
606      * @return Reference to this
607      */
608     RingHistos& operator=(const RingHistos& o) 
609     {
610       if (&o == this) return *this;
611       TObject::operator=(o);
612       fDet  = o.fDet;
613       fRing = o.fRing;
614       fName = o.fName;
615       return *this;
616     }
617     /** 
618      * Define the outout list in @a d
619      * 
620      * @param d Where to put the output list
621      * 
622      * @return Newly allocated TList object or null
623      */
624     TList* DefineOutputList(TList* d) const;
625     /** 
626      * Get our output list from the container @a d
627      * 
628      * @param d where to get the output list from 
629      * 
630      * @return The found TList or null
631      */
632     TList* GetOutputList(const TList* d) const;
633     /** 
634      * Find a specific histogram in the source list @a d
635      * 
636      * @param d     (top)-container 
637      * @param name  Name of histogram
638      * 
639      * @return Found histogram or null
640      */
641     TH1* GetOutputHist(const TList* d, const char* name) const;
642     /** 
643      * 
644      * 
645      * 
646      * @return 
647      */
648     Color_t Color() const 
649     { 
650       return AliForwardUtil::RingColor(fDet, fRing);
651     }
652     /** 
653      * The name of this ring 
654      * 
655      * @return Name of this ring 
656      */
657     const char* GetName() const { return fName.Data(); } 
658     UShort_t fDet;   // Detector
659     Char_t   fRing;  // Ring
660     TString  fName;  // Name
661
662     ClassDef(RingHistos,1) 
663   };
664   /* @} */
665
666   //__________________________________________________________________
667   /**
668    * A guard idom for producing debug output 
669    * 
670    */
671   struct DebugGuard 
672   {
673     /** 
674      * Constructor 
675      * 
676      * @param lvl       Current level
677      * @param msgLvl    Target level 
678      * @param format    @c printf -like format
679      * 
680      * @return 
681      */
682     DebugGuard(Int_t lvl, Int_t msgLvl, const char* format, ...);
683     /** 
684      * Destructor
685      */
686     ~DebugGuard();
687     /** 
688      * Make a message 
689      * 
690      * @param lvl    Current level
691      * @param msgLvl Target level 
692      * @param format @c printf -like format
693      */
694     static void Message(Int_t lvl, Int_t msgLvl, const char* format, ...);
695   private:
696     /** 
697      * Output the message 
698      * 
699      * @param in    Direction
700      * @param msg   Message 
701      */
702     static void Output(int in, TString& msg);
703     /** 
704      * Format a message 
705      * 
706      * @param out     Output is stored here
707      * @param format  @c printf -like format
708      * @param ap      List of arguments
709      */
710     static void Format(TString& out, const char* format, va_list ap);
711     TString fMsg;
712   };
713 private:
714   /** 
715    * Constructor 
716    */
717   AliForwardUtil() {}
718   /** 
719    * Copy constructor 
720    * 
721    * @param o Object to copy from 
722    */
723   AliForwardUtil(const AliForwardUtil& o) : TObject(o) {}
724   /** 
725    * Assingment operator 
726    * 
727    * 
728    * @return Reference to this object 
729    */
730   AliForwardUtil& operator=(const AliForwardUtil&) { return *this; }
731   /** 
732    * Destructor
733    */
734   ~AliForwardUtil() {}
735   
736
737   ClassDef(AliForwardUtil,1) // Utilities - do not make object
738 };
739
740 // #ifdef LOG_NO_DEBUG
741 // # define DGUARD(L,N,F,...) do {} while(false) 
742 // #else
743 /** 
744  * Macro to declare a DebugGuard
745  * 
746  * @param L Current debug level
747  * @param N Target debug level
748  * @param F @c printf -like Format 
749  */
750 # define DGUARD(L,N,F,...)                                      \
751   AliForwardUtil::DebugGuard _GUARD(L,N,F, ## __VA_ARGS__)
752 /** 
753  * Macro to make a debug message, using DebugGuard::Message
754  * 
755  * @param L Current debug level
756  * @param N Target debug level
757  * @param F @c printf -like Format 
758  */
759 # define DMSG(L,N,F,...)                                        \
760   AliForwardUtil::DebugGuard::Message(L,N,F, ## __VA_ARGS__)
761 // #endif
762 #endif
763 // Local Variables:
764 //  mode: C++
765 // End:
766