Repository navigation
Structural Update to EventBuilderV2 for LAPPDs - #393
Conversation
Limitations of existing framework - Metadata read from both ACDCs in 'LAPPDLoadStore.cpp', but beamgate and timestamps are constructed out of ACDC 0 metadata only. - This led to wrong beamgate alignment in the 'offsetFit_MultipleLAPPD.cpp', causing only ACDC 0 fit to be right. - Later only ACDC 0 offsets and corrections were propagated to downstream tools for matching during EventBuilding. - Not able to recover as much LAPPD events as expected despite moving towards a PPS pre-scale of 5. Updations to code - The structural changes are made to code such that all ACDC related variables are split into '0/1'. - This version is now dual-ACDC EBV2. - The tools are modified to accomodate both ACDCs for all chains of the event building stages. - Updated tools are 'LAPPDLoadStore', 'LAPPDTreeMaker', 'EBLAPPD', 'EBSaver', 'ProcessedLAPPDFilter' and 'ANNIEEventTreeMaker'. - Updated the matching logic in 'EBLAPPD' to use an OR condition between corrected timestamps from both ACDCs to maximize LAPPD event recovery. - The changes are validated over both beam data and laser data, in gpvms and grid submissions as well. - Other fixes include memory leak and code readability. - Cleaned up verbose logging and aligned verbose name with tool name in 'LAPPDLoadStoreConfig'. - Cleaned up 'ANNIEEventTreeMakerConfig'. Issues - With these changes, the existing processed data will not be able to run through 'BeamClusterAnalysis'. Pending - Update downstream analysis and support tools (outside of EBV2) to fully accommodate the new dual-ACDC architecture: - 'PrintDQ', 'LAPPDTreeMaker' (only relevant part was updated) and 'PhaseIITreeMaker'.
- Implemented fallback logic to support older data files that lack explicit ACDC board identifiers. - Safely routes legacy single-board data to downstream tools. - ACDC 1 variables will be set to zero as default in such cases.
- Refactored tree making tools to fully support the new dual-ACDC data configurations. - Note: These are tools used outside the primary data processing chain, so they currently have limited test coverage.
- Implemented OR-logic for the PPS missing check in dual-board configurations. - Dropped backward compatibility for legacy single-board data, as data quality checks are primarily run on new data acquisitions.
|
Added my presentation slides in the above described changes for validation. |
|
well, i can't see anything amiss, although with 4,000+ lines changed in our critical Tools, perhaps we should try one of those newfangled AI reviews Steven made on it. What I do see is boilerplate. So much boilerplate. This is not specifically an issue with this PR in particular, but it touches relevant Tools and highlights a common issue throughout ToolAnalysis - large swathes of code doing the same operation on large numbers of variables:
or or similar. Monolithic blocks, multiple pages long, for simple fetch, set, clear, or the like. It'll collapse huge amounts of code, make things clearer and easier to maintain, and the code will be so much nicer to review. :) |
|
just waiting on @S81D's RoboReview 🤖 |
|
I can run it tonight! I need my tokens for another project at the moment :) |
Thanks @S81D , I will take a look by tomorrow and get back to this PR. |
|
i can't look at it without logging in. 🥲 |
|
Sorry @marc1uk ! - find attached a PDF of the artifact |
|
thanks steven. I strongly agree with the remarks in "Design questions for the author" about Data Structure - it's similar to my previous remarks about using classes, in a more narrowly scoped but much more pointed way. 34 CStore buffers, 32 ANNIEEvent maps and parallel tree branches, all being duplicated. Oof! Please do review the whole document; e.g. the multiplicative factor to Correction mentioned in bullet 2 and the shift in beam gate (perhaps that's intended?) mentioned in bullet 4 on page 7 could be insidious bugs if they aren't intended. |
|
hii @marc1uk , @S81D , Sharing my responses to the review here: Most of the points flagged in the Claude review either don’t affect our processing or can be left for a follow-up cleanup PR. I’ve fixed the minor issues that needed immediate attention. |
The |
@marc1uk , this was definitely a bug. This correction comes from offset fitting output loaded in |
I’m not sure what the original intention behind the drift correction was, but it doesn’t affect our results. I hope I have responded to everything and fixed that was needed in this PR. Let me know if there is anything more required from me. |
i'm surprised that went unnoticed. Thanks for the thorough review; looks like all the critical parts on the current analysis path are addressed. I do grow concerned that our codebase is accumulating an increasing amount of legacy code with known breakages.... feels like we're reaping the results of accumulated poor practices in terms of code factoring and separation of concerns, and a complete overhaul is now the only way to get back on track. In any case, as commented in the other PR, please document outstanding points being left for later. |
Resolves the conflicts with ANNIEsoft#389 and ANNIEsoft#393 in ANNIEEventTreeMaker: - ANNIEEventTreeMaker.cpp: Application moved the RingCounting_fill read; this branch only adds the DirectParent_MCHit_fill read next to it. - BeamClusterAnalysisMC/ANNIEEventTreeMakerConfig: Application's reorganised file, plus this branch's DirectParent_MCHit_fill 1. Against Application, the merged tree differs by exactly this branch's changes (same 20 files, same changed lines). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Describe your changes
Limitations of existing framework
LAPPDLoadStore.cpp, but beamgate and timestamp were constructed out of ACDC 0 metadata only.offsetFit_MultipleLAPPD.cpp, such that only the ACDC 0 fit was correctly aligned.offsetFit_MultipleLAPPD.cppto support dual-ACDC EBV2 ANNIE_HelperScripts#2Updates to the EventBuilderV2 framework
LAPPDLoadStore,LAPPDTreeMaker,EBLAPPD,EBSaver,ProcessedLAPPDFilterandANNIEEventTreeMaker.PrintDQandPhaseIITreeMaker.EBLAPPDto use an OR condition between the corrected timestamps from the two ACDCs, allowing LAPPD events associated with either ACDC to be recovered.LAPPDLoadStoreto support legacy single-board data files that do not contain explicit ACDC board identifiers.PrintDQtool.Additional updates
LAPPDLoadStoreConfig.ANNIEEventTreeMakerConfig.Validation
LAPPDTreeMakerandPhaseIITreeMakertools have limited testing since they are not directly related to data processing stages.Checklist before submitting your PR
newusage, there is a reason the data must be on the heapnewthere is adelete, unless I explicitly know why (e.g. ROOT or a BoostStore takes ownership)Additional Material
Attach any validation or demonstration files here. You may also link to relavant docdb articles.
Here are my presentation slides:
https://annie-docdb.fnal.gov/cgi-bin/sso/ShowDocument?docid=6990