Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 8 additions & 1 deletion offline/framework/fun4all/Fun4AllServer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,14 @@ int Fun4AllServer::EndRun(const int runno)
int Fun4AllServer::End()
{
recoConsts *rc = recoConsts::instance();
EndRun(rc->get_IntFlag("RUNNUMBER")); // call SubsysReco EndRun methods for current run
if (rc->FlagExist("RUNNUMBER"))
{
EndRun(rc->get_IntFlag("RUNNUMBER")); // call SubsysReco EndRun methods for current run
Comment on lines +1108 to +1110

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Use an int-specific RUNNUMBER check here.

PHFlag::FlagExist() is type-agnostic, so this branch is still unsafe: it returns true if RUNNUMBER exists as a string/float/etc., and get_IntFlag("RUNNUMBER") then emits the same error/stack trace and falls back to 0. That means the new guard does not fully satisfy the PHFlag contract and can still call EndRun(0) in a mistyped-flag scenario. Please gate this on integer-flag existence specifically, or otherwise avoid get_IntFlag() unless the flag is known to be an int.

}
else
{
std::cout << PHWHERE << " No RUNNUMBER Int Flag set, not calling EndRun() for registered modules" << std::endl;
}
int i = 0;
std::vector<std::pair<SubsysReco *, PHCompositeNode *>>::iterator iter;
gROOT->cd(default_Tdirectory.c_str());
Expand Down
1 change: 0 additions & 1 deletion offline/framework/fun4all/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ libfun4all_la_SOURCES = \
libfun4all_la_LIBADD = \
libSubsysReco.la \
libTDirectoryHelper.la \
-lboost_filesystem \
-lFROG \
-lffaobjects \
-lphool \
Expand Down
10 changes: 9 additions & 1 deletion offline/framework/fun4allraw/SingleTriggeredInput.cc
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,15 @@ void SingleTriggeredInput::FillPool()
if (!FilesDone())
{
int eventvectorsize = FillEventVector();
// this seems a unique signature for raw data files which only contain the
// begin and end run event but no data events. FillEventVector() returns -1
// and since no events were read the m_PacketEventDeque is empty
if (eventvectorsize < 0 && m_PacketEventDeque.empty())
{
std::cout << Name() << ": No data Events in input file " << FileName() << std::endl;
AllDone(1);
return;
Comment on lines 731 to +739

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

The no-data-file guard never fires once packet keys have been seeded.

FillEventVector() touches m_PacketEventDeque[pid] before any data event is accepted, so on the begin/end-only input this map is typically non-empty with only empty deques. That makes m_PacketEventDeque.empty() false here, so AllDone(1) is skipped and Fun4AllTriggeredInputManager::run() still proceeds past FillPool() instead of taking the graceful empty-input exit this PR is adding.

Suggested fix
     int eventvectorsize = FillEventVector();
-    if (eventvectorsize < 0 && m_PacketEventDeque.empty())
+    const bool no_packet_events = std::all_of(
+        m_PacketEventDeque.begin(), m_PacketEventDeque.end(),
+        [](const auto& entry) { return entry.second.empty(); });
+    if (eventvectorsize < 0 && no_packet_events)
     {
       std::cout << Name() << ": No data Events in input file " << FileName() << std::endl;
       AllDone(1);
       return;
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
int eventvectorsize = FillEventVector();
// this seems a unique signature for raw data files which only contain the
// begin and end run event but no data events. FillEventVector() returns -1
// and since no events were read the m_PacketEventDeque is empty
if (eventvectorsize < 0 && m_PacketEventDeque.empty())
{
std::cout << Name() << ": No data Events in input file " << FileName() << std::endl;
AllDone(1);
return;
int eventvectorsize = FillEventVector();
// this seems a unique signature for raw data files which only contain the
// begin and end run event but no data events. FillEventVector() returns -1
// and since no events were read the m_PacketEventDeque is empty
const bool no_packet_events = std::all_of(
m_PacketEventDeque.begin(), m_PacketEventDeque.end(),
[](const auto& entry) { return entry.second.empty(); });
if (eventvectorsize < 0 && no_packet_events)
{
std::cout << Name() << ": No data Events in input file " << FileName() << std::endl;
AllDone(1);
return;

}
if (eventvectorsize != 0)
{
if (Gl1Input()->m_bclkdiffarray_map.empty())
Expand Down Expand Up @@ -1226,7 +1235,6 @@ int SingleTriggeredInput::ReadEvent()
size_t size = m_PacketEventDeque.begin()->second.size();
std::cout << "deque size: " << size << std::endl;
}

auto* ref_evt = m_PacketEventDeque.begin()->second.front();
RunNumber(ref_evt->getRunNumber());

Expand Down
1 change: 0 additions & 1 deletion simulation/g4simulation/g4main/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ libg4testbench_la_LDFLAGS = \

libg4testbench_la_LIBADD = \
libphg4hit.la \
-lboost_filesystem \
-lffamodules \
-lfun4all \
-lg4decayer \
Expand Down