PandoraPFA / LCContent

Algorithms and tools for LC event reconstruction
GNU General Public License v3.0
2 stars 10 forks source link

Create LCContent/EventWritingAlgorithm #17

Closed andresailer closed 7 years ago

andresailer commented 7 years ago

https://github.com/PandoraPFA/LCContent/pull/16#discussion_r140034006

Testing is a bit involved if you've not done it before. What you need to do (or Steve might have time to take a look; we haven't talked about this in detail yet) is implement a LC-specific version of the SDK-provided EventWriting and EventReading algorithms (could inherit most functionality). You'd then need to register your factory objects with the EventWriter/EventReader instance.

To test, you'd then run a LC job, with an EventWriting algorithm instance running as e.g. the first (might as well, for clarity) algorithm. You can then reproduce the same reconstruction input, then output, using the LCReco entry point application (see LCReco on GitHub), running a standard PandoraSettings file, but with an instance of the EventReading algorithm first up.

https://github.com/PandoraPFA/LCContent/pull/16#discussion_r140593664

There's some examples (a little bit involved) of how we have done this for the LArTPC use case, linked below. The idea is that you just need to register the factories with the pandora:: FileWriter and pandora::FileWriter, then proceed as before.

https://github.com/PandoraPFA/LArContent/blob/master/larpandoracontent/LArPersistency/EventWritingAlgorithm.cc#L113 https://github.com/PandoraPFA/LArContent/blob/master/larpandoracontent/LArPersistency/EventReadingAlgorithm.cc#L140

When writing or reading e.g. a Track, the existing derived binary and xml implementations will pass control to the registered factory to do their "extra" bit of writing/reading before working with the standard object properties described in the SDK.

https://github.com/PandoraPFA/PandoraSDK/blob/master/src/Persistency/BinaryFileWriter.cc#L274 https://github.com/PandoraPFA/PandoraSDK/blob/master/src/Persistency/XmlFileWriter.cc#L283

https://github.com/PandoraPFA/PandoraSDK/blob/master/src/Persistency/BinaryFileReader.cc#L650 https://github.com/PandoraPFA/PandoraSDK/blob/master/src/Persistency/XmlFileReader.cc#L617

andresailer commented 7 years ago

Looking at the LAREventWritingAlgorithm, it does not inherit from the SDK EventWritingAlgorithm. Did you ( @PandoraPFA ) not mean literally inherit, but inherit by copy-and-paste?

PandoraPFA commented 7 years ago

There's no good reason why this didn't happen - it should have. If you're not trying to do anything too ambitious, i.e. just register some new factories, then inheriting most functionality should ease future maintenance and improve clarity. I can't recall the original decisions for LArEventWriting/Reading, but these algorithms (esp. Reading) do have some additional goals and complexities.

andresailer commented 7 years ago

Solved by #18