ATLAS Offline Software
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
IDPVM::ResolutionHelper Class Reference

#include <ResolutionHelper.h>

Inheritance diagram for IDPVM::ResolutionHelper:
Collaboration diagram for IDPVM::ResolutionHelper:

Classes

struct  resolutionResultInBin
 package the output of a single bin resolution measurement More...
 

Public Types

enum  methods { iterRMS_convergence, Gauss_fit, fusion_iterRMS_Gaussfit }
 methods acc to which mean&RMS can be evaluated More...
 

Public Member Functions

 ResolutionHelper ()
 
 ~ResolutionHelper ()
 
void makeResolutions (const TH2 *h_input2D, TH1 *hwidth, TH1 *hmean, TH1 *hproj[], bool saveProjections, IDPVM::ResolutionHelper::methods theMethod=IDPVM::ResolutionHelper::iterRMS_convergence)
 extract 1D resolution plots from a 2D "residual vs observable" histogram. More...
 
void makeResolutions (const TH2 *h_input2D, TH1 *hwidth, TH1 *hmean, IDPVM::ResolutionHelper::methods theMethod=IDPVM::ResolutionHelper::iterRMS_convergence)
 extract 1D resolution plots from a 2D "residual vs observable" histogram. More...
 
resolutionResultInBin ResolutionHelperResultsModUnits (TH1D *p_input_hist, IDPVM::ResolutionHelper::methods theMethod=IDPVM::ResolutionHelper::iterRMS_convergence)
 single-bin resolution evaluation, also internally used by makeResolutions More...
 
void setResults (TH1 *p_input_hist, methods p_method)
 wrapper to set mean,rms,and fraction of events in tails nb: some of the methods are allowed to modify input histogram More...
 
double getMean ()
 results getters More...
 
double getMeanError ()
 
double getRMS ()
 
double getRMSError ()
 
double getFracOut ()
 fraction of events that is within the range of input histogram, but goes out-of range during width and mean evaluation if this is large, you should refine the method for width and mean evaluation can be done during post-processing, does not require new InDetPVM run More...
 
double getFracOutUnc ()
 
double getFracUOflow ()
 fraction of events in under- and over-flow bins of input histogram if this is large, the input histogram range needs to be increased requires InDetPVM code-change and re-run More...
 
const std::vector< std::string > & getDebugs ()
 return accumulated messages More...
 
const std::vector< std::string > & getInfos ()
 
const std::vector< std::string > & getWarnings ()
 
const std::vector< std::string > & getErrors ()
 
bool msgLvl (const MSG::Level lvl) const
 Test the output level. More...
 
MsgStream & msg () const
 The standard message stream. More...
 
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream. More...
 
void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 

Static Public Member Functions

static std::string reportUOBinVal (const std::string &p_histName, const std::vector< std::pair< unsigned int, double > > &p_vecBinVal)
 helper to report bin and fraction of under-/over- flow events, as accumulated by top-level pull or resolution histogram More...
 

Private Member Functions

int setGaussFit (TH1 *p_input_hist)
 
int setIterativeConvergence (TH1 *p_input_hist)
 iteratively change histogram range, until convergence return # remaining iterations before hitting the max. More...
 
void setFout (double p_nsig, double p_ntot)
 evaluate the fraction of evens out of signal region and its uncertainty More...
 
void setLargeError ()
 set large mean and RMS errors in case we eg. exclude too many events during evaluation More...
 
bool initialize (TH1 *p_input_hist)
 helper to fill-in starting values of the results vector More...
 
void initMessaging () const
 Initialize our message level and MessageSvc. More...
 

Static Private Member Functions

static void cloneHistogram (TH1D *h, TH1 *hcopy)
 

Private Attributes

double m_mean {0.}
 results/outputs: More...
 
double m_meanError {0.}
 
double m_RMS {0.}
 
double m_RMSError {0.}
 
double m_FracOut {0.}
 
double m_FracOutUnc {0.}
 
double m_FracUOflow {0.}
 
std::vector< std::string > m_debugs
 
std::vector< std::string > m_infos
 
std::vector< std::string > m_warnings
 
std::vector< std::string > m_errors
 
std::string m_inHistName {""}
 
double m_largeErrorFact {10.}
 
double m_maxUOflowFrac {0.05}
 
