Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This replaces the
JANA/JCsvWriter.h
withexamples/CsvWriter
. The reasoning is as follows:JCsvWriter produces a format that is not particularly useful for anybody. It produces a single CSV file containing a table with rows for all objects in a particular collection over a range of events. Unlike JInspector, it can't be used interactively or from a debugger. Because it is a class template, it can't be put in its own plugin; to use it requires recompilation. However, since running it imposes a dramatic performance penalty, it should only be run for debugging! Finally, it only works with JObject-based data models, and hence can't be used with EICrecon at all. Halld_recon users, meanwhile, would prefer hd_dump or janadump because those (a) are interactive, (b) print multiple collections from a single event without recompilation, and (c) live in an independent plugin.
Aside from the clear functional deficiencies, JCsvWriter has design deficiencies. Firstly, it is a class template rather than a class. This goes against the principle of keeping the surface area of templates small. Secondly, the templating is unnecessary, because all of the information that JCsvWriter extracts from its target collection lives at the JObject level. Finally, the ability to extract entire families of data model objects from the JEvent is an action most JANA users need, but have no example for, and the current JCsvWriter obfuscates this rather than clarifies it.
Users do not need JCsvWriter; they have JInspector, hd_dump, and regressiontest, each of which serves at least one use case more effectively than JCsvWriter. What users do need is a simple example of how to generically extract JObjects from a JEvent, how to use JObjectSummaries, and how to leverage the plugin architecture to add functionality at runtime. JCsvWriter is conceptually simple enough that users can learn from the source code without being bogged down by the details of other APIs or file formats.
To bring this about, JCsvWriter should be moved out of the core JANA library and into examples. It should be de-templatized, redesigned so that it prints the contents of multiple collections per event, and extensively commented. It should use the new CallbackMode::ExpertMode interface and Parameter helpers, to help test the new interface out, and help users get used to them.