Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
335e4dd
Unfolder topologies no longer pull in no-op Folder
nathanwbrei May 18, 2026
b8abcbb
Remove JEvent RefToSelf mechanism
nathanwbrei May 18, 2026
91e5335
Fix overloaded virtual warnings in JOmniFactory (again)
nathanwbrei May 19, 2026
0639e26
Change JEventSource::SetEventLevels() => SetParentLevels()
nathanwbrei May 20, 2026
1641b7e
Add JEventLevelHierarchy
nathanwbrei May 24, 2026
55cb085
Bugfix: MapArrow handles multiple parallel sources correctly
nathanwbrei May 24, 2026
d68747e
WIP: JTopologyBuilder::CreateTopologyFromScratch
nathanwbrei May 24, 2026
fa1be98
JArrow::AddPort now requires PortDirection
nathanwbrei May 25, 2026
3fa5460
WIP: JTopologyBuilder::CreateTopologyFromScratch part 2
nathanwbrei May 25, 2026
80e1837
Test cases pass again
nathanwbrei May 25, 2026
dc2f38d
Remove JTopologyBuilder::AttachLevel
nathanwbrei May 25, 2026
d3393c5
Print wiring service status after JANA splash screen
nathanwbrei May 25, 2026
a3c5e3b
Add "Order" column to topology table
nathanwbrei May 25, 2026
d72efa0
Update JMultilevelSourceArrow to use new Port machinery
nathanwbrei May 25, 2026
f1b5f53
JTopologyBuilder autowires multi event sources
nathanwbrei May 25, 2026
aa52d9a
JTopologyBuilder autowires event folders
nathanwbrei May 25, 2026
c6755ef
Convert JComponentManager methods to PascalCase
nathanwbrei May 25, 2026
83ef629
Small fix
nathanwbrei May 26, 2026
ccbd471
Update TimesliceExample
nathanwbrei May 26, 2026
d3d9898
Bring back JCM::get_evt_src_gens
nathanwbrei May 26, 2026
38ebe9a
Small CI fix
nathanwbrei May 26, 2026
fbc0d77
Another small fix
nathanwbrei May 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test_integration_epic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ jobs:
$GITHUB_WORKSPACE/bin/jana \
-Pplugins=TimesliceExample \
-Pjana:nevents=100 \
-Puse_timeslices=0 \
events.root

- name: Run TimesliceExample with complex (timeslice) topology
Expand Down
4 changes: 2 additions & 2 deletions src/examples/misc/TimesliceExample/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ if (USE_PODIO)
target_link_libraries(TimesliceExample PUBLIC PodioDatamodel PodioDatamodelDict podio::podioRootIO)

add_test(NAME jana-example-timeslices-simple-tests
COMMAND ${CMAKE_INSTALL_PREFIX}/bin/jana -Pplugins=TimesliceExample -Pjana:nevents=10 events.root)
COMMAND ${CMAKE_INSTALL_PREFIX}/bin/jana -Pplugins=TimesliceExample -Puse_timeslices=0 -Pjana:nevents=10 events.root)

add_test(NAME jana-example-timeslices-complex-tests
COMMAND ${CMAKE_INSTALL_PREFIX}/bin/jana -Pplugins=TimesliceExample -Pjana:nevents=10 timeslices.root)
COMMAND ${CMAKE_INSTALL_PREFIX}/bin/jana -Pplugins=TimesliceExample -Puse_timeslices=1 -Pjana:nevents=10 timeslices.root)

