3 #include "TProfile2D.h" 10 sprintf(
name,
"%s_proj", prof2d->GetName());
12 name, prof2d->GetTitle(), prof2d->GetNbinsY(), prof2d->GetYaxis()->GetXmin(), prof2d->GetYaxis()->GetXmax());
13 res->SetDirectory(
nullptr);
15 for (
int iy = 1;
iy < prof2d->GetNbinsY() + 1; ++
iy) {
19 for (
int ix = 1;
ix < prof2d->GetNbinsX() + 1; ++
ix) {
20 const int ibin = prof2d->GetBin(
ix,
iy);
21 sum += prof2d->GetBinContent(ibin) * prof2d->GetBinEntries(ibin);
22 sumsq += prof2d->GetBinError(ibin) * prof2d->GetBinError(ibin) * prof2d->GetBinEntries(ibin) *
23 prof2d->GetBinEntries(ibin) +
24 prof2d->GetBinContent(ibin) * prof2d->GetBinContent(ibin) * prof2d->GetBinEntries(ibin);
25 nevt += prof2d->GetBinEntries(ibin);
28 double meansq =
nevt == 0 ? 0 : sumsq /
nevt;
44 sprintf(
name,
"%s_proj", prof2d->GetName());
46 name, prof2d->GetTitle(), prof2d->GetNbinsX(), prof2d->GetXaxis()->GetXmin(), prof2d->GetXaxis()->GetXmax());
47 res->SetDirectory(
nullptr);
49 for (
int ix = 1;
ix < prof2d->GetNbinsX() + 1; ++
ix) {
53 for (
int iy = 1;
iy < prof2d->GetNbinsY() + 1; ++
iy) {
54 const int ibin = prof2d->GetBin(
ix,
iy);
55 sum += prof2d->GetBinContent(ibin) * prof2d->GetBinEntries(ibin);
56 sumsq += prof2d->GetBinError(ibin) * prof2d->GetBinError(ibin) * prof2d->GetBinEntries(ibin) *
57 prof2d->GetBinEntries(ibin) +
58 prof2d->GetBinContent(ibin) * prof2d->GetBinContent(ibin) * prof2d->GetBinEntries(ibin);
59 nevt += prof2d->GetBinEntries(ibin);
62 double meansq =
nevt == 0 ? 0 : sumsq /
nevt;
TH1D * projectProfile2DAlongY(TProfile2D *prof2d)
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
TH1D * projectProfile2DAlongX(TProfile2D *prof2d)