36 #include "TCollection.h" 40 #include "THnSparse.h" 45 template <class TemplateArray, typename TemplateType>
61 template <
class TemplateArray,
typename TemplateType>
63 AliTHnBase(name, title, nSelStep, nVarIn, nBinIn),
83 template <
class TemplateArray,
typename TemplateType>
98 template <
class TemplateArray,
typename TemplateType>
125 template <
class TemplateArray,
typename TemplateType>
140 template <
class TemplateArray,
typename TemplateType>
162 template <
class TemplateArray,
typename TemplateType>
168 AliCFContainer::operator=(c);
202 template <
class TemplateArray,
typename TemplateType>
209 AliCFContainer::Copy(target);
232 template <
class TemplateArray,
typename TemplateType>
247 TIterator* iter = list->MakeIterator();
251 while ((obj = iter->Next())) {
274 fSumw2[i]->GetArray()[l] += entry->
fSumw2[i]->GetArray()[l];
284 template <
class TemplateArray,
typename TemplateType>
340 AliInfo(Form(
"Created values container for step %d", istep));
349 AliInfo(Form(
"Created sumw2 container for step %d", istep));
353 fValues[istep]->GetArray()[bin] += weight;
355 fSumw2[istep]->GetArray()[bin] += weight * weight;
363 template <
class TemplateArray,
typename TemplateType>
373 bin *=
GetAxis(i, 0)->GetNbins();
374 bin += binIdx[i] - 1;
380 template <
class TemplateArray,
typename TemplateType>
390 TemplateType* source =
fValues[i]->GetArray();
392 TemplateType* sourceSumw2 = source;
394 sourceSumw2 =
fSumw2[i]->GetArray();
396 THnSparse* target = cont->GetGrid(i)->GetGrid();
403 nBins[j] = target->GetAxis(j)->GetNbins();
416 if (source[globalBin] != 0)
418 target->SetBinContent(binIdx, source[globalBin]);
419 target->SetBinError(binIdx, TMath::Sqrt(sourceSumw2[globalBin]));
426 for (
Int_t j=fNVars-1; j>0; j--)
428 if (binIdx[j] > nBins[j])
435 if (binIdx[0] > nBins[0])
439 AliInfo(Form(
"Step %d: copied %lld entries out of %lld bins", i, count,
GetGlobalBinIndex(binIdx)));
446 template <
class TemplateArray,
typename TemplateType>
454 template <
class TemplateArray,
typename TemplateType>
467 TemplateType* source =
fValues[i]->GetArray();
468 TemplateType* sourceSumw2 = 0;
470 sourceSumw2 =
fSumw2[i]->GetArray();
472 THnSparse* target = GetGrid(i)->GetGrid();
479 nBins[j] = target->GetAxis(j)->GetNbins();
487 TemplateType sumValues = 0;
488 TemplateType sumSumw2 = 0;
489 for (
Int_t j=1; j<=nBins[axis]; j++)
493 sumValues += source[globalBin];
494 source[globalBin] = 0;
498 sumSumw2 += sourceSumw2[globalBin];
499 sourceSumw2[globalBin] = 0;
505 source[globalBin] = sumValues;
507 sourceSumw2[globalBin] = sumSumw2;
514 for (
Int_t j=fNVars-2; j>0; j--)
516 if (binIdx[j] > nBins[j])
523 if (binIdx[0] > nBins[0])
527 AliInfo(Form(
"Step %d: reduced %lld bins to %lld entries", i,
GetGlobalBinIndex(binIdx), count));
templateClassImp(AliTHnT) template< class TemplateArray
Double_t * fLastVars
cache Nbins per axis
virtual void FillParent()
virtual Long64_t Merge(TCollection *list)
virtual void DeleteContainers()
Int_t * fNbinsCache
cache axis pointers (about 50% of the time in Fill is spent in GetAxis otherwise) ...
TAxis * GetAxis(TDirectory *dir, const char *name, Bool_t verbose=true)
virtual void Copy(TObject &c) const
Long64_t GetGlobalBinIndex(const Int_t *binIdx)
virtual void FillContainer(AliCFContainer *cont)
virtual void Fill(const Double_t *var, Int_t istep, Double_t weight=1.)
AliTHnT & operator=(const AliTHnT &corr)
Int_t * fLastBins
caching of last used bins (in many loops some vars are the same for a while)
TH1 * Merge(const TH1 *cen, const TH1 *fwd, Double_t &xlow, Double_t &xhigh)
virtual void ReduceAxis()