Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bonsai reconstruction crashes on an event generated by ratpac #111

Open
davehadley opened this issue Jun 23, 2020 · 3 comments
Open

bonsai reconstruction crashes on an event generated by ratpac #111

davehadley opened this issue Jun 23, 2020 · 3 comments

Comments

@davehadley
Copy link
Contributor

The version of BONSAI included within rat-pac crashes on the first event of the attached file.

example_problematic_ratpac_file.zip

The RAT-PAC macro to generate this file is:

/glg4debug/glg4param omit_muon_processes  0.0
/glg4debug/glg4param omit_hadronic_processes  0.0

/rat/db/set DETECTOR experiment "Watchman"
/rat/db/set DETECTOR geo_file "Watchman/Watchman.geo"


/run/initialize

# BEGIN EVENT LOOP
/rat/proc lesssimpledaq
# /rat/proc fitbonsai
/rat/proc fitcentroid
/rat/proc fitpath
/rat/proc count
/rat/procset update 200

# Use IO.default_output_filename
/rat/proclast outroot
#END EVENT LOOP


/generator/add decaychain 214Bi:regexfill:poisson


/generator/pos/set shield+
#/generator/rate/set 1.0

/generator/rate/set 1
/run/beamOn 1000

Inspecting the crash inside gdb the issue seems to be because inside fourhitgrid::fourhitgrid only 3 hits are selected. This leads to a seg fault since this grid object is used without checking that it is in a valid state.

I don't understand the reconstruction enough to know whether this is due to invalid input data that the reconstruction should not be expected to handle, or whether this is a valid input and the problem is in bonsai.

@MarcFBergevin
Copy link
Contributor

Bonsai requires at least 4 hit for any realistic fit to be made. There used to be a condition that required at least 4 nhits prior to dark noise before. This seemed to have been taken out. It was added recently with a requirement of 9 nhits. This has not yet been ported to the version of rat-pac within Watchman.

@MarcFBergevin
Copy link
Contributor

Based on conversations with the DAQ group, a detector threshold of 6 nhits is realistic. There are two potential approach here:

  1. Enforce that no events below 6 hits are processed by bonsai with a if condition in the bonsai loop
  2. Implement a DAQ triggering scheme.

For the second option:

  1. @ekneale Is implementing a trigger scheme in lesssimpledaq.
  2. @MorganAskins has two pull request open (noise generator and splitevdaq

Finally, @katfra noticed that reconstruction from the bonsai version in rat-pac has much poorer reconstructions than the bonsai standalone. From my understanding, this was not completly explained by the change of likelihood.

@davehadley
Copy link
Contributor Author

davehadley commented Jun 24, 2020

This has not yet been ported to the version of rat-pac within Watchman.

@MarcFBergevin, thanks for looking at this issue. For now, does that mean it is recommended to use the HEAD version from: https://github.com/AIT-WATCHMAN/bonsai/ ?

On this particular issue, I may be misunderstanding, but in this case, the crashing event has nhits=59.
BONSAI constructs a goodness object (a subclass of hitselection) that selects only 3 hits (i.e. nselected() returns 3).
This leads the call to fourhitgrid::fourhitgrid and likelihood::maximize to return early (since there aren't enough hits).

The segfault happens on the line:

x = 10. * bsfit->xfit();

Since likelihood::maximize did not complete the bsfit object contains no fit result.

So, naively, it seems like a bug in BONSAI and that the correct action is to modify BONSAI to check that the bsfit object is in a valid state before using its results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants