+void AliUEHist::DeepCopy(AliUEHist* from)
+{
+ // copies the entries of this object's members from the object <from> to this object
+ // fills using the fill function and thus allows that the objects have different binning
+
+ for (Int_t region=0; region<4; region++)
+ {
+ if (!fTrackHist[region] || !from->fTrackHist[region])
+ continue;
+
+ for (Int_t step=0; step<fTrackHist[region]->GetNStep(); step++)
+ {
+ Printf("Copying region %d step %d", region, step);
+ THnSparse* target = fTrackHist[region]->GetGrid(step)->GetGrid();
+ THnSparse* source = from->fTrackHist[region]->GetGrid(step)->GetGrid();
+
+ target->Reset();
+ target->RebinnedAdd(source);
+ }
+ }
+
+ for (Int_t step=0; step<fEventHist->GetNStep(); step++)
+ {
+ Printf("Ev: Copying step %d", step);
+ THnSparse* target = fEventHist->GetGrid(step)->GetGrid();
+ THnSparse* source = from->fEventHist->GetGrid(step)->GetGrid();
+
+ target->Reset();
+ target->RebinnedAdd(source);
+ }
+
+ for (Int_t step=0; step<TMath::Min(fTrackHistEfficiency->GetNStep(), from->fTrackHistEfficiency->GetNStep()); step++)
+ {
+ if (!from->fTrackHistEfficiency->GetGrid(step))
+ continue;
+
+ Printf("Eff: Copying step %d", step);
+ THnSparse* target = fTrackHistEfficiency->GetGrid(step)->GetGrid();
+ THnSparse* source = from->fTrackHistEfficiency->GetGrid(step)->GetGrid();
+
+ target->Reset();
+ target->RebinnedAdd(source);
+ }
+}
+
+void AliUEHist::SymmetrizepTBins()
+{
+ // copy pt,a < pt,t bins to pt,a > pt,t (inverting deltaphi and delta eta as it should be) including symmetric bins
+
+ for (Int_t region=0; region<4; region++)
+ {
+ if (!fTrackHist[region])
+ continue;
+
+ for (Int_t step=0; step<fTrackHist[region]->GetNStep(); step++)
+ {
+ Printf("Copying region %d step %d", region, step);
+ THnSparse* target = fTrackHist[region]->GetGrid(step)->GetGrid();
+ if (target->GetEntries() == 0)
+ continue;
+
+ // for symmetric bins
+ THnSparse* source = (THnSparse*) target->Clone();
+
+ Int_t zVtxBins = 1;
+ if (target->GetNdimensions() > 5)
+ zVtxBins = target->GetAxis(5)->GetNbins();
+
+ // axes: 0 delta eta; 1 pT,a; 2 pT,t; 3 centrality; 4 delta phi; 5 vtx-z
+ for (Int_t i3 = 1; i3 <= target->GetAxis(3)->GetNbins(); i3++)
+ for (Int_t i5 = 1; i5 <= zVtxBins; i5++)
+ {
+ for (Int_t i1 = 1; i1 <= target->GetAxis(1)->GetNbins(); i1++)
+ for (Int_t i2 = 1; i2 <= target->GetAxis(2)->GetNbins(); i2++)
+ {
+ // find source bin
+ Int_t binA = target->GetAxis(1)->FindBin(target->GetAxis(2)->GetBinCenter(i2));
+ Int_t binT = target->GetAxis(2)->FindBin(target->GetAxis(1)->GetBinCenter(i1));
+
+ Printf("(%d %d) Copying from %d %d to %d %d", i3, i5, binA, binT, i1, i2);
+
+ for (Int_t i0 = 1; i0 <= target->GetAxis(0)->GetNbins(); i0++)
+ for (Int_t i4 = 1; i4 <= target->GetAxis(4)->GetNbins(); i4++)
+ {
+ Int_t binEta = target->GetAxis(0)->FindBin(-target->GetAxis(0)->GetBinCenter(i0));
+ Double_t phi = -target->GetAxis(4)->GetBinCenter(i4);
+ if (phi < -TMath::Pi()/2)
+ phi += TMath::TwoPi();
+ Int_t binPhi = target->GetAxis(4)->FindBin(phi);
+
+ Int_t binSource[] = { binEta, binA, binT, i3, binPhi, i5 };
+ Int_t binTarget[] = { i0, i1, i2, i3, i4, i5 };
+
+ Double_t value = source->GetBinContent(binSource);
+ Double_t error = source->GetBinError(binSource);
+
+ if (error == 0)
+ continue;
+
+ Double_t value2 = target->GetBinContent(binTarget);
+ Double_t error2 = target->GetBinError(binTarget);
+
+ Double_t sum = value;
+ Double_t err = error;
+
+ if (error2 > 0)
+ {
+ sum = value + value2;
+ err = TMath::Sqrt(error * error + error2 * error2);
+ }
+
+ // Printf(" Values: %f +- %f; %f +- %f --> %f +- %f", value, error, value2, error2, sum, err);
+
+ target->SetBinContent(binTarget, sum);
+ target->SetBinError(binTarget, err);
+ }
+ }
+ }
+
+ delete source;
+ }
+ }
+}
+