std::string m_nm
 Message source name. More...
 
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels) More...
 
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer. More...
 
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level. More...
 
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging) More...
 

Detailed Description

Definition at line 28 of file InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/ResolutionHelper.h.

Member Enumeration Documentation

◆ methods

methods acc to which mean&RMS can be evaluated

Enumerator
iterRMS_convergence 
Gauss_fit 
fusion_iterRMS_Gaussfit 

Definition at line 36 of file InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/ResolutionHelper.h.

Constructor & Destructor Documentation

◆ ResolutionHelper()

IDPVM::ResolutionHelper::ResolutionHelper ( )

Definition at line 24 of file InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ResolutionHelper.cxx.

24  :
25  AthMessaging("ResolutionHelper")
26  {
27  }

◆ ~ResolutionHelper()

IDPVM::ResolutionHelper::~ResolutionHelper ( )
inline

Member Function Documentation

◆ cloneHistogram()

void IDPVM::ResolutionHelper::cloneHistogram ( TH1D h,
TH1 hcopy 
)
staticprivate

Definition at line 323 of file InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ResolutionHelper.cxx.

323  {
324  unsigned int nbin = h->GetNbinsX();
325 
326  for (unsigned int ibin = 0; ibin < nbin; ibin++) {
327  hcopy->SetBinContent(ibin + 1, h->GetBinContent(ibin + 1));
328  hcopy->SetBinError(ibin + 1, h->GetBinError(ibin + 1));
329  }
330 }

◆ getDebugs()

const std::vector<std::string>& IDPVM::ResolutionHelper::getDebugs ( )
inline

return accumulated messages

Definition at line 100 of file InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/ResolutionHelper.h.

100 { return m_debugs; };

◆ getErrors()

const std::vector<std::string>& IDPVM::ResolutionHelper::getErrors ( )
inline

◆ getFracOut()

double IDPVM::ResolutionHelper::getFracOut ( )
inline

fraction of events that is within the range of input histogram, but goes out-of range during width and mean evaluation if this is large, you should refine the method for width and mean evaluation can be done during post-processing, does not require new InDetPVM run

Definition at line 87 of file InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/ResolutionHelper.h.

87 { return m_FracOut; };

◆ getFracOutUnc()

double IDPVM::ResolutionHelper::getFracOutUnc ( )
inline

◆ getFracUOflow()

double IDPVM::ResolutionHelper::getFracUOflow ( )
inline

fraction of events in under- and over-flow bins of input histogram if this is large, the input histogram range needs to be increased requires InDetPVM code-change and re-run

Definition at line 93 of file InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/ResolutionHelper.h.

93 { return m_FracUOflow; };

◆ getInfos()

const std::vector<std::string>& IDPVM::ResolutionHelper::getInfos ( )
inline

◆ getMean()

double IDPVM::ResolutionHelper::getMean ( )
inline

◆ getMeanError()

double IDPVM::ResolutionHelper::getMeanError ( )
inline

◆ getRMS()

double IDPVM::ResolutionHelper::getRMS ( )
inline

◆ getRMSError()

double IDPVM::ResolutionHelper::getRMSError ( )
inline

◆ getWarnings()

const std::vector<std::string>& IDPVM::ResolutionHelper::getWarnings ( )
inline

◆ initialize()

bool IDPVM::ResolutionHelper::initialize ( TH1 p_input_hist)
private

helper to fill-in starting values of the results vector

Definition at line 29 of file InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ResolutionHelper.cxx.

29  {
30 
31  if ( !m_debugs.empty())
32  m_debugs.clear();
33  if ( !m_infos.empty())
34  m_infos.clear();
35  if ( !m_warnings.empty())
36  m_warnings.clear();
37  if ( !m_errors.empty())
38  m_errors.clear();
39 
40  if (!p_input_hist) {
41  m_errors.emplace_back("ResolutionHelper::initialize: empty input histogram passed: ");
43  return false;
44  }
45 
46  m_inHistName = p_input_hist->GetName();
47 
48  if ( 0==p_input_hist->GetEntries() ) {
49  m_debugs.push_back("ResolutionHelper::initialize: got input histogram with 0 entries: "+ m_inHistName);
51  return false;
52  }
53 
54  m_RMS = p_input_hist->GetRMS();
55  m_RMSError = p_input_hist->GetRMSError();
56  m_mean = p_input_hist->GetMean();
57  m_meanError = p_input_hist->GetMeanError();
58  m_FracOut = 0.;
59  m_FracOutUnc = 0.;
60  double nExclUOflow = p_input_hist->Integral(1,p_input_hist->GetNbinsX());
61  double nInclUOflow = p_input_hist->Integral(0,p_input_hist->GetNbinsX()+1);
62  double fUOflow = (nExclUOflow>0.) ? (nInclUOflow-nExclUOflow)/nExclUOflow : -1.;
63  m_FracUOflow = (fUOflow>m_maxUOflowFrac) ? fUOflow : -1;
64 
65  return true;
66  }

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40 {
42  m_lvl = m_imsg ?
43  static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
44  MSG::INFO;
45 }

