Possible fix of eventloop running only on particle level entries.
Hi @fdiazcap
With this fix, the list of pairs m_particleAndReco
is now a set
instead of a vector
. This list is built first by looping on the particle level tree and then by looping on the reco tree.
The set is filled also (for example when looping on the particle level tree) when the event is not found in the reco level tree. In this case the GetEntryNumberWithIndex
function returns -1 and the pair would be (whatever, -1). In this case, when event loop goes
for (const auto idx : m_particleAndReco) {
m_algorithm->particleLevelReader()->SetEntry(std::get<0>(idx));
m_algorithm->truthReader()->SetEntry(std::get<0>(idx));
m_algorithm->reader()->SetEntry(std::get<1>(idx));
the m_algorithm->reader()->SetEntry(std::get<1>(idx));
line will be called with an invalid value of index (-1).
In the execute functions of WbWbLoop we need to add a check that the entry is valid. This should be easy if in the execute function we could access the "reader" objects. Probably with the m_algorithm->reader()
(for reco level) and m_algorthm->particleLevelReader()
functions.
Something like
if (m_algorithm->reader()->GetEntryStatus() != TTreeReader::kEntryValid) passedreco = false; //and viceversa for passedparticle
should work (see https://root.cern.ch/doc/v608/classTTreeReader.html#a568e43c7d7d8b1f511bbbeb92c9094a8)