Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 33 additions & 29 deletions PWGEM/Dilepton/TableProducer/skimmerOTS.cxx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.

Check failure on line 1 in PWGEM/Dilepton/TableProducer/skimmerOTS.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/workflow-file]

Name of a workflow file must match the name of the main struct in it (without the PWG prefix). (Class implementation files should be in "Core" directories.)

Check failure on line 1 in PWGEM/Dilepton/TableProducer/skimmerOTS.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-task]

Specify task name only when it cannot be derived from the struct name. Only append to the default name.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
Expand Down Expand Up @@ -33,6 +33,8 @@
using namespace o2::framework::expressions;
using namespace o2::soa;

using MyCollisions = soa::Join<aod::Collisions, aod::EMEvSels>;

struct skimmerOTS {
Produces<o2::aod::EMSWTriggerInfosTMP> swtinfo_tmp; // Join aod::Collision later.
Produces<o2::aod::EMSWTriggerBitsTMP> swtbit_tmp;
Expand All @@ -40,8 +42,8 @@
Produces<o2::aod::EMSWTriggerTOICountersTMP> swtcounterTOI_tmp;

// CCDB options
Configurable<std::string> ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};

Check failure on line 45 in PWGEM/Dilepton/TableProducer/skimmerOTS.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)
Configurable<std::string> cfg_swt_names{"cfg_swt_names", "fLMeeIMR,fLMeeHMR", "comma-separated software trigger names"}; // !trigger names have to be pre-registered in dileptonTable.h for bit operation!

Check failure on line 46 in PWGEM/Dilepton/TableProducer/skimmerOTS.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)
o2::framework::Configurable<std::string> ccdbPathSoftwareTrigger{"ccdbPathSoftwareTrigger", "EventFiltering/Zorro/", "ccdb path for ZORRO objects"};
Configurable<uint64_t> bcMarginForSoftwareTrigger{"bcMarginForSoftwareTrigger", 100, "Number of BCs of margin for software triggers"};

Expand Down Expand Up @@ -130,7 +132,7 @@
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<aod::BCsWithTimestamps>(); // don't use foundBC.
Expand All @@ -141,35 +143,37 @@
// 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
Expand All @@ -177,5 +181,5 @@
};
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
{
return WorkflowSpec{adaptAnalysisTask<skimmerOTS>(cfgc, TaskName{"skimmer-ots"})};

Check failure on line 184 in PWGEM/Dilepton/TableProducer/skimmerOTS.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[name/o2-task]

Device names skimmer-ots and skimmer-o-t-s generated from the specified task name skimmer-ots and from the struct name skimmerOTS, respectively, differ in hyphenation. Consider fixing capitalisation of the struct name to SkimmerOts and removing TaskName.
}
Loading