◆ makeResolutions() [1/2]

void IDPVM::ResolutionHelper::makeResolutions ( const TH2 h_input2D,
TH1 hwidth,
TH1 hmean,
IDPVM::ResolutionHelper::methods  theMethod = IDPVM::ResolutionHelper::iterRMS_convergence 
)

extract 1D resolution plots from a 2D "residual vs observable" histogram.

Parameters
[in]h_input2Dinput histogram (x = observable, y = residuals)
[out]hwidthoutput histogram, will be filled with the width of the residuals (-> resolution)
[out]hmeanoutput histogram, will be filled with the mean of the residuals (-> bias)
[out]hprojarray of histograms, will be populated by an array of 1-dimensional projections of Y within bins in X
[in]saveProjectionssteers the filling of hpoj
[in]theMethodthe method used to extract the width and mean. Default is iterative RMS.

Definition at line 257 of file InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ResolutionHelper.cxx.

257  {
258 
259  // warnings in case input histograms have large % events in under- and over- flow bins
260  std::vector< std::pair<unsigned int,double> > warnUOBinFrac;
261 
262  if (h_input2D->GetNbinsX() != hwidth->GetNbinsX() || h_input2D->GetNbinsX() != hmean->GetNbinsX()){
263  ATH_MSG_ERROR("Inconsistent binnings between 1D and 2D histos - please fix your config!");
264  return;
265  }
266  for (int ibin = 0; ibin < h_input2D->GetNbinsX(); ibin++) {
267  std::string tmpName = h_input2D->GetName() + std::string("py_bin") + std::to_string(ibin + 1);
268  std::shared_ptr<TH1D> tmp {static_cast<TH1D*>(h_input2D->ProjectionY(tmpName.c_str(), ibin + 1, ibin + 1))};
269  if (tmp->Integral() < 1) {
270  continue;
271  }
272  const resolutionResultInBin & result = ResolutionHelperResultsModUnits(tmp.get(), theMethod);
273  hwidth->SetBinContent(ibin + 1, result.width);
274  hwidth->SetBinError(ibin + 1, result.widthError);
275  hmean->SetBinContent(ibin + 1, result.mean);
276  hmean->SetBinError(ibin + 1, result.meanError);
277  if (result.outlierFrac > m_maxUOflowFrac) {
278  warnUOBinFrac.emplace_back(ibin + 1,result.outlierFrac);
279  }
280  }
281  if (!warnUOBinFrac.empty()) {
282  ATH_MSG_WARNING(reportUOBinVal(hwidth->GetName(),warnUOBinFrac));
283  ATH_MSG_WARNING(reportUOBinVal(hwidth->GetName(),warnUOBinFrac));
284  }
285 }

◆ makeResolutions() [2/2]

void IDPVM::ResolutionHelper::makeResolutions ( const TH2 h_input2D,
TH1 hwidth,
TH1 hmean,
TH1 hproj[],
bool  saveProjections,
IDPVM::ResolutionHelper::methods  theMethod = IDPVM::ResolutionHelper::iterRMS_convergence 
)

extract 1D resolution plots from a 2D "residual vs observable" histogram.

Parameters
[in]h_input2Dinput histogram (x = observable, y = residuals)
[out]hwidthoutput histogram, will be filled with the width of the residuals (-> resolution)
[out]hmeanoutput histogram, will be filled with the mean of the residuals (-> bias)
[out]hprojarray of histograms, will be populated by an array of 1-dimensional projections of Y within bins in X
[in]saveProjectionssteers the filling of hpoj
[in]theMethodthe method used to extract the width and mean. Default is iterative RMS.

