|
ATLAS Offline Software
|
#include <ResolutionHelper.h>
|
| 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 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...
|
|
|
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...
|
|
◆ methods
◆ ResolutionHelper()
IDPVM::ResolutionHelper::ResolutionHelper |
( |
| ) |
|
◆ ~ResolutionHelper()
IDPVM::ResolutionHelper::~ResolutionHelper |
( |
| ) |
|
|
inline |
◆ cloneHistogram()
void IDPVM::ResolutionHelper::cloneHistogram |
( |
TH1D * |
h, |
|
|
TH1 * |
hcopy |
|
) |
| |
|
staticprivate |
◆ getDebugs()
const std::vector<std::string>& IDPVM::ResolutionHelper::getDebugs |
( |
| ) |
|
|
inline |
◆ getErrors()
const std::vector<std::string>& IDPVM::ResolutionHelper::getErrors |
( |
| ) |
|
|
inline |
◆ getFracOut()
double IDPVM::ResolutionHelper::getFracOut |
( |
| ) |
|
|
inline |
◆ getFracOutUnc()
double IDPVM::ResolutionHelper::getFracOutUnc |
( |
| ) |
|
|
inline |
◆ getFracUOflow()
double IDPVM::ResolutionHelper::getFracUOflow |
( |
| ) |
|
|
inline |
◆ 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.
41 m_errors.emplace_back(
"ResolutionHelper::initialize: empty input histogram passed: ");
48 if ( 0==p_input_hist->GetEntries() ) {
49 m_debugs.push_back(
"ResolutionHelper::initialize: got input histogram with 0 entries: "+
m_inHistName);
54 m_RMS = p_input_hist->GetRMS();
56 m_mean = p_input_hist->GetMean();
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.;
◆ 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.
◆ makeResolutions() [1/2]
extract 1D resolution plots from a 2D "residual vs observable" histogram.
- Parameters
-
[in] | h_input2D | input histogram (x = observable, y = residuals) |
[out] | hwidth | output histogram, will be filled with the width of the residuals (-> resolution) |
[out] | hmean | output histogram, will be filled with the mean of the residuals (-> bias) |
[out] | hproj | array of histograms, will be populated by an array of 1-dimensional projections of Y within bins in X |
[in] | saveProjections | steers the filling of hpoj |
[in] | theMethod | the method used to extract the width and mean. Default is iterative RMS.
|
Definition at line 257 of file InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ResolutionHelper.cxx.
260 std::vector< std::pair<unsigned int,double> > warnUOBinFrac;
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!");
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) {
273 hwidth->SetBinContent(ibin + 1,
result.width);
274 hwidth->SetBinError(ibin + 1,
result.widthError);
278 warnUOBinFrac.emplace_back(ibin + 1,
result.outlierFrac);
281 if (!warnUOBinFrac.empty()) {
◆ makeResolutions() [2/2]
extract 1D resolution plots from a 2D "residual vs observable" histogram.
- Parameters
-
[in] | h_input2D | input histogram (x = observable, y = residuals) |
[out] | hwidth | output histogram, will be filled with the width of the residuals (-> resolution) |
[out] | hmean | output histogram, will be filled with the mean of the residuals (-> bias) |
[out] | hproj | array of histograms, will be populated by an array of 1-dimensional projections of Y within bins in X |
[in] | saveProjections | steers the filling of hpoj |
[in] | theMethod | the method used to extract the width and mean. Default is iterative RMS.
|
Definition at line 288 of file InnerDetector/InDetValidation/InDetPhysValMonitoring/src/ResolutionHelper.cxx.
291 std::vector< std::pair<unsigned int,double> > warnUOBinFrac;
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!");
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 {
static_cast<TH1D*
>(h_input2D->ProjectionY(tmpName.c_str(), ibin+1, ibin+1))};
301 if (
tmp->Integral() < 1) {
304 if (saveProjections) {
308 hwidth->SetBinContent(ibin + 1,
result.width);
309 hwidth->SetBinError(ibin + 1,
result.widthError);
313 warnUOBinFrac.emplace_back(ibin + 1,
result.outlierFrac);
316 if (!warnUOBinFrac.empty()) {
◆ 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.
◆ 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
-
lvl | The message level to test against |
- Returns
- boolean Indicating if messages at given level will be printed
- Return values
-
true | Messages at level "lvl" will be printed |
Definition at line 151 of file AthMessaging.h.
◆ 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.
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: "
82 for (
auto it : p_vecBinVal )
83 reportl <<
"bin"<<
it.first <<
": " << std::setprecision(2) <<
it.second*100. <<
"%, ";
◆ ResolutionHelperResultsModUnits()
single-bin resolution evaluation, also internally used by makeResolutions
- Parameters
-
p_input_hist | input histogram, 1D distribution of the residual
|
theMethod | method 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.
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.;
248 return {
getRMS()*unitConversionFactor,
250 getMean()*unitConversionFactor,
◆ setFout()
void IDPVM::ResolutionHelper::setFout |
( |
double |
p_nsig, |
|
|
double |
p_ntot |
|
) |
| |
|
private |
◆ setGaussFit()
int IDPVM::ResolutionHelper::setGaussFit |
( |
TH1 * |
p_input_hist | ) |
|
|
private |
◆ 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.
132 double mean=p_input_hist->GetMean();
133 double RMS = p_input_hist->GetRMS();
137 unsigned int ntries_max = 100;
139 double nRMS_width = 3.0;
148 int binmax_was = p_input_hist->GetNbinsX();
150 unsigned int ntries = 0;
155 while ( ntries<ntries_max ) {
157 RMS = p_input_hist->GetRMS();
158 mean = p_input_hist->GetMean();
162 int binmin=
std::max(1,p_input_hist->GetXaxis()->FindFixBin(
xmin));
164 int binmax=
std::min(p_input_hist->GetNbinsX(),p_input_hist->GetXaxis()->FindFixBin(
xmax));
166 if ( binmin_was==binmin && binmax_was==binmax ) {
171 p_input_hist->GetXaxis()->SetRange(binmin,binmax);
184 double nSig = p_input_hist->Integral(p_input_hist->GetXaxis()->FindBin(
xmin),
185 p_input_hist->GetXaxis()->FindBin(
xmax));
187 double nTot = p_input_hist->Integral(1,p_input_hist->GetNbinsX());
191 return(ntries_max-ntries);
◆ setLargeError()
void IDPVM::ResolutionHelper::setLargeError |
( |
| ) |
|
|
private |
◆ setLevel()
void AthMessaging::setLevel |
( |
MSG::Level |
lvl | ) |
|
|
inherited |
◆ 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.
206 m_warnings.push_back(
"\t\t\t* ResolutionHelper::setIterativeConvergence did not converge for "+
m_inHistName);
215 m_warnings.push_back(
"\t\t\t* ResolutionHelper::fusion_iterRMS_Gaussfit both methods failed for "+
m_inHistName);
218 m_errors.push_back(
"\t\t\t* ResolutionHelper::setResults: method not supported. No evaluation for "+
m_inHistName);
223 std::ostringstream debugl;
224 debugl <<
"\tResolutionHelper::setResults: too large fraction of out-of-range events for histogram ";
228 m_debugs.push_back(
"\t\t\t* ResolutionHelper::setResults: scaling errors up for "
234 p_input_hist->GetXaxis()->SetRange(1,p_input_hist->GetNbinsX());
◆ ATLAS_THREAD_SAFE
std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT |
|
mutableprivateinherited |
◆ 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 |
◆ 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 |
◆ 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 |
◆ 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:
std::atomic< MSG::Level > m_lvl
Current logging level.
bool initialize(TH1 *p_input_hist)
helper to fill-in starting values of the results vector
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="")
double getMean()
results getters
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...
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
IMessageSvc * getMessageSvc(bool quiet=false)
AthMessaging()
Default constructor:
std::vector< std::string > m_errors
double getFracOut()
fraction of events that is within the range of input histogram, but goes out-of range during width an...
std::vector< std::string > m_infos
int setIterativeConvergence(TH1 *p_input_hist)
iteratively change histogram range, until convergence return # remaining iterations before hitting th...
MsgStream & msg() const
The standard message stream.
std::vector< std::string > m_debugs
int setGaussFit(TH1 *p_input_hist)
std::string to_string(const DetectorType &type)
void setFout(double p_nsig, double p_ntot)
evaluate the fraction of evens out of signal region and its uncertainty
std::vector< std::string > m_warnings
#define ATH_MSG_WARNING(x)
static void cloneHistogram(TH1D *h, TH1 *hcopy)
std::string m_nm
Message source name.
@ fusion_iterRMS_Gaussfit
double m_mean
results/outputs:
void initMessaging() const
Initialize our message level and MessageSvc.
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
void setLargeError()
set large mean and RMS errors in case we eg. exclude too many events during evaluation
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...
resolutionResultInBin ResolutionHelperResultsModUnits(TH1D *p_input_hist, IDPVM::ResolutionHelper::methods theMethod=IDPVM::ResolutionHelper::iterRMS_convergence)
single-bin resolution evaluation, also internally used by makeResolutions