Skip to content

Commit

Permalink
JEventPool is now responsible for setting JEvent app ptr
Browse files Browse the repository at this point in the history
Previously, it was the JEventSource, which doesn't work in the case of TimesliceExample, because PhysicsEvents come straight from the pool.
  • Loading branch information
nathanwbrei committed May 8, 2024
1 parent 11674a7 commit 8a74887
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/libraries/JANA/JEventSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ class JEventSource : public jana::omni::JComponent, public jana::omni::JHasOutpu

// We configure the event
event->SetEventNumber(m_event_count); // Default event number to event count
event->SetJApplication(m_app);
event->SetJEventSource(this);
event->SetSequential(false);
event->GetJCallGraphRecorder()->Reset();
Expand Down
3 changes: 2 additions & 1 deletion src/libraries/JANA/JFactory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
void JFactory::Create(const std::shared_ptr<const JEvent>& event) {

// We need this for JMultifactoryHelper. Eventually it should go away
SetApplication(event->GetJApplication());
auto app = event->GetJApplication();
if (app != nullptr) SetApplication(app);

if (mStatus == Status::Uninitialized) {
CallWithJExceptionWrapper("JFactory::Init", [&](){ Init(); });
Expand Down
7 changes: 6 additions & 1 deletion src/libraries/JANA/Omni/JComponentFwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,12 @@ struct JComponent {
return m_status;
}

void SetApplication(JApplication* app) { m_app = app; }
void SetApplication(JApplication* app) {
if (app == nullptr) {
throw JException("Attempting to set a null JApplication pointer!");
}
m_app = app;
}

void SetLogger(JLogger logger) { m_logger = logger; }

Expand Down
1 change: 1 addition & 0 deletions src/libraries/JANA/Services/JComponentManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ void JComponentManager::configure_event(JEvent& event) {
event.SetFactorySet(factory_set);
event.SetDefaultTags(m_default_tags);
event.GetJCallGraphRecorder()->SetEnabled(m_enable_call_graph_recording);
event.SetJApplication(GetApplication());
}


Expand Down

0 comments on commit 8a74887

Please sign in to comment.