Skip to content

2021 Spring cleaning

Maximilian Emanuel Goblirsch-Kolb requested to merge Dev21 into master

While we wait for spring, covid vaccination, world peace, and my neigbourhood baker to finally resume baking those delicious cookie/nougat/chocolate/almond rings he apparently stopped making 3 years ago (😠), I started spring cleaning NTAU a bit.

These changes are intended to greatly improve accessibility and break down some ugly tightly coupled functionality into more modular components.

  • My main victim is the Plot class, which went from O(10) constructors with at least 5 arguments to a single one with two arguments.

  • The PostProcessor is gone, it will instead be absorbed into the (more powerful) populators which can be daisy-chained a la NormaliseToUnitWidth(ExtractSlice(RunHistoFiller(myBinning, mySample, mySelection,myFillInstruction))). This logic will make it possible to define entire processing chains including ratio plots, efficiency calculations, etc, in the up-front declarative format of the Plot constructor, and lazy evaluation will populate everything without additional overhead.

  • I also do away with names having to be distinct for objects passed into the HistoFiller and remove them for good. The only case where we still need a name is the reference object used to define a binning.

  • The legend option and format are removed from the Plot and migrate to the PlotFormat. This will make IDPVM-plotting-style workloads more convenient.

  • To no longer have to worry about forgetting to call populate() for a plot before use, I made this automatically happen when trying to access the underlying histogram in a non-const context. Please note that if the first access to the histo happens in a const context, you should still call populate() in advance the old fashioned way, to ensure the populating has happened (since we can not do this anymore on a const Plot...)

  • I reorganized the headers into a few distinct areas to make it clearer what does what. A top-level header is provided to get all NTAU components in a client package / program without having to worry about sorting out which files need to be included

  • the bloated PlotUtils namespace is being split into an entire set of headers in the "Helpers" folder.

  • the PlotFormat class was internally refactored, making it more easy to add new settings. It now also supports user-defined int/float/string-typed settings "on the fly", similar in concept to xAOD decorations. This should make it easier to pass analysis/use-case specific info down the chain.

  • the CanvasOptions was refactored as well and now uses the same type for its data members as the PlotFormat. It is now a pure data class, with functionality handed over to the PlotUtils namespace.

  • we now have unit tests! Hopefully this will help reduce the number of "silent" bugs lurking in the codebase.

  • and we have a lovely CI pipeline, which will spam us with e-mails for every MR! Yay? 😨

So far the ideas are in place and things compile... It will likely take some work until they run.

Obviously, this will not be backward compatible, and we will need to make a legacy branch of the current NTAU before this can be merged.

CCing @zschilla @jojungge for information, feedback, feature requests and the invitation to collaborate 😉

Edited by Maximilian Emanuel Goblirsch-Kolb

Merge request reports