ldmx-sw icon indicating copy to clipboard operation
ldmx-sw copied to clipboard

Create DeepEcalProcessFilter

Open tvami opened this issue 1 year ago • 3 comments

Is your feature request related to a problem? Please describe.

We currently dont have a filter that would concentrate on having a brem in the deeper layers of ECAL

Describe the solution you'd like

Make DeepEcalProcessFilter that keeps events that undergo a conversion process in the Ecal-back (definition of that should be configurable)

Additional context

See @tylerhoroho-UVA 's talk at the SWAN meeting today: https://indico.fnal.gov/event/64332/timetable/#16-late-showering-photon-backg

tvami avatar Apr 22 '24 18:04 tvami

I would suggest looking at the design of the EcalDarkBremFilter and similar filters I developed for the EaT analysis. They make use of the PartialEnergySorter user action which forces Geant4 to process all particles above a certain energy first. This is different from its default behavior of just processing the last particle that was created (unwinding a stack) and is much more performant when users need to make a "mid-shower" filtering decision.

The PartialEnergySorter, as a "stacking" action, defines two[^1] "stages" of the simulation. In the first stage, all of the particles above the input threshold are processed. In the second stage, the rest of the particles are processed. Geant4 has a callback for when stages are being changed NewStage which we allow actions to implement. This function is where you could make your check in the middle of a shower. Besides the EcalDarkBremFilter, the other mid-shower filters also rely on this behavior. You'll see all of them make the primary keep/abort decision within the NewStage function.

Since this is mainly position based rather than energy based, we could think about writing a new action similar to PartialEnergySorter which prefers processing particles that are deeper than others. However, this stack manipulation is complicated so if you can define an energy threshold that is both definitive for your sample (e.g. we only care about late conversions above X energy, conversions below this energy will be cut out by the analysis) and this threshold is significant relative to the beam energy, then the PartialEnergySorter will be helpful. (The second criterion is mainly there to ensure that the stack manipulation is actually helping improve performance. If the threshold is too low, too much of the shower will be processed in the first stage thus sacrificing any performance benefit that the sorter can help with.)

[^1]: To be pedantic, its technically at least two stages. There could be more stages if other filters/actions modify the stacking behavior. In addition, often Geant4 calls NewStage a second time right before it starts the third stage which has no particles. I don't know why this is although it is rather simple to code around this feature/bug.

tomeichlersmith avatar Apr 22 '24 18:04 tomeichlersmith

Sounds good, thanks Tom! @tylerhoroho-UVA what's a good energy threshold to consider?

tvami avatar Apr 22 '24 18:04 tvami

I think using a similar energy threshold to the one we use on the creation of a hard brem is reasonable. Maybe >2.4 GeV (for a 4 GeV beam)?

horohoo avatar Apr 22 '24 19:04 horohoo