]>
Commit | Line | Data |
---|---|---|
e6339065 | 1 | /* $Id$ */ |
2 | ||
3 | #ifndef ALIUNFOLDING_H | |
4 | #define ALIUNFOLDING_H | |
5 | ||
6 | // | |
7 | // class that implements several unfolding methods | |
19442b86 | 8 | // I.e. chi2 minimization and bayesian unfolding |
9 | // The whole class is static and not thread-safe (due to the fact that MINUIT unfolding is not thread-safe) | |
e6339065 | 10 | // |
11 | ||
12 | // TMatrixD, TVectorD defined here, because it does not seem possible to predeclare these (or i do not know how) | |
13 | // --> | |
14 | // $ROOTSYS/include/TVectorDfwd.h:21: conflicting types for `typedef struct TVectorT<Double_t> TVectorD' | |
15 | // PWG0/AliUnfolding.h:21: previous declaration as `struct TVectorD' | |
16 | ||
17 | #include "TObject.h" | |
18 | #include <TMatrixD.h> | |
19 | #include <TVectorD.h> | |
20 | ||
21 | class TH1; | |
22 | class TH2; | |
e6339065 | 23 | class TF1; |
e6339065 | 24 | |
25 | class AliUnfolding : public TObject | |
26 | { | |
27 | public: | |
28 | enum RegularizationType { kNone = 0, kPol0, kPol1, kLog, kEntropy, kCurvature }; | |
19442b86 | 29 | enum MethodType { kInvalid = -1, kChi2Minimization = 0, kBayesian = 1, kFunction = 2}; |
e6339065 | 30 | |
19442b86 | 31 | virtual ~AliUnfolding() {}; |
e6339065 | 32 | |
19442b86 | 33 | static void SetUnfoldingMethod(MethodType methodType); |
34 | static void SetCreateOverflowBin(Float_t overflowBinLimit); | |
35 | static void SetSkipBinsBegin(Int_t nBins); | |
36 | static void SetNbins(Int_t nMeasured, Int_t nUnfolded); | |
37 | static void SetChi2Regularization(RegularizationType type, Float_t weight); | |
38 | static void SetMinuitStepSize(Float_t stepSize) { fgMinuitStepSize = stepSize; } | |
39 | static void SetNormalizeInput(Bool_t flag) { fgNormalizeInput = flag; } | |
40 | static void SetBayesianParameters(Float_t smoothing, Int_t nIterations); | |
41 | static void SetFunction(TF1* function); | |
42 | static void SetDebug(Bool_t flag) { fgDebug = flag; } | |
e6339065 | 43 | |
19442b86 | 44 | static Int_t Unfold(TH2* correlation, TH1* efficiency, TH1* measured, TH1* initialConditions, TH1* result, Bool_t check = kFALSE); |
e6339065 | 45 | |
19442b86 | 46 | protected: |
47 | AliUnfolding() {}; | |
e6339065 | 48 | |
19442b86 | 49 | static Int_t UnfoldWithMinuit(TH2* correlation, TH1* efficiency, TH1* measured, TH1* initialConditions, TH1* result, Bool_t check); |
50 | static Int_t UnfoldWithBayesian(TH2* correlation, TH1* aEfficiency, TH1* measured, TH1* initialConditions, TH1* aResult); | |
51 | static Int_t UnfoldWithFunction(TH2* correlation, TH1* efficiency, TH1* measured, TH1* /* initialConditions */, TH1* aResult); | |
52 | ||
53 | static void DrawGuess(Double_t *params); | |
54 | static void CreateOverflowBin(TH2* correlation, TH1* measured); | |
55 | static void SetStaticVariables(TH2* correlation, TH1* measured); | |
e6339065 | 56 | |
e6339065 | 57 | static Double_t RegularizationPol0(TVectorD& params); |
58 | static Double_t RegularizationPol1(TVectorD& params); | |
59 | static Double_t RegularizationTotalCurvature(TVectorD& params); | |
60 | static Double_t RegularizationEntropy(TVectorD& params); | |
61 | static Double_t RegularizationLog(TVectorD& params); | |
62 | ||
19442b86 | 63 | static void Chi2Function(Int_t&, Double_t*, Double_t& chi2, Double_t *params, Int_t); |
64 | static void TF1Function(Int_t& unused1, Double_t* unused2, Double_t& chi2, Double_t *params, Int_t unused3); | |
e6339065 | 65 | |
66 | // static variable to be accessed by MINUIT | |
19442b86 | 67 | static TMatrixD* fgCorrelationMatrix; // contains fCurrentCorrelation in matrix form |
68 | static TMatrixD* fgCorrelationCovarianceMatrix; // contains the errors of fCurrentESD | |
69 | static TVectorD* fgCurrentESDVector; // contains fCurrentESD | |
70 | static TVectorD* fgEntropyAPriori; // a-priori distribution for entropy regularization | |
71 | ||
72 | static TF1* fgFitFunction; // fit function | |
e6339065 | 73 | |
19442b86 | 74 | // --- configuration params follow --- |
75 | static MethodType fgMethodType; // unfolding method to be used | |
76 | static Int_t fgMaxParams; // bins in unfolded histogram = number of fit params | |
77 | static Int_t fgMaxInput; // bins in measured histogram | |
78 | static Float_t fgOverflowBinLimit; // to fix fluctuations at high multiplicities, all entries above the limit are summarized in one bin | |
e6339065 | 79 | |
19442b86 | 80 | static RegularizationType fgRegularizationType; // regularization that is used during Chi2 method |
81 | static Float_t fgRegularizationWeight; // factor for regularization term | |
82 | static Int_t fgSkipBinsBegin; // (optional) skip the given number of bins in the regularization | |
83 | static Float_t fgMinuitStepSize; // (usually not needed to be changed) step size in minimization | |
84 | static Bool_t fgNormalizeInput; // normalize input spectrum | |
e6339065 | 85 | |
19442b86 | 86 | static Float_t fgBayesianSmoothing; // smoothing parameter (0 = no smoothing) |
87 | static Int_t fgBayesianIterations; // number of iterations in Bayesian method | |
e6339065 | 88 | |
19442b86 | 89 | static Bool_t fgDebug; // debug flag |
90 | // --- end of configuration --- | |
e6339065 | 91 | |
19442b86 | 92 | private: |
e6339065 | 93 | AliUnfolding(const AliUnfolding&); |
94 | AliUnfolding& operator=(const AliUnfolding&); | |
95 | ||
96 | ClassDef(AliUnfolding, 0); | |
97 | }; | |
98 | ||
99 | #endif | |
100 |