else()
message(STATUS "Skipping examples/TimesliceExample because USE_PODIO=Off")
Expand Down
39 changes: 22 additions & 17 deletions src/examples/misc/TimesliceExample/TimesliceExample.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,28 @@ void InitPlugin(JApplication *app) {
// Event processor that writes events (and timeslices, if they are present) to file
app->Add(new MyFileWriter());

// Unfolder that takes timeslices and splits them into physics events.
app->Add(new MyTimesliceSplitter());

// Factory that produces timeslice-level protoclusters from timeslice-level hits
app->Add(new JOmniFactoryGeneratorT<MyProtoclusterFactory>(
{ .tag = "timeslice_protoclusterizer",
.level = JEventLevel::Timeslice,
.input_names = {"hits"},
.output_names = {"ts_protoclusters"}
}));

// Factory that produces event-level protoclusters from event-level hits
app->Add(new JOmniFactoryGeneratorT<MyProtoclusterFactory>(
{ .tag = "event_protoclusterizer",
.input_names = {"hits"},
.output_names = {"evt_protoclusters"}}
));
bool use_timeslices = app->RegisterParameter("use_timeslices", true);

if (use_timeslices) {
// Unfolder that takes timeslices and splits them into physics events.
app->Add(new MyTimesliceSplitter());

// Factory that produces timeslice-level protoclusters from timeslice-level hits
app->Add(new JOmniFactoryGeneratorT<MyProtoclusterFactory>(
{ .tag = "timeslice_protoclusterizer",
.level = JEventLevel::Timeslice,
.input_names = {"hits"},
.output_names = {"ts_protoclusters"}
}));
}
else {
// Factory that produces event-level protoclusters from event-level hits
app->Add(new JOmniFactoryGeneratorT<MyProtoclusterFactory>(
{ .tag = "event_protoclusterizer",
.input_names = {"hits"},
.output_names = {"evt_protoclusters"}}
));
}

// Factory that produces event-level clusters from event-level protoclusters
app->Add(new JOmniFactoryGeneratorT<MyClusterFactory>(
Expand Down
5 changes: 2 additions & 3 deletions src/libraries/JANA/Components/JOmniFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ class JOmniFactory : public JFactory {
}

// This is more hackery to suppress the overloaded-virtual warning
// Has to virtual simply because EICrecon already declares it as override
// Has to be virtual simply because EICrecon already declares it as override
using JFactory::ChangeRun;
void ChangeRun(int32_t) {};

virtual void ChangeRun(int32_t) {};

using ConfigType = ConfigT;

Expand Down
29 changes: 17 additions & 12 deletions src/libraries/JANA/JApplication.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,33 +71,38 @@ void JApplication::AddPluginPath(std::string path) {

void JApplication::Add(JEventSource* event_source) {
/// Adds the given JEventSource to the JANA context. Ownership is passed to JComponentManager.
m_component_manager->add(event_source);
m_component_manager->Add(event_source);
}

void JApplication::Add(JEventSourceGenerator *source_generator) {
/// Adds the given JEventSourceGenerator to the JANA context. Ownership is passed to JComponentManager.
m_component_manager->add(source_generator);
m_component_manager->Add(source_generator);
}

void JApplication::Add(JFactoryGenerator *factory_generator) {
/// Adds the given JFactoryGenerator to the JANA context. Ownership is passed to JComponentManager.
m_component_manager->add(factory_generator);
m_component_manager->Add(factory_generator);
}

void JApplication::Add(JEventProcessor* processor) {
/// Adds the given JEventProcessor to the JANA context. Ownership is passed to JComponentManager.
m_component_manager->add(processor);
m_component_manager->Add(processor);
}

void JApplication::Add(std::string event_source_name) {
/// Adds the event source name (e.g. a file or socket name) to the JANA context. JANA will instantiate
/// the corresponding JEventSource using a user-provided JEventSourceGenerator.
m_component_manager->add(event_source_name);
m_component_manager->Add(event_source_name);
}

void JApplication::Add(JEventUnfolder* unfolder) {
/// Adds the given JEventUnfolder to the JANA context. Ownership is passed to JComponentManager.
m_component_manager->add(unfolder);
m_component_manager->Add(unfolder);
}

void JApplication::Add(JEventFolder* folder) {
/// Adds the given JEventFolder to the JANA context. Ownership is passed to JComponentManager.
m_component_manager->Add(folder);
}


Expand All @@ -115,10 +120,6 @@ void JApplication::Initialize() {

// We trigger initialization
m_service_locator->get<JParameterManager>();
auto component_manager = m_service_locator->get<JComponentManager>();
auto plugin_loader = m_service_locator->get<JPluginLoader>();
auto topology_builder = m_service_locator->get<JTopologyBuilder>();
auto wiring_service = m_service_locator->get<jana::services::JWiringService>();

// Set logger on JApplication itself
m_logger = m_params->GetLogger("jana");
Expand All @@ -136,6 +137,10 @@ void JApplication::Initialize() {
JVersion::PrintVersionDescription(oss);
LOG_INFO(m_logger) << oss.str() << LOG_END;
}
auto component_manager = m_service_locator->get<JComponentManager>();
auto plugin_loader = m_service_locator->get<JPluginLoader>();
auto topology_builder = m_service_locator->get<JTopologyBuilder>();
auto wiring_service = m_service_locator->get<jana::services::JWiringService>();

// Attach all plugins
for (const auto& plugin_name : wiring_service->GetPluginNames()) {
Expand All @@ -144,7 +149,7 @@ void JApplication::Initialize() {
plugin_loader->attach_plugins(component_manager.get());

// Resolve and initialize all components
component_manager->configure_components();
component_manager->ConfigureComponents();

// Once all components have been wired in jcm::configure_components(), there shouldn't be any unused wirings
wiring_service->CheckAllWiringsAreUsed();
Expand Down Expand Up @@ -297,7 +302,7 @@ int JApplication::GetExitCode() {

const JComponentSummary& JApplication::GetComponentSummary() {
/// Returns a data object describing all components currently running
return m_component_manager->get_component_summary();
return m_component_manager->GetComponentSummary();
}

// Performance/status monitoring
Expand Down
2 changes: 2 additions & 0 deletions src/libraries/JANA/JApplicationFwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class JComponentManager;
class JPluginLoader;
class JExecutionEngine;
class JEventUnfolder;
class JEventFolder;
class JServiceLocator;
class JParameter;
class JParameterManager;
Expand Down Expand Up @@ -66,6 +67,7 @@ class JApplication {
void Add(JEventSource* event_source);
void Add(JEventProcessor* processor);
void Add(JEventUnfolder* unfolder);
void Add(JEventFolder* folder);


// Controlling processing
Expand Down
15 changes: 1 addition & 14 deletions src/libraries/JANA/JEvent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ JEvent::JEvent() : mInspector(this){
JEvent::JEvent(JApplication* app) : mInspector(this) {
// Furnish the JEvent with the parameter values and factory generators provided to the JApplication
app->Initialize();
app->GetService<JComponentManager>()->configure_event(*this);
app->GetService<JComponentManager>()->ConfigureEvent(*this);
}

JEvent::~JEvent() {
Expand Down Expand Up @@ -144,19 +144,6 @@ std::vector<JEvent*> JEvent::ReleaseAllParents() {
return released_parents;
}

void JEvent::TakeRefToSelf() {
mReferenceCount++;
}

int JEvent::ReleaseRefToSelf() {
int remaining_refs = mReferenceCount.fetch_sub(1);
remaining_refs -= 1; // fetch_sub post increments
if (remaining_refs < 0) {
throw JException("JEvent's own refcount has gone negative!");
}
return remaining_refs;
}

int JEvent::GetChildCount() {
return mReferenceCount;
}
Expand Down
3 changes: 0 additions & 3 deletions src/libraries/JANA/JEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@ class JEvent : public std::enable_shared_from_this<JEvent> {
uint64_t GetParentNumber(JEventLevel level) const;
void SetParentNumber(JEventLevel level, uint64_t number);

void TakeRefToSelf();
int ReleaseRefToSelf();

// Lifecycle
void Clear(bool processed_successfully=true);
void Finish();
Expand Down
7 changes: 1 addition & 6 deletions src/libraries/JANA/JEventSource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,8 @@ JEventSource::Result JEventSource::DoNext(std::shared_ptr<JEvent> event) {
DoClose(false);
return Result::FailureFinished;
}
else if (result == Result::FailureTryAgain) {
// We end up here if we tried to read an entry in a file but it is on a tape drive and isn't ready yet
// or if we polled the socket, found no new messages, but still expect messages later
return Result::FailureTryAgain;
}
else {
throw JException("Invalid JEventSource::Result value!");
return result;
}
}
else { // status == Closed
Expand Down
6 changes: 3 additions & 3 deletions src/libraries/JANA/JEventSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class JEventSource : public jana::components::JComponent,
bool m_enable_process_parallel = false;
Status m_status = Status::Unopened;

std::vector<JEventLevel> m_event_levels;
std::vector<JEventLevel> m_parent_levels;
JEventLevel m_next_level = JEventLevel::None;


Expand Down Expand Up @@ -148,7 +148,7 @@ class JEventSource : public jana::components::JComponent,
uint64_t GetSkippedEventCount() const { return m_events_skipped; };
uint64_t GetProcessedEventCount() const { return m_events_processed; };

const std::vector<JEventLevel> GetEventLevels() { return m_event_levels; }
const std::vector<JEventLevel> GetParentLevels() { return m_parent_levels; }

bool IsGetObjectsEnabled() const { return m_enable_get_objects; }
bool IsFinishEventEnabled() const { return m_enable_finish_event; }
Expand Down Expand Up @@ -181,7 +181,7 @@ class JEventSource : public jana::components::JComponent,
void SetNSkip(uint64_t nskip) { m_nskip = nskip; };

void SetNextEventLevel(JEventLevel level) { m_next_level = level; }
void SetEventLevels(std::vector<JEventLevel> levels) { m_event_levels = levels; }
void SetParentLevels(std::vector<JEventLevel> levels) { m_parent_levels = levels; }
JEventLevel GetNextInputLevel() const { return m_next_level; }


Expand Down
Loading
Loading