-
Notifications
You must be signed in to change notification settings - Fork 29
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
NDLAr Specific Updates Before Second Pass (plus address issue #240) #239
Conversation
Can you say/show a little more about the before and after performance for the ndlar simulation? In 2x2, we batch module-by-module ( larnd-sim/cli/simulate_pixels.py Line 806 in 485c163
larnd-sim/cli/simulate_pixels.py Line 840 in 485c163
|
Unfortunately this isn't an attempt at an improvement in performance. I posted here in the |
What is the evidence you have that this line is a bug? We have been running with it in for 2x2 simulation since moving to module-by-module batching ( |
Hi @alexbooth92 and @krwood , following up the discussion here. I see the problem that Alex pointed out. In this line, it assumes |
cli/simulate_pixels.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
n_tpc_batch = 2 if mod2mod_variation else n_modules * 2
ievd = np.unique(all_mod_tracks[sim.EVENT_SEPARATOR])[ (i_batch * tpc_batch_size) // n_tpc_batch]
To add some proof - without either of the suggested fixes above and the following
You get the following - I have tried to make the print outs self explanatory:
My understanding here is that I haven't tried @YifanC 's solution yet. |
If I try @YifanC's solution verbatim I get a similar out of bounds error. My understanding is this - the following:
is a list of event IDs / spill IDs with a length equal to the number of tracks in all modules.
is a list of event IDs / spill IDs with a length equal to the number of events or spills. Yifan has highlighted that the fix here is two-fold. We need a piece of code that:
There may be something more subtle that I am missing but I don't really understand why we have to use the batch indexing at all just to get the current
to do 1. as originally suggested? It also means we are not hardcoding any values of "2" anywhere in the code to bite us later. To do 2., as Yifan pointed out the original solution would not simulate light in the case of no tracks but I think we could just remove the
The other proposed solution I think would just fall over in the case of no tracks? Although I haven't thought too much about it. |
Hi @alexbooth92 , thanks for the follow up. Yea, in 2x2 for the light detector, the entire detector (all modules) are triggered together, so even there's no "signal", we would need to put some readout to it. The trigger scheme is not settled for ndlar yet. It may not be the same, but I would like to maintain the possibility to run 2x2 trigger scheme.
when the |
Re. the out of bounds error with your solution, it might just be an off by one but I can't check right now because Perlmutter is down. I think I understand what you have tried to do I think it makes sense 🤔 saying that though we should not be hard coding anything. Factors of 2 in code scare me. At risk of sounding like a broken record 😅 I still don't really understand why we need this complex bit of logic just to get the event ID... |
You are right. My proposed solution only works when
It should cover the case even |
Hey @alexbooth92, Oh I think I know why you get out of bound error for the change I suggested. When you get into sub-batch which controls by |
Sorry, and I totally agree with you that we can get event_id like |
Sure please do! |
Hi @alexbooth92 , it ended up as a one liner. I added the event_id to the batch output, and I think this should be a general solution. I tested with a 2x2 file for 3 events by setting |
I think this is a nice solution Yifan! I can confirm I no longer see the errors that I described above with the full NDLAr. Requesting permission again to merge :) @krwood |
A couple of things in here that needed to be fixed before a second pass of
larnd-sim
with full ND geometry, spotted in debugging ofMiniProdN1.2
.While testing with new round of files I came across a bug, summarised in issue #240. This PR will close #240.