diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/addTruthJets.py b/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/addTruthJets.py index f4bf41ea47b535c9371ea13cf7f329895e3b14d4..7577a637213ea7045e9148a1d758e8eba7cc4419 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/addTruthJets.py +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/addTruthJets.py @@ -83,7 +83,7 @@ def addTruthJetsIfNotExising(truth_jets_name) : alg_type, float(alg_param_str)/10., "truth", - ghostArea=0.0) + ptmin=5000) jet_tools=[] diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/PhysValITk_jobOptions.py b/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/PhysValITk_jobOptions.py index 4c2731158559ec80f08404b6df85431fd66c3e71..96dd2c4e4e6e10c361b4966d9778b0f4a3315b93 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/PhysValITk_jobOptions.py +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/PhysValITk_jobOptions.py @@ -18,10 +18,10 @@ import AthenaPoolCnvSvc.ReadAthenaPool # FNAME=[ "IDTRKVALDAOD.pool.root" ] # runDAOD = True # set to False for AOD/ESD and True for IDTRKVALDAOD #....................................................................... -# uncomment this for testing: step 1.6, mu=200 file: -FNAME=[ "root://eosatlas.cern.ch//eos/atlas/atlasgroupdisk/perf-idtracking/dq2/rucio/mc15_14TeV/52/34/AOD.10041692._000001.pool.root.1", - "root://eosatlas.cern.ch//eos/atlas/atlasgroupdisk/perf-idtracking/dq2/rucio/mc15_14TeV/45/38/AOD.10041692._000002.pool.root.1" ] -runDAOD = False # these are AOD-s +# uncomment this for testing: step 1.7, mu=0 single muon with pt=1GeV samples: +FNAME=[ "root://eosatlas.cern.ch//eos/atlas/atlasgroupdisk/perf-idtracking/dq2/rucio/mc15_14TeV/33/e7/DAOD_IDTRKVALID.10847851._000001.pool.root.1", + "root://eosatlas.cern.ch//eos/atlas/atlasgroupdisk/perf-idtracking/dq2/rucio/mc15_14TeV/51/39/DAOD_IDTRKVALID.10847851._000002.pool.root.1" ] +runDAOD = True # these are DAOD-s #....................................................................... # uncomment to read multiple files: #import glob @@ -195,6 +195,10 @@ TrackTruthSelectionTool.pdgId = -1 TrackTruthSelectionTool.requireCharged = True TrackTruthSelectionTool.requireStatus1 = True TrackTruthSelectionTool.maxProdVertRadius = 260. #max prod. vertex radius of secondaries [mm] +# to select particle within BCL acceptance +#TrackTruthSelectionTool.radiusCylinder = 857 #BCL approximate radius +#TrackTruthSelectionTool.minZCylinder = 1167 #BCL min z +#TrackTruthSelectionTool.maxZCylinder = 1361 #BCL min z TrackTruthSelectionTool.OutputLevel = INFO ToolSvc += TrackTruthSelectionTool @@ -225,7 +229,7 @@ ServiceMgr.MessageSvc.OutputLevel = WARNING ServiceMgr.MessageSvc.defaultLimit = 10000 # max. number of events to process -theApp.EvtMax = 5 +theApp.EvtMax = -1 # dump configuration from AthenaCommon.ConfigurationShelve import saveToAscii diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/postprocessHistos.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/postprocessHistos.cxx index 1113013db2fcf1a39e4c853a1334dcbd86362562..177a3d83c8a331519d2491f3ab93e42576cde3ad 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/postprocessHistos.cxx +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/postprocessHistos.cxx @@ -2,26 +2,29 @@ Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -/* - ____________________________________________________________________________ - @file postprocessHistos_updt.cxx - @author: Liza Mijovic, Soeren Prell - - Goal: merge root files from several (grid) runs - Why needed: dedicated treatment of some of the profiles - to set mean, width and their uncertainties - Notes: tools to set these correspond to InDetPVM GetMeanWidth class tools - For the script to work correctly, you need to update it if: - GetMeanWidth tools or call parameters in InDetPVM code change. - ____________________________________________________________________________ +/** +* ____________________________________________________________________________ +* @file postprocessHistos_updt.cxx +* @author: Liza Mijovic, Soeren Prell +* +* Goal: merge root files from several (grid) runs +* Why needed: dedicated treatment of some of the profiles +* to set mean, width and their uncertainties +* Notes: tools to set these correspond to InDetPVM GetMeanWidth class tools +* For the script to work correctly, you need to update it if: +* GetMeanWidth tools or call parameters in InDetPVM code change. +* ____________________________________________________________________________ */ -// 0..4 in increasing verbosity -#define PRINTDBG 1 +// 0..4 in increasing verbosity: 0=none,error,warning,info,4=debug +define PRINTDBG 2 #include <iostream> #include <iterator> #include <utility> +#include <algorithm> +#include <sstream> +#include <utility> #include <boost/algorithm/string.hpp> @@ -98,25 +101,25 @@ TObject* get_zip(string p_name,vector<string> p_names, vector<TObject*> p_objs) //____________________________________________________________________________________ // postprocessing helpers -// base from which tool-specific postprocessing should inherit +/** base from which tool-specific postprocessing should inherit */ class IDPVM_pproc { public: IDPVM_pproc(){}; ~IDPVM_pproc(){}; - // fetching and book-keeping of objects needed for postprocessing + /// fetching and book-keeping of objects needed for postprocessing virtual void initializePlots(){}; - // function implementing/calling the actual posprocessing + /// function implementing/calling the actual posprocessing virtual void finalizePlots(){}; - // wraper to get all that postprocessing requires in one go + /// wraper to get all that postprocessing requires in one go virtual int postprocess_dir(TDirectory* p_dir){return 0;}; - // set keys of histograms to postprocess + /// set keys of histograms to postprocess virtual void set_pproc_targnames(){}; - // set list of histograms needed as inputs to postprocessing + /// set list of histograms needed as inputs to postprocessing virtual void set_pproc_srcnames(){}; - // conventions to get a source name for a target object to postprocess + /// conventions to get a source name for a target object to postprocess virtual string get_srcname_for(string p_name){return "";}; - // common (not tool-specific) helpers: - // check if all targets and sources are available + /// common (not tool-specific) helpers: + /// check if all targets and sources are available bool check_hasall_targs_srcs(const TDirectory* p_dir); vector<string> get_pproc_targnames(){return m_pproc_targnames;}; vector<string> get_pproc_srcnames(){return m_pproc_srcnames;}; @@ -137,12 +140,12 @@ bool IDPVM_pproc::check_hasall_targs_srcs(const TDirectory* p_dir) { for (auto check : checks) { if (!p_dir->GetKey(check.c_str())) { if (0<PRINTDBG) { - cout <<"no postprocessing."<<std::endl; - if (1<PRINTDBG) { - cout << __FILE__ << "\t\tNo key " << check <<" found." << endl; + cout <<" no postprocessing."<<std::endl; + if (2<PRINTDBG) { + cout << __FILE__ << "\tNo key " << check <<" found." << endl; if (0 < nfound) { - cout << __FILE__ << "\t\t.... NB this directory contains >= " << nfound << " keys required for postprocessing.\n"; - cout << __FILE__ << "\t\t.... Is your postprocessing script consistent with InDetPVM tag used for producing the file ?" << endl; + cout << __FILE__ << "\t.... NB this directory contains >= " << nfound << " keys required for postprocessing.\n"; + cout << __FILE__ << "\t.... Is your postprocessing script consistent with InDetPVM tag used for producing the file ?" << endl; } } } @@ -152,9 +155,9 @@ bool IDPVM_pproc::check_hasall_targs_srcs(const TDirectory* p_dir) { } } if (0<PRINTDBG) { - cout << "run postprocessing."<<endl; - if (1<PRINTDBG) { - cout << __FILE__ << "\t\tfound all targets and sources "<< endl; + cout << " run postprocessing."<<endl; + if (2<PRINTDBG) { + cout << __FILE__ << "\tfound all targets and sources "<< endl; } } @@ -164,34 +167,35 @@ bool IDPVM_pproc::check_hasall_targs_srcs(const TDirectory* p_dir) { TObject* IDPVM_pproc::get_target(string p_name) { TObject* ret_obj = get_zip(p_name,m_pproc_targnames,m_pproc_targets); if (NULL==ret_obj && 0<PRINTDBG) - cout << __FILE__ << "\t\t\terror: could not fetch target "<< p_name << endl; + cout << __FILE__ << "\t\terror: could not fetch target "<< p_name << endl; return ret_obj; } TObject* IDPVM_pproc::get_source(string p_name) { TObject* ret_obj = get_zip(p_name,m_pproc_srcnames,m_pproc_sources); if (NULL==ret_obj && 0<PRINTDBG) - cout << __FILE__ << "\t\t\terror: could not fetch source "<< p_name << endl; + cout << __FILE__ << "\t\terror: could not fetch source "<< p_name << endl; return ret_obj; } int IDPVM_pproc::write_targets() { for (auto targ : m_pproc_targets) { targ->Write(targ->GetName(),TObject::kOverwrite); - if (PRINTDBG>1) { - cout << __FILE__<< "\t\tupdated target histogram: "<<targ->GetName()<<endl; + if (PRINTDBG>2) { + cout << __FILE__<< "\tupdated target histogram: "<<targ->GetName()<<endl; } } return 0; } -//------------------------------------------------------------------------------------ -// GetMeanWidth tool -// this code is copy-pasted from the corresponding src/.cxx and .h classes -// requires manual update when those are updated +/** ------------------------------------------------------------------------------------ + * GetMeanWidth tool + * this code is copy-pasted from the corresponding src/.cxx and .h classes + * requires manual update when those are updated + */ //.................................................................................... -// GetMeanWidth.h +// ------------ start of carbon-copy from src/ GetMeanWidth.h namespace IDPVM { class GetMeanWidth { @@ -201,50 +205,69 @@ namespace IDPVM { // nop }; - // methods acc to which mean&RMS can be evaluated + /// methods acc to which mean&RMS can be evaluated enum methods { iterRMS_convergence, Gauss_fit, fusion_iterRMS_Gaussfit }; - // wrapper to set mean,rms,and fraction of events in tails - // nb: some of the methods are allowed to modify input histogram + /// wrapper to set mean,rms,and fraction of events in tails + /// nb: some of the methods are allowed to modify input histogram void setResults(TH1* p_input_hist, methods p_method); - // results getters + /// results getters double getMean() { return m_mean; }; double getMeanError() { return m_meanError; }; double getRMS() { return m_RMS; }; double getRMSError() { return m_RMSError; }; + /// 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 double getFracOut() { return m_FracOut; }; double getFracOutUnc() { return m_FracOutUnc; }; - // return and clear accumulated warnings and errors + /// 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 + double getFracUOflow() { return m_FracUOflow; }; + /// helper to report bin and fraction of under-/over- flow events, + /// as accumulated by top-level pull or resolution histogram + string reportUOBinVal(string p_histName, vector< std::pair<unsigned int,double> > p_vecBinVal); + /// return accumulated messages + vector<string> getDebugs() { return m_debugs; }; vector<string> getInfos() { return m_infos; }; vector<string> getWarnings() { return m_warnings; }; vector<string> getErrors() { return m_errors; }; private: - // use gaussian fit, return 0 in case of successful fit + /// use gaussian fit, return 0 in case of successful fit int setGaussFit(TH1* p_input_hist); - // iteratively change histogram range, until convergence - // return # remaining iterations before hitting the max. allowed + /// iteratively change histogram range, until convergence + /// return # remaining iterations before hitting the max. allowed int setIterativeConvergence(TH1* p_input_hist); - // evaluate the fraction of evens out of signal region and its uncertainty - void setFout(double p_nsig,double p_ntot); - // helper to fill-in starting values of the results vector + /// evaluate the fraction of evens out of signal region and its uncertainty + void setFout(double p_nsig,double p_ntot); + /// set large mean and RMS errors in case we eg. exclude too many events during evaluation + void setLargeError(); + /// helper to fill-in starting values of the results vector bool initialize(TH1* p_input_hist); - - - // results/outputs: - double m_mean,m_meanError,m_RMS,m_RMSError,m_FracOut,m_FracOutUnc; + + /// results/outputs: + double m_mean,m_meanError,m_RMS,m_RMSError,m_FracOut,m_FracOutUnc,m_FracUOflow; + vector<string> m_debugs; vector<string> m_infos; vector<string> m_warnings; vector<string> m_errors; - //helpers - string m_inHistName; + /// helpers + string m_inHistName; + /// increase mean and RMS errors by this factor in case of ambiguous evaluation + /// ... eg in case we eg. exclude too many events during evaluation + double m_largeErrorFact; + /// maximum fraction of Under- and Overflow events we tolerate + double m_maxUOflowFrac; }; } // end of namespace -// end of GetMeanWidth.h +// ------------ end of carbon-copy from src/GetMeanWidth.h //.................................................................................... -// GetMeanWidth.cxx +// ------------ start of carbon-copy from src/GetMeanWidth.cxx : namespace IDPVM { GetMeanWidth::GetMeanWidth() : @@ -254,12 +277,17 @@ namespace IDPVM { m_RMSError(0.), m_FracOut(0.), m_FracOutUnc(0.), - m_inHistName("") { + m_FracUOflow(0.), + m_inHistName(""), + m_largeErrorFact(10.), + m_maxUOflowFrac(0.001) { //nop } bool GetMeanWidth::initialize(TH1* p_input_hist) { + if ( !m_debugs.empty()) + m_debugs.clear(); if ( !m_infos.empty()) m_infos.clear(); if ( !m_warnings.empty()) @@ -276,7 +304,7 @@ namespace IDPVM { m_inHistName = p_input_hist->GetName(); if ( 0==p_input_hist->GetEntries() ) { - m_infos.push_back("GetMeanWidth::initialize: got input histogram with 0 entries: "+ m_inHistName); + m_debugs.push_back("GetMeanWidth::initialize: got input histogram with 0 entries: "+ m_inHistName); m_mean=m_meanError=m_RMS=m_RMSError=m_FracOut=m_FracOutUnc=0.; return false; } @@ -287,9 +315,33 @@ namespace IDPVM { m_meanError = p_input_hist->GetMeanError(); m_FracOut = 0.; m_FracOutUnc = 0.; + double nExclUOflow = p_input_hist->Integral(1,p_input_hist->GetNbinsX()); + double nInclUOflow = p_input_hist->Integral(0,p_input_hist->GetNbinsX()+1); + double fUOflow = (nExclUOflow>0.) ? (nInclUOflow-nExclUOflow)/nExclUOflow : -1.; + m_FracUOflow = (fUOflow>m_maxUOflowFrac) ? fUOflow : -1; return true; } + + void GetMeanWidth::setLargeError() { + std::ostringstream debugl; + debugl << __FILE__ << "\t\t" << m_inHistName + << ": scaling mean and RMS errors by factor: " << m_largeErrorFact; + m_debugs.push_back(debugl.str()); + m_meanError*=m_largeErrorFact; + m_RMSError*=m_largeErrorFact; + } + + string GetMeanWidth::reportUOBinVal(string p_histName, vector< std::pair<unsigned int,double> > p_vecBinVal) { + std::ostringstream reportl; + if (!p_vecBinVal.empty()) { + reportl << "Errors scaled up for resol. hist. with large % of events in over- and under-flow: " + << p_histName<<": "; + for ( auto it : p_vecBinVal ) + reportl << "bin"<<it.first << ": " << std::setprecision(2) << it.second*100. << "%, "; + } + return reportl.str(); + } void GetMeanWidth::setFout(double p_nsig,double p_ntot) { m_FracOut=0.; @@ -325,7 +377,7 @@ namespace IDPVM { // get fraction of events outside 3*RMS + its ~ uncertainty double nSig = p_input_hist->Integral(p_input_hist->GetXaxis()->FindBin(-3.0 * m_RMS), p_input_hist->GetXaxis()->FindBin(3.0 * m_RMS)); - double nTot = p_input_hist->Integral(); + double nTot = p_input_hist->Integral(1,p_input_hist->GetNbinsX()); setFout(nSig,nTot); // return fit status @@ -347,8 +399,8 @@ namespace IDPVM { // iteration counters and helpers: // min and max range of the histogram: - double min=0.; - double max=0.; + double xmin=0.; + double xmax=0.; // min and max bins of the histogram in previous iteration // 0-th iteration: range of the original histogram int binmin_was = 1; @@ -363,11 +415,12 @@ namespace IDPVM { ++ntries; RMS = p_input_hist->GetRMS(); mean = p_input_hist->GetMean(); - min = -1.0*nRMS_width*RMS + mean; - max = nRMS_width*RMS + mean; - // find bins corresponding to new range - int binmin=p_input_hist->GetXaxis()->FindFixBin(min); - int binmax=p_input_hist->GetXaxis()->FindFixBin(max); + xmin = -1.0*nRMS_width*RMS + mean; + xmax = nRMS_width*RMS + mean; + // find bins corresponding to new range, disregard underflow + int binmin=std::max(1,p_input_hist->GetXaxis()->FindFixBin(xmin)); + // find bins corresponding to new range, disregard overflow + int binmax=std::min(p_input_hist->GetNbinsX(),p_input_hist->GetXaxis()->FindFixBin(xmax)); // end iteration if these are same bins as in prev. iteration if ( binmin_was==binmin && binmax_was==binmax ) { break; @@ -387,8 +440,9 @@ namespace IDPVM { m_meanError=p_input_hist->GetMeanError(); // get fraction of excluded events + its ~ uncertainty - double nSig = p_input_hist->Integral(p_input_hist->GetXaxis()->FindBin(min), - p_input_hist->GetXaxis()->FindBin(max)); + double nSig = p_input_hist->Integral(p_input_hist->GetXaxis()->FindBin(xmin), + p_input_hist->GetXaxis()->FindBin(xmax)); + // disregard under- and over- flow double nTot = p_input_hist->Integral(1,p_input_hist->GetNbinsX()); setFout(nSig,nTot); @@ -408,21 +462,32 @@ namespace IDPVM { if (iterRMS_convergence == p_method) { if ( !setIterativeConvergence(p_input_hist) ) - m_warnings.push_back("GetMeanWidth::setIterativeConvergence did not converge for "+ m_inHistName); + m_warnings.push_back("\t\t\t* GetMeanWidth::setIterativeConvergence did not converge for "+ m_inHistName); } else if (Gauss_fit == p_method) { if ( !setGaussFit(p_input_hist) ) - m_warnings.push_back("GetMeanWidth::setGaussFit: fit failed for "+ m_inHistName); + m_warnings.push_back("\t\t\t* GetMeanWidth::setGaussFit: fit failed for "+ m_inHistName); } else if (fusion_iterRMS_Gaussfit == p_method) { if ( !setIterativeConvergence(p_input_hist) && !setGaussFit(p_input_hist) ) - m_warnings.push_back("GetMeanWidth::fusion_iterRMS_Gaussfit both methods failed for "+ m_inHistName); + m_warnings.push_back("\t\t\t* GetMeanWidth::fusion_iterRMS_Gaussfit both methods failed for "+ m_inHistName); } else { - m_errors.push_back("GetMeanWidth::setResults: method not supported. No evaluation for "+ m_inHistName); + m_errors.push_back("\t\t\t* GetMeanWidth::setResults: method not supported. No evaluation for "+ m_inHistName); } - + + // check if large fraction of events was in over- and under-flow + if ( m_FracUOflow > 0. ) { + std::ostringstream debugl; + debugl << "\tGetMeanWidth::setResults: too large fraction of out-of-range events for histogram "; + debugl << m_inHistName << ": " << m_FracUOflow << " > " << m_maxUOflowFrac; + m_debugs.push_back(debugl.str()); + setLargeError(); + m_debugs.push_back("\t\t\t* GetMeanWidth::setResults: scaling errors up for " + +m_inHistName+". Too many under- and over- flows."); + } + // reset range metadata to state prior to iteration // this gets changed in iterative or fusion) p_input_hist->GetXaxis()->SetRange(1,p_input_hist->GetNbinsX()); @@ -431,21 +496,23 @@ namespace IDPVM { } }//end of namespace -// end of GetMeanWidth.cxx +// ---------------- end of carbon-copy from GetMeanWidth.cxx //.................................................................................... //------------------------------------------------------------------------------------ -// postprocessing for InDetPerfPlot_res tool +/** postprocessing for InDetPerfPlot_res tool + * code assembled from InDetPerfPlot_res, but not copied from there directly + */ class InDetPerfPlot_res_pproc : public IDPVM_pproc { public: InDetPerfPlot_res_pproc(); ~InDetPerfPlot_res_pproc(){}; void initializePlots(); - // todo: smarter imple + /// todo: smarter imple int postprocess_dir(TDirectory* p_dir); - // requieres manual synch with Athena source + /// requieres manual synch with Athena source void finalizePlots(); - // ditto + /// ditto void Refinement(TH1D* temp, IDPVM::GetMeanWidth::methods p_method, int var, int j, const std::vector<TH1*>& tvec, const std::vector<TH1*>& rvec); @@ -453,27 +520,27 @@ public: void set_pproc_srcnames(); string get_srcname_for(string p_name); private: - // source and target histograms used in postprocessing - // resolution - // * vs eta - vector<TH2*> m_meanbasePlots; // res vs param vs eta - vector<TH1*> m_meanPlots; // resmean vs param vs eta - vector<TH1*> m_resoPlots; // reswidth vs param vs eta - // * vs pt - vector<TH2*> m_mean_vs_ptbasePlots; // res vs param vs pt - vector<TH1*> m_mean_vs_ptPlots; // resmean vs param vs pt - vector<TH1*> m_resptPlots;// reswidth vs param vs pt - // pulls <-- we do these only vs pt - vector<TH2*> m_pullbasePlots; // pull vs param vs eta - vector<TH1*> m_pullmeanPlots; // pullmean vs param vs eta - vector<TH1*> m_pullwidthPlots; // pullwidth vs param vs eta - // helpers and quantities used by the postprocessing code + /// source and target histograms used in postprocessing + /// resolution + /// * vs eta + vector<TH2*> m_meanbasePlots; /// res vs param vs eta + vector<TH1*> m_meanPlots; /// resmean vs param vs eta + vector<TH1*> m_resoPlots; /// reswidth vs param vs eta + /// * vs pt + vector<TH2*> m_mean_vs_ptbasePlots; /// res vs param vs pt + vector<TH1*> m_mean_vs_ptPlots; /// resmean vs param vs pt + vector<TH1*> m_resptPlots;/// reswidth vs param vs pt + /// pulls <-- we do these only vs pt + vector<TH2*> m_pullbasePlots; /// pull vs param vs eta + vector<TH1*> m_pullmeanPlots; /// pullmean vs param vs eta + vector<TH1*> m_pullwidthPlots; /// pullwidth vs param vs eta + /// helpers and quantities used by the postprocessing code vector<string> m_paramNames {"d0", "z0", "phi", "theta", "z0*sin(theta)", "qopt"}; vector<string> m_quantnames {"width","mean"}; enum Param { D0, Z0, PHI, THETA, Z0SIN_THETA, QOPT, NPARAMS }; - // class and methods for evaluating mean and width of distributions + /// class and methods for evaluating mean and width of distributions IDPVM::GetMeanWidth m_getMeanWidth; IDPVM::GetMeanWidth::methods m_meanWidthMethod; }; @@ -542,8 +609,11 @@ void InDetPerfPlot_res_pproc::initializePlots(){ } //..................................................................................... +// ----- carbon-copy of src/InDetPerfPlot_res.cxx's finalizePlots() + replace ATHENA_MSG with std::cout +// also copy over any functions InDetPerfPlot_res.cxx's finalizePlots() calls +// needs to be kept in synch with InDetPerfPlot_res.cxx's finalizePlots() manually void InDetPerfPlot_res_pproc::finalizePlots() { - unsigned int ptBins(0); +unsigned int ptBins(0); if (m_mean_vs_ptbasePlots[0]) { ptBins = m_mean_vs_ptPlots[0]->GetNbinsX(); } else { @@ -552,6 +622,11 @@ void InDetPerfPlot_res_pproc::finalizePlots() { } for (unsigned int var(0); var != NPARAMS; ++var) { if (m_meanPlots[var]) { + // warnings in case input histograms have large % events in under- and over- flow bins + vector< std::pair<unsigned int,double> > warnUOBinEtaRes; + vector< std::pair<unsigned int,double> > warnUOBinEtaPull; + vector< std::pair<unsigned int,double> > warnUOBinPtRes; + unsigned int etaBins = m_meanPlots[var]->GetNbinsX(); auto& meanbasePlot = m_meanbasePlots[var]; auto& pullbasePlot = m_pullbasePlots[var]; @@ -560,18 +635,44 @@ void InDetPerfPlot_res_pproc::finalizePlots() { TH1D* temp = meanbasePlot->ProjectionY(Form("%s_projy_bin%d", "Big_Histo", j), j, j); TH1D* temp_pull = pullbasePlot->ProjectionY(Form("%s_projy_bin%d", "Pull_Histo", j), j, j); Refinement(temp, m_meanWidthMethod, var, j, m_meanPlots, m_resoPlots); + if (m_getMeanWidth.getFracUOflow()>0.) + warnUOBinEtaRes.push_back(std::make_pair(j,m_getMeanWidth.getFracUOflow())); Refinement(temp_pull, m_meanWidthMethod, var, j, m_pullmeanPlots, m_pullwidthPlots); + if (m_getMeanWidth.getFracUOflow()>0.) + warnUOBinEtaPull.push_back(std::make_pair(j,m_getMeanWidth.getFracUOflow())); + } + // print warnings in case of under- and over- flows + if (PRINTDBG>1 && !warnUOBinEtaRes.empty()) { + std::cout << __FILE__ << "\t\t WARNING: " + << m_getMeanWidth.reportUOBinVal(m_meanPlots[var]->GetName(),warnUOBinEtaRes) << std::endl; + std::cout << __FILE__ << "\t\t WARNING: " + << m_getMeanWidth.reportUOBinVal(m_resoPlots[var]->GetName(),warnUOBinEtaRes) << std::endl; + } + if (PRINTDBG>1 && !warnUOBinEtaPull.empty()) { + std::cout << __FILE__ << "\t\t WARNING: " + << m_getMeanWidth.reportUOBinVal(m_pullmeanPlots[var]->GetName(),warnUOBinEtaPull) << std::endl; + std::cout << __FILE__ << "\t\t WARNING: " + << m_getMeanWidth.reportUOBinVal(m_pullwidthPlots[var]->GetName(),warnUOBinEtaPull) << std::endl; } + auto& mean_vs_ptbasePlot = m_mean_vs_ptbasePlots[var]; for (unsigned int i = 1; i <= ptBins; i++) { TH1D* temp = mean_vs_ptbasePlot->ProjectionY(Form("%s_projy_bin%d", "Big_Histo", i), i, i); Refinement(temp, m_meanWidthMethod, var, i, m_mean_vs_ptPlots, m_resptPlots); + if (m_getMeanWidth.getFracUOflow()>0.) + warnUOBinPtRes.push_back(std::make_pair(i,m_getMeanWidth.getFracUOflow())); + } + // print warnings in case of under- and over- flows + if (PRINTDBG>1 && !warnUOBinPtRes.empty()) { + std::cout << __FILE__ << "\t\t WARNING: " + << m_getMeanWidth.reportUOBinVal(m_mean_vs_ptPlots[var]->GetName(),warnUOBinPtRes) << std::endl; + std::cout << __FILE__ << "\t\t WARNING: " + << m_getMeanWidth.reportUOBinVal(m_resptPlots[var]->GetName(),warnUOBinPtRes) << std::endl; } } } - - return; -}// end of InDetPerfPlot_res_pproc::finalizePlots() +} // end of InDetPerfPlot_res::finalizePlots() +// end of InDetPerfPlot_res_pproc::finalizePlots() //..................................................................................... //..................................................................................... @@ -586,7 +687,11 @@ InDetPerfPlot_res_pproc::Refinement(TH1D* temp, IDPVM::GetMeanWidth::methods p_m } m_getMeanWidth.setResults(temp, p_method); - // print out any warnings and errors + // print out any messages + if (PRINTDBG>3) { + for (auto _it : m_getMeanWidth.getDebugs()) + std::cout << _it << std::endl; + } if (PRINTDBG>2) { for (auto _it : m_getMeanWidth.getInfos()) std::cout << _it << std::endl; @@ -601,7 +706,7 @@ InDetPerfPlot_res_pproc::Refinement(TH1D* temp, IDPVM::GetMeanWidth::methods p_m } // RMS and RMSerror (rvec[var])->SetBinContent(j, m_getMeanWidth.getRMS()); - (rvec[var])->SetBinError(j, m_getMeanWidth.getRMSError()); + (rvec[var])->SetBinError(j, m_getMeanWidth.getRMSError()); // mean and meanerror (tvec[var])->SetBinContent(j, m_getMeanWidth.getMean()); (tvec[var])->SetBinError(j, m_getMeanWidth.getMeanError()); @@ -613,15 +718,15 @@ InDetPerfPlot_res_pproc::Refinement(TH1D* temp, IDPVM::GetMeanWidth::methods p_m //------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------ -// postprocessing for InDetPerfPlot_resITk tool +/** postprocessing for InDetPerfPlot_resITk tool */ class InDetPerfPlot_resITk_pproc : public IDPVM_pproc { public: InDetPerfPlot_resITk_pproc(); ~InDetPerfPlot_resITk_pproc(){}; void initializePlots(); - // todo: smarter imple + /// todo: smarter imple int postprocess_dir(TDirectory* p_dir); - // requieres manual synch with Athena source + /// requieres manual synch with Athena source void finalizePlots(); void set_pproc_targnames(); void set_pproc_srcnames(); @@ -651,8 +756,8 @@ private: }; pCfg m_paramProp[NPARAMS]; - // source and target histograms used in postprocessing - // --------------------------- + /// source and target histograms used in postprocessing + /// --------------------------- TH2* m_resITk_resHelpereta[NPARAMS]; TH1* m_resITk_Resolution_vs_eta[NPARAMS][m_nResHist]; TH1* m_resITk_ResProjections_vs_eta[NPARAMS][m_nEtaBins]; @@ -671,8 +776,8 @@ private: TH2* m_resITk_resHelperpt_neg[NPARAMS]; TH1* m_resITk_Resolution_vs_pt_neg[NPARAMS][m_nResHist]; - TH2* m_resITk_pullHelperpt[NPARAMS]; // pull width as a function of pT - TH2* m_resITk_pullHelpereta[NPARAMS]; // pull width as a function of pT + TH2* m_resITk_pullHelperpt[NPARAMS]; /// pull width as a function of pT + TH2* m_resITk_pullHelpereta[NPARAMS]; /// pull width as a function of pT TH1* m_resITk_pullResolution_vs_pt[NPARAMS][m_nResHist]; TH1* m_resITk_pullResolution_vs_eta[NPARAMS][m_nResHist]; @@ -682,23 +787,14 @@ private: TH1* m_resITk_Resolution_vs_pt_EtaBin[NPARAMS][4][m_nResHist]; TH1* m_resITk_Resolution_vs_eta_PtBin[NPARAMS][4][m_nResHist]; - // --------------------------- - // significance histo sources + /// --------------------------- + /// significance histo sources TH2* m_significance_d0; TH2* m_significance_z0; - // significance histo targets + /// significance histo targets TH1* m_significance_d0_vs_eta; TH1* m_significance_z0_vs_eta; - // --------------------------- - // fix histogram sources - TH1* m_fix_qoverpt_res[m_nEtaBins]; - TH1* m_fix_d0_res[m_nEtaBins]; - TH1* m_fix_z0_res[m_nEtaBins]; - // fix histogram targets - TH1* m_fix_qoverptresolutionRMS_vs_eta; - TH1* m_fix_d0resolutionRMS_vs_eta; - TH1* m_fix_z0resolutionRMS_vs_eta; - // --------------------------- + /// --------------------------- std::string m_resHisto[m_nResHist] = { "resolutionRMS", "meanRMS", "resolutionGAUS", "meanGAUS" }; @@ -715,42 +811,33 @@ private: void cloneHistogram(TH1D* h, TH1* hcopy); - // target and source getter helpers: - // makeResolutions histograms: - // struct holding target and source names for eta pulls & resolutions + /// target and source getter helpers: + /// makeResolutions histograms: + /// struct holding target and source names for eta pulls & resolutions struct pullreso_eta { string targnames[NPARAMS][m_nResHist] = { {""} }; string srcnames_1D[NPARAMS][m_nEtaBins] = { { ""} }; string srcnames_2D[NPARAMS] = {""}; }; - // struct holding target and source names for pt pulls & resolutions + /// struct holding target and source names for pt pulls & resolutions struct pullreso_pt { string targnames[NPARAMS][m_nResHist] = { {""} }; string srcnames_1D[NPARAMS][m_nPtBins] = { {""} }; string srcnames_2D[NPARAMS] = {""}; }; - // we'll make the following: - // eta resolutions: inclusive + split to pos and neg charge + /// we'll make the following: + /// eta resolutions: inclusive + split to pos and neg charge pullreso_eta m_res_eta; pullreso_eta m_res_eta_pos; pullreso_eta m_res_eta_neg; - // pt resolutions: inclusive + split to pos and neg charge + /// pt resolutions: inclusive + split to pos and neg charge pullreso_pt m_res_pt; pullreso_pt m_res_pt_pos; pullreso_pt m_res_pt_neg; - // pulls vs pt and eta + /// pulls vs pt and eta pullreso_eta m_pull_eta; pullreso_eta m_pull_pt; - void set_makeResolutions_targ_src_names(); - // histograms with manual fixes: - // one string per histo for making target and source names & fetching - const vector<string> m_fixes {"fix_qoverpt", "fix_d0", "fix_z0" }; - // one target per histo - vector<string> m_fix_targnames; - // a number (m_nbins_fixes) of source per histo - static const unsigned int m_nbins_fixes = 16; - vector< vector<string> > m_fix_srcnames; - void set_fix_targnames_srcnames(); + void set_makeResolutions_targ_src_names(); }; InDetPerfPlot_resITk_pproc::InDetPerfPlot_resITk_pproc() : @@ -771,8 +858,6 @@ InDetPerfPlot_resITk_pproc::InDetPerfPlot_resITk_pproc() : // set helpers for filling source and target names: // ... makeResolutions histograms set_makeResolutions_targ_src_names(); - // .... fixed histograms: - set_fix_targnames_srcnames(); // generic target and src setters set_pproc_targnames(); set_pproc_srcnames(); @@ -787,25 +872,6 @@ int InDetPerfPlot_resITk_pproc::postprocess_dir(TDirectory* p_dir) { return write_targets(); } -void InDetPerfPlot_resITk_pproc::set_fix_targnames_srcnames() { - // sets names for targets and sources needed for fix histograms - if (!m_fix_targnames.empty()) - m_fix_targnames.clear(); - if (!m_fix_srcnames.empty()) - m_fix_srcnames.clear(); - for (auto fix : m_fixes) { - string fix_targname = fix+m_resHisto[0]+"_vs_eta"; - m_fix_targnames.push_back(fix_targname); - vector<string> thisfix_srcnames; - for (unsigned int i=0; i<m_nbins_fixes; ++i) { - string fix_srcname = fix+"_res"+std::to_string(i+1); - thisfix_srcnames.push_back(fix_srcname); - } - m_fix_srcnames.push_back(thisfix_srcnames); - } - return; -} - void InDetPerfPlot_resITk_pproc::set_makeResolutions_targ_src_names() { // sources and targets needed for makeResolution calls: @@ -906,10 +972,6 @@ void InDetPerfPlot_resITk_pproc::set_pproc_targnames() { } } //............................................................................ - - // fix histos - for (auto tn : m_fix_targnames) - m_pproc_targnames.push_back(tn); // significance histos: m_pproc_targnames.push_back("significance_d0_vs_eta"); @@ -960,13 +1022,6 @@ void InDetPerfPlot_resITk_pproc::set_pproc_srcnames() { } //............................................................................ - // fix histograms - for (auto sns : m_fix_srcnames) { - for (auto sn : sns) { - m_pproc_srcnames.push_back(sn); - } - } - // significance histograms: m_pproc_srcnames.push_back("significance_d0"); m_pproc_srcnames.push_back("significance_z0"); @@ -1064,38 +1119,6 @@ void InDetPerfPlot_resITk_pproc::initializePlots(){ } // end of pulls //............................................................................ - - //............................................................................ - // fix targets: - int ifix=0; - for (auto fix : m_fixes) { - string fix_targname=m_fix_targnames[ifix]; - TH1* targ_hist = dynamic_cast<TH1*>(get_target(fix_targname)); - if ("fix_qoverpt"==fix) - m_fix_qoverptresolutionRMS_vs_eta = targ_hist; - else if ("fix_d0"==fix) - m_fix_d0resolutionRMS_vs_eta = targ_hist; - else if ("fix_z0"==fix) - m_fix_z0resolutionRMS_vs_eta = targ_hist; - ++ifix; - } - // fix sources: - ifix=0; - for (auto fix : m_fixes) { - for (unsigned int ibin=0; ibin<m_nbins_fixes; ++ibin) { - string fix_srcname=m_fix_srcnames[ifix][ibin]; - TH1* src_hist = dynamic_cast<TH1*>(get_source(fix_srcname)); - if ("fix_qoverpt"==fix) - m_fix_qoverpt_res[ibin]=src_hist; - else if ("fix_d0"==fix) - m_fix_d0_res[ibin]=src_hist; - else if ("fix_z0"==fix) - m_fix_z0_res[ibin]=src_hist; - } - ++ifix; - } - // end of fix histograms - //............................................................................ // significance histograms: m_significance_d0 = dynamic_cast<TH2*>(get_source("significance_d0")); @@ -1119,13 +1142,27 @@ InDetPerfPlot_resITk_pproc::getMeanWidthResultsModUnits(TH1* p_input_hist, vecto } m_getMeanWidth.setResults(p_input_hist, p_method); + // print out any warnings and errors + if (PRINTDBG>3) + for (auto _it : m_getMeanWidth.getDebugs()) + std::cout << _it << std::endl; + if (PRINTDBG>2) + for (auto _it : m_getMeanWidth.getInfos()) + std::cout << _it << std::endl; + if (PRINTDBG>1) + for (auto _it : m_getMeanWidth.getWarnings()) + std::cout <<_it << std::endl; + if (PRINTDBG>0) + for (auto _it : m_getMeanWidth.getErrors()) + std::cout << _it << std::endl; p_result.push_back(m_getMeanWidth.getRMS()); p_result.push_back(m_getMeanWidth.getRMSError()); p_result.push_back(m_getMeanWidth.getMean()); p_result.push_back(m_getMeanWidth.getMeanError()); p_result.push_back(m_getMeanWidth.getFracOut()); p_result.push_back(m_getMeanWidth.getFracOutUnc()); - + p_result.push_back(m_getMeanWidth.getFracUOflow()); + TString vari = p_input_hist->GetName(); if ( !vari.Contains("pull") && (vari.Contains("d0") || vari.Contains("z0")) ) { @@ -1136,16 +1173,6 @@ InDetPerfPlot_resITk_pproc::getMeanWidthResultsModUnits(TH1* p_input_hist, vecto p_result[2]*= mm2um; p_result[3]*= mm2um; } - - /* - // print out any warnings and errors - // <-- LM need to figure out what to do to get - // ATH_MSG not working in this class - for (auto _it : m_getMeanWidth.getWarnings()) - ATH_MSG_WARNING(_it); - for (auto _it : m_getMeanWidth.getErrors()) - ATH_MSG_ERROR(_it); - */ } // end of InDetPerfPlot_resITk_pproc::getMeanWidthResultsModUnits //..................................................................................... @@ -1155,7 +1182,9 @@ InDetPerfPlot_resITk_pproc::makeResolutions(TH2* h, TH1* hres[4]) { // Should fix this in a better way TString hname = h->GetName(); - + // warnings in case input histograms have large % events in under- and over- flow bins + vector< std::pair<unsigned int,double> > warnUOBinFrac; + if (hname.Contains("Helpereta")) { for (unsigned int ieta = 0; ieta < m_nEtaBins; ieta++) { std::string tmpName = h->GetName() + std::string("py_bin") + std::to_string(ieta + 1); @@ -1170,6 +1199,8 @@ InDetPerfPlot_resITk_pproc::makeResolutions(TH2* h, TH1* hres[4]) { hres[0]->SetBinError(ieta + 1, result.at(1)); hres[1]->SetBinContent(ieta + 1, result.at(2)); hres[1]->SetBinError(ieta + 1, result.at(3)); + if (result.size()>6 && result.at(6)>0.) + warnUOBinFrac.push_back(std::make_pair(ieta + 1,result.at(6))); result.clear(); /* std::vector<float> result; @@ -1180,8 +1211,15 @@ InDetPerfPlot_resITk_pproc::makeResolutions(TH2* h, TH1* hres[4]) { hres[3]->SetBinContent(ieta+1,result.at(2)); hres[3]->SetBinError(ieta+1,result.at(3));*/ delete tmp; + } + if (PRINTDBG>1 && !warnUOBinFrac.empty()) { + std::cout << __FILE__ << "\t\t WARNING: " << m_getMeanWidth.reportUOBinVal(hres[0]->GetName(),warnUOBinFrac) << std::endl; + std::cout << __FILE__ << "\t\t WARNING: " << m_getMeanWidth.reportUOBinVal(hres[1]->GetName(),warnUOBinFrac) << std::endl; } - } else if (hname.Contains("Helperpt")) { + } + else if (hname.Contains("Helperpt")) { + if (!warnUOBinFrac.empty()) + warnUOBinFrac.clear(); for (unsigned int ipt = 0; ipt < m_nPtBins; ipt++) { std::string tmpName = h->GetName() + std::string("py_bin") + std::to_string(ipt + 1); TH1D* tmp = (TH1D*) h->ProjectionY(tmpName.c_str(), h->GetXaxis()->FindBin(m_PtBins[ipt]), @@ -1195,6 +1233,8 @@ InDetPerfPlot_resITk_pproc::makeResolutions(TH2* h, TH1* hres[4]) { hres[0]->SetBinError(ipt + 1, result.at(1)); hres[1]->SetBinContent(ipt + 1, result.at(2)); hres[1]->SetBinError(ipt + 1, result.at(3)); + if (result.size()>6 && result.at(6)>0.) + warnUOBinFrac.push_back(std::make_pair(ipt + 1,result.at(6))); result.clear(); /* @@ -1207,13 +1247,19 @@ InDetPerfPlot_resITk_pproc::makeResolutions(TH2* h, TH1* hres[4]) { hres[3]->SetBinError(ipt+1,result.at(3));*/ delete tmp; } + if (PRINTDBG>1 && !warnUOBinFrac.empty()) { + std::cout << __FILE__ << "\t\t WARNING: " << m_getMeanWidth.reportUOBinVal(hres[0]->GetName(),warnUOBinFrac) << std::endl; + std::cout << __FILE__ << "\t\t WARNING: " << m_getMeanWidth.reportUOBinVal(hres[1]->GetName(),warnUOBinFrac) << std::endl; + } } } void InDetPerfPlot_resITk_pproc::makeResolutions(TH2* h, TH1* hres[4], TH1* hproj[m_nEtaBins], bool save) { TString hname = h->GetName(); - + // warnings in case input histograms have large % events in under- and over- flow bins + vector< std::pair<unsigned int,double> > warnUOBinFrac; + if (hname.Contains("Helpereta")) { for (unsigned int ieta = 0; ieta < m_nEtaBins; ieta++) { std::string tmpName = h->GetName() + std::string("py_bin") + std::to_string(ieta + 1); @@ -1231,6 +1277,8 @@ InDetPerfPlot_resITk_pproc::makeResolutions(TH2* h, TH1* hres[4], TH1* hproj[m_n hres[0]->SetBinError(ieta + 1, result.at(1)); hres[1]->SetBinContent(ieta + 1, result.at(2)); hres[1]->SetBinError(ieta + 1, result.at(3)); + if (result.size()>6 && result.at(6)>0.) + warnUOBinFrac.push_back(std::make_pair(ieta + 1,result.at(6))); result.clear(); /* std::vector<float> result; @@ -1242,7 +1290,13 @@ InDetPerfPlot_resITk_pproc::makeResolutions(TH2* h, TH1* hres[4], TH1* hproj[m_n hres[3]->SetBinError(ieta+1,result.at(3));*/ delete tmp; } + if (PRINTDBG>1 && !warnUOBinFrac.empty()) { + std::cout << __FILE__ << "\t\t WARNING: " << m_getMeanWidth.reportUOBinVal(hres[0]->GetName(),warnUOBinFrac) << std::endl; + std::cout << __FILE__ << "\t\t WARNING: " << m_getMeanWidth.reportUOBinVal(hres[1]->GetName(),warnUOBinFrac) << std::endl; + } } else if (hname.Contains("Helperpt")) { + if (!warnUOBinFrac.empty()) + warnUOBinFrac.clear(); for (unsigned int ipt = 0; ipt < m_nPtBins; ipt++) { std::string tmpName = h->GetName() + std::string("py_bin") + std::to_string(ipt + 1); TH1D* tmp = (TH1D*) h->ProjectionY(tmpName.c_str(), h->GetXaxis()->FindBin(m_PtBins[ipt]), @@ -1259,6 +1313,8 @@ InDetPerfPlot_resITk_pproc::makeResolutions(TH2* h, TH1* hres[4], TH1* hproj[m_n hres[0]->SetBinError(ipt + 1, result.at(1)); hres[1]->SetBinContent(ipt + 1, result.at(2)); hres[1]->SetBinError(ipt + 1, result.at(3)); + if (result.size()>6 && result.at(6)>0.) + warnUOBinFrac.push_back(std::make_pair(ipt + 1,result.at(6))); result.clear(); /* std::vector<float> result; IDPVM::GetMeanWidth::methods altMeanWidthMethod = Gauss_fit; @@ -1269,6 +1325,10 @@ InDetPerfPlot_resITk_pproc::makeResolutions(TH2* h, TH1* hres[4], TH1* hproj[m_n hres[3]->SetBinError(ipt+1,result.at(3));*/ delete tmp; } + if (PRINTDBG>1 && !warnUOBinFrac.empty()) { + std::cout << __FILE__ << "\t\t WARNING: " << m_getMeanWidth.reportUOBinVal(hres[0]->GetName(),warnUOBinFrac) << std::endl; + std::cout << __FILE__ << "\t\t WARNING: " << m_getMeanWidth.reportUOBinVal(hres[1]->GetName(),warnUOBinFrac) << std::endl; + } } } @@ -1286,7 +1346,10 @@ InDetPerfPlot_resITk_pproc::cloneHistogram(TH1D* h, TH1* hcopy) { void InDetPerfPlot_resITk_pproc::makeResolutions(TH3* h, TH1* hres_eta[4][4], TH1* hres_pt[4][4]) { - + + // warnings in case input histograms have large % events in under- and over- flow bins + vector< std::pair<unsigned int,double> > warnUOBinFrac; + float BinEta[5] = { 0.0, 1.0, 1.5, 2.7, 5.0 }; @@ -1318,12 +1381,20 @@ InDetPerfPlot_resITk_pproc::makeResolutions(TH3* h, TH1* hres_eta[4][4], TH1* hr hres_eta[ieta][0]->SetBinError(ipt + 1, result.at(1)); hres_eta[ieta][1]->SetBinContent(ipt + 1, result.at(2)); hres_eta[ieta][1]->SetBinError(ipt + 1, result.at(3)); + if (result.size()>6 && result.at(6)>0.) + warnUOBinFrac.push_back(std::make_pair(ieta + 1,result.at(6))); delete tmp1; delete tmp2; } + if (PRINTDBG>1 && !warnUOBinFrac.empty()) { + std::cout << __FILE__ << "\t\t WARNING: " << m_getMeanWidth.reportUOBinVal(hres_eta[ieta][0]->GetName(),warnUOBinFrac) << std::endl; + std::cout << __FILE__ << "\t\t WARNING: " << m_getMeanWidth.reportUOBinVal(hres_eta[ieta][1]->GetName(),warnUOBinFrac) << std::endl; + } } for (unsigned int ipt = 0; ipt < 4; ipt++) { + if (!warnUOBinFrac.empty()) + warnUOBinFrac.clear(); for (unsigned int ieta = 0; ieta < m_nEtaBins; ieta++) { std::string tmpName = h->GetName() + std::string("pz_binPt") + std::to_string(ipt + 1) + std::string("pz_binEta") + std::to_string(ieta + 1); @@ -1340,12 +1411,22 @@ InDetPerfPlot_resITk_pproc::makeResolutions(TH3* h, TH1* hres_eta[4][4], TH1* hr hres_pt[ipt][0]->SetBinError(ieta + 1, result.at(1)); hres_pt[ipt][1]->SetBinContent(ieta + 1, result.at(2)); hres_pt[ipt][1]->SetBinError(ieta + 1, result.at(3)); + if (result.size()>6 && result.at(6)>0.) + warnUOBinFrac.push_back(std::make_pair(ieta + 1,result.at(6))); delete tmp; } + if (PRINTDBG>1 && !warnUOBinFrac.empty()) { + std::cout << __FILE__ << "\t\t WARNING: " << m_getMeanWidth.reportUOBinVal(hres_pt[ipt][0]->GetName(),warnUOBinFrac) << std::endl; + std::cout << __FILE__ << "\t\t WARNING: " << m_getMeanWidth.reportUOBinVal(hres_pt[ipt][1]->GetName(),warnUOBinFrac) << std::endl; + } } } // end of InDetPerfPlot_resITk_pproc::makeResolutions ///..................................................................................... +//..................................................................................... +// ----- carbon-copy of src/InDetPerfPlot_resITk.cxx's finalizePlots() + replace ATHENA_MSG with std::cout +// also copy over any functions InDetPerfPlot_resITk.cxx's finalizePlots() calls +// needs to be kept in synch with InDetPerfPlot_resITk.cxx's finalizePlots() manually void InDetPerfPlot_resITk_pproc::finalizePlots() { for (unsigned int iparam = 0; iparam < NPARAMS; iparam++) { @@ -1389,26 +1470,7 @@ void InDetPerfPlot_resITk_pproc::finalizePlots() { m_significance_z0_vs_eta->SetBinContent(ieta + 1, tmp->GetRMS()); m_significance_z0_vs_eta->SetBinError(ieta + 1, tmp->GetRMSError()); } - - for (int ieta = 0; ieta < m_nEtaBins; ieta++) { - std::vector<float> result; - getMeanWidthResultsModUnits(m_fix_qoverpt_res[ieta], result, m_meanWidthMethod); - m_fix_qoverptresolutionRMS_vs_eta->SetBinContent(ieta + 1, result.at(0)); - m_fix_qoverptresolutionRMS_vs_eta->SetBinError(ieta + 1, result.at(1)); - } - - for (int ieta = 0; ieta < m_nEtaBins; ieta++) { - std::vector<float> result; - getMeanWidthResultsModUnits(m_fix_d0_res[ieta], result, m_meanWidthMethod); - m_fix_d0resolutionRMS_vs_eta->SetBinContent(ieta + 1, result.at(0)); - m_fix_d0resolutionRMS_vs_eta->SetBinError(ieta + 1, result.at(1)); - } - for (int ieta = 0; ieta < m_nEtaBins; ieta++) { - std::vector<float> result; - getMeanWidthResultsModUnits(m_fix_z0_res[ieta], result, m_meanWidthMethod); - m_fix_z0resolutionRMS_vs_eta->SetBinContent(ieta + 1, result.at(0)); - m_fix_z0resolutionRMS_vs_eta->SetBinError(ieta + 1, result.at(1)); - } + return; } // end of InDetPerfPlot_resITk_pproc::finalizePlots() //.................................................................................... diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/run_postprocess.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/run_postprocess.sh index 162cb992d989bf9e0e1c3866db77d51702058212..a6094733b77de173328ea6c4274118df541e0180 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/run_postprocess.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/run_postprocess.sh @@ -37,9 +37,10 @@ if [[ "$#" < "$NMANDARGS" ]]; then exit 1; fi +# no hadd options support (eg -f etc); keep it simple if [[ "$#" > "$NMANDARGS" ]]; then echo "---------------------------------------------------------------------------------------" - echo "$0 : hadd-ing histograms that do not require dedicated postprocessing" + echo "$0 : 1st step: hadd-ing histograms" echo "---------------------------------------------------------------------------------------" hadd $@ if [[ "0" != "$?" ]]; then @@ -49,13 +50,13 @@ if [[ "$#" > "$NMANDARGS" ]]; then fi echo "---------------------------------------------------------------------------------------" -echo "$0 : compiling posprocessing script" +echo "$0 : 2nd step: compiling posprocessing script" echo "---------------------------------------------------------------------------------------" NAME=postprocessHistos g++ -O2 -Wall -fPIC -std=c++11 $(root-config --cflags) -o ${NAME} ${NAME}.cxx $(root-config --libs) echo "---------------------------------------------------------------------------------------" -echo "$0 : running postprocessing" +echo "$0 : 3rd step: running postprocessing" echo "---------------------------------------------------------------------------------------" ./postprocessHistos $1 if [[ "0" != "$?" ]]; then diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/AthTruthSelectionTool.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/AthTruthSelectionTool.cxx index dbb13bfb00d50eef793918f6b476ede30081eada..7096e63a1cb2bb4ffdfe0375194c28590ea7956c 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/AthTruthSelectionTool.cxx +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/AthTruthSelectionTool.cxx @@ -257,7 +257,7 @@ std::string AthTruthSelectionTool::str() const { return m_cutFlow.report(); } -//Following is from Simone Pagan-Griso, to be re-incorporated for specific studies + /* bool AthTruthSelectionTool::acceptExtrapolatedTPToSurface(const xAOD::TruthParticle& p) const { diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/GetMeanWidth.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/GetMeanWidth.cxx index eb8ef3ff2c57edec4460eda5942d72cd6d01519c..7b35d6c61d1dd5cd1bc66489b3c3c72c44987252 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/GetMeanWidth.cxx +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/GetMeanWidth.cxx @@ -9,6 +9,13 @@ **/ #include "GetMeanWidth.h" +#include "TH1.h" +#include "TFitResultPtr.h" +#include "TFitResult.h" +#include <cmath> +#include <sstream> +#include <iostream> +#include <iomanip> namespace IDPVM { @@ -19,12 +26,17 @@ namespace IDPVM { m_RMSError(0.), m_FracOut(0.), m_FracOutUnc(0.), - m_inHistName("") { + m_FracUOflow(0.), + m_inHistName(""), + m_largeErrorFact(10.), + m_maxUOflowFrac(0.001) { //nop } bool GetMeanWidth::initialize(TH1* p_input_hist) { + if ( !m_debugs.empty()) + m_debugs.clear(); if ( !m_infos.empty()) m_infos.clear(); if ( !m_warnings.empty()) @@ -41,7 +53,7 @@ namespace IDPVM { m_inHistName = p_input_hist->GetName(); if ( 0==p_input_hist->GetEntries() ) { - m_infos.push_back("GetMeanWidth::initialize: got input histogram with 0 entries: "+ m_inHistName); + m_debugs.push_back("GetMeanWidth::initialize: got input histogram with 0 entries: "+ m_inHistName); m_mean=m_meanError=m_RMS=m_RMSError=m_FracOut=m_FracOutUnc=0.; return false; } @@ -52,9 +64,33 @@ namespace IDPVM { m_meanError = p_input_hist->GetMeanError(); m_FracOut = 0.; m_FracOutUnc = 0.; + double nExclUOflow = p_input_hist->Integral(1,p_input_hist->GetNbinsX()); + double nInclUOflow = p_input_hist->Integral(0,p_input_hist->GetNbinsX()+1); + double fUOflow = (nExclUOflow>0.) ? (nInclUOflow-nExclUOflow)/nExclUOflow : -1.; + m_FracUOflow = (fUOflow>m_maxUOflowFrac) ? fUOflow : -1; return true; } + + void GetMeanWidth::setLargeError() { + std::ostringstream debugl; + debugl << __FILE__ << "\t\t" << m_inHistName + << ": scaling mean and RMS errors by factor: " << m_largeErrorFact; + m_debugs.push_back(debugl.str()); + m_meanError*=m_largeErrorFact; + m_RMSError*=m_largeErrorFact; + } + + std::string GetMeanWidth::reportUOBinVal(std::string p_histName, std::vector< std::pair<unsigned int,double> > p_vecBinVal) { + std::ostringstream reportl; + if (!p_vecBinVal.empty()) { + reportl << "Errors scaled up for resol. hist. with large % of events in over- and under-flow: " + << p_histName<<": "; + for ( auto it : p_vecBinVal ) + reportl << "bin"<<it.first << ": " << std::setprecision(2) << it.second*100. << "%, "; + } + return reportl.str(); + } void GetMeanWidth::setFout(double p_nsig,double p_ntot) { m_FracOut=0.; @@ -66,7 +102,7 @@ namespace IDPVM { } if (nout > 0.) { m_FracOut=nout/p_nsig; - m_FracOutUnc=(nout / p_ntot) * TMath::Sqrt(1. / nout + 1. / p_ntot); + m_FracOutUnc=(nout / p_ntot) * std::sqrt(1. / nout + 1. / p_ntot); } } return; @@ -90,7 +126,7 @@ namespace IDPVM { // get fraction of events outside 3*RMS + its ~ uncertainty double nSig = p_input_hist->Integral(p_input_hist->GetXaxis()->FindBin(-3.0 * m_RMS), p_input_hist->GetXaxis()->FindBin(3.0 * m_RMS)); - double nTot = p_input_hist->Integral(); + double nTot = p_input_hist->Integral(1,p_input_hist->GetNbinsX()); setFout(nSig,nTot); // return fit status @@ -112,27 +148,28 @@ namespace IDPVM { // iteration counters and helpers: // min and max range of the histogram: - double min=0.; - double max=0.; + double xmin=0.; + double xmax=0.; // min and max bins of the histogram in previous iteration // 0-th iteration: range of the original histogram int binmin_was = 1; int binmax_was = p_input_hist->GetNbinsX(); // initial number of iteration steps unsigned int ntries = 0; - + // iteratively cut tails untill the RMS gets stable about mean // RMS stable: when input histogram range after cutting by // +- 3*RMS is same as the range before cutting - while ( ntries<ntries_max ) { + while ( ntries<ntries_max ) { ++ntries; RMS = p_input_hist->GetRMS(); mean = p_input_hist->GetMean(); - min = -1.0*nRMS_width*RMS + mean; - max = nRMS_width*RMS + mean; - // find bins corresponding to new range - int binmin=p_input_hist->GetXaxis()->FindFixBin(min); - int binmax=p_input_hist->GetXaxis()->FindFixBin(max); + xmin = -1.0*nRMS_width*RMS + mean; + xmax = nRMS_width*RMS + mean; + // find bins corresponding to new range, disregard underflow + int binmin=std::max(1,p_input_hist->GetXaxis()->FindFixBin(xmin)); + // find bins corresponding to new range, disregard overflow + int binmax=std::min(p_input_hist->GetNbinsX(),p_input_hist->GetXaxis()->FindFixBin(xmax)); // end iteration if these are same bins as in prev. iteration if ( binmin_was==binmin && binmax_was==binmax ) { break; @@ -152,8 +189,9 @@ namespace IDPVM { m_meanError=p_input_hist->GetMeanError(); // get fraction of excluded events + its ~ uncertainty - double nSig = p_input_hist->Integral(p_input_hist->GetXaxis()->FindBin(min), - p_input_hist->GetXaxis()->FindBin(max)); + double nSig = p_input_hist->Integral(p_input_hist->GetXaxis()->FindBin(xmin), + p_input_hist->GetXaxis()->FindBin(xmax)); + // disregard under- and over- flow double nTot = p_input_hist->Integral(1,p_input_hist->GetNbinsX()); setFout(nSig,nTot); @@ -173,26 +211,36 @@ namespace IDPVM { if (iterRMS_convergence == p_method) { if ( !setIterativeConvergence(p_input_hist) ) - m_warnings.push_back("GetMeanWidth::setIterativeConvergence did not converge for "+ m_inHistName); + m_warnings.push_back("\t\t\t* GetMeanWidth::setIterativeConvergence did not converge for "+ m_inHistName); } else if (Gauss_fit == p_method) { if ( !setGaussFit(p_input_hist) ) - m_warnings.push_back("GetMeanWidth::setGaussFit: fit failed for "+ m_inHistName); + m_warnings.push_back("\t\t\t* GetMeanWidth::setGaussFit: fit failed for "+ m_inHistName); } else if (fusion_iterRMS_Gaussfit == p_method) { if ( !setIterativeConvergence(p_input_hist) && !setGaussFit(p_input_hist) ) - m_warnings.push_back("GetMeanWidth::fusion_iterRMS_Gaussfit both methods failed for "+ m_inHistName); + m_warnings.push_back("\t\t\t* GetMeanWidth::fusion_iterRMS_Gaussfit both methods failed for "+ m_inHistName); } else { - m_errors.push_back("GetMeanWidth::setResults: method not supported. No evaluation for "+ m_inHistName); + m_errors.push_back("\t\t\t* GetMeanWidth::setResults: method not supported. No evaluation for "+ m_inHistName); } - + + // check if large fraction of events was in over- and under-flow + if ( m_FracUOflow > 0. ) { + std::ostringstream debugl; + debugl << "\tGetMeanWidth::setResults: too large fraction of out-of-range events for histogram "; + debugl << m_inHistName << ": " << m_FracUOflow << " > " << m_maxUOflowFrac; + m_debugs.push_back(debugl.str()); + setLargeError(); + m_debugs.push_back("\t\t\t* GetMeanWidth::setResults: scaling errors up for " + +m_inHistName+". Too many under- and over- flows."); + } + // reset range metadata to state prior to iteration // this gets changed in iterative or fusion) p_input_hist->GetXaxis()->SetRange(1,p_input_hist->GetNbinsX()); return; } - }//end of namespace diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/GetMeanWidth.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/GetMeanWidth.h index 98b9fc0fc341729d4c106b474f6ae965ada146a3..22a0018384d7c459af0846d90641ee19789613d7 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/GetMeanWidth.h +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/GetMeanWidth.h @@ -10,17 +10,14 @@ * @author Max Baugh, Liza Mijovic, Nora Pettersson **/ -#include <iostream> -#include <vector> -#include "TH1.h" -#include "TFitResultPtr.h" -#include "TFitResult.h" -#include "TMath.h" -using std::string; -using std::vector; +#include <vector> +#include <string> +#include <utility> + +class TH1; /* Helper class to evaluate mean and RMS using dedicated methods useful eg for histograms with long tails etc. @@ -34,45 +31,71 @@ namespace IDPVM { // nop }; - // methods acc to which mean&RMS can be evaluated + /// methods acc to which mean&RMS can be evaluated enum methods { iterRMS_convergence, Gauss_fit, fusion_iterRMS_Gaussfit }; // wrapper to set mean,rms,and fraction of events in tails // nb: some of the methods are allowed to modify input histogram void setResults(TH1* p_input_hist, methods p_method); - // results getters + /// results getters double getMean() { return m_mean; }; double getMeanError() { return m_meanError; }; double getRMS() { return m_RMS; }; double getRMSError() { return m_RMSError; }; + /** 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 + **/ double getFracOut() { return m_FracOut; }; double getFracOutUnc() { return m_FracOutUnc; }; - // return and clear accumulated warnings and errors - vector<string> getInfos() { return m_infos; }; - vector<string> getWarnings() { return m_warnings; }; - vector<string> getErrors() { return m_errors; }; - + /** 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 + **/ + double getFracUOflow() { return m_FracUOflow; }; + /** helper to report bin and fraction of under-/over- flow events, + * as accumulated by top-level pull or resolution histogram + **/ + std::string reportUOBinVal(std::string p_histName, std::vector< std::pair<unsigned int,double> > p_vecBinVal); + ///return accumulated messages + //@{ + std::vector<std::string> getDebugs() { return m_debugs; }; + std::vector<std::string> getInfos() { return m_infos; }; + std::vector<std::string> getWarnings() { return m_warnings; }; + std::vector<std::string> getErrors() { return m_errors; }; + //@} private: // use gaussian fit, return 0 in case of successful fit int setGaussFit(TH1* p_input_hist); - // iteratively change histogram range, until convergence - // return # remaining iterations before hitting the max. allowed + /// iteratively change histogram range, until convergence + /// return # remaining iterations before hitting the max. allowed int setIterativeConvergence(TH1* p_input_hist); - // evaluate the fraction of evens out of signal region and its uncertainty - void setFout(double p_nsig,double p_ntot); - // helper to fill-in starting values of the results vector + /// evaluate the fraction of evens out of signal region and its uncertainty + void setFout(double p_nsig,double p_ntot); + /// set large mean and RMS errors in case we eg. exclude too many events during evaluation + void setLargeError(); + /// helper to fill-in starting values of the results vector bool initialize(TH1* p_input_hist); - // results/outputs: - double m_mean,m_meanError,m_RMS,m_RMSError,m_FracOut,m_FracOutUnc; - vector<string> m_infos; - vector<string> m_warnings; - vector<string> m_errors; + /// results/outputs: + //@{ + double m_mean,m_meanError,m_RMS,m_RMSError,m_FracOut,m_FracOutUnc,m_FracUOflow; + std::vector<std::string> m_debugs; + std::vector<std::string> m_infos; + std::vector<std::string> m_warnings; + std::vector<std::string> m_errors; + //@} //helpers - string m_inHistName; + std::string m_inHistName; + // increase mean and RMS errors by this factor in case of ambiguous evaluation + // ... eg in case we eg. exclude too many events during evaluation + double m_largeErrorFact; + // maximum fraction of Under- and Overflow events we tolerate + double m_maxUOflowFrac; }; -} +} // end of namespace #endif diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetDummyPlots.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetDummyPlots.cxx index e8d621ea318144b1b1af753350b092ebecb27752..f366b8800f992abb63cda22601a0fee94c4d6790 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetDummyPlots.cxx +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetDummyPlots.cxx @@ -250,7 +250,10 @@ InDetDummyPlots::minDR(float min_dR, float prod_rad, float bestmatch, double BID fillHisto(m_minimum_delta_R_not_found_overall, min_dR); } + //fillHisto(m_charge_vs_truth_match_rate, truth_pt, cvst); fillHisto(m_min_dR_vs_delta_inverse_pt, BIDPt, min_dR); + //fillHisto(m_charge_truth_agreement, prod_rad, cvst); + //fillHisto(m_truth_vs_charge_product, charge_product, bestmatch); } void diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_res.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_res.cxx index fe3ef61b397df297278501cef212c0d2cde4d298..07660619598a03960341668aef87f5a617baae93 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_res.cxx +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_res.cxx @@ -396,6 +396,11 @@ InDetPerfPlot_res::finalizePlots() { } for (unsigned int var(0); var != NPARAMS; ++var) { if (m_meanPlots[var]) { + // warnings in case input histograms have large % events in under- and over- flow bins + std::vector< std::pair<unsigned int,double> > warnUOBinEtaRes; + std::vector< std::pair<unsigned int,double> > warnUOBinEtaPull; + std::vector< std::pair<unsigned int,double> > warnUOBinPtRes; + unsigned int etaBins = m_meanPlots[var]->GetNbinsX(); auto& meanbasePlot = m_meanbasePlots[var]; auto& pullbasePlot = m_pullbasePlots[var]; @@ -404,13 +409,33 @@ InDetPerfPlot_res::finalizePlots() { TH1D* temp = meanbasePlot->ProjectionY(Form("%s_projy_bin%d", "Big_Histo", j), j, j); TH1D* temp_pull = pullbasePlot->ProjectionY(Form("%s_projy_bin%d", "Pull_Histo", j), j, j); Refinement(temp, m_meanWidthMethod, var, j, m_meanPlots, m_resoPlots); + if (m_getMeanWidth.getFracUOflow()>0.) + warnUOBinEtaRes.push_back(std::make_pair(j,m_getMeanWidth.getFracUOflow())); Refinement(temp_pull, m_meanWidthMethod, var, j, m_pullmeanPlots, m_pullwidthPlots); + if (m_getMeanWidth.getFracUOflow()>0.) + warnUOBinEtaPull.push_back(std::make_pair(j,m_getMeanWidth.getFracUOflow())); + } + // print warnings in case of under- and over- flows + if (!warnUOBinEtaRes.empty()) { + ATH_MSG_WARNING(m_getMeanWidth.reportUOBinVal(m_meanPlots[var]->GetName(),warnUOBinEtaRes)); + ATH_MSG_WARNING(m_getMeanWidth.reportUOBinVal(m_resoPlots[var]->GetName(),warnUOBinEtaRes)); + } + if (!warnUOBinEtaPull.empty()) { + ATH_MSG_WARNING(m_getMeanWidth.reportUOBinVal(m_pullmeanPlots[var]->GetName(),warnUOBinEtaPull)); + ATH_MSG_WARNING(m_getMeanWidth.reportUOBinVal(m_pullwidthPlots[var]->GetName(),warnUOBinEtaPull)); } auto& mean_vs_ptbasePlot = m_mean_vs_ptbasePlots[var]; for (unsigned int i = 1; i <= ptBins; i++) { TH1D* temp = mean_vs_ptbasePlot->ProjectionY(Form("%s_projy_bin%d", "Big_Histo", i), i, i); Refinement(temp, m_meanWidthMethod, var, i, m_mean_vs_ptPlots, m_resptPlots); + if (m_getMeanWidth.getFracUOflow()>0.) + warnUOBinPtRes.push_back(std::make_pair(i,m_getMeanWidth.getFracUOflow())); + } + // print warnings in case of under- and over- flows + if (!warnUOBinPtRes.empty()) { + ATH_MSG_WARNING(m_getMeanWidth.reportUOBinVal(m_mean_vs_ptPlots[var]->GetName(),warnUOBinPtRes)); + ATH_MSG_WARNING(m_getMeanWidth.reportUOBinVal(m_resptPlots[var]->GetName(),warnUOBinPtRes)); } } } -} +}// end of InDetPerfPlot_res::finalizePlots() diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_resITk.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_resITk.cxx index efdf23aed19fd97762bace24b98d4ce5c4acd1b9..96a970e9e4d410e344cd0aaf0f84d760da96b4c7 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_resITk.cxx +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_resITk.cxx @@ -10,8 +10,10 @@ #include "InDetPerfPlot_resITk.h" // #include <iostream> #include <map> +#include <utility> +#include <cmath> -InDetPerfPlot_resITk::InDetPerfPlot_resITk(PlotBase* pParent, const std::string& sDir) : PlotBase(pParent, sDir), +InDetPerfPlot_resITk::InDetPerfPlot_resITk(InDetPlotBase* pParent, const std::string& sDir) : InDetPlotBase(pParent, sDir), m_meanWidthMethod(IDPVM::GetMeanWidth::iterRMS_convergence), m_primTrk(false), m_secdTrk(false), @@ -91,14 +93,8 @@ InDetPerfPlot_resITk::InDetPerfPlot_resITk(PlotBase* pParent, const std::string& m_significance_z0{}, m_significance_d0_vs_eta{}, - m_significance_z0_vs_eta{}, - - m_fix_qoverpt_res{}, - m_fix_qoverptresolutionRMS_vs_eta{}, - m_fix_d0_res{}, - m_fix_d0resolutionRMS_vs_eta{}, - m_fix_z0_res{}, - m_fix_z0resolutionRMS_vs_eta{} { + m_significance_z0_vs_eta{} { + TString tsDir = (TString) sDir; if (tsDir.Contains("Primary")) { @@ -254,6 +250,7 @@ InDetPerfPlot_resITk::InDetPerfPlot_resITk(PlotBase* pParent, const std::string& void InDetPerfPlot_resITk::initializePlots() { + // Bins for resolutions int nBinsEta = 50.0; float nMinEta = -5.0; @@ -553,74 +550,6 @@ InDetPerfPlot_resITk::initializePlots() { m_significance_z0_vs_eta = Book1D("significance_z0_vs_eta", "z0 significance with w.r.t pv; #eta; z_{0} sign width", m_nEtaBins, -4.0, 4.0, false); -// tmp fix for pT resolution -// 16 eta bins - std::string fixName = "fix_qoverpt_res1"; - m_fix_qoverpt_res[0] = Book1D(fixName, fixName, 600, -15.0, 15.0, false); - fixName = "fix_qoverpt_res2"; - m_fix_qoverpt_res[1] = Book1D(fixName, fixName, 600, -5.0, 5.0, false); - fixName = "fix_qoverpt_res3"; - m_fix_qoverpt_res[2] = Book1D(fixName, fixName, 600, -2.0, 2.0, false); - fixName = "fix_qoverpt_res4"; - m_fix_qoverpt_res[3] = Book1D(fixName, fixName, 600, -1.0, 1.0, false); - fixName = "fix_qoverpt_res5"; - m_fix_qoverpt_res[4] = Book1D(fixName, fixName, 600, -1.0, 1.0, false); - fixName = "fix_qoverpt_res6"; - m_fix_qoverpt_res[5] = Book1D(fixName, fixName, 600, -0.5, 0.5, false); - fixName = "fix_qoverpt_res7"; - m_fix_qoverpt_res[6] = Book1D(fixName, fixName, 600, -0.2, 0.2, false); - fixName = "fix_qoverpt_res8"; - m_fix_qoverpt_res[7] = Book1D(fixName, fixName, 600, -0.2, 0.2, false); - - fixName = "fix_qoverpt_res16"; - m_fix_qoverpt_res[15] = Book1D(fixName, fixName, 600, -15.0, 15.0, false); - fixName = "fix_qoverpt_res15"; - m_fix_qoverpt_res[14] = Book1D(fixName, fixName, 600, -5.0, 5.0, false); - fixName = "fix_qoverpt_res14"; - m_fix_qoverpt_res[13] = Book1D(fixName, fixName, 600, -2.0, 2.0, false); - fixName = "fix_qoverpt_res13"; - m_fix_qoverpt_res[12] = Book1D(fixName, fixName, 600, -1.0, 1.0, false); - fixName = "fix_qoverpt_res12"; - m_fix_qoverpt_res[11] = Book1D(fixName, fixName, 600, -1.0, 1.0, false); - fixName = "fix_qoverpt_res11"; - m_fix_qoverpt_res[10] = Book1D(fixName, fixName, 600, -0.5, 0.5, false); - fixName = "fix_qoverpt_res10"; - m_fix_qoverpt_res[9] = Book1D(fixName, fixName, 600, -0.2, 0.2, false); - fixName = "fix_qoverpt_res9"; - m_fix_qoverpt_res[8] = Book1D(fixName, fixName, 600, -0.2, 0.2, false); - - m_fix_qoverptresolutionRMS_vs_eta = Book1D("fix_qoverptresolutionRMS_vs_eta", - "fix_qoverptresolutionRMS_vseta; true particle #eta; p_{T} #times #sigma(1/p_{T})", m_nEtaBins, -4.0, 4.0, - false); - - - - float rangesd0[16] = { - 1.5, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.5 - }; - - float rangesz0[16] = { - 10.0, 10.0, 8.0, 6.0, 6.0, 4.0, 3.0, 2.0, - 2.0, 3.0, 4.0, 6.0, 6.0, 8.0, 10.0, 10.0 - }; - - for (int ieta = 0; ieta < 16; ieta++) { - fixName = "fix_d0_res" + std::to_string(ieta + 1); - m_fix_d0_res[ieta] = Book1D(fixName, fixName, 600, -rangesd0[ieta], rangesd0[ieta], false); - } - m_fix_d0resolutionRMS_vs_eta = Book1D("fix_d0resolutionRMS_vs_eta", - "fix_d0resolutionRMS_vs_eta; true particle #eta; #sigma(d_{0}) [#mum]", - m_nEtaBins, -4.0, 4.0, false); - - - for (int ieta = 0; ieta < 16; ieta++) { - fixName = "fix_z0_res" + std::to_string(ieta + 1); - m_fix_z0_res[ieta] = Book1D(fixName, fixName, 600, -rangesz0[ieta], rangesz0[ieta], false); - } - m_fix_z0resolutionRMS_vs_eta = Book1D("fix_z0resolutionRMS_vs_eta", - "fix_z0resolutionRMS_vs_eta; true particle #eta; #sigma(z_{0}) [#mum]", - m_nEtaBins, -4.0, 4.0, false); } void @@ -737,15 +666,7 @@ InDetPerfPlot_resITk::getPlots() { m_DEBUG_D0dep[iparam]->Fill(m_trkP[iparam], m_trkP[D0]); } - for (int ieta = 0; ieta < m_nEtaBins; ieta++) { - // std::cout << eta << " " << m_EtaBins[ieta+1] << " " << m_EtaBins[ieta] << std::endl; - if (eta < m_EtaBins[ieta + 1] && eta > m_EtaBins[ieta]) { - m_fix_qoverpt_res[ieta]->Fill(m_resP[QOVERPT]); - m_fix_d0_res[ieta]->Fill(m_resP[D0]); - m_fix_z0_res[ieta]->Fill(m_resP[Z0]); - // std::cout << ieta << std::endl; - } - } + m_significance_d0->Fill(eta, m_trkP[D0]); m_significance_z0->Fill(eta, m_trkP[Z0]); } @@ -779,11 +700,11 @@ InDetPerfPlot_resITk::getTrackParameters(const xAOD::TrackParticle& trkprt) { m_trkP[D0] = trkprt.d0(); m_trkP[Z0] = trkprt.z0(); m_trkP[QOVERP] = trkprt.qOverP(); - m_trkP[QOVERPT] = trkprt.qOverP() * (1 / TMath::Sin(trkprt.theta())); + m_trkP[QOVERPT] = trkprt.qOverP() * (1 / std::sin(trkprt.theta())); m_trkP[THETA] = trkprt.theta(); m_trkP[PHI] = trkprt.phi0(); m_trkP[PT] = trkprt.pt() / 1000.; - m_trkP[Z0SIN] = trkprt.z0() * TMath::Sin(trkprt.theta()); + m_trkP[Z0SIN] = trkprt.z0() * std::sin(trkprt.theta()); m_DEBUG_FirstHitR_d0->Fill(trkprt.radiusOfFirstHit(), m_trkP[D0]); @@ -796,15 +717,15 @@ InDetPerfPlot_resITk::getTrackParameters(const xAOD::TrackParticle& trkprt) { } } // Track fit errors - m_trkErrP[D0] = TMath::Sqrt(trkprt.definingParametersCovMatrix()(0, 0)); - m_trkErrP[Z0] = TMath::Sqrt(trkprt.definingParametersCovMatrix()(1, 1)); - m_trkErrP[PHI] = TMath::Sqrt(trkprt.definingParametersCovMatrix()(2, 2)); - m_trkErrP[THETA] = TMath::Sqrt(trkprt.definingParametersCovMatrix()(3, 3)); - m_trkErrP[QOVERP] = TMath::Sqrt(trkprt.definingParametersCovMatrix()(4, 4)); - m_trkErrP[QOVERPT] = m_trkErrP[QOVERP] * (1 / TMath::Sin(trkprt.theta())); + m_trkErrP[D0] = std::sqrt(trkprt.definingParametersCovMatrix()(0, 0)); + m_trkErrP[Z0] = std::sqrt(trkprt.definingParametersCovMatrix()(1, 1)); + m_trkErrP[PHI] = std::sqrt(trkprt.definingParametersCovMatrix()(2, 2)); + m_trkErrP[THETA] = std::sqrt(trkprt.definingParametersCovMatrix()(3, 3)); + m_trkErrP[QOVERP] = std::sqrt(trkprt.definingParametersCovMatrix()(4, 4)); + m_trkErrP[QOVERPT] = m_trkErrP[QOVERP] * (1 / std::sin(trkprt.theta())); m_trkErrP[Z0SIN] = - TMath::Sqrt(pow(m_trkErrP[THETA] * TMath::Sin(m_trkP[THETA]), - 2) + pow(m_trkP[Z0] * m_trkErrP[THETA] * TMath::Cos(m_trkP[THETA]), 2)); + std::sqrt(std::pow(m_trkErrP[THETA] * std::sin(m_trkP[THETA]), + 2) + std::pow(m_trkP[Z0] * m_trkErrP[THETA] * std::cos(m_trkP[THETA]), 2)); // Get error on pT, taken from xAOD::TrackingHelpers.pTErr() but this function only works on a pointer input... if (trkprt.definingParametersCovMatrixVec().size() < 15) { @@ -848,14 +769,14 @@ InDetPerfPlot_resITk::getTrackParameters(const xAOD::TruthParticle& truthprt) { (truthprt.isAvailable<float>("theta") && truthprt.isAvailable<float>("qOverP")) ? m_truetrkP[QOVERPT] = truthprt.auxdata<float>("qOverP") * (1 / - TMath::Sin(truthprt.auxdata<float>("theta"))) : + std::sin(truthprt.auxdata<float>("theta"))) : m_truetrkP[QOVERPT] = -9999.; m_truetrkP[PT] = truthprt.pt() / 1000.; (truthprt.isAvailable<float>("z0") && truthprt.isAvailable<float>("theta")) ? m_truetrkP[Z0SIN] = m_truetrkP[Z0] * - TMath::Sin(m_truetrkP[THETA]) : m_truetrkP[Z0SIN] = + std::sin(m_truetrkP[THETA]) : m_truetrkP[Z0SIN] = -9999.; } @@ -902,31 +823,11 @@ InDetPerfPlot_resITk::finalizePlots() { m_significance_z0_vs_eta->SetBinContent(ieta + 1, tmp->GetRMS()); m_significance_z0_vs_eta->SetBinError(ieta + 1, tmp->GetRMSError()); } - // m_fix_qoverpt_res[8] = Book1D(fixName,fixName,600,-0.2,0.2,false); - - for (int ieta = 0; ieta < m_nEtaBins; ieta++) { - std::vector<float> result; - getMeanWidthResultsModUnits(m_fix_qoverpt_res[ieta], result, m_meanWidthMethod); - m_fix_qoverptresolutionRMS_vs_eta->SetBinContent(ieta + 1, result.at(0)); - m_fix_qoverptresolutionRMS_vs_eta->SetBinError(ieta + 1, result.at(1)); - } - for (int ieta = 0; ieta < m_nEtaBins; ieta++) { - std::vector<float> result; - getMeanWidthResultsModUnits(m_fix_d0_res[ieta], result, m_meanWidthMethod); - m_fix_d0resolutionRMS_vs_eta->SetBinContent(ieta + 1, result.at(0)); - m_fix_d0resolutionRMS_vs_eta->SetBinError(ieta + 1, result.at(1)); - } - for (int ieta = 0; ieta < m_nEtaBins; ieta++) { - std::vector<float> result; - getMeanWidthResultsModUnits(m_fix_z0_res[ieta], result, m_meanWidthMethod); - m_fix_z0resolutionRMS_vs_eta->SetBinContent(ieta + 1, result.at(0)); - m_fix_z0resolutionRMS_vs_eta->SetBinError(ieta + 1, result.at(1)); - } } void -InDetPerfPlot_resITk::getMeanWidthResultsModUnits(TH1* p_input_hist, vector<float>& p_result, +InDetPerfPlot_resITk::getMeanWidthResultsModUnits(TH1* p_input_hist, std::vector<float>& p_result, IDPVM::GetMeanWidth::methods p_method) { // LM: reason for using this function: // orignial code was set up to only have resolution resuls in um, @@ -937,6 +838,14 @@ InDetPerfPlot_resITk::getMeanWidthResultsModUnits(TH1* p_input_hist, vector<floa p_result.clear(); } m_getMeanWidth.setResults(p_input_hist, p_method); + for (auto it : m_getMeanWidth.getDebugs()) + ATH_MSG_DEBUG(it); + for (auto it : m_getMeanWidth.getInfos()) + ATH_MSG_INFO(it); + for (auto it : m_getMeanWidth.getWarnings()) + ATH_MSG_WARNING(it); + for (auto it : m_getMeanWidth.getErrors()) + ATH_MSG_ERROR(it); p_result.push_back(m_getMeanWidth.getRMS()); p_result.push_back(m_getMeanWidth.getRMSError()); p_result.push_back(m_getMeanWidth.getMean()); @@ -968,9 +877,12 @@ InDetPerfPlot_resITk::getMeanWidthResultsModUnits(TH1* p_input_hist, vector<floa void InDetPerfPlot_resITk::makeResolutions(TH2* h, TH1* hres[4]) { + // Should fix this in a better way TString hname = h->GetName(); - + // warnings in case input histograms have large % events in under- and over- flow bins + std::vector< std::pair<unsigned int,double> > warnUOBinFrac; + if (hname.Contains("Helpereta")) { for (unsigned int ieta = 0; ieta < m_nEtaBins; ieta++) { std::string tmpName = h->GetName() + std::string("py_bin") + std::to_string(ieta + 1); @@ -985,6 +897,8 @@ InDetPerfPlot_resITk::makeResolutions(TH2* h, TH1* hres[4]) { hres[0]->SetBinError(ieta + 1, result.at(1)); hres[1]->SetBinContent(ieta + 1, result.at(2)); hres[1]->SetBinError(ieta + 1, result.at(3)); + if (result.size()>6 && result.at(6)>0.) + warnUOBinFrac.push_back(std::make_pair(ieta + 1,result.at(6))); result.clear(); /* std::vector<float> result; @@ -995,8 +909,15 @@ InDetPerfPlot_resITk::makeResolutions(TH2* h, TH1* hres[4]) { hres[3]->SetBinContent(ieta+1,result.at(2)); hres[3]->SetBinError(ieta+1,result.at(3));*/ delete tmp; + } + if (!warnUOBinFrac.empty()) { + ATH_MSG_WARNING(m_getMeanWidth.reportUOBinVal(hres[0]->GetName(),warnUOBinFrac)); + ATH_MSG_WARNING(m_getMeanWidth.reportUOBinVal(hres[1]->GetName(),warnUOBinFrac)); } - } else if (hname.Contains("Helperpt")) { + } + else if (hname.Contains("Helperpt")) { + if (!warnUOBinFrac.empty()) + warnUOBinFrac.clear(); for (unsigned int ipt = 0; ipt < m_nPtBins; ipt++) { std::string tmpName = h->GetName() + std::string("py_bin") + std::to_string(ipt + 1); TH1D* tmp = (TH1D*) h->ProjectionY(tmpName.c_str(), h->GetXaxis()->FindBin(m_PtBins[ipt]), @@ -1010,6 +931,8 @@ InDetPerfPlot_resITk::makeResolutions(TH2* h, TH1* hres[4]) { hres[0]->SetBinError(ipt + 1, result.at(1)); hres[1]->SetBinContent(ipt + 1, result.at(2)); hres[1]->SetBinError(ipt + 1, result.at(3)); + if (result.size()>6 && result.at(6)>0.) + warnUOBinFrac.push_back(std::make_pair(ipt + 1,result.at(6))); result.clear(); /* @@ -1022,13 +945,19 @@ InDetPerfPlot_resITk::makeResolutions(TH2* h, TH1* hres[4]) { hres[3]->SetBinError(ipt+1,result.at(3));*/ delete tmp; } + if (!warnUOBinFrac.empty()) { + ATH_MSG_WARNING(m_getMeanWidth.reportUOBinVal(hres[0]->GetName(),warnUOBinFrac)); + ATH_MSG_WARNING(m_getMeanWidth.reportUOBinVal(hres[1]->GetName(),warnUOBinFrac)); + } } } void InDetPerfPlot_resITk::makeResolutions(TH2* h, TH1* hres[4], TH1* hproj[m_nEtaBins], bool save) { TString hname = h->GetName(); - + // warnings in case input histograms have large % events in under- and over- flow bins + std::vector< std::pair<unsigned int,double> > warnUOBinFrac; + if (hname.Contains("Helpereta")) { for (unsigned int ieta = 0; ieta < m_nEtaBins; ieta++) { std::string tmpName = h->GetName() + std::string("py_bin") + std::to_string(ieta + 1); @@ -1046,6 +975,8 @@ InDetPerfPlot_resITk::makeResolutions(TH2* h, TH1* hres[4], TH1* hproj[m_nEtaBin hres[0]->SetBinError(ieta + 1, result.at(1)); hres[1]->SetBinContent(ieta + 1, result.at(2)); hres[1]->SetBinError(ieta + 1, result.at(3)); + if (result.size()>6 && result.at(6)>0.) + warnUOBinFrac.push_back(std::make_pair(ieta + 1,result.at(6))); result.clear(); /* std::vector<float> result; @@ -1057,7 +988,13 @@ InDetPerfPlot_resITk::makeResolutions(TH2* h, TH1* hres[4], TH1* hproj[m_nEtaBin hres[3]->SetBinError(ieta+1,result.at(3));*/ delete tmp; } + if (!warnUOBinFrac.empty()) { + ATH_MSG_WARNING(m_getMeanWidth.reportUOBinVal(hres[0]->GetName(),warnUOBinFrac)); + ATH_MSG_WARNING(m_getMeanWidth.reportUOBinVal(hres[1]->GetName(),warnUOBinFrac)); + } } else if (hname.Contains("Helperpt")) { + if (!warnUOBinFrac.empty()) + warnUOBinFrac.clear(); for (unsigned int ipt = 0; ipt < m_nPtBins; ipt++) { std::string tmpName = h->GetName() + std::string("py_bin") + std::to_string(ipt + 1); TH1D* tmp = (TH1D*) h->ProjectionY(tmpName.c_str(), h->GetXaxis()->FindBin(m_PtBins[ipt]), @@ -1074,6 +1011,8 @@ InDetPerfPlot_resITk::makeResolutions(TH2* h, TH1* hres[4], TH1* hproj[m_nEtaBin hres[0]->SetBinError(ipt + 1, result.at(1)); hres[1]->SetBinContent(ipt + 1, result.at(2)); hres[1]->SetBinError(ipt + 1, result.at(3)); + if (result.size()>6 && result.at(6)>0.) + warnUOBinFrac.push_back(std::make_pair(ipt + 1,result.at(6))); result.clear(); /* std::vector<float> result; IDPVM::GetMeanWidth::methods altMeanWidthMethod = Gauss_fit; @@ -1084,6 +1023,10 @@ InDetPerfPlot_resITk::makeResolutions(TH2* h, TH1* hres[4], TH1* hproj[m_nEtaBin hres[3]->SetBinError(ipt+1,result.at(3));*/ delete tmp; } + if (!warnUOBinFrac.empty()) { + ATH_MSG_WARNING(m_getMeanWidth.reportUOBinVal(hres[0]->GetName(),warnUOBinFrac)); + ATH_MSG_WARNING(m_getMeanWidth.reportUOBinVal(hres[1]->GetName(),warnUOBinFrac)); + } } } @@ -1101,6 +1044,10 @@ InDetPerfPlot_resITk::cloneHistogram(TH1D* h, TH1* hcopy) { void InDetPerfPlot_resITk::makeResolutions(TH3* h, TH1* hres_eta[4][4], TH1* hres_pt[4][4]) { + + // warnings in case input histograms have large % events in under- and over- flow bins + std::vector< std::pair<unsigned int,double> > warnUOBinFrac; + float BinEta[5] = { 0.0, 1.0, 1.5, 2.7, 5.0 }; @@ -1132,12 +1079,20 @@ InDetPerfPlot_resITk::makeResolutions(TH3* h, TH1* hres_eta[4][4], TH1* hres_pt[ hres_eta[ieta][0]->SetBinError(ipt + 1, result.at(1)); hres_eta[ieta][1]->SetBinContent(ipt + 1, result.at(2)); hres_eta[ieta][1]->SetBinError(ipt + 1, result.at(3)); + if (result.size()>6 && result.at(6)>0.) + warnUOBinFrac.push_back(std::make_pair(ieta + 1,result.at(6))); delete tmp1; delete tmp2; } + if (!warnUOBinFrac.empty()) { + ATH_MSG_WARNING(m_getMeanWidth.reportUOBinVal(hres_eta[ieta][0]->GetName(),warnUOBinFrac)); + ATH_MSG_WARNING(m_getMeanWidth.reportUOBinVal(hres_eta[ieta][1]->GetName(),warnUOBinFrac)); + } } for (unsigned int ipt = 0; ipt < 4; ipt++) { + if (!warnUOBinFrac.empty()) + warnUOBinFrac.clear(); for (unsigned int ieta = 0; ieta < m_nEtaBins; ieta++) { std::string tmpName = h->GetName() + std::string("pz_binPt") + std::to_string(ipt + 1) + std::string("pz_binEta") + std::to_string(ieta + 1); @@ -1154,8 +1109,13 @@ InDetPerfPlot_resITk::makeResolutions(TH3* h, TH1* hres_eta[4][4], TH1* hres_pt[ hres_pt[ipt][0]->SetBinError(ieta + 1, result.at(1)); hres_pt[ipt][1]->SetBinContent(ieta + 1, result.at(2)); hres_pt[ipt][1]->SetBinError(ieta + 1, result.at(3)); + if (result.size()>6 && result.at(6)>0.) + warnUOBinFrac.push_back(std::make_pair(ieta + 1,result.at(6))); delete tmp; } + if (!warnUOBinFrac.empty()) { + ATH_MSG_WARNING(m_getMeanWidth.reportUOBinVal(hres_pt[ipt][0]->GetName(),warnUOBinFrac)); + ATH_MSG_WARNING(m_getMeanWidth.reportUOBinVal(hres_pt[ipt][1]->GetName(),warnUOBinFrac)); + } } } - diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_resITk.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_resITk.h index 1db90a2c73f6c11db71348e81d679061281ba330..577bb8e59dfe54fcf11b988eebcb1c5acc9fc86f 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_resITk.h +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_resITk.h @@ -15,7 +15,7 @@ // local includes -#include "TrkValHistUtils/PlotBase.h" +#include "InDetPlotBase.h" #include "TProfile.h" // could be fwd declared? #include "xAODTracking/TrackParticle.h" @@ -38,7 +38,7 @@ class IExtrapolator; ///class holding res plots for Inner Detector RTT Validation and implementing fill methods -class InDetPerfPlot_resITk: public PlotBase { +class InDetPerfPlot_resITk: public InDetPlotBase { public: enum Param { D0, Z0, QOVERP, QOVERPT, THETA, PHI, PT, Z0SIN, NPARAMS @@ -57,7 +57,7 @@ public: }; - InDetPerfPlot_resITk(PlotBase* pParent, const std::string& dirName); + InDetPerfPlot_resITk(InDetPlotBase* pParent, const std::string& dirName); void fill(const xAOD::TrackParticle& trkprt, const xAOD::TruthParticle& truthprt); // virtual bool isDefined(TString t); @@ -92,7 +92,7 @@ private: void makeResolutions(TH2* h, TH1* h2[m_nResHist]); void makeResolutions(TH3* h, TH1* h2[][m_nResHist], TH1* h3[][m_nResHist]); - void getMeanWidthResultsModUnits(TH1* p_input_hist, vector<float>& p_result, + void getMeanWidthResultsModUnits(TH1* p_input_hist, std::vector<float>& p_result, IDPVM::GetMeanWidth::methods p_method); void getTrackParameters(const xAOD::TruthParticle& truthprt); void getTrackParameters(const xAOD::TrackParticle& truthprt); diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysHitDecoratorTool.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysHitDecoratorTool.cxx index e30148c21f0603a902c80a065fc53b0f064f6273..09c8ae52510a9cffdc41ac59a3ddef74d475d484 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysHitDecoratorTool.cxx +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysHitDecoratorTool.cxx @@ -99,7 +99,7 @@ InDetPhysHitDecoratorTool::decorateTrack(const xAOD::TrackParticle& particle, co typedef std::tuple<int, int, int, float, float, float, float, int, int, int> SingleResult_t; typedef std::vector<SingleResult_t> TrackResult_t; - const float invalidFloat(std::numeric_limits<float>::quiet_NaN()); + const float invalidFloat(-1); // const float invalidDouble(std::numeric_limits<double>::quiet_NaN()); const float invalidRes(invalidFloat), invalidPull(invalidFloat); const int invalidDetector(-1); @@ -187,8 +187,8 @@ InDetPhysHitDecoratorTool::decorateTrack(const xAOD::TrackParticle& particle, co } // Get residuals - old code, remains the same? // define residuals at -1 if no measurement (better way?) - float residualLocY(invalidFloat), pullLocY(invalidFloat);// NaN by default - float residualLocX = -1, pullLocX = -1; // what values? + float residualLocY(invalidFloat), pullLocY(invalidFloat);// -1 by default + float residualLocX = invalidFloat, pullLocX = invalidFloat; // what values? int phiWidth(-1); int etaWidth(-1); std::unique_ptr<const Trk::ResidualPull> residualPull(nullptr); diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/dRMatchingTool.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/dRMatchingTool.h index 039213642743eb8f5ea283bd9229ebea9bb5f05c..f487867e7b2c13f3dcdddbfdcc86afe80114182e 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/dRMatchingTool.h +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/dRMatchingTool.h @@ -56,7 +56,7 @@ * * The tool is able to perform matching wrt. dR as well relative pT-resolution, * i.e. - * @f$ \Delta p_{T}/p_{T} = \frac{|p_{T,this} - p_{T,other}|}{p_{T,this}} @f$ + * \Delta p_{T}/p_{T} = \frac{|p_{T,this} - p_{T,other}|}{p_{T,this}} * The tool is configured such that a successful match means that all set cuts * were passed. That means that if only the dR-cut is set, no pT-resoution cut * is imposed, and conversely. In particular, if neither cut is set, no