Definition at line 288 of file InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ResolutionHelper.cxx.

288  {
289 
290  // warnings in case input histograms have large % events in under- and over- flow bins
291  std::vector< std::pair<unsigned int,double> > warnUOBinFrac;
292 
293  if (h_input2D->GetNbinsX() != hwidth->GetNbinsX() || h_input2D->GetNbinsX() != hmean->GetNbinsX()){
294  ATH_MSG_ERROR("Inconsistent binnings between 1D and 2D histos - please fix your config!");
295  return;
296  }
297 
298  for (int ibin = 0; ibin < hwidth->GetNbinsX(); ibin++) {
299  std::string tmpName = h_input2D->GetName() + std::string("py_bin") + std::to_string(ibin + 1);
300  std::shared_ptr<TH1D> tmp {dynamic_cast<TH1D*>(h_input2D->ProjectionY(tmpName.c_str(), ibin+1, ibin+1))};
301  if (tmp->Integral() < 1) {
302  continue;
303  }
304  if (saveProjections) {
305  cloneHistogram(tmp.get(), hproj[ibin]);
306  }
307  const resolutionResultInBin & result = ResolutionHelperResultsModUnits(tmp.get(), theMethod);
308  hwidth->SetBinContent(ibin + 1, result.width);
309  hwidth->SetBinError(ibin + 1, result.widthError);
310  hmean->SetBinContent(ibin + 1, result.mean);
311  hmean->SetBinError(ibin + 1, result.meanError);
312  if (result.outlierFrac>m_maxUOflowFrac){
313  warnUOBinFrac.emplace_back(ibin + 1,result.outlierFrac);
314  }
315  }
316  if (!warnUOBinFrac.empty()) {
317  ATH_MSG_WARNING(reportUOBinVal(hwidth->GetName(),warnUOBinFrac));
318  ATH_MSG_WARNING(reportUOBinVal(hwidth->GetName(),warnUOBinFrac));
319  }
320 }

◆ msg() [1/2]

MsgStream & AthMessaging::msg ( ) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 164 of file AthMessaging.h.

165 {
166  MsgStream* ms = m_msg_tls.get();
167  if (!ms) {
168  if (!m_initialized.test_and_set()) initMessaging();
169  ms = new MsgStream(m_imsg,m_nm);
170  m_msg_tls.reset( ms );
171  }
172 
173  ms->setLevel (m_lvl);
174  return *ms;
175 }

◆ msg() [2/2]

MsgStream & AthMessaging::msg ( const MSG::Level  lvl) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 179 of file AthMessaging.h.

180 { return msg() << lvl; }

◆ msgLvl()

bool AthMessaging::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Test the output level.

Parameters
lvlThe message level to test against
Returns
boolean Indicating if messages at given level will be printed
Return values
trueMessages at level "lvl" will be printed

Definition at line 151 of file AthMessaging.h.

152 {
153  if (!m_initialized.test_and_set()) initMessaging();
154  if (m_lvl <= lvl) {
155  msg() << lvl;
156  return true;
157  } else {
158  return false;
159  }
160 }

◆ reportUOBinVal()

std::string IDPVM::ResolutionHelper::reportUOBinVal ( const std::string &  p_histName,
const std::vector< std::pair< unsigned int, double > > &  p_vecBinVal 
)
static

helper to report bin and fraction of under-/over- flow events, as accumulated by top-level pull or resolution histogram

Definition at line 77 of file InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ResolutionHelper.cxx.

77  {
78  std::ostringstream reportl;
79  if (!p_vecBinVal.empty()) {
80  reportl << "Errors scaled up for resol. hist. with large % of events in over- and under-flow: "
81  << p_histName<<": ";
82  for ( auto it : p_vecBinVal )
83  reportl << "bin"<<it.first << ": " << std::setprecision(2) << it.second*100. << "%, ";
84  }
85  return reportl.str();
86  }

◆ ResolutionHelperResultsModUnits()

ResolutionHelper::resolutionResultInBin IDPVM::ResolutionHelper::ResolutionHelperResultsModUnits ( TH1D p_input_hist,
IDPVM::ResolutionHelper::methods  theMethod = IDPVM::ResolutionHelper::iterRMS_convergence 
)

single-bin resolution evaluation, also internally used by makeResolutions

