@@ -33,6 +33,8 @@ using namespace o2::framework;
3333using namespace o2 ::framework::expressions;
3434using namespace o2 ::soa;
3535
36+ using MyCollisions = soa::Join<aod::Collisions, aod::EMEvSels>;
37+
3638struct skimmerOTS {
3739 Produces<o2::aod::EMSWTriggerInfosTMP> swtinfo_tmp; // Join aod::Collision later.
3840 Produces<o2::aod::EMSWTriggerBitsTMP> swtbit_tmp;
@@ -130,7 +132,7 @@ struct skimmerOTS {
130132 mRunNumber = bc.runNumber ();
131133 }
132134
133- void process (aod::Collisions const & collisions, aod::BCsWithTimestamps const &)
135+ void process (MyCollisions const & collisions, aod::BCsWithTimestamps const &)
134136 {
135137 for (const auto & collision : collisions) {
136138 auto bc = collision.template bc_as <aod::BCsWithTimestamps>(); // don't use foundBC.
@@ -141,35 +143,37 @@ struct skimmerOTS {
141143 // uint16_t analyzedToI_bitmap = 0;
142144 registry.fill (HIST (" hCollisionCounter" ), 1 ); // all
143145
144- if (zorro.isSelected (bc.globalBC (), bcMarginForSoftwareTrigger)) { // triggered event
145- auto swt_bitset = zorro.getLastResult (); // this has to be called after zorro::isSelected, or simply call zorro.fetch
146- auto TOIcounters = zorro.getTOIcounters (); // this has to be called after zorro::isSelected, or simply call zorro.fetch
147- auto ATcounters = zorro.getATcounters (); // this has to be called after zorro::isSelected, or simply call zorro.fetch
148-
149- // LOGF(info, "swt_bitset.to_string().c_str() = %s", swt_bitset.to_string().c_str());
150- for (size_t idx = 0 ; idx < mTOIidx .size (); idx++) {
151- if (swt_bitset.test (mTOIidx [idx])) {
152- auto swtname = swt_names[idx];
153- int emswtId = o2::aod::pwgem::dilepton::swt::aliasLabels.at (swtname);
154- trigger_bitmap |= BIT (emswtId);
155- // 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));
156- registry.fill (HIST (" hCollisionCounter" ), idx + 2 ); // fired trigger
157-
158- // LOGF(info, "ATcounters[mTOIidx[idx]] = %d, TOIcounters[idx] = %d", ATcounters[mTOIidx[idx]], TOIcounters[idx]);
159-
160- while (ATcounters[mTOIidx [idx]] > mATCounters [emswtId]) {
161- mATCounters [emswtId]++;
162- swtcounterAT_tmp (BIT (emswtId));
163- }
164-
165- while (TOIcounters[idx] > mTOICounters [emswtId]) {
166- mTOICounters [emswtId]++; // always incremented by 1 in zorro!!
167- swtcounterTOI_tmp (BIT (emswtId));
146+ if (collision.isSelected ()) {
147+
148+ if (zorro.isSelected (bc.globalBC (), bcMarginForSoftwareTrigger)) { // triggered event
149+ auto swt_bitset = zorro.getLastResult (); // this has to be called after zorro::isSelected, or simply call zorro.fetch
150+ auto TOIcounters = zorro.getTOIcounters (); // this has to be called after zorro::isSelected, or simply call zorro.fetch
151+ auto ATcounters = zorro.getATcounters (); // this has to be called after zorro::isSelected, or simply call zorro.fetch
152+
153+ // LOGF(info, "swt_bitset.to_string().c_str() = %s", swt_bitset.to_string().c_str());
154+ for (size_t idx = 0 ; idx < mTOIidx .size (); idx++) {
155+ if (swt_bitset.test (mTOIidx [idx])) {
156+ auto swtname = swt_names[idx];
157+ int emswtId = o2::aod::pwgem::dilepton::swt::aliasLabels.at (swtname);
158+ trigger_bitmap |= BIT (emswtId);
159+ // 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));
160+ registry.fill (HIST (" hCollisionCounter" ), idx + 2 ); // fired trigger
161+
162+ // LOGF(info, "ATcounters[mTOIidx[idx]] = %d, TOIcounters[idx] = %d", ATcounters[mTOIidx[idx]], TOIcounters[idx]);
163+
164+ while (ATcounters[mTOIidx [idx]] > mATCounters [emswtId]) {
165+ mATCounters [emswtId]++;
166+ swtcounterAT_tmp (BIT (emswtId));
167+ }
168+
169+ while (TOIcounters[idx] > mTOICounters [emswtId]) {
170+ mTOICounters [emswtId]++; // always incremented by 1 in zorro!!
171+ swtcounterTOI_tmp (BIT (emswtId));
172+ }
173+ // LOGF(info, "collision.globalIndex() = %d, bc.globalBC() = %llu, mTOICounters[%d] = %d, mATcounters[%d] = %d", collision.globalIndex(), bc.globalBC(), emswtId, mTOICounters[emswtId], emswtId, mATCounters[emswtId]);
168174 }
169-
170- // LOGF(info, "collision.globalIndex() = %d, bc.globalBC() = %llu, mTOICounters[%d] = %d, mATcounters[%d] = %d", collision.globalIndex(), bc.globalBC(), emswtId, mTOICounters[emswtId], emswtId, mATCounters[emswtId]);
171- }
172- } // end of TOI loop
175+ } // end of TOI loop
176+ }
173177 }
174178 swtbit_tmp (trigger_bitmap);
175179 } // end of collision loop
0 commit comments