]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGHF/hfe/AliHFECorrectSpectrumBase.cxx
Merge branch 'TPCdev' of https://git.cern.ch/reps/AliRoot into TPCdev
[u/mrichter/AliRoot.git] / PWGHF / hfe / AliHFECorrectSpectrumBase.cxx
CommitLineData
959ea9d8 1
2/**************************************************************************
3* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4* *
5* Author: The ALICE Off-line Project. *
6* Contributors are mentioned in the code where appropriate. *
7* *
8* Permission to use, copy, modify and distribute this software and its *
9* documentation strictly for non-commercial purposes is hereby granted *
10* without fee, provided that the above copyright notice appears in all *
11* copies and that both the copyright notice and this permission notice *
12* appear in the supporting documentation. The authors make no claims *
13* about the suitability of this software for any purpose. It is *
14* provided "as is" without express or implied warranty. *
15**************************************************************************/
16//
17// Class for spectrum correction
18// Subtraction of hadronic background, Unfolding of the data and
19// Renormalization done here
20// The following containers have to be set:
21// - Correction framework container for real data
22// - Correction framework container for MC (Efficiency Map)
23// - Correction framework container for background coming from data
24// - Correction framework container for background coming from MC
25//
26// Author:
27// Raphaelle Bailhache <R.Bailhache@gsi.de>
28// Markus Fasel <M.Fasel@gsi.de>
29//
30
31#include <TArrayD.h>
32#include <TH1.h>
33#include <TList.h>
34#include <TObjArray.h>
35#include <TROOT.h>
36#include <TCanvas.h>
37#include <TLegend.h>
38#include <TStyle.h>
39#include <TMath.h>
40#include <TAxis.h>
41#include <TGraphErrors.h>
42#include <TFile.h>
43#include <TPad.h>
44#include <TH2D.h>
45#include <TF1.h>
46
47#include "AliPID.h"
48#include "AliCFContainer.h"
49#include "AliCFDataGrid.h"
50#include "AliCFEffGrid.h"
51#include "AliCFGridSparse.h"
52#include "AliCFUnfolding.h"
53#include "AliLog.h"
54
55#include "AliHFECorrectSpectrumBase.h"
56#include "AliHFEcuts.h"
57#include "AliHFEcontainer.h"
58#include "AliHFEtools.h"
59
60ClassImp(AliHFECorrectSpectrumBase)
61
62//____________________________________________________________
63AliHFECorrectSpectrumBase::AliHFECorrectSpectrumBase(const char *name):
64 TNamed(name, ""),
63bdf450 65 fCFContainers(new TObjArray(kNbCFContainers)),
959ea9d8 66 fCorrelation(NULL),
67 fEfficiencyFunction(NULL),
68 fEtaSelected(kFALSE),
69 fSetSmoothing(kFALSE),
70 fNbDimensions(1),
71 fNEvents(0),
72 fStepMC(-1),
73 fStepTrue(-1),
74 fStepData(-1),
75 fStepBeforeCutsV0(-1),
76 fStepAfterCutsV0(-1),
77 fStepGuessedUnfolding(-1),
78 fNumberOfIterations(10),
79 fChargeChoosen(kAllCharge),
80 fTestCentralityLow(-1),
81 fTestCentralityHigh(-1)
82{
83 //
84 // Default constructor
85 //
86
87 memset(fEtaRange, 0, sizeof(Double_t) * 2);
88 memset(fEtaRangeNorm, 0, sizeof(Double_t) * 2);
58a496d1 89 memset(fDims, 0, sizeof(Int_t) * 3);
ff8249bd 90 SetNbDimensions(1);
959ea9d8 91
92}
93//____________________________________________________________
94AliHFECorrectSpectrumBase::AliHFECorrectSpectrumBase(const AliHFECorrectSpectrumBase &ref):
95 TNamed(ref),
96 fCFContainers(NULL),
97 fCorrelation(NULL),
98 fEfficiencyFunction(NULL),
99 fEtaSelected(ref.fEtaSelected),
100 fSetSmoothing(ref.fSetSmoothing),
101 fNbDimensions(ref.fNbDimensions),
102 fNEvents(ref.fNEvents),
103 fStepMC(ref.fStepMC),
104 fStepTrue(ref.fStepTrue),
105 fStepData(ref.fStepData),
106 fStepBeforeCutsV0(ref.fStepBeforeCutsV0),
107 fStepAfterCutsV0(ref.fStepAfterCutsV0),
108 fStepGuessedUnfolding(ref.fStepGuessedUnfolding),
109 fNumberOfIterations(ref.fNumberOfIterations),
110 fChargeChoosen(ref.fChargeChoosen),
111 fTestCentralityLow(ref.fTestCentralityLow),
112 fTestCentralityHigh(ref.fTestCentralityHigh)
113{
114 //
115 // Copy constructor
116 //
117 ref.Copy(*this);
118
119}
120//____________________________________________________________
121AliHFECorrectSpectrumBase &AliHFECorrectSpectrumBase::operator=(const AliHFECorrectSpectrumBase &ref){
122 //
123 // Assignment operator
124 //
125 if(this == &ref)
126 ref.Copy(*this);
127 return *this;
128}
129//____________________________________________________________
130void AliHFECorrectSpectrumBase::Copy(TObject &o) const {
131 //
132 // Copy into object o
133 //
134 AliHFECorrectSpectrumBase &target = dynamic_cast<AliHFECorrectSpectrumBase &>(o);
135 target.fCFContainers = fCFContainers;
136 target.fCorrelation = fCorrelation;
137 target.fEfficiencyFunction = fEfficiencyFunction;
138 target.fEtaSelected = fEtaSelected;
139 target.fSetSmoothing = fSetSmoothing;
140 target.fNbDimensions = fNbDimensions;
141 target.fNEvents = fNEvents;
142 target.fStepMC = fStepMC;
143 target.fStepTrue = fStepTrue;
144 target.fStepData = fStepData;
145 target.fStepBeforeCutsV0 = fStepBeforeCutsV0;
146 target.fStepAfterCutsV0 = fStepAfterCutsV0;
147 target.fStepGuessedUnfolding = fStepGuessedUnfolding;
148 target.fNumberOfIterations = fNumberOfIterations;
149 target.fChargeChoosen = fChargeChoosen;
150 target.fTestCentralityLow = fTestCentralityLow;
151 target.fTestCentralityHigh = fTestCentralityHigh;
ff8249bd 152 target.fDims[0] = fDims[0];
153 target.fDims[1] = fDims[1];
154 target.fDims[2] = fDims[2];
959ea9d8 155 target.fEtaRange[0] = fEtaRange[0];
156 target.fEtaRange[1] = fEtaRange[1];
157 target.fEtaRangeNorm[0] = fEtaRangeNorm[0];
158 target.fEtaRangeNorm[1] = fEtaRangeNorm[1];
159
160}
161
162//____________________________________________________________
163AliHFECorrectSpectrumBase::~AliHFECorrectSpectrumBase(){
164 //
165 // Destructor
166 //
167 if(fCFContainers) delete fCFContainers;
168
169}
170//__________________________________________________________________________________
171TGraphErrors *AliHFECorrectSpectrumBase::Normalize(THnSparse * const spectrum) const {
172 //
173 // Normalize the spectrum to 1/(2*Pi*p_{T})*dN/dp_{T} (GeV/c)^{-2}
174 // Give the final pt spectrum to be compared
175 //
176
177 if(fNEvents > 0) {
178
179 TH1D* projection = spectrum->Projection(0);
ff8249bd 180 AliHFEtools::NormaliseBinWidth(projection);
959ea9d8 181 TGraphErrors *graphError = NormalizeTH1(projection);
182 return graphError;
183
184 }
185
186 return 0x0;
187
188
189}
190//__________________________________________________________________________________
191TGraphErrors *AliHFECorrectSpectrumBase::Normalize(AliCFDataGrid * const spectrum) const {
192 //
193 // Normalize the spectrum to 1/(2*Pi*p_{T})*dN/dp_{T} (GeV/c)^{-2}
194 // Give the final pt spectrum to be compared
195 //
196 if(fNEvents > 0) {
197
198 TH1D* projection = (TH1D *) spectrum->Project(0);
ff8249bd 199 AliHFEtools::NormaliseBinWidth(projection);
959ea9d8 200 TGraphErrors *graphError = NormalizeTH1(projection);
201
202 return graphError;
203
204 }
205
206 return 0x0;
207
208
209}
210//__________________________________________________________________________________
211TGraphErrors *AliHFECorrectSpectrumBase::NormalizeTH1(TH1 *input) const {
212 //
213 // Normalize the spectrum to 1/(2*Pi*p_{T})*dN/dp_{T} (GeV/c)^{-2}
214 // Give the final pt spectrum to be compared
215 //
216 Double_t chargecoefficient = 0.5;
217 if(fChargeChoosen != 0) chargecoefficient = 1.0;
218
219 Double_t etarange = fEtaSelected ? fEtaRangeNorm[1] - fEtaRangeNorm[0] : 1.6;
220 printf("Normalizing Eta Range %f\n", etarange);
7483e78e 221 printf("Number of events in Normalisation: %d\n", fNEvents);
222 AliDebug(3, Form("charge coefficient: %f\n", chargecoefficient));
959ea9d8 223 if(fNEvents > 0) {
224
225 TGraphErrors *spectrumNormalized = new TGraphErrors(input->GetNbinsX());
226 Double_t p = 0, dp = 0; Int_t point = 1;
227 Double_t n = 0, dN = 0;
228 Double_t nCorr = 0, dNcorr = 0;
7483e78e 229 //Double_t errdN = 0, errdp = 0;
230 Double_t errdN = 0;
959ea9d8 231 for(Int_t ibin = input->GetXaxis()->GetFirst(); ibin <= input->GetXaxis()->GetLast(); ibin++){
232 point = ibin - input->GetXaxis()->GetFirst();
233 p = input->GetXaxis()->GetBinCenter(ibin);
ff8249bd 234 dp = input->GetXaxis()->GetBinWidth(ibin)/2.;
959ea9d8 235 n = input->GetBinContent(ibin);
7483e78e 236 AliDebug(6, Form("p: %f, n: %e\n", p, n));
959ea9d8 237 dN = input->GetBinError(ibin);
238 // New point
239 nCorr = chargecoefficient * 1./etarange * 1./(Double_t)(fNEvents) * 1./(2. * TMath::Pi() * p) * n;
240 errdN = 1./(2. * TMath::Pi() * p);
7483e78e 241 //errdp = 1./(2. * TMath::Pi() * p*p) * n;
242 //dNcorr = chargecoefficient * 1./etarange * 1./(Double_t)(fNEvents) * TMath::Sqrt(errdN * errdN * dN *dN + errdp *errdp * dp *dp);
243 dNcorr = chargecoefficient * 1./etarange * 1./(Double_t)(fNEvents) * TMath::Sqrt(errdN * errdN * dN *dN);
959ea9d8 244
245 spectrumNormalized->SetPoint(point, p, nCorr);
246 spectrumNormalized->SetPointError(point, dp, dNcorr);
247 }
248 spectrumNormalized->GetXaxis()->SetTitle("p_{T} [GeV/c]");
249 spectrumNormalized->GetYaxis()->SetTitle("#frac{1}{2 #pi p_{T}} #frac{dN}{dp_{T}} / [GeV/c]^{-2}");
250 spectrumNormalized->SetMarkerStyle(22);
251 spectrumNormalized->SetMarkerColor(kBlue);
252 spectrumNormalized->SetLineColor(kBlue);
253
254 return spectrumNormalized;
255
256 }
257
258 return 0x0;
259
260
261}
262//____________________________________________________________
263void AliHFECorrectSpectrumBase::SetContainer(AliCFContainer *cont, AliHFECorrectSpectrumBase::CFContainer_t type){
264 //
265 // Set the container for a given step to the
266 //
63bdf450 267 if(!fCFContainers) fCFContainers = new TObjArray(kNbCFContainers);
959ea9d8 268 fCFContainers->AddAt(cont, type);
269}
270
271//____________________________________________________________
272AliCFContainer *AliHFECorrectSpectrumBase::GetContainer(AliHFECorrectSpectrumBase::CFContainer_t type){
273 //
274 // Get Correction Framework Container for given type
275 //
276 if(!fCFContainers) return NULL;
277 return dynamic_cast<AliCFContainer *>(fCFContainers->At(type));
278}
279//____________________________________________________________
7483e78e 280AliCFContainer *AliHFECorrectSpectrumBase::GetSlicedContainer(AliCFContainer *container, Int_t nDim, Int_t *dimensions,Int_t source,Chargetype_t charge, Int_t centralitylow, Int_t centralityhigh, Bool_t doCentralityProjection) {
959ea9d8 281 //
282 // Slice bin for a given source of electron
283 // nDim is the number of dimension the corrections are done
284 // dimensions are the definition of the dimensions
285 // source is if we want to keep only one MC source (-1 means we don't cut on the MC source)
286 // positivenegative if we want to keep positive (1) or negative (0) or both (-1)
287 // centrality (-1 means we do not cut on centrality)
288 //
7483e78e 289 const double kVerySmall = 1e-5;
959ea9d8 290
291 Double_t *varMin = new Double_t[container->GetNVar()],
292 *varMax = new Double_t[container->GetNVar()];
293
294 Double_t *binLimits;
295 for(Int_t ivar = 0; ivar < container->GetNVar(); ivar++){
296
297 binLimits = new Double_t[container->GetNBins(ivar)+1];
298 container->GetBinLimits(ivar,binLimits);
299 varMin[ivar] = binLimits[0];
300 varMax[ivar] = binLimits[container->GetNBins(ivar)];
301 // source
302 if(ivar == 4){
303 if((source>= 0) && (source<container->GetNBins(ivar))) {
ff8249bd 304 varMin[ivar] = container->GetAxis(4,0)->GetBinLowEdge(container->GetAxis(4,0)->FindBin(binLimits[source]));
305 varMax[ivar] = container->GetAxis(4,0)->GetBinUpEdge(container->GetAxis(4,0)->FindBin(binLimits[source]));
959ea9d8 306 }
307 }
308 // charge
309 if(ivar == 3) {
ff8249bd 310 if(charge != kAllCharge){
311 varMin[ivar] = container->GetAxis(3,0)->GetBinLowEdge(container->GetAxis(3,0)->FindBin(charge));
312 varMax[ivar] = container->GetAxis(3,0)->GetBinUpEdge(container->GetAxis(3,0)->FindBin(charge));
313 }
959ea9d8 314 }
315 // eta
316 if(ivar == 1){
317 for(Int_t ic = 1; ic <= container->GetAxis(1,0)->GetLast(); ic++)
318 AliDebug(1, Form("eta bin %d, min %f, max %f\n", ic, container->GetAxis(1,0)->GetBinLowEdge(ic), container->GetAxis(1,0)->GetBinUpEdge(ic)));
319 if(fEtaSelected){
320 varMin[ivar] = fEtaRange[0];
321 varMax[ivar] = fEtaRange[1];
322 }
323 }
324 if(fEtaSelected){
325 fEtaRangeNorm[0] = container->GetAxis(1,0)->GetBinLowEdge(container->GetAxis(1,0)->FindBin(fEtaRange[0]));
326 fEtaRangeNorm[1] = container->GetAxis(1,0)->GetBinUpEdge(container->GetAxis(1,0)->FindBin(fEtaRange[1]));
7483e78e 327 AliInfo(Form("Normalization done in eta range [%f,%f]\n", fEtaRangeNorm[0], fEtaRangeNorm[1]));
959ea9d8 328 }
329 // centrality
330 if(ivar == 5){
7483e78e 331 if((centralitylow>= 0) && (centralitylow<container->GetNBins(ivar)) && (centralityhigh>= 0) && (centralityhigh<container->GetNBins(ivar)) && doCentralityProjection) {
332 varMin[ivar] = binLimits[centralitylow]+ kVerySmall;
333 varMax[ivar] = binLimits[centralityhigh]+ kVerySmall;
334
335 TAxis *axistest = container->GetAxis(5,0);
336 AliDebug(1, Form("Number of bin in centrality direction %d\n",axistest->GetNbins()));
337 AliDebug(1, Form("Project from %f to %f\n",binLimits[centralitylow],binLimits[centralityhigh]));
338 Double_t lowcentrality = axistest->GetBinLowEdge(axistest->FindBin(binLimits[centralitylow]));
339 Double_t highcentrality = axistest->GetBinUpEdge(axistest->FindBin(binLimits[centralityhigh]));
340 AliDebug(1, Form("Low centrality %f and high centrality %f\n",lowcentrality,highcentrality));
341 }
959ea9d8 342 }
343
7483e78e 344 // Protect varmax against overflow
345 if(TMath::Abs(varMax[ivar] - binLimits[container->GetNBins(ivar)]) < kVerySmall){
346 AliInfo("Protection against overflow bin");
347 varMax[ivar] -= kVerySmall;
348 }
349 if(varMax[ivar] > binLimits[container->GetNBins(ivar)]){
350 AliError("Upper limit exceeds allowed range");
351 varMax[ivar] = binLimits[container->GetNBins(ivar)] - kVerySmall;
352 }
353
354 // Protect varmin against overflow
355 if(TMath::Abs(varMin[ivar] - binLimits[container->GetNBins(ivar)]) < kVerySmall){
356 AliInfo("Protection against overflow bin");
357 varMin[ivar] -= kVerySmall;
358 }
359 if(varMin[ivar] > binLimits[container->GetNBins(ivar)]){
360 AliError("Upper limit exceeds allowed range");
361 varMin[ivar] = binLimits[container->GetNBins(ivar)] - kVerySmall;
362 }
363 AliDebug(1, Form("variable %d: Settting limits to %f and %f\n", ivar, varMin[ivar], varMax[ivar]));
959ea9d8 364 delete[] binLimits;
7483e78e 365
959ea9d8 366 }
7483e78e 367
959ea9d8 368 AliCFContainer *k = container->MakeSlice(nDim, dimensions, varMin, varMax);
369 delete[] varMin; delete[] varMax;
370
371 return k;
372
373}
374
375//_________________________________________________________________________
7483e78e 376THnSparseF *AliHFECorrectSpectrumBase::GetSlicedCorrelation(THnSparseF *correlationmatrix, Int_t nDim, Int_t *dimensions,Chargetype_t charge,Int_t centralitylow, Int_t centralityhigh, Bool_t doCentralityProjection) const {
959ea9d8 377 //
378 // Slice correlation
379 //
380
381 Int_t ndimensions = correlationmatrix->GetNdimensions();
382 //printf("Number of dimension %d correlation map\n",ndimensions);
383 if(ndimensions < (2*nDim)) {
384 AliError("Problem in the dimensions");
385 return NULL;
386 }
387
388 // Cut in centrality is centrality > -1
389 if((5+((Int_t)(ndimensions/2.))) < ndimensions) {
390 if((centralitylow >=0) && (centralityhigh >=0)) {
391
392 TAxis *axiscentrality0 = correlationmatrix->GetAxis(5);
393 TAxis *axiscentrality1 = correlationmatrix->GetAxis(5+((Int_t)(ndimensions/2.)));
394
395 Int_t bins0 = axiscentrality0->GetNbins();
396 Int_t bins1 = axiscentrality1->GetNbins();
397
398 AliDebug(1, Form("Number of centrality bins: %d and %d\n",bins0,bins1));
399 if(bins0 != bins1) {
7483e78e 400 AliError("Problem in the dimensions");
401 return NULL;
959ea9d8 402 }
403
7483e78e 404 if((centralitylow>= 0) && (centralitylow<bins0) && (centralityhigh>= 0) && (centralityhigh<bins0) && doCentralityProjection) {
405 axiscentrality0->SetRangeUser(centralitylow,centralityhigh);
406 axiscentrality1->SetRangeUser(centralitylow,centralityhigh);
959ea9d8 407
7483e78e 408 Double_t lowcentrality0 = axiscentrality0->GetBinLowEdge(axiscentrality0->FindBin(centralitylow));
409 Double_t highcentrality0 = axiscentrality0->GetBinUpEdge(axiscentrality0->FindBin(centralityhigh));
410 Double_t lowcentrality1 = axiscentrality1->GetBinLowEdge(axiscentrality1->FindBin(centralitylow));
411 Double_t highcentrality1 = axiscentrality1->GetBinUpEdge(axiscentrality1->FindBin(centralityhigh));
412 AliDebug(1,Form("0 Low centrality %f and high centrality %f\n",lowcentrality0,highcentrality0));
413 AliDebug(1,Form("1 Low centrality %f and high centrality %f\n",lowcentrality1,highcentrality1));
959ea9d8 414
415 }
416 }
417 }
418
419 // Cut in eta > -1
420 if(fEtaSelected){
421 if((1+((Int_t)(ndimensions/2.))) < ndimensions) {
422
423 TAxis *axiseta0 = correlationmatrix->GetAxis(1);
424 TAxis *axiseta1 = correlationmatrix->GetAxis(1+((Int_t)(ndimensions/2.)));
425
426 Int_t bins0 = axiseta0->GetNbins();
427 Int_t bins1 = axiseta1->GetNbins();
428
429 AliDebug(1, Form("Number of eta bins: %d and %d\n",bins0,bins1));
430 if(bins0 != bins1) {
431 AliError("Problem in the dimensions");
432 return NULL;
433 }
434
435 axiseta0->SetRangeUser(fEtaRange[0],fEtaRange[1]);
436 axiseta1->SetRangeUser(fEtaRange[0],fEtaRange[1]);
437
438 Double_t loweta0 = axiseta0->GetBinLowEdge(axiseta0->FindBin(fEtaRange[0]));
439 Double_t higheta0 = axiseta0->GetBinUpEdge(axiseta0->FindBin(fEtaRange[1]));
440 Double_t loweta1 = axiseta1->GetBinLowEdge(axiseta1->FindBin(fEtaRange[0]));
441 Double_t higheta1 = axiseta1->GetBinUpEdge(axiseta1->FindBin(fEtaRange[1]));
442 AliInfo(Form("0 Low eta %f and high eta %f\n",loweta0,higheta0));
443 AliInfo(Form("1 Low eta %f and high eta %f\n",loweta1,higheta1));
444
445 }
446 }
447
448 // Cut in charge
449 if(charge != kAllCharge) {
450 if((3+((Int_t)(ndimensions/2.))) < ndimensions) {
451
452 TAxis *axischarge0 = correlationmatrix->GetAxis(3);
453 TAxis *axischarge1 = correlationmatrix->GetAxis(3+((Int_t)(ndimensions/2.)));
454
455 Int_t bins0 = axischarge0->GetNbins();
456 Int_t bins1 = axischarge1->GetNbins();
457
458 AliDebug(1, Form("Number of charge bins: %d and %d\n",bins0,bins1));
459 if(bins0 != bins1) {
460 AliError("Problem in the dimensions");
461 return NULL;
462 }
463
464 axischarge0->SetRangeUser(charge,charge);
465 axischarge1->SetRangeUser(charge,charge);
466
467 Double_t lowcharge0 = axischarge0->GetBinLowEdge(axischarge0->FindBin(charge));
468 Double_t highcharge0 = axischarge0->GetBinUpEdge(axischarge0->FindBin(charge));
469 Double_t lowcharge1 = axischarge1->GetBinLowEdge(axischarge1->FindBin(charge));
470 Double_t highcharge1 = axischarge1->GetBinUpEdge(axischarge1->FindBin(charge));
471 AliInfo(Form("0 Low charge %f and high charge %f\n",lowcharge0,highcharge0));
472 AliInfo(Form("1 Low charge %f and high charge %f\n",lowcharge1,highcharge1));
473
474 }
475 }
476
477
478 Int_t ndimensionsContainer = (Int_t) ndimensions/2;
479
480 Int_t *dim = new Int_t[nDim*2];
481 for(Int_t iter=0; iter < nDim; iter++){
482 dim[iter] = dimensions[iter];
483 dim[iter+nDim] = ndimensionsContainer + dimensions[iter];
484 }
485
486 THnSparseF *k = (THnSparseF *) correlationmatrix->Projection(nDim*2,dim);
487
488 delete[] dim;
489 return k;
490
491}
959ea9d8 492//___________________________________________________________________________
493void AliHFECorrectSpectrumBase::CorrectStatErr(AliCFDataGrid *backgroundGrid) const {
494 //
495 // Correct statistical error
496 //
497
498 TH1D *h1 = (TH1D*)backgroundGrid->Project(0);
499 Int_t nbinX = h1->GetNbinsX();
500 Int_t bins[1];
501 for(Long_t i = 1; i <= nbinX; i++) {
502 bins[0] = i;
503 Float_t content = h1->GetBinContent(i);
504 if(content>0){
505 Float_t error = TMath::Sqrt(content);
506 backgroundGrid->SetElementError(bins, error);
507 }
508 }
509}
510//_________________________________________________________________________
511TObject* AliHFECorrectSpectrumBase::GetSpectrum(const AliCFContainer * const c, Int_t step) {
512 AliCFDataGrid* data = new AliCFDataGrid("data","",*c, step);
513 return data;
514}
515//_________________________________________________________________________
516TObject* AliHFECorrectSpectrumBase::GetEfficiency(const AliCFContainer * const c, Int_t step, Int_t step0){
517 //
518 // Create efficiency grid and calculate efficiency
519 // of step to step0
520 //
521 TString name("eff");
522 name += step;
523 name+= step0;
524 AliCFEffGrid* eff = new AliCFEffGrid((const char*)name,"",*c);
525 eff->CalculateEfficiency(step,step0);
526 return eff;
527}
ff8249bd 528//____________________________________________________________________________
529void AliHFECorrectSpectrumBase::SetNbDimensions(Int_t nbDimensions) {
530 //
531 // Set the dimensions
532 //
533 fNbDimensions = nbDimensions;
534 switch(fNbDimensions){
535 case 1: fDims[0] = 0;
536 break;
537 case 2: for(Int_t i = 0; i < 2; i++) fDims[i] = i;
538 break;
539 case 3: for(Int_t i = 0; i < 3; i++) fDims[i] = i;
540 break;
541 default:
542 AliError("Container with this number of dimensions not foreseen (yet)");
543 return ;
544 };
545
546}