Skip to content
Snippets Groups Projects
Commit b2585c32 authored by Ruggero Turra's avatar Ruggero Turra :headphones:
Browse files

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
parent a9dc20b2
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment