]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - CORRFW/AliCFUnfolding.h
extending unit test for AliHLTComponent by a sample event processing sequence
[u/mrichter/AliRoot.git] / CORRFW / AliCFUnfolding.h
index e7e211a735dd02b87b6f74abe6ebca01a529fff0..bc611f6666e47b116302d550f23e93e5def9fd1e 100644 (file)
@@ -5,9 +5,7 @@
 //--------------------------------------------------------------------//
 //                                                                    //
 // AliCFUnfolding Class                                               //
-// Class to handle general unfolding procedure                        // 
-// For the moment only bayesian unfolding is supported                //
-// The next steps are to add chi2 minimisation and weighting methods  //
+// Class to handle general unfolding procedure using bayesian method  //
 //                                                                    //
 // Author : renaud.vernet@cern.ch                                     //
 //--------------------------------------------------------------------//
@@ -15,6 +13,8 @@
 #include "TNamed.h"
 #include "THnSparse.h"
 
+class TF1;
+
 class AliCFUnfolding : public TNamed {
 
  public :
@@ -28,7 +28,12 @@ class AliCFUnfolding : public TNamed {
   void SetMaxNumberOfIterations(Int_t n)  {fMaxNumIterations=n;}
   void SetMaxChi2(Double_t val)           {fMaxChi2=val;}
   void SetMaxChi2PerDOF(Double_t val);
-  void UseSmoothing(Bool_t b=kTRUE)       {fUseSmoothing=b;}
+  void UseSmoothing(TF1* fcn=0x0, Option_t* opt="iremn") { // if fcn=0x0 then smooth using neighbouring bins 
+    fUseSmoothing=kTRUE;                                   // this function must NOT be used if fNVariables > 3
+    fSmoothFunction=fcn;                                   // the option "opt" is used if "fcn" is specified
+    fSmoothOption=opt;
+  } 
+                                                                                                
   void Unfold();
 
   THnSparse* GetResponse()        const {return fResponse;}
@@ -37,17 +42,20 @@ class AliCFUnfolding : public TNamed {
   THnSparse* GetOriginalPrior()   const {return fOriginalPrior;}
   THnSparse* GetEfficiency()      const {return fEfficiency;}
   THnSparse* GetUnfolded()        const {return fUnfolded;}
+  THnSparse* GetEstMeasured()     const {return fMeasuredEstimate;}
+  THnSparse* GetMeasured()        const {return fMeasured;}
+  THnSparse* GetConditional()     const {return fConditional;}
+  TF1*       GetSmoothFunction()  const {return fSmoothFunction;}
 
  private :
   
   // user-related settings
   THnSparse     *fResponse;           // Response matrix : dimensions must be 2N = 2 x (number of variables)
-                                      // first N dimensions must be filled with reconstructed values
-                                      // last  N dimensions must be filled with generated values
+                                      // dimensions 0 ->  N-1 must be filled with reconstructed values
+                                      // dimensions N -> 2N-1 must be filled with generated values
   THnSparse     *fPrior;              // This is the assumed generated distribution : dimensions must be N = number of variables
                                       // it will be used at the first step 
                                       // then will be updated automatically at each iteration
-  THnSparse     *fOriginalPrior;      // This is the original prior distribution : will not be modified
   THnSparse     *fEfficiency;         // Efficiency map : dimensions must be N = number of variables
                                       // this map must be filled only with "true" values of the variables (should not include resolution effects)
   THnSparse     *fMeasured;           // Measured spectrum to be unfolded : dimensions must be N = number of variables
@@ -55,8 +63,11 @@ class AliCFUnfolding : public TNamed {
   Int_t          fNVariables;         // Number of variables used in analysis spectra (pt, y, ...)
   Double_t       fMaxChi2;            // Maximum Chi2 between unfolded and prior distributions. 
   Bool_t         fUseSmoothing;       // Smooth the unfolded sectrum at each iteration
+  TF1           *fSmoothFunction;     // Function used to smooth the unfolded spectrum
+  Option_t      *fSmoothOption;       // Option to use during the fit (with fSmoothFunction) ; default is "iremn"
 
   // internal settings
+  THnSparse     *fOriginalPrior;     // This is the original prior distribution : will not be modified
   THnSparse     *fInverseResponse;   // Inverse response matrix
   THnSparse     *fMeasuredEstimate;  // Estimation of the measured (M) spectrum given the a priori (T) distribution
   THnSparse     *fConditional;       // Matrix holding the conditional probabilities P(M|T)
@@ -68,15 +79,17 @@ class AliCFUnfolding : public TNamed {
   
 
   // functions
-  void     Init();                // initialisation of the internal settings
-  void     GetCoordinates();      // gets a cell coordinates in Measured and True space
-  void     CreateConditional();   // creates the conditional matrix from the response matrix
-  void     CreateEstMeasured();   // creates the measured spectrum estimation from the conditional matrix and the prior distribution
-  void     CreateInvResponse();   // creates the inverse response function (Bayes Theorem) from the conditional matrix and the prior distribution
-  void     CreateUnfolded();      // creates the unfolded spectrum from the inverse response matrix and the measured distribution
-  void     CreateFlatPrior();     // creates a flat a priori distribution in case the one given in the constructor is null
-  Double_t GetChi2();             // returns the chi2 between unfolded and prior spectra
-  void     Smooth();              // smooth the unfolded spectrum using the neighbouring cells
+  void     Init();                  // initialisation of the internal settings
+  void     GetCoordinates();        // gets a cell coordinates in Measured and True space
+  void     CreateConditional();     // creates the conditional matrix from the response matrix
+  void     CreateEstMeasured();     // creates the measured spectrum estimation from the conditional matrix and the prior distribution
+  void     CreateInvResponse();     // creates the inverse response function (Bayes Theorem) from the conditional matrix and the prior distribution
+  void     CreateUnfolded();        // creates the unfolded spectrum from the inverse response matrix and the measured distribution
+  void     CreateFlatPrior();       // creates a flat a priori distribution in case the one given in the constructor is null
+  Double_t GetChi2();               // returns the chi2 between unfolded and prior spectra
+  Short_t  Smooth();                // function calling smoothing methods
+  Short_t  SmoothUsingNeighbours(); // smoothes the unfolded spectrum using the neighbouring cells
+  Short_t  SmoothUsingFunction();   // smoothes the unfolded spectrum using a fit function
 
   ClassDef(AliCFUnfolding,0);
 };