Parameters
p_input_histinput histogram, 1D distribution of the residual
theMethodmethod to use (default: iterative RMS)
Returns
resolutionResultInBin object packaging the mean and width of the distribution determined using the specified method as well as outlier bin fractions.

Definition at line 238 of file InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ResolutionHelper.cxx.

238  {
239  // LM: reason for using this function:
240  // orignial code was set up to only have resolution resuls in um,
241  // while inputs are in mm. Do not want to do a substantial rewrite.
242  TString vari = p_input_hist->GetName();
243  bool isInMicrons = ( !vari.Contains("pull") &&
244  (vari.Contains("d0") || vari.Contains("z0")) );
245  const double unitConversionFactor = isInMicrons ? 1000. : 1.; // mm measurements to um outputs
246  setResults(p_input_hist, theMethod);
247 
248  return {getRMS()*unitConversionFactor,
249  getRMSError()*unitConversionFactor,
250  getMean()*unitConversionFactor,
251  getMeanError()*unitConversionFactor,
252  getFracOut(),
253  getFracOutUnc()};
254 }

◆ setFout()

void IDPVM::ResolutionHelper::setFout ( double  p_nsig,
double  p_ntot 
)
private

evaluate the fraction of evens out of signal region and its uncertainty

Definition at line 88 of file InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ResolutionHelper.cxx.

88  {
89  m_FracOut=0.;
90  m_FracOutUnc=0.;
91  if (p_ntot>0.) {
92  double nout=p_ntot-p_nsig;
93  if (nout / p_ntot > 0.9) {
94  nout = 0.;
95  }
96  if (nout > 0.) {
97  m_FracOut=nout/p_nsig;
98  m_FracOutUnc=(nout / p_ntot) * std::sqrt(1. / nout + 1. / p_ntot);
99  }
100  }
101  }

◆ setGaussFit()

int IDPVM::ResolutionHelper::setGaussFit ( TH1 p_input_hist)
private

Definition at line 103 of file InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ResolutionHelper.cxx.

103  {
104 
105  int ret=0;
106 
107  // evaluate mean and with via the Gauss fit
108  TFitResultPtr r = p_input_hist->Fit("gaus", "QS0");
109  if ( r.Get() and (0 == (r->Status()%1000)) ) {
110  m_RMS=r->Parameter(2);//RMS
111  m_RMSError=r->ParError(2);//RMS_error
112  m_mean=r->Parameter(1);//mean
113  m_meanError=r->ParError(1);//mean_error
114  }
115  else
116  ret=1;
117 
118  // get fraction of events outside 3*RMS + its ~ uncertainty
119  double nSig = p_input_hist->Integral(p_input_hist->GetXaxis()->FindBin(-3.0 * m_RMS),
120  p_input_hist->GetXaxis()->FindBin(3.0 * m_RMS));
121  double nTot = p_input_hist->Integral(1,p_input_hist->GetNbinsX());
122  setFout(nSig,nTot);
123 
124  // return fit status
125  return ret;
126  }

◆ setIterativeConvergence()

int IDPVM::ResolutionHelper::setIterativeConvergence ( TH1 p_input_hist)
private

iteratively change histogram range, until convergence return # remaining iterations before hitting the max.

allowed

Definition at line 129 of file InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ResolutionHelper.cxx.

