51 :
asg::AsgMessaging(Form(
"%s",toCopy.m_name.
Data()))
52 , m_isInit(toCopy.m_isInit)
53 , m_name(toCopy.m_name)
54 , m_interpolate(toCopy.m_interpolate)
56 , m_nDim(toCopy.m_nDim)
67 throw std::runtime_error(
"Failed to copy histogram in UncertaintyHistogram copy constructor");
75 throw std::runtime_error(
"Failed to build projection cache in UncertaintyHistogram copy constructor");
91 return StatusCode::FAILURE;
95 if (!histFile->IsOpen())
98 return StatusCode::FAILURE;
106 return StatusCode::FAILURE;
114 return StatusCode::FAILURE;
116 m_histo->SetDirectory(
nullptr);
124 return StatusCode::FAILURE;
130 return StatusCode::SUCCESS;
206 return m_histo->GetBinContent(std::as_const(*m_histo).GetXaxis()->FindFixBin(valX));
233 return m_histo->GetBinContent(std::as_const(*m_histo).GetXaxis()->FindFixBin(valX),
234 std::as_const(*m_histo).GetYaxis()->FindFixBin(valY));
259 return m_histo->GetBinContent(std::as_const(*m_histo).GetXaxis()->FindFixBin(valX),
260 std::as_const(*m_histo).GetYaxis()->FindFixBin(valY),
261 std::as_const(*m_histo).GetZaxis()->FindFixBin(valZ));
272 double val = valInput;
287 val = (1.-1.e-3)*
axis->GetBinWidth(numBins)+
axis->GetBinLowEdge(numBins);
295 const static int maxNumWarn = 0;
296 static std::atomic<int> numWarn = 0;
302 float val = valInput;
303 const double lowVal =
axis->GetBinLowEdge(1);
304 const double highVal =
axis->GetBinLowEdge(numBins+1);
305 if (val < lowVal || val >= highVal)
307 if (
val != highVal && ++numWarn < maxNumWarn)
308 ATH_MSG_WARNING(Form(
"Variable value is %f, outside of the axis range of (%f,%f) for %s. "
310 <<
" (Only first " << maxNumWarn <<
" instances printed, this is " << numWarn <<
")");
314 val = lowVal>0 ? (1.0+1.e-4)*lowVal : (1.0-1.
e-4)*lowVal;
316 val = highVal>0 ? (1.0-1.e-4)*highVal : (1.0+1.
e-4)*highVal;
328 return StatusCode::FAILURE;
334 ATH_MSG_FATAL(
"Unsupported histogram dimensionality for projection caching: " <<
m_histo->GetDimension());
335 return StatusCode::FAILURE;
342 return StatusCode::FAILURE;
350 if (
m_histo->GetDimension() == 1)
351 return StatusCode::SUCCESS;
356 if (
m_histo->GetDimension() == 1)
359 return StatusCode::FAILURE;
365 return StatusCode::FAILURE;
373 if (
m_histo->GetDimension() == 2)
376 TH2* localHist =
dynamic_cast<TH2*
>(
m_histo);
380 ATH_MSG_FATAL(
"Failed to convert histogram to a TH2, please check inputs: " <<
m_name.Data());
381 return StatusCode::FAILURE;
387 for (Long64_t
binY = 0;
binY < localHist->GetNbinsY()+1; ++
binY)
395 for (Long64_t
binX = 0;
binX < localHist->GetNbinsX()+1; ++
binX)
404 ATH_MSG_FATAL(
"Unexpected interpolation type, somehow escaped earlier checks: " <<
m_name.Data());
405 return StatusCode::FAILURE;
408 else if (
m_histo->GetDimension() == 3)
411 TH3* localHist =
dynamic_cast<TH3*
>(
m_histo);
414 ATH_MSG_FATAL(
"Failed to convert histogram to a TH3, please check inputs: " <<
m_name.Data());
415 return StatusCode::FAILURE;
422 for (Long64_t
binY = 0;
binY < localHist->GetNbinsY()+1; ++
binY)
424 for (Long64_t
binZ = 0;
binZ < localHist->GetNbinsZ()+1; ++
binZ)
434 for (Long64_t
binX = 0;
binX < localHist->GetNbinsX()+1; ++
binX)
436 for (Long64_t
binZ = 0;
binZ < localHist->GetNbinsZ()+1; ++
binZ)
446 ATH_MSG_FATAL(
"Unexpected interpolation type, somehow escaped earlier checks: " <<
m_name.Data());
447 return StatusCode::FAILURE;
454 return StatusCode::FAILURE;
462 hist->SetDirectory(
nullptr);
467 return StatusCode::SUCCESS;