PMGCrossSectionTool more safe when reading cross section txt file
Now the tool is more safe when reading the txt file and errors are reported in case the file has problems. Also other minor changes: * Ignore first line of the txt file (since it is a header). Before it was included as a sample * Check if txt file exists * Check if there are problem when parsing the lines, skip in case * Check if file is empty * Use std::map instead of std::vector since the main operations are insertions and searches * Improved error message (remove context information, since it is added by the athena message service) * Parsing of the lines refactorized, much simpler, but same features * Remove non needed includes Changes to the previous behaviour: * No more sample with dsid==0 corresponding to the header (not wanted) * Error messages in casae of: missing files, empty files, lines not in the desidered format * Due to the usage of std::map instead of std::vector, if there are duplicated samples, before the first won, now the last wins. The only case when I can see this to be legitimate is if one wants to overwrite a previous cross section (e.g. the default txt file with an analysis-based txt file), so "the last win" should be the desidered behaviour. Former-commit-id: acdd06be5f260253ad56d472c3dcdd8f131ca055
Showing
- PhysicsAnalysis/AnalysisCommon/PMGTools/PMGTools/PMGCrossSectionTool.h 3 additions, 2 deletions...is/AnalysisCommon/PMGTools/PMGTools/PMGCrossSectionTool.h
- PhysicsAnalysis/AnalysisCommon/PMGTools/Root/PMGCrossSectionTool.cxx 59 additions, 113 deletions...ysis/AnalysisCommon/PMGTools/Root/PMGCrossSectionTool.cxx
Loading
Please register or sign in to comment