129  {
130 
131  // evaluate mean and RMS using iterative converfgence:
132  double mean=p_input_hist->GetMean();
133  double RMS = p_input_hist->GetRMS();
134 
135  // iteration parameters:
136  // max iteration steps
137  unsigned int ntries_max = 100;
138  // width of cutting range in [RMS]
139  double nRMS_width = 3.0;
140 
141  // iteration counters and helpers:
142  // min and max range of the histogram:
143  double xmin=0.;
144  double xmax=0.;
145  // min and max bins of the histogram in previous iteration
146  // 0-th iteration: range of the original histogram
147  int binmin_was = 1;
148  int binmax_was = p_input_hist->GetNbinsX();
149  // initial number of iteration steps
150  unsigned int ntries = 0;
151 
152  // iteratively cut tails untill the RMS gets stable about mean
153  // RMS stable: when input histogram range after cutting by
154  // +- 3*RMS is same as the range before cutting
155  while ( ntries<ntries_max ) {
156  ++ntries;
157  RMS = p_input_hist->GetRMS();
158  mean = p_input_hist->GetMean();
159  xmin = -1.0*nRMS_width*RMS + mean;
160  xmax = nRMS_width*RMS + mean;
161  // find bins corresponding to new range, disregard underflow
162  int binmin=std::max(1,p_input_hist->GetXaxis()->FindFixBin(xmin));
163  // find bins corresponding to new range, disregard overflow
164  int binmax=std::min(p_input_hist->GetNbinsX(),p_input_hist->GetXaxis()->FindFixBin(xmax));
165  // end iteration if these are same bins as in prev. iteration
166  if ( binmin_was==binmin && binmax_was==binmax ) {
167  break;
168  }
169  else {
170  // else set the new range and continue iteration
171  p_input_hist->GetXaxis()->SetRange(binmin,binmax);
172  binmin_was=binmin;
173  binmax_was=binmax;
174  }
175  } // end of ( ntries<ntries_max ) ; iterative convergence loop
176 
177  // set the iteration results that are accessible to clients:
178  m_RMS=RMS;
179  m_RMSError= p_input_hist->GetRMSError();
180  m_mean=mean;
181  m_meanError=p_input_hist->GetMeanError();
182 
183  // get fraction of excluded events + its ~ uncertainty
184  double nSig = p_input_hist->Integral(p_input_hist->GetXaxis()->FindBin(xmin),
185  p_input_hist->GetXaxis()->FindBin(xmax));
186  // disregard under- and over- flow
187  double nTot = p_input_hist->Integral(1,p_input_hist->GetNbinsX());
188  setFout(nSig,nTot);
189 
190  // return number of remaining allowed iteration steps
191  return(ntries_max-ntries);
192  }

◆ setLargeError()

void IDPVM::ResolutionHelper::setLargeError ( )
private

set large mean and RMS errors in case we eg. exclude too many events during evaluation

Definition at line 68 of file InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ResolutionHelper.cxx.

68  {
69  std::ostringstream debugl;
70  debugl << __FILE__ << "\t\t" << m_inHistName
71  << ": scaling mean and RMS errors by factor: " << m_largeErrorFact;
72  m_debugs.push_back(debugl.str());
75  }

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level  lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29 {
30  m_lvl = lvl;
31 }

◆ setResults()

void IDPVM::ResolutionHelper::setResults ( TH1 p_input_hist,
methods  p_method 
)

wrapper to set mean,rms,and fraction of events in tails nb: some of the methods are allowed to modify input histogram

Definition at line 197 of file InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ResolutionHelper.cxx.

197  {
198 
199  // set start values of the results vector
200  // mean RMS etc as in the input histo prior to trimming
201  if (!initialize(p_input_hist))
202  return;
203 
204  if (iterRMS_convergence == p_method) {
205  if ( !setIterativeConvergence(p_input_hist) )
206  m_warnings.push_back("\t\t\t* ResolutionHelper::setIterativeConvergence did not converge for "+ m_inHistName);
207  }
208  else if (Gauss_fit == p_method) {
209  if ( !setGaussFit(p_input_hist) )
210  m_warnings.push_back("\t\t\t* ResolutionHelper::setGaussFit: fit failed for "+ m_inHistName);
211  }
212  else if (fusion_iterRMS_Gaussfit == p_method) {
213  if ( !setIterativeConvergence(p_input_hist) &&
214  !setGaussFit(p_input_hist) )
215  m_warnings.push_back("\t\t\t* ResolutionHelper::fusion_iterRMS_Gaussfit both methods failed for "+ m_inHistName);
216  }
217  else {
218  m_errors.push_back("\t\t\t* ResolutionHelper::setResults: method not supported. No evaluation for "+ m_inHistName);
219  }
220 
221  // check if large fraction of events was in over- and under-flow
222  if ( m_FracUOflow > 0. ) {
223  std::ostringstream debugl;
224  debugl << "\tResolutionHelper::setResults: too large fraction of out-of-range events for histogram ";
225  debugl << m_inHistName << ": " << m_FracUOflow << " > " << m_maxUOflowFrac;
226  m_debugs.push_back(debugl.str());
227  setLargeError();
228  m_debugs.push_back("\t\t\t* ResolutionHelper::setResults: scaling errors up for "
229  +m_inHistName+". Too many under- and over- flows.");
230  }
231 
232  // reset range metadata to state prior to iteration
233  // this gets changed in iterative or fusion)
234  p_input_hist->GetXaxis()->SetRange(1,p_input_hist->GetNbinsX());
235  }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging)

