Skip to content

Commit 904c3aa

Browse files
committed
EOF checker for LHE events
1 parent 96c3a3b commit 904c3aa

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

MC/config/PWGGAJE/external/generator/generator_pythia8_powheg.C

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,17 @@ public:
147147
return true;
148148
}
149149

150+
Bool_t checkEOF() {
151+
// Check if the POWHEG generation is done
152+
int result = system(("grep -q /LesHouchesEvents " + mLHEFoutput).c_str());
153+
if (result == 0)
154+
{
155+
return true;
156+
} else {
157+
return false;
158+
}
159+
}
160+
150161
Bool_t POWchecker() {
151162
// Check if the POWHEG events file exists
152163
LOG(info) << "Waiting for " << mLHEFoutput << " to exist";
@@ -155,6 +166,11 @@ public:
155166
std::this_thread::sleep_for(std::chrono::milliseconds(100));
156167
}
157168
LOG(info) << "POWHEG events file for job " << mCurrFile << " found";
169+
while (!checkEOF())
170+
{
171+
std::this_thread::sleep_for(std::chrono::milliseconds(100));
172+
}
173+
LOG(info) << "POWHEG events ready";
158174
return true;
159175
}
160176

0 commit comments

Comments
 (0)