Functions
quietHistFit.cxx File Reference
#include "dunecore/DuneCommon/Utility/quietHistFit.h"
#include "TFitResult.h"
#include "TF1.h"
#include "TH1F.h"

Go to the source code of this file.

Functions

int quietHistFit (TH1 *ph, std::string fname, std::string fopt)
 
int quietHistFit (TH1 *ph, TF1 *pf, std::string fopt)
 

Function Documentation

int quietHistFit ( TH1 *  ph,
std::string  fname,
std::string  fopt 
)

Definition at line 25 of file quietHistFit.cxx.

25  {
26  // Block Root info message for new Canvas produced in fit.
27  int levelSave = gErrorIgnoreLevel;
28  gErrorIgnoreLevel = 1002;
29  // Block non-default (e.g. art) from handling the Root "error".
30  // We switch to the Root default handler while making the call to Print.
31  ErrorHandlerFunc_t pehSave = nullptr;
32  ErrorHandlerFunc_t pehDefault = DefaultErrorHandler;
33  if ( GetErrorHandler() != pehDefault ) {
34  pehSave = SetErrorHandler(pehDefault);
35  }
36  int fstat = get(ph->Fit(fname.c_str(), fopt.c_str()));
37  if ( pehSave != nullptr ) SetErrorHandler(pehSave);
38  gErrorIgnoreLevel = levelSave;
39  return fstat;
40 }
int quietHistFit ( TH1 *  ph,
TF1 *  pf,
std::string  fopt 
)

Definition at line 44 of file quietHistFit.cxx.

44  {
45  // Block Root info message for new Canvas produced in fit.
46  int levelSave = gErrorIgnoreLevel;
47  gErrorIgnoreLevel = 1002;
48  // Block non-default (e.g. art) from handling the Root "error".
49  // We switch to the Root default handler while making the call to Print.
50  ErrorHandlerFunc_t pehSave = nullptr;
51  ErrorHandlerFunc_t pehDefault = DefaultErrorHandler;
52  if ( GetErrorHandler() != pehDefault ) {
53  pehSave = SetErrorHandler(pehDefault);
54  }
55  int fstat = get(ph->Fit(pf, fopt.c_str()));
56  if ( pehSave != nullptr ) SetErrorHandler(pehSave);
57  gErrorIgnoreLevel = levelSave;
58  return fstat;
59 }