Definition at line 141 of file AthMessaging.h.

◆ m_debugs

std::vector<std::string> IDPVM::ResolutionHelper::m_debugs
private

◆ m_errors

std::vector<std::string> IDPVM::ResolutionHelper::m_errors
private

◆ m_FracOut

double IDPVM::ResolutionHelper::m_FracOut {0.}
private

◆ m_FracOutUnc

double IDPVM::ResolutionHelper::m_FracOutUnc {0.}
private

◆ m_FracUOflow

double IDPVM::ResolutionHelper::m_FracUOflow {0.}
private

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

◆ m_infos

std::vector<std::string> IDPVM::ResolutionHelper::m_infos
private

◆ m_inHistName

std::string IDPVM::ResolutionHelper::m_inHistName {""}
private

◆ m_largeErrorFact

double IDPVM::ResolutionHelper::m_largeErrorFact {10.}
private

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

◆ m_maxUOflowFrac

double IDPVM::ResolutionHelper::m_maxUOflowFrac {0.05}
private

◆ m_mean

double IDPVM::ResolutionHelper::m_mean {0.}
private

◆ m_meanError

double IDPVM::ResolutionHelper::m_meanError {0.}
private

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels)

Definition at line 132 of file AthMessaging.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.

◆ m_RMS

double IDPVM::ResolutionHelper::m_RMS {0.}
private

◆ m_RMSError

double IDPVM::ResolutionHelper::m_RMSError {0.}
private

◆ m_warnings

std::vector<std::string> IDPVM::ResolutionHelper::m_warnings
private

