LDMX-Software / ldmx-sw

The Light Dark Matter eXperiment simulation and reconstruction framework.
https://ldmx-software.github.io
GNU General Public License v3.0
21 stars 19 forks source link

When biasing, only events which are fully processed should be written out. #49

Closed omar-moreno closed 7 years ago

omar-moreno commented 7 years ago

Currently, even if an event doesn't pass the biasing conditions, the MC particles and sim hits are still written to the ROOT file. A user should be able to control which events are written out.

JeremyMcCormick commented 7 years ago

Probably the cleanest way to do this is raising a G4Exception in your biasing code with a severity level of EventMustBeAborted which should cause the event to be aborted in the run manager. I assume then that the AnalyzeEvent() method of the persistency manager will not be called which is where the event is written out. If it is called even when the event is aborted, we could check the state of the run manager to see if the event is being aborted and skip writing out the ROOT event for those events.

I don't think we want to skip writing events based on whether some hits collection is filled or not. It could be empty for some other reason than the biasing plugin.

JeremyMcCormick commented 7 years ago

Is this still a problem with your photonuclear biasing class?

I see you call AbortEvent() from within your code and I believe if this is working correctly then the end of event IO should not be activated. Is that what you're seeing?

omar-moreno commented 7 years ago

No, even though I call AbortEvent, the event gets written out. I'm going to look into this now.

JeremyMcCormick commented 7 years ago

Okay, probably the persistency manager needs to check in AnalyzeEvent() that the run manager isn't aborting the event. That would be easy to add.

I know there is a hard abort for run called with AbortRun(false) but I didn't see a similar option on the AbortEvent() method.

On Thursday, November 10, 2016, Omar Moreno notifications@github.com wrote:

No, even though I call AbortEvent, the event gets written out. I'm going to look into this now.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/LDMXAnalysis/ldmx-sw/issues/49#issuecomment-259807820, or mute the thread https://github.com/notifications/unsubscribe-auth/ACF68yy5YEsJjNNg97RG2wvJiKs1DurQks5q84eogaJpZM4Kt0Xl .

omar-moreno commented 7 years ago

I'm testing something now. I'll commit it if it works.

JeremyMcCormick commented 7 years ago

Also, we should also make sure that aborting the event does not cause a memory leak because an object is not cleared or deleted properly.