diff --git a/PWGEM/Dilepton/TableProducer/skimmerOTS.cxx b/PWGEM/Dilepton/TableProducer/skimmerOTS.cxx index b37ae9d8dc6..8a1ab8bdf64 100644 --- a/PWGEM/Dilepton/TableProducer/skimmerOTS.cxx +++ b/PWGEM/Dilepton/TableProducer/skimmerOTS.cxx @@ -33,6 +33,8 @@ using namespace o2::framework; using namespace o2::framework::expressions; using namespace o2::soa; +using MyCollisions = soa::Join; + struct skimmerOTS { Produces swtinfo_tmp; // Join aod::Collision later. Produces swtbit_tmp; @@ -130,7 +132,7 @@ struct skimmerOTS { mRunNumber = bc.runNumber(); } - void process(aod::Collisions const& collisions, aod::BCsWithTimestamps const&) + void process(MyCollisions const& collisions, aod::BCsWithTimestamps const&) { for (const auto& collision : collisions) { auto bc = collision.template bc_as(); // don't use foundBC. @@ -141,35 +143,37 @@ struct skimmerOTS { // uint16_t analyzedToI_bitmap = 0; registry.fill(HIST("hCollisionCounter"), 1); // all - if (zorro.isSelected(bc.globalBC(), bcMarginForSoftwareTrigger)) { // triggered event - auto swt_bitset = zorro.getLastResult(); // this has to be called after zorro::isSelected, or simply call zorro.fetch - auto TOIcounters = zorro.getTOIcounters(); // this has to be called after zorro::isSelected, or simply call zorro.fetch - auto ATcounters = zorro.getATcounters(); // this has to be called after zorro::isSelected, or simply call zorro.fetch - - // LOGF(info, "swt_bitset.to_string().c_str() = %s", swt_bitset.to_string().c_str()); - for (size_t idx = 0; idx < mTOIidx.size(); idx++) { - if (swt_bitset.test(mTOIidx[idx])) { - auto swtname = swt_names[idx]; - int emswtId = o2::aod::pwgem::dilepton::swt::aliasLabels.at(swtname); - trigger_bitmap |= BIT(emswtId); - // LOGF(info, "swtname = %s is fired. swt index in original swt table = %d, swt index for EM table = %d", swtname.data(), mTOIidx[idx], o2::aod::pwgem::dilepton::swt::aliasLabels.at(swtname)); - registry.fill(HIST("hCollisionCounter"), idx + 2); // fired trigger - - // LOGF(info, "ATcounters[mTOIidx[idx]] = %d, TOIcounters[idx] = %d", ATcounters[mTOIidx[idx]], TOIcounters[idx]); - - while (ATcounters[mTOIidx[idx]] > mATCounters[emswtId]) { - mATCounters[emswtId]++; - swtcounterAT_tmp(BIT(emswtId)); - } - - while (TOIcounters[idx] > mTOICounters[emswtId]) { - mTOICounters[emswtId]++; // always incremented by 1 in zorro!! - swtcounterTOI_tmp(BIT(emswtId)); + if (collision.isSelected()) { + + if (zorro.isSelected(bc.globalBC(), bcMarginForSoftwareTrigger)) { // triggered event + auto swt_bitset = zorro.getLastResult(); // this has to be called after zorro::isSelected, or simply call zorro.fetch + auto TOIcounters = zorro.getTOIcounters(); // this has to be called after zorro::isSelected, or simply call zorro.fetch + auto ATcounters = zorro.getATcounters(); // this has to be called after zorro::isSelected, or simply call zorro.fetch + + // LOGF(info, "swt_bitset.to_string().c_str() = %s", swt_bitset.to_string().c_str()); + for (size_t idx = 0; idx < mTOIidx.size(); idx++) { + if (swt_bitset.test(mTOIidx[idx])) { + auto swtname = swt_names[idx]; + int emswtId = o2::aod::pwgem::dilepton::swt::aliasLabels.at(swtname); + trigger_bitmap |= BIT(emswtId); + // LOGF(info, "swtname = %s is fired. swt index in original swt table = %d, swt index for EM table = %d", swtname.data(), mTOIidx[idx], o2::aod::pwgem::dilepton::swt::aliasLabels.at(swtname)); + registry.fill(HIST("hCollisionCounter"), idx + 2); // fired trigger + + // LOGF(info, "ATcounters[mTOIidx[idx]] = %d, TOIcounters[idx] = %d", ATcounters[mTOIidx[idx]], TOIcounters[idx]); + + while (ATcounters[mTOIidx[idx]] > mATCounters[emswtId]) { + mATCounters[emswtId]++; + swtcounterAT_tmp(BIT(emswtId)); + } + + while (TOIcounters[idx] > mTOICounters[emswtId]) { + mTOICounters[emswtId]++; // always incremented by 1 in zorro!! + swtcounterTOI_tmp(BIT(emswtId)); + } + // LOGF(info, "collision.globalIndex() = %d, bc.globalBC() = %llu, mTOICounters[%d] = %d, mATcounters[%d] = %d", collision.globalIndex(), bc.globalBC(), emswtId, mTOICounters[emswtId], emswtId, mATCounters[emswtId]); } - - // LOGF(info, "collision.globalIndex() = %d, bc.globalBC() = %llu, mTOICounters[%d] = %d, mATcounters[%d] = %d", collision.globalIndex(), bc.globalBC(), emswtId, mTOICounters[emswtId], emswtId, mATCounters[emswtId]); - } - } // end of TOI loop + } // end of TOI loop + } } swtbit_tmp(trigger_bitmap); } // end of collision loop