Repository navigation
Conversation
The channel and timing-chain maps are filled once in the constructor and only read afterwards, but the service was declared LEGACY, so art ran every module that uses it (CRT decoder, strip-hit producer, CRTGeoService users) one at a time. - Every lookup is now const. - GetTimingChainFromOfflineModuleID and GetTimingChainFromMAC5 used unordered_map::operator[], which inserts an entry on a miss: a write from a lookup, and a data race once two threads ask at once. They now use find() and return 0 on a miss, the same value operator[] returned. - DECLARE_ART_SERVICE(..., SHARED) instead of LEGACY. - Include the cetlib headers the constructor uses. No change in output. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every lookup only reads the tagger, module, strip, and SiPM maps filled in the constructor. The only writer is the preBeginRun callback, which on data refreshes the calibration constants from the CRT calibration database (a SHARED service). art processes run transitions with no events in flight, so that write cannot overlap a read from another thread. - The 15 lookups that were not yet const are now const (StripHit3DPos, StripWorldToLocalPos, FEBWorldPos, FEBChannel0WorldPos, CheckOverlap, AdjacentStrips, DifferentOrientations, WhichTagger, GlobalConstrainedCoordinates, IsPointInsideCRTLimits, StripArea, StripAverageY). - DECLARE_ART_SERVICE(..., SHARED) instead of LEGACY. Together with the CRTChannelMapService change, CRT jobs can now run with more than one thread. No change in output. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Makes
SBND::CRTChannelMapServiceandsbnd::crt::CRTGeoServicethread-safeSHAREDart services. Both were declaredLEGACY, so art refused to run any job that loads them with more than one thread or schedule.CRTChannelMapService (first commit)
const.GetTimingChainFromOfflineModuleIDandGetTimingChainFromMAC5usedunordered_map::operator[], which inserts an entry when the key is missing: a write from a lookup, and a data race once two threads ask at the same time. They now usefind()and still return 0 for a missing module.CRTGeoService (second commit)
constnow are.preBeginRuncallback, which on data refreshes the calibration constants from the (alreadySHARED) CRT calibration database. art processes run transitions with no events in flight, so that write cannot overlap an event-time read.The
constchanges alter member-function signatures, so every library that uses either service has to be rebuilt with it (24 libraries in sbndcode, which happens automatically in a release).Testing (sbndcode v10_26_00 on sbndbuild03, MC BNB + cosmics, 10 events):
crtstrips,crtclustering,crtspacepoints,crttracks): identical products to the release. All 18 leaves uproot can read are identical; the others have identical byte counts.--nthreads 4 --nschedules 4: the release stops at job setup ("CRTChannelMapService is a legacy service"); with this PR the job runs all 10 events, and its CRT products are identical to the single-threaded release run.preBeginRunwith the calibration database) and the CRT decoder, since I ran MC only.🤖 Generated with Claude Code