Skip to content

Commit

Permalink
Add protection on custom systematic variation: cannot lead to effcien…
Browse files Browse the repository at this point in the history
…cies outside [0,1]
  • Loading branch information
dstocco authored and aphecetche committed Sep 30, 2016
1 parent 110f53f commit 110c70a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion MUON/macros/MUONTriggerChamberEfficiency.C
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,16 @@ void BuildSystematicMap ( TString runList, Double_t globalSyst = -0.02, TString
for ( Int_t iboard=0; iboard<234; iboard++ ) {
Int_t idx = ich*234*3+iboard*3+icount;
Int_t ibin = iboard+1;
Double_t countDiff = TMath::Nint(systDiff[idx] * auxHisto->GetBinContent(ibin));
Double_t countAll = auxHisto->GetBinContent(ibin);
Double_t countDiff = TMath::Nint(systDiff[idx] * countAll);
Double_t countOrig = histo->GetBinContent(ibin);
Double_t newCount = countOrig+countDiff;
if ( newCount < 0 || newCount > countAll ) {
printf("WARNING: ch %i board %i cath %i systDiff %g newEff %g / %g\n",11+ich,ibin,icount,systDiff[idx],newCount,countAll);
if ( newCount < 0 ) newCount = 0;
else newCount = countAll;
printf(" => setting numerator to %g\n",newCount);
}
histo->SetBinContent(ibin,newCount);
if ( histo->GetSumw2N() > 0 ) histo->SetBinError(ibin,TMath::Sqrt(newCount));
}
Expand Down

0 comments on commit 110c70a

Please sign in to comment.