1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
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
21 #ifndef ALIHFESPECTRUM_H
22 #define ALIHFESPECTRUM_H
34 class AliHFEcontainer;
38 class AliHFEspectrum : public TNamed{
45 kMCContainerCharmMC = 4,
46 kMCWeightedContainerNonHFEESD =5,
47 kMCWeightedContainerConversionESD = 6,
51 AliHFEspectrum(const char* name);
55 Bool_t Init(const AliHFEcontainer *datahfecontainer, const AliHFEcontainer *mchfecontainer, const AliHFEcontainer *v0hfecontainer=0x0, const AliHFEcontainer *bghfecontainer=0x0);
56 Bool_t Correct(Bool_t subtractcontamination=kTRUE);
57 Bool_t CorrectBeauty(Bool_t subtractcontamination=kTRUE);
59 AliCFDataGrid *SubtractBackground(Bool_t setBackground = kFALSE);
61 AliCFDataGrid *CorrectV0Efficiency(AliCFDataGrid* const bgsubpectrum = 0x0);
62 AliCFDataGrid *CorrectParametrizedEfficiency(AliCFDataGrid* const bgsubpectrum = 0x0);
64 TList *Unfold(AliCFDataGrid* const bgsubpectrum = 0x0);
65 AliCFDataGrid *CorrectForEfficiency(AliCFDataGrid* const bgsubpectrum = 0x0);
67 TGraphErrors *Normalize(THnSparse * const spectrum,Int_t i = 0) const;
68 TGraphErrors *Normalize(AliCFDataGrid * const spectrum,Int_t i = 0) const;
69 TGraphErrors *NormalizeTH1N(TH1 *input,Int_t normalization) const;
70 void CorrectFromTheWidth(TH1D *h1) const;
71 void CorrectStatErr(AliCFDataGrid *backgroundGrid) const;
73 void SetCorrelation(THnSparseF * const correlation) {fCorrelation = correlation; };
74 void SetContainer(AliCFContainer *cont, AliHFEspectrum::CFContainer_t type);
75 void SetEfficiencyFunction(TF1 *efficiencyFunction) { fEfficiencyFunction = efficiencyFunction; };
76 void SetPbPbAnalysis(Bool_t isPbPb = kFALSE) { fBeamType=(Char_t) isPbPb; };
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; };
81 void SetMCEffStep(Int_t step) { fStepMC = step; };
82 void SetMCTruthStep(Int_t step) { fStepTrue = step; };
83 void SetStepToCorrect(Int_t step) { fStepData = step; };
84 void SetStepBeforeCutsV0(Int_t step) { fStepBeforeCutsV0 = step; };
85 void SetStepAfterCutsV0(Int_t step) { fStepAfterCutsV0 = step; };
86 void SetNbDimensions(Int_t nbDimensions) { fNbDimensions = nbDimensions; };
87 void SetChargeChoosen(Int_t chargechoosen) {fChargeChoosen = chargechoosen; };
88 void SetEtaRange(Double_t etamin, Double_t etamax) { fEtaRange[0] = etamin; fEtaRange[1] = etamax; fEtaSelected = kTRUE; }
89 void SetUnSetCorrelatedErrors(Bool_t unsetcorrelatederrors) {fUnSetCorrelatedErrors = unsetcorrelatederrors;};
90 void SetSmoothing(Bool_t setSmoothing) {fSetSmoothing = setSmoothing;};
92 void SetNCentralityBinAtTheEnd(Int_t nCentralityBinAtTheEnd) {fNCentralityBinAtTheEnd = nCentralityBinAtTheEnd; };
93 void SetLowHighBoundaryCentralityBinAtTheEnd(Int_t low, Int_t high, Int_t i) { fLowBoundaryCentralityBinAtTheEnd[i] = low; fHighBoundaryCentralityBinAtTheEnd[i] = high;};
95 void SetBeautyAnalysis() { fInclusiveSpectrum = kFALSE; };
96 void SetHadronEffbyIPcut(THnSparseF* hsHadronEffbyIPcut) { fHadronEffbyIPcut = hsHadronEffbyIPcut;};
97 void SetNonHFEBackground2ndMethod() { fNonHFEbgMethod2 = kTRUE; };
98 void SetNonHFEmode(Int_t mode){ fNonHFEmode = mode; };
100 void SetStepGuessedUnfolding(Int_t stepGuessedUnfolding) { fStepGuessedUnfolding = stepGuessedUnfolding; };
101 void SetNumberOfIteration(Int_t numberOfIteration) { fNumberOfIterations = numberOfIteration; };
103 void SetDumpToFile(Bool_t dumpToFile) { fDumpToFile=dumpToFile; };
105 void SetDebugLevel(Int_t debugLevel) { fDebugLevel = debugLevel; };
107 AliCFDataGrid* GetCharmBackground();
108 AliCFDataGrid* GetConversionBackground();
109 AliCFDataGrid* GetNonHFEBackground();
110 THnSparse* GetCharmWeights();
111 THnSparse* GetBeautyIPEff();
112 THnSparse* GetCharmEff();
113 THnSparse* GetPIDxIPEff(Int_t source);
115 void EnableIPanaHadronBgSubtract() { fIPanaHadronBgSubtract = kTRUE; };
116 void EnableIPanaCharmBgSubtract() { fIPanaCharmBgSubtract = kTRUE; };
117 void EnableIPanaConversionBgSubtract() { fIPanaConversionBgSubtract = kTRUE; };
118 void EnableIPanaNonHFEBgSubtract() { fIPanaNonHFEBgSubtract = kTRUE; };
122 AliCFContainer *GetContainer(AliHFEspectrum::CFContainer_t contt);
123 AliCFContainer *GetSlicedContainer(AliCFContainer *cont, Int_t ndim, Int_t *dimensions,Int_t source=-1,Int_t positivenegative=-1);
124 THnSparseF *GetSlicedCorrelation(THnSparseF *correlationmatrix,Int_t nDim, Int_t *dimensions) const;
125 TObject* GetSpectrum(const AliCFContainer * const c, Int_t step);
126 TObject* GetEfficiency(const AliCFContainer * const c, Int_t step, Int_t step0);
128 void AddTemporaryObject(TObject *cont);
129 void ClearObject(TObject *o);
131 TGraphErrors *NormalizeTH1(TH1 *input,Int_t i = 0) const;
135 AliHFEspectrum(const AliHFEspectrum &);
136 AliHFEspectrum &operator=(const AliHFEspectrum &);
138 TList *fCFContainers; // List of Correction Framework Containers
139 TList *fTemporaryObjects; // Emulate garbage collection
140 THnSparseF *fCorrelation; // Correlation Matrices
141 AliCFDataGrid *fBackground; // Background Grid
142 TF1 *fEfficiencyFunction; // Efficiency Function
144 THnSparseF *fWeightCharm; // Weight for charm bg
146 Bool_t fInclusiveSpectrum; // Inclusive Spectrum
147 Bool_t fDumpToFile; // Write Result in a file
149 Bool_t fEtaSelected; // Switch for eta selection
150 Bool_t fUnSetCorrelatedErrors; // Unset correlated errors
151 Bool_t fSetSmoothing; // Set smoothing
153 Bool_t fIPanaHadronBgSubtract; // Hadron background subtraction
154 Bool_t fIPanaCharmBgSubtract; // Charm background subtraction
155 Bool_t fIPanaConversionBgSubtract; // Conversion background subtraction
156 Bool_t fIPanaNonHFEBgSubtract; // nonHFE except for conversion background subtraction
157 Bool_t fNonHFEbgMethod2; // switch for 2nd method to subtract non HFE background
158 Int_t fNonHFEmode; // choose NonHFE background level (upper, lower, central)
160 Int_t fNbDimensions; // Number of dimensions for the correction
161 Int_t fNEvents[20]; // Number of Events
162 Int_t fNMCEvents; // Number of MC Events
163 Int_t fNMCbgEvents; // Number of BG MC Events
164 Int_t fStepMC; // MC step (for unfolding)
165 Int_t fStepTrue; // MC step of the final spectrum
166 Int_t fStepData; // Data Step (various applications)
167 Int_t fStepBeforeCutsV0; // Before cuts V0
168 Int_t fStepAfterCutsV0; // After cuts V0
169 Int_t fStepGuessedUnfolding; // Step for first guessed unfolding
170 Int_t fNumberOfIterations; // Number of iterations
171 Int_t fChargeChoosen; // Select positive or negative electrons
173 Double_t fEtaRange[2]; // Eta range
175 Int_t fNCentralityBinAtTheEnd; // Number of centrality class at the end
176 Int_t fLowBoundaryCentralityBinAtTheEnd[20]; // Boundary of the bins
177 Int_t fHighBoundaryCentralityBinAtTheEnd[20]; // Boundary of the bins
179 THnSparseF *fHadronEffbyIPcut;// container for hadron efficiency by IP cut
180 TH1D *fConversionEff; // conversion IP cut eff
181 TH1D *fNonHFEEff; // nonhfe IP cut eff
182 Char_t fBeamType; // beamtype; default -1; pp =0; PbPb=1
185 Int_t fDebugLevel; // Debug Level
187 ClassDef(AliHFEspectrum, 1)