The documentation for this class was generated from the following files:
IDPVM::ResolutionHelper::m_FracOutUnc
double m_FracOutUnc
Definition: InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/ResolutionHelper.h:126
AthMessaging::m_lvl
std::atomic< MSG::Level > m_lvl
Current logging level.
Definition: AthMessaging.h:138
beamspotman.r
def r
Definition: beamspotman.py:676
IDPVM::ResolutionHelper::iterRMS_convergence
@ iterRMS_convergence
Definition: InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/ResolutionHelper.h:36
IDPVM::ResolutionHelper::getRMS
double getRMS()
Definition: InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/ResolutionHelper.h:80
IDPVM::ResolutionHelper::initialize
bool initialize(TH1 *p_input_hist)
helper to fill-in starting values of the results vector
Definition: InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ResolutionHelper.cxx:29
IDPVM::ResolutionHelper::m_meanError
double m_meanError
Definition: InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/ResolutionHelper.h:122
mean
void mean(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
Definition: dependence.cxx:254
get_generator_info.result
result
Definition: get_generator_info.py:21
max
#define max(a, b)
Definition: cfImp.cxx:41
IDPVM::ResolutionHelper::getMean
double getMean()
results getters
Definition: InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/ResolutionHelper.h:78
IDPVM::ResolutionHelper::m_FracOut
double m_FracOut
Definition: InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/ResolutionHelper.h:125
IDPVM::ResolutionHelper::setResults
void setResults(TH1 *p_input_hist, methods p_method)
wrapper to set mean,rms,and fraction of events in tails nb: some of the methods are allowed to modify...
Definition: InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ResolutionHelper.cxx:197
IDPVM::ResolutionHelper::m_maxUOflowFrac
double m_maxUOflowFrac
Definition: InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/ResolutionHelper.h:142
skel.it
it
Definition: skel.GENtoEVGEN.py:423
TH1D
Definition: rootspy.cxx:342
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
python.SystemOfUnits.ms
int ms
Definition: SystemOfUnits.py:132
hmean
double hmean(TH1 *h)
Definition: computils.cxx:433
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
IDPVM::ResolutionHelper::getFracOutUnc
double getFracOutUnc()
Definition: InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/ResolutionHelper.h:88
AthMessaging::AthMessaging
AthMessaging()
Default constructor:
IDPVM::ResolutionHelper::getMeanError
double getMeanError()
Definition: InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/ResolutionHelper.h:79
IDPVM::ResolutionHelper::Gauss_fit
@ Gauss_fit
Definition: InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/ResolutionHelper.h:36
IDPVM::ResolutionHelper::m_errors
std::vector< std::string > m_errors
Definition: InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/ResolutionHelper.h:132
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
TH1::SetBinContent
void SetBinContent(int, double)
Definition: rootspy.cxx:301
xmin
double xmin
Definition: listroot.cxx:60
IDPVM::ResolutionHelper::m_RMSError
double m_RMSError
Definition: InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/ResolutionHelper.h:124
ret
T ret(T t)
Definition: rootspy.cxx:260
IDPVM::ResolutionHelper::m_FracUOflow
double m_FracUOflow
Definition: InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/ResolutionHelper.h:127
IDPVM::ResolutionHelper::getFracOut
double getFracOut()
fraction of events that is within the range of input histogram, but goes out-of range during width an...
Definition: InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/ResolutionHelper.h:87
IDPVM::ResolutionHelper::m_infos
std::vector< std::string > m_infos
Definition: InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/ResolutionHelper.h:130
IDPVM::ResolutionHelper::setIterativeConvergence
int setIterativeConvergence(TH1 *p_input_hist)
iteratively change histogram range, until convergence return # remaining iterations before hitting th...
Definition: InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ResolutionHelper.cxx:129
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
TH1::SetBinError
void SetBinError(int, double)
Definition: rootspy.cxx:304
min
#define min(a, b)
Definition: cfImp.cxx:40
IDPVM::ResolutionHelper::m_debugs
std::vector< std::string > m_debugs
Definition: InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/ResolutionHelper.h:129
IDPVM::ResolutionHelper::setGaussFit
int setGaussFit(TH1 *p_input_hist)
Definition: InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ResolutionHelper.cxx:103
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
IDPVM::ResolutionHelper::m_RMS
double m_RMS
Definition: InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/ResolutionHelper.h:123
IDPVM::ResolutionHelper::setFout
void setFout(double p_nsig, double p_ntot)
evaluate the fraction of evens out of signal region and its uncertainty
Definition: InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ResolutionHelper.cxx:88
IDPVM::ResolutionHelper::m_warnings
std::vector< std::string > m_warnings
Definition: InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/ResolutionHelper.h:131
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
IDPVM::ResolutionHelper::cloneHistogram
static void cloneHistogram(TH1D *h, TH1 *hcopy)
Definition: InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ResolutionHelper.cxx:323
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
DiTauMassTools::HistInfoV2::RMS
@ RMS
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:31
xmax
double xmax
Definition: listroot.cxx:61
IDPVM::ResolutionHelper::fusion_iterRMS_Gaussfit
@ fusion_iterRMS_Gaussfit
Definition: InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/ResolutionHelper.h:36
IDPVM::ResolutionHelper::m_mean
double m_mean
results/outputs:
Definition: InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/ResolutionHelper.h:121
IDPVM::ResolutionHelper::m_largeErrorFact
double m_largeErrorFact
Definition: InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/ResolutionHelper.h:140
AthMessaging::initMessaging
void initMessaging() const
Initialize our message level and MessageSvc.
Definition: AthMessaging.cxx:39
AthMessaging::m_msg_tls
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
Definition: AthMessaging.h:132
IDPVM::ResolutionHelper::setLargeError
void setLargeError()
set large mean and RMS errors in case we eg. exclude too many events during evaluation
Definition: InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ResolutionHelper.cxx:68
IDPVM::ResolutionHelper::getRMSError
double getRMSError()
Definition: InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/ResolutionHelper.h:81
IDPVM::ResolutionHelper::reportUOBinVal
static std::string reportUOBinVal(const std::string &p_histName, const std::vector< std::pair< unsigned int, double > > &p_vecBinVal)
helper to report bin and fraction of under-/over- flow events, as accumulated by top-level pull or re...
Definition: InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ResolutionHelper.cxx:77
IDPVM::ResolutionHelper::ResolutionHelperResultsModUnits
resolutionResultInBin ResolutionHelperResultsModUnits(TH1D *p_input_hist, IDPVM::ResolutionHelper::methods theMethod=IDPVM::ResolutionHelper::iterRMS_convergence)
single-bin resolution evaluation, also internally used by makeResolutions
Definition: InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ResolutionHelper.cxx:238
IDPVM::ResolutionHelper::m_inHistName
std::string m_inHistName
Definition: InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/ResolutionHelper.h:137