Skip to content
Snippets Groups Projects

Update TPileupReweighting.cxx to work with low-cross-section signal samples

Merged Louie Dartmoor Corpe requested to merge fix-prw-zero-integral-protection into 21.2
@@ -1921,7 +1921,7 @@ void CP::TPileupReweighting::normalizeHistogram(TH1* hist){
bin = hist->GetBin(binx,biny,binz);
Double_t value = hist->GetBinContent(bin);
Double_t normalizer = proj->GetBinContent(binx);
if(fabs(normalizer)>0.00001) {
if(normalizer!=0.0) {
hist->SetBinContent(bin,value/normalizer);
} else {
skipNorm=true;
@@ -1933,7 +1933,7 @@ void CP::TPileupReweighting::normalizeHistogram(TH1* hist){
if(skipNorm && m_debugging) Warning("normalizeHistogram","Skipped normalization in hist %s",hist->GetName());
} else {
//normalize to the sum of weights
if(fabs(hist->GetSumOfWeights())>0.000000001) {
if(hist->GetSumOfWeights()!=0.0) {
hist->Scale(1.0/hist->GetSumOfWeights());
} else {
if (m_debugging) Warning("normalizeHistogram","Skipping Normalizing histogram %s to ~zero: %f",hist->GetName(),hist->GetSumOfWeights());
Loading