Skip to content

Commit a54fbb7

Browse files
committed
o2sim: Fixing a problem when generated event is empty
We encountered infinite loops when the event was empty (or at least when there is no real trackable particle inside). This commit is fixing this problem.
1 parent 46a1cfe commit a54fbb7

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

run/O2PrimaryServerDevice.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ class O2PrimaryServerDevice : public FairMQDevice
159159

160160
auto& prims = mStack.getPrimaries();
161161
auto numberofparts = (int)std::ceil(prims.size() / (1. * mChunkGranularity));
162+
// number of parts should be at least 1 (even if empty)
163+
numberofparts = std::max(1, numberofparts);
162164

163165
o2::Data::PrimaryChunk m;
164166
o2::Data::SubEventInfo i;

0 commit comments

Comments
 (0)