Update of the HFE package
[u/mrichter/AliRoot.git] / PWG3 / hfe / AliHFEspectrum.h
CommitLineData
c2690925 1 /**************************************************************************
c04c80e6 2* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3* *
4* Author: The ALICE Off-line Project. *
5* Contributors are mentioned in the code where appropriate. *
6* *
7* Permission to use, copy, modify and distribute this software and its *
8* documentation strictly for non-commercial purposes is hereby granted *
9* without fee, provided that the above copyright notice appears in all *
10* copies and that both the copyright notice and this permission notice *
11* appear in the supporting documentation. The authors make no claims *
12* about the suitability of this software for any purpose. It is *
13* provided "as is" without express or implied warranty. *
14**************************************************************************/
15//
16// Class for spectrum correction
17// Subtraction of hadronic background, Unfolding of the data and
18// Renormalization done here
19// For more information see the implementation file
20//
c2690925 21#ifndef ALIHFESPECTRUM_H
22#define ALIHFESPECTRUM_H
23
c04c80e6 24#ifndef ROOT_TNamed
25#include <TNamed.h>
26#endif
27
28class TGraphErrors;
29class TObject;
30class TH1;
c2690925 31class TF1;
c04c80e6 32class TList;
33class AliCFContainer;
3a72645a 34class AliHFEcontainer;
c04c80e6 35class AliCFDataGrid;
36class AliCFEffGrid;
37
38class AliHFEspectrum : public TNamed{
39 public:
40 enum CFContainer_t{
3a72645a 41 kDataContainer = 0,
42 kBackgroundData = 1,
43 kMCContainerMC = 2,
44 kMCContainerESD = 3,
c2690925 45 kDataContainerV0 = 4,
46 kNonHFEBackgroundData = 5,
47 kMCContainerCharmMC = 6,
48 kMCContainerConversionMC = 7,
49 kMCContainerNonHFEMC = 8
c04c80e6 50 };
3a72645a 51
c04c80e6 52 AliHFEspectrum(const char* name);
53 ~AliHFEspectrum();
3a72645a 54
c04c80e6 55
c2690925 56 Bool_t Init(const AliHFEcontainer *datahfecontainer, const AliHFEcontainer *mchfecontainer, const AliHFEcontainer *v0hfecontainer=0x0, const AliHFEcontainer *bghfecontainer=0x0);
3a72645a 57 Bool_t Correct(Bool_t subtractcontamination=kTRUE);
c2690925 58 Bool_t CorrectBeauty(Bool_t subtractcontamination=kTRUE);
3a72645a 59
60 AliCFDataGrid *SubtractBackground(Bool_t setBackground = kFALSE);
61
62 AliCFDataGrid *CorrectV0Efficiency(AliCFDataGrid* const bgsubpectrum = 0x0);
c2690925 63 AliCFDataGrid *CorrectParametrizedEfficiency(AliCFDataGrid* const bgsubpectrum = 0x0);
3a72645a 64
65 TList *Unfold(AliCFDataGrid* const bgsubpectrum = 0x0);
66 AliCFDataGrid *CorrectForEfficiency(AliCFDataGrid* const bgsubpectrum = 0x0);
67
c2690925 68 TGraphErrors *Normalize(THnSparse * const spectrum,Int_t i = 0) const;
69 TGraphErrors *Normalize(AliCFDataGrid * const spectrum,Int_t i = 0) const;
70 TGraphErrors *NormalizeTH1N(TH1 *input,Int_t normalization) const;
71 void CorrectFromTheWidth(TH1D *h1) const;
3a72645a 72
c04c80e6 73 void SetCorrelation(THnSparseF * const correlation) {fCorrelation = correlation; };
74 void SetContainer(AliCFContainer *cont, AliHFEspectrum::CFContainer_t type);
c2690925 75 void SetEfficiencyFunction(TF1 *efficiencyFunction) { fEfficiencyFunction = efficiencyFunction; };
76 void SetPbPbAnalysis(Bool_t isPbPb = kFALSE) { fBeamType=(Char_t) isPbPb; };
3a72645a 77
c2690925 78 void SetNumberOfEvents(Int_t nEvents,Int_t i = 0) { fNEvents[i] = nEvents; };
79 void SetNumberOfMCEvents(Int_t nEvents) { fNMCEvents = nEvents; };
80 void SetNumberOfMC2Events(Int_t nEvents) { fNMCbgEvents = nEvents; };
c04c80e6 81 void SetMCEffStep(Int_t step) { fStepMC = step; };
82 void SetMCTruthStep(Int_t step) { fStepTrue = step; };
83 void SetStepToCorrect(Int_t step) { fStepData = step; };
3a72645a 84 void SetStepBeforeCutsV0(Int_t step) { fStepBeforeCutsV0 = step; };
85 void SetStepAfterCutsV0(Int_t step) { fStepAfterCutsV0 = step; };
bf892a6a 86 void SetNbDimensions(Int_t nbDimensions) { fNbDimensions = nbDimensions; };
c2690925 87 void SetChargeChoosen(Int_t chargechoosen) {fChargeChoosen = chargechoosen; };
88 void SetUnSetCorrelatedErrors(Bool_t unsetcorrelatederrors) {fUnSetCorrelatedErrors = unsetcorrelatederrors;};
e156c3bb 89 void SetSmoothing(Bool_t setSmoothing) {fSetSmoothing = setSmoothing;};
c2690925 90
91 void SetNCentralityBinAtTheEnd(Int_t nCentralityBinAtTheEnd) {fNCentralityBinAtTheEnd = nCentralityBinAtTheEnd; };
92 void SetLowHighBoundaryCentralityBinAtTheEnd(Int_t low, Int_t high, Int_t i) { fLowBoundaryCentralityBinAtTheEnd[i] = low; fHighBoundaryCentralityBinAtTheEnd[i] = high;};
93
94 void SetBeautyAnalysis() { fInclusiveSpectrum = kFALSE; };
95 void SetHadronEffbyIPcut(THnSparseF* hsHadronEffbyIPcut) { fHadronEffbyIPcut = hsHadronEffbyIPcut;};
96 void SetNonHFEBackground2ndMethod() { fNonHFEbgMethod2 = kTRUE; };
3a72645a 97
c04c80e6 98 void SetStepGuessedUnfolding(Int_t stepGuessedUnfolding) { fStepGuessedUnfolding = stepGuessedUnfolding; };
99 void SetNumberOfIteration(Int_t numberOfIteration) { fNumberOfIterations = numberOfIteration; };
3a72645a 100
c04c80e6 101 void SetDumpToFile(Bool_t dumpToFile) { fDumpToFile=dumpToFile; };
102
3a72645a 103 void SetDebugLevel(Int_t debugLevel) { fDebugLevel = debugLevel; };
c04c80e6 104
c2690925 105 AliCFDataGrid* GetCharmBackground();
106 AliCFDataGrid* GetConversionBackground();
107 AliCFDataGrid* GetNonHFEBackground();
108 THnSparse* GetWeights();
109
110 void EnableIPanaHadronBgSubtract() { fIPanaHadronBgSubtract = kTRUE; };
111 void EnableIPanaCharmBgSubtract() { fIPanaCharmBgSubtract = kTRUE; };
112 void EnableIPanaConversionBgSubtract() { fIPanaConversionBgSubtract = kTRUE; };
113 void EnableIPanaNonHFEBgSubtract() { fIPanaNonHFEBgSubtract = kTRUE; };
114
c04c80e6 115 protected:
3a72645a 116
c04c80e6 117 AliCFContainer *GetContainer(AliHFEspectrum::CFContainer_t contt);
c2690925 118 AliCFContainer *GetSlicedContainer(AliCFContainer *cont, Int_t ndim, Int_t *dimensions,Int_t source=-1,Int_t positivenegative=-1);
3a72645a 119 THnSparseF *GetSlicedCorrelation(THnSparseF *correlationmatrix,Int_t nDim, Int_t *dimensions) const;
c2690925 120 TObject* GetSpectrum(const AliCFContainer * const c, Int_t step);
121 TObject* GetEfficiency(const AliCFContainer * const c, Int_t step, Int_t step0);
c04c80e6 122
123 void AddTemporaryObject(TObject *cont);
124 void ClearObject(TObject *o);
125
c2690925 126 TGraphErrors *NormalizeTH1(TH1 *input,Int_t i = 0) const;
c04c80e6 127
128
129 private:
130 AliHFEspectrum(const AliHFEspectrum &);
131 AliHFEspectrum &operator=(const AliHFEspectrum &);
132
133 TList *fCFContainers; // List of Correction Framework Containers
134 TList *fTemporaryObjects; // Emulate garbage collection
135 THnSparseF *fCorrelation; // Correlation Matrices
136 AliCFDataGrid *fBackground; // Background Grid
c2690925 137 TF1 *fEfficiencyFunction; // Efficiency Function
138
139 THnSparseF *fWeightCharm; // Weight for charm bg
c04c80e6 140
3a72645a 141 Bool_t fInclusiveSpectrum; // Inclusive Spectrum
c04c80e6 142 Bool_t fDumpToFile; // Write Result in a file
143
c2690925 144 Bool_t fUnSetCorrelatedErrors; // Unset correlated errors
e156c3bb 145 Bool_t fSetSmoothing; // Set smoothing
c2690925 146
147 Bool_t fIPanaHadronBgSubtract; // Hadron background subtraction
148 Bool_t fIPanaCharmBgSubtract; // Charm background subtraction
149 Bool_t fIPanaConversionBgSubtract; // Conversion background subtraction
150 Bool_t fIPanaNonHFEBgSubtract; // nonHFE except for conversion background subtraction
151 Bool_t fNonHFEbgMethod2; // switch for 2nd method to subtract non HFE background
152
3a72645a 153 Int_t fNbDimensions; // Number of dimensions for the correction
c2690925 154 Int_t fNEvents[20]; // Number of Events
155 Int_t fNMCEvents; // Number of MC Events
156 Int_t fNMCbgEvents; // Number of BG MC Events
c04c80e6 157 Int_t fStepMC; // MC step (for unfolding)
158 Int_t fStepTrue; // MC step of the final spectrum
159 Int_t fStepData; // Data Step (various applications)
3a72645a 160 Int_t fStepBeforeCutsV0; // Before cuts V0
161 Int_t fStepAfterCutsV0; // After cuts V0
c04c80e6 162 Int_t fStepGuessedUnfolding; // Step for first guessed unfolding
163 Int_t fNumberOfIterations; // Number of iterations
c2690925 164 Int_t fChargeChoosen; // Select positive or negative electrons
165
166 Int_t fNCentralityBinAtTheEnd; // Number of centrality class at the end
167 Int_t fLowBoundaryCentralityBinAtTheEnd[20]; // Boundary of the bins
168 Int_t fHighBoundaryCentralityBinAtTheEnd[20]; // Boundary of the bins
169
170 THnSparseF *fHadronEffbyIPcut;// container for hadron efficiency by IP cut
171 Char_t fBeamType; // beamtype; default -1; pp =0; PbPb=1
172
c04c80e6 173
3a72645a 174 Int_t fDebugLevel; // Debug Level
c04c80e6 175
176 ClassDef(AliHFEspectrum, 1)
177};
178#endif
179