#include <cmath>
#include "TH1D.h"
#include "TProfile2D.h"
Go to the source code of this file.
◆ projectProfile2DAlongX()
TH1D* projectProfile2DAlongX |
( |
TProfile2D * |
prof2d | ) |
|
Definition at line 5 of file UtilityMacros.cc.
References submitPVResolutionJobs::err, SiStripPI::mean, Skims_PA_cff::name, nevt, and mathSSE::sqrt().
11 sprintf(
name,
"%s_proj",prof2d->GetName());
12 res =
new TH1D(
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)*prof2d->GetBinEntries(ibin)+
23 prof2d->GetBinContent(ibin)*prof2d->GetBinContent(ibin)*prof2d->GetBinEntries(ibin);
24 nevt += prof2d->GetBinEntries(ibin);
27 double meansq =
nevt==0 ? 0: sumsq/
nevt;
◆ projectProfile2DAlongY()
TH1D* projectProfile2DAlongY |
( |
TProfile2D * |
prof2d | ) |
|
Definition at line 38 of file UtilityMacros.cc.
References submitPVResolutionJobs::err, SiStripPI::mean, Skims_PA_cff::name, nevt, and mathSSE::sqrt().
44 sprintf(
name,
"%s_proj",prof2d->GetName());
45 res =
new TH1D(
name,prof2d->GetTitle(),prof2d->GetNbinsX(),prof2d->GetXaxis()->GetXmin(),prof2d->GetXaxis()->GetXmax());
46 res->SetDirectory(
nullptr);
48 for(
int ix=1;ix<prof2d->GetNbinsX()+1;++ix) {
52 for(
int iy=1;iy<prof2d->GetNbinsY()+1;++iy) {
53 const int ibin = prof2d->GetBin(ix,iy);
54 sum += prof2d->GetBinContent(ibin)*prof2d->GetBinEntries(ibin);
55 sumsq += prof2d->GetBinError(ibin)*prof2d->GetBinError(ibin)*prof2d->GetBinEntries(ibin)*prof2d->GetBinEntries(ibin)+
56 prof2d->GetBinContent(ibin)*prof2d->GetBinContent(ibin)*prof2d->GetBinEntries(ibin);
57 nevt += prof2d->GetBinEntries(ibin);
60 double meansq =
nevt==0 ? 0: sumsq/
nevt;