Skip to content

add pre-cut KL beam beta histogram#1122

Open
keigo-miz wants to merge 2 commits into
sdobbs_klong_beamfrom
keigo_klf
Open

add pre-cut KL beam beta histogram#1122
keigo-miz wants to merge 2 commits into
sdobbs_klong_beamfrom
keigo_klf

Conversation

@keigo-miz
Copy link
Copy Markdown
Contributor

Add pre-cut KL beam beta histogram in DBeamKLong_factory (filled before beta > 1 cut).

@sdobbs
Copy link
Copy Markdown
Contributor

sdobbs commented Apr 20, 2026

Thanks Keigo - could you please change making the histogram to the Init() function? This is generally where we define the histograms - you also don't have to worry about multithreading in that function.

@keigo-miz
Copy link
Copy Markdown
Contributor Author

Thanks for the review. I’ve moved the pre-cut \beta histogram booking into DBeamKLong_factory::Init() as you suggested, and left BeginRun() for run-dependent geometry only; Fill() stays in Process() with the existing RootWriteLock.

While testing with monitoring_hists and ReactionFilter together and NTHREADS>1, the job could still crash. The issue wasn’t the move to Init() by itself: in this JANA2 setup, Init() can run lazily on a worker thread the first time DBeamKLong is needed, while other threads are also using ROOT (gDirectory, etc.). Those directory operations aren’t thread-safe without the global ROOT lock.

To fix that, the histogram booking block in Init() is now wrapped in JLockService::RootWriteLock() / RootUnLock() (same idea as elsewhere in halld_recon). With that, the same run configuration completes successfully multithreaded with monitoring_hists enabled.

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

Successfully merging this pull request may close these issues.

2 participants