Skip to content

Commit d669d84

Browse files
Dan RileyDan Riley
authored andcommitted
Add tbb task isolation so TTree::Fill doesn't steal a framework task
1 parent 2203a47 commit d669d84

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

PhysicsTools/NanoAOD/plugins/NanoAODOutputModule.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545

4646
#include <iostream>
4747

48+
#include "tbb/task_arena.h"
49+
4850
class NanoAODOutputModule : public edm::one::OutputModule<> {
4951
public:
5052
NanoAODOutputModule(edm::ParameterSet const& pset);
@@ -216,7 +218,7 @@ void NanoAODOutputModule::write(edm::EventForOutput const& iEvent) {
216218
// fill event branches
217219
for (auto& t : m_evstrings)
218220
t.fill(iEvent, *m_tree);
219-
m_tree->Fill();
221+
tbb::this_task_arena::isolate([&] { m_tree->Fill(); });
220222

221223
m_processHistoryRegistry.registerProcessHistory(iEvent.processHistory());
222224
}
@@ -230,7 +232,7 @@ void NanoAODOutputModule::writeLuminosityBlock(edm::LuminosityBlockForOutput con
230232
for (auto& t : m_lumiTables)
231233
t.fill(iLumi, *m_lumiTree);
232234

233-
m_lumiTree->Fill();
235+
tbb::this_task_arena::isolate([&] { m_lumiTree->Fill(); });
234236

235237
m_processHistoryRegistry.registerProcessHistory(iLumi.processHistory());
236238
}
@@ -262,7 +264,7 @@ void NanoAODOutputModule::writeRun(edm::RunForOutput const& iRun) {
262264
}
263265
}
264266

265-
m_runTree->Fill();
267+
tbb::this_task_arena::isolate([&] { m_runTree->Fill(); });
266268

267269
m_processHistoryRegistry.registerProcessHistory(iRun.processHistory());
268270
}

0 commit comments

Comments
 (0)