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
35 class AliHFEcontainer;
39 class AliHFEspectrum : public TNamed{
46 kMCContainerCharmMC = 4,
47 kMCWeightedContainerNonHFEESD =5,
48 kMCWeightedContainerConversionESD = 6,
65 AliHFEspectrum(const char* name);
69 Bool_t Init(const AliHFEcontainer *datahfecontainer, const AliHFEcontainer *mchfecontainer, const AliHFEcontainer *v0hfecontainer=0x0, const AliHFEcontainer *bghfecontainer=0x0);
70 Bool_t Correct(Bool_t subtractcontamination=kTRUE);
71 Bool_t CorrectBeauty(Bool_t subtractcontamination=kTRUE);
73 AliCFDataGrid *SubtractBackground(Bool_t setBackground = kFALSE);
75 AliCFDataGrid *CorrectV0Efficiency(AliCFDataGrid* const bgsubpectrum = 0x0);
76 AliCFDataGrid *CorrectParametrizedEfficiency(AliCFDataGrid* const bgsubpectrum = 0x0);
78 TList *Unfold(AliCFDataGrid* const bgsubpectrum = 0x0);
79 AliCFDataGrid *CorrectForEfficiency(AliCFDataGrid* const bgsubpectrum = 0x0);
81 TGraphErrors *Normalize(THnSparse * const spectrum,Int_t i = 0) const;
82 TGraphErrors *Normalize(AliCFDataGrid * const spectrum,Int_t i = 0) const;
83 TGraphErrors *NormalizeTH1N(TH1 *input,Int_t normalization) const;
84 void CorrectFromTheWidth(TH1D *h1) const;
85 void CorrectStatErr(AliCFDataGrid *backgroundGrid) const;
87 void SetCorrelation(THnSparseF * const correlation) {fCorrelation = correlation; };
88 void SetContainer(AliCFContainer *cont, AliHFEspectrum::CFContainer_t type);
89 void SetEfficiencyFunction(TF1 *efficiencyFunction) { fEfficiencyFunction = efficiencyFunction; };
90 void SetPbPbAnalysis(Bool_t isPbPb = kFALSE) { fBeamType=(Char_t) isPbPb; };
92 void SetParameterizedEff(AliCFContainer *container, AliCFContainer *containermb, AliCFContainer *containeresd, AliCFContainer *containeresdmb, Int_t *dimensions);
94 void SetNumberOfEvents(Int_t nEvents,Int_t i = 0) { fNEvents[i] = nEvents; };
95 void SetNumberOfMCEvents(Int_t nEvents) { fNMCEvents = nEvents; };
96 void SetNumberOfMC2Events(Int_t nEvents,Int_t i = 0) { fNMCbgEvents[i] = nEvents; };
97 void SetMCEffStep(Int_t step) { fStepMC = step; };
98 void SetMCTruthStep(Int_t step) { fStepTrue = step; };
99 void SetStepToCorrect(Int_t step) { fStepData = step; };
100 void SetStepBeforeCutsV0(Int_t step) { fStepBeforeCutsV0 = step; };
101 void SetStepAfterCutsV0(Int_t step) { fStepAfterCutsV0 = step; };
102 void SetNbDimensions(Int_t nbDimensions) { fNbDimensions = nbDimensions; };
103 void SetChargeChoosen(Chargetype_t chargechoosen) {fChargeChoosen = chargechoosen; };
104 void SetEtaRange(Double_t etamin, Double_t etamax) { fEtaRange[0] = etamin; fEtaRange[1] = etamax; fEtaSelected = kTRUE; }
105 void SetUnSetCorrelatedErrors(Bool_t unsetcorrelatederrors) {fUnSetCorrelatedErrors = unsetcorrelatederrors;};
106 void SetSmoothing(Bool_t setSmoothing) {fSetSmoothing = setSmoothing;};
108 void SetNCentralityBinAtTheEnd(Int_t nCentralityBinAtTheEnd) {fNCentralityBinAtTheEnd = nCentralityBinAtTheEnd; };
109 void SetLowHighBoundaryCentralityBinAtTheEnd(Int_t low, Int_t high, Int_t i) { fLowBoundaryCentralityBinAtTheEnd[i] = low; fHighBoundaryCentralityBinAtTheEnd[i] = high;};
111 void SetBeautyAnalysis() { fInclusiveSpectrum = kFALSE; };
112 void CallInputFileForBeauty2ndMethod();
113 void SetInputFileForBeauty2ndMethod(const char *filenameb = "BSpectrum2ndmethod.root"){fkBeauty2ndMethodfilename = filenameb; };
114 void SetBeautyAnalysis2ndMethod(Bool_t beauty2ndmethod) { fBeauty2ndMethod = beauty2ndmethod; }
115 void SetIPEffCombinedSamples(Bool_t ipEffCombinedSamples) { fIPEffCombinedSamples = ipEffCombinedSamples; }
116 void SetHadronEffbyIPcut(THnSparseF* hsHadronEffbyIPcut) { fHadronEffbyIPcut = hsHadronEffbyIPcut;};
117 void SetNonHFEsyst(Bool_t syst){ fNonHFEsyst = syst; };
119 void SetStepGuessedUnfolding(Int_t stepGuessedUnfolding) { fStepGuessedUnfolding = stepGuessedUnfolding; };
120 void SetNumberOfIteration(Int_t numberOfIteration) { fNumberOfIterations = numberOfIteration; };
122 void SetDumpToFile(Bool_t dumpToFile) { fDumpToFile=dumpToFile; };
124 void SetDebugLevel(Int_t debugLevel, Bool_t writeToFile = kFALSE) { fDebugLevel = debugLevel; fWriteToFile = writeToFile; };
127 AliCFDataGrid* GetRawBspectra2ndMethod();
128 AliCFDataGrid* GetCharmBackground();
129 AliCFDataGrid* GetConversionBackground();
130 AliCFDataGrid* GetNonHFEBackground();
131 THnSparse* GetCharmWeights();
132 THnSparse* GetBeautyIPEff();
133 THnSparse* GetPIDxIPEff(Int_t source);
134 void CalculateNonHFEsyst(Int_t centrality = 0);
136 void EnableIPanaHadronBgSubtract() { fIPanaHadronBgSubtract = kTRUE; };
137 void EnableIPanaCharmBgSubtract() { fIPanaCharmBgSubtract = kTRUE; };
138 void EnableIPanaConversionBgSubtract() { fIPanaConversionBgSubtract = kTRUE; };
139 void EnableIPanaNonHFEBgSubtract() { fIPanaNonHFEBgSubtract = kTRUE; };
140 void EnableIPParameterizedEff() { fIPParameterizedEff = kTRUE; };
144 AliCFContainer *GetContainer(AliHFEspectrum::CFContainer_t contt);
145 AliCFContainer *GetSlicedContainer(AliCFContainer *cont, Int_t ndim, Int_t *dimensions,Int_t source=-1,Chargetype_t charge=kAllCharge,Int_t centrality=-1);
146 THnSparseF *GetSlicedCorrelation(THnSparseF *correlationmatrix,Int_t nDim, Int_t *dimensions) const;
147 TObject* GetSpectrum(const AliCFContainer * const c, Int_t step);
148 TObject* GetEfficiency(const AliCFContainer * const c, Int_t step, Int_t step0);
150 void AddTemporaryObject(TObject *cont);
151 void ClearObject(TObject *o);
153 TGraphErrors *NormalizeTH1(TH1 *input,Int_t i = 0) const;
157 AliHFEspectrum(const AliHFEspectrum &);
158 AliHFEspectrum &operator=(const AliHFEspectrum &);
160 TObjArray *fCFContainers; // List of Correction Framework Containers
161 TList *fTemporaryObjects; // Emulate garbage collection
162 THnSparseF *fCorrelation; // Correlation Matrices
163 AliCFDataGrid *fBackground; // Background Grid
164 TF1 *fEfficiencyFunction; // Efficiency Function
165 TF1 *fEfficiencyTOFPIDD[kCentrality]; // TOF PID efficiency parameterized
166 TF1 *fEfficiencyesdTOFPIDD[kCentrality]; // TOF PID efficiency parameterized
167 TF1 *fEfficiencyIPCharmD[kCentrality]; // IP efficiency parameterized for charm
168 TF1 *fEfficiencyIPBeautyD[kCentrality]; // IP efficiency parameterized for beauty
169 TF1 *fEfficiencyIPConversionD[kCentrality]; // IP efficiency parameterized for conversion
170 TF1 *fEfficiencyIPNonhfeD[kCentrality]; // IP efficiency parameterized for nonhfe
172 THnSparseF *fWeightCharm; // Weight for charm bg
174 AliCFContainer *fConvSourceContainer[kElecBgSources][kBgLevels][kCentrality]; //container for conversion electrons, divided into different photon sources
175 AliCFContainer *fNonHFESourceContainer[kElecBgSources][kBgLevels][kCentrality]; //container for non-HF electrons, divided into different sources
177 Bool_t fInclusiveSpectrum; // Inclusive Spectrum
178 Bool_t fDumpToFile; // Write Result in a file
180 Bool_t fEtaSelected; // Switch for eta selection
181 Bool_t fUnSetCorrelatedErrors; // Unset correlated errors
182 Bool_t fSetSmoothing; // Set smoothing
184 Bool_t fIPanaHadronBgSubtract; // Hadron background subtraction
185 Bool_t fIPanaCharmBgSubtract; // Charm background subtraction
186 Bool_t fIPanaConversionBgSubtract; // Conversion background subtraction
187 Bool_t fIPanaNonHFEBgSubtract; // nonHFE except for conversion background subtraction
188 Bool_t fIPParameterizedEff; // switch to use parameterized efficiency for ip analysis
189 Bool_t fNonHFEsyst; // choose NonHFE background level (upper, lower, central)
190 Bool_t fBeauty2ndMethod; // 2nd method to get beauty spectrum
191 Bool_t fIPEffCombinedSamples; // flag to combine two different samples
193 Int_t fNbDimensions; // Number of dimensions for the correction
194 Int_t fNEvents[20]; // Number of Events
195 Int_t fNMCEvents; // Number of MC Events
196 Int_t fNMCbgEvents[20]; // Number of BG MC Events
197 Int_t fStepMC; // MC step (for unfolding)
198 Int_t fStepTrue; // MC step of the final spectrum
199 Int_t fStepData; // Data Step (various applications)
200 Int_t fStepBeforeCutsV0; // Before cuts V0
201 Int_t fStepAfterCutsV0; // After cuts V0
202 Int_t fStepGuessedUnfolding; // Step for first guessed unfolding
203 Int_t fNumberOfIterations; // Number of iterations
204 Chargetype_t fChargeChoosen; // Select positive or negative electrons
206 Double_t fEtaRange[2]; // Eta range
207 Double_t fEtaRangeNorm[2]; // Eta range used in the normalization
209 Int_t fNCentralityBinAtTheEnd;// Number of centrality class at the end
210 Int_t fLowBoundaryCentralityBinAtTheEnd[20]; // Boundary of the bins
211 Int_t fHighBoundaryCentralityBinAtTheEnd[20]; // Boundary of the bins
213 THnSparseF *fHadronEffbyIPcut;// container for hadron efficiency by IP cut
214 TH1D *fEfficiencyCharmSigD[kCentrality]; // charm IP cut eff from signal enhanced MC
215 TH1D *fEfficiencyBeautySigD[kCentrality]; // beauty IP cut eff from signal enhanced MC
216 TH1D *fConversionEff[kCentrality]; // conversion IP cut eff
217 TH1D *fNonHFEEff[kCentrality]; // nonhfe IP cut eff
218 TH1D *fCharmEff[kCentrality]; // charm IP cut eff
219 TH1D *fBeautyEff[kCentrality]; // beauty IP cut eff
220 TH1D *fConversionEffbgc; // conversion IP cut eff
221 TH1D *fNonHFEEffbgc; // nonhfe IP cut eff
222 TH1D *fBSpectrum2ndMethod; // beauty spectrum for 2nd method
223 const char *fkBeauty2ndMethodfilename; // name of file, which contains beauty spectrum for 2ndmethod
224 Char_t fBeamType; // beamtype; default -1; pp =0; PbPb=1
227 Int_t fDebugLevel; // Debug Level
228 Bool_t fWriteToFile; // Write plots to eps files
230 ClassDef(AliHFEspectrum, 1)