Skip to content

Commit c3a9667

Browse files
author
David Dobrigkeit Chinellato
committed
Fully suppress strangenes not required
1 parent 68e906e commit c3a9667

File tree

1 file changed

+51
-34
lines changed

1 file changed

+51
-34
lines changed

PWGLF/Utils/strangenessBuilderModule.h

Lines changed: 51 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,8 @@ class BuilderModule
397397
return preSelectOpts.massCutOm->get("constant") + pt * preSelectOpts.massCutOm->get("linear") + preSelectOpts.massCutOm->get("expoConstant") * TMath::Exp(-pt / preSelectOpts.massCutOm->get("expoRelax"));
398398
}
399399

400+
int nEnabledTables = 0;
401+
400402
// helper object
401403
o2::pwglf::strangenessBuilderHelper straHelper;
402404

@@ -519,6 +521,49 @@ class BuilderModule
519521
cascadeBuilderOpts = inputCascadeBuilderOpts;
520522
preSelectOpts = inputPreSelectOpts;
521523

524+
baseOpts.mEnabledTables.resize(nTables, 0);
525+
526+
LOGF(info, "Checking if strangeness building is required");
527+
auto& workflows = context.services().template get<o2::framework::RunningWorkflowInfo const>();
528+
529+
nEnabledTables = 0;
530+
531+
TString listOfRequestors[nTables];
532+
for (int i = 0; i < nTables; i++) {
533+
int f = baseOpts.enabledTables->get(tableNames[i].c_str(), "enable");
534+
if (f == 1) {
535+
baseOpts.mEnabledTables[i] = 1;
536+
listOfRequestors[i] = "manual enabling";
537+
}
538+
if (f == -1) {
539+
// autodetect this table in other devices
540+
for (o2::framework::DeviceSpec const& device : workflows.devices) {
541+
// Step 1: check if this device subscribed to the V0data table
542+
for (auto const& input : device.inputs) {
543+
if (o2::framework::DataSpecUtils::partialMatch(input.matcher, o2::header::DataOrigin("AOD"))) {
544+
auto&& [origin, description, version] = o2::framework::DataSpecUtils::asConcreteDataMatcher(input.matcher);
545+
std::string tableNameWithVersion = tableNames[i];
546+
if (version > 0) {
547+
tableNameWithVersion += Form("_%03d", version);
548+
}
549+
if (input.matcher.binding == tableNameWithVersion) {
550+
LOGF(info, "Device %s has subscribed to %s (version %i)", device.name, tableNames[i], version);
551+
listOfRequestors[i].Append(Form("%s ", device.name.c_str()));
552+
baseOpts.mEnabledTables[i] = 1;
553+
nEnabledTables++;
554+
}
555+
}
556+
}
557+
}
558+
}
559+
}
560+
561+
if(nEnabledTables==0){
562+
LOGF(info, "Strangeness building not required. Will suppress all functionality, including logs, from this point forward.");
563+
return;
564+
}
565+
566+
522567
// setup bookkeeping histogram
523568
auto h = histos.template add<TH1>("hTableBuildingStatistics", "hTableBuildingStatistics", o2::framework::kTH1D, {{nTablesConst, -0.5f, static_cast<float>(nTablesConst)}});
524569
auto h2 = histos.template add<TH1>("hInputStatistics", "hInputStatistics", o2::framework::kTH1D, {{nTablesConst, -0.5f, static_cast<float>(nTablesConst)}});
@@ -588,44 +633,12 @@ class BuilderModule
588633

589634
mRunNumber = 0;
590635

591-
baseOpts.mEnabledTables.resize(nTables, 0);
592-
593-
LOGF(info, "Configuring tables to generate");
594-
auto& workflows = context.services().template get<o2::framework::RunningWorkflowInfo const>();
595-
596-
TString listOfRequestors[nTables];
597636
for (int i = 0; i < nTables; i++) {
598637
// adjust bookkeeping histogram
599638
h->GetXaxis()->SetBinLabel(i + 1, tableNames[i].c_str());
600639
h2->GetXaxis()->SetBinLabel(i + 1, tableNames[i].c_str());
601-
h->SetBinContent(i + 1, -1); // mark all as disabled to start
602-
603-
int f = baseOpts.enabledTables->get(tableNames[i].c_str(), "enable");
604-
if (f == 1) {
605-
baseOpts.mEnabledTables[i] = 1;
606-
listOfRequestors[i] = "manual enabling";
607-
}
608-
if (f == -1) {
609-
// autodetect this table in other devices
610-
for (o2::framework::DeviceSpec const& device : workflows.devices) {
611-
// Step 1: check if this device subscribed to the V0data table
612-
for (auto const& input : device.inputs) {
613-
if (device.name.compare("strangenessbuilder-initializer") == 0)
614-
continue; // don't listen to the initializer
615-
if (o2::framework::DataSpecUtils::partialMatch(input.matcher, o2::header::DataOrigin("AOD"))) {
616-
auto&& [origin, description, version] = o2::framework::DataSpecUtils::asConcreteDataMatcher(input.matcher);
617-
std::string tableNameWithVersion = tableNames[i];
618-
if (version > 0) {
619-
tableNameWithVersion += Form("_%03d", version);
620-
}
621-
if (input.matcher.binding == tableNameWithVersion) {
622-
LOGF(info, "Device %s has subscribed to %s (version %i)", device.name, tableNames[i], version);
623-
listOfRequestors[i].Append(Form("%s ", device.name.c_str()));
624-
baseOpts.mEnabledTables[i] = 1;
625-
}
626-
}
627-
}
628-
}
640+
if(baseOpts.mEnabledTables[i] == false){
641+
h->SetBinContent(i + 1, -1); // mark disabled tables, distinguish from zero counts
629642
}
630643
}
631644

@@ -2509,6 +2522,10 @@ class BuilderModule
25092522
template <typename TCCDB, typename THistoRegistry, typename TCollisions, typename TMCCollisions, typename TV0s, typename TCascades, typename TTrackedCascades, typename TTracks, typename TBCs, typename TMCParticles, typename TProducts>
25102523
void dataProcess(TCCDB& ccdb, THistoRegistry& histos, TCollisions const& collisions, TMCCollisions const& mccollisions, TV0s const& v0s, TCascades const& cascades, TTrackedCascades const& trackedCascades, TTracks const& tracks, TBCs const& bcs, TMCParticles const& mcParticles, TProducts& products)
25112524
{
2525+
if(nEnabledTables == 0){
2526+
return; // fully suppressed
2527+
}
2528+
25122529
if (!initCCDB(ccdb, bcs, collisions))
25132530
return;
25142531

0 commit comments

Comments
 (0)