Skip to content

Commit

Permalink
Prevent using getByToken on EcalRawData when skipped and not consumed
Browse files Browse the repository at this point in the history
  • Loading branch information
alejands committed Sep 22, 2023
1 parent 4d18fd5 commit 6ec2b12
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
10 changes: 9 additions & 1 deletion DQM/EcalMonitorTasks/interface/EcalDQMonitorTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,16 @@ class EcalDQMonitorTask : public DQMOneEDAnalyzer<edm::LuminosityBlockCache<ecal

edm::EDGetToken collectionTokens_[ecaldqm::nCollections]; // list of EDGetTokens
std::vector<std::pair<Processor, ecaldqm::Collections>> schedule_; // schedule of collections to run

std::vector<std::string> skipCollections_; // list of collections to explicitly remove from schedule
bool allowMissingCollections_; // when true, skip missing collections and log as warning
// note: skipping a collection here will result in
// EcalDQMonitorTask not consuming it, which may lead the
// module producing the collection to not run at all

bool allowMissingCollections_; // when true (default), skip missing collections and log as warning
// note: collections skipped by the parameter skipCollections will
// bypass this check and not issue warnings

int processedEvents_;

/* TASK TIME PROFILING */
Expand Down
13 changes: 11 additions & 2 deletions DQM/EcalMonitorTasks/plugins/EcalDQMonitorTask.cc
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,15 @@ void EcalDQMonitorTask::analyze(edm::Event const& _evt, edm::EventSetup const& _

std::set<ecaldqm::DQWorker*> enabledTasks;

bool eventTypeFiltering(false);
edm::Handle<EcalRawDataCollection> dcchsHndl;
if (_evt.getByToken(collectionTokens_[ecaldqm::kEcalRawData], dcchsHndl)) {

if (std::find(skipCollections_.begin(), skipCollections_.end(), "EcalRawData") != skipCollections_.end()) {
if (verbosity_ > 2)
edm::LogInfo("EcalDQM") << "EcalRawDataCollection is being skipped. No event-type filtering will be applied";

} else if (_evt.getByToken(collectionTokens_[ecaldqm::kEcalRawData], dcchsHndl)) {
eventTypeFiltering = true;
// determine event type (called run type in DCCHeader for some reason) for each FED
std::stringstream ss;
if (verbosity_ > 2)
Expand Down Expand Up @@ -194,9 +201,11 @@ void EcalDQMonitorTask::analyze(edm::Event const& _evt, edm::EventSetup const& _
return;
} else {
edm::LogWarning("EcalDQM") << "EcalRawDataCollection does not exist. No event-type filtering will be applied";
executeOnWorkers_([&enabledTasks](ecaldqm::DQWorker* worker) { enabledTasks.insert(worker); }, "");
}

if (!eventTypeFiltering)
executeOnWorkers_([&enabledTasks](ecaldqm::DQWorker* worker) { enabledTasks.insert(worker); }, "");

++processedEvents_;

// start event processing
Expand Down

0 comments on commit 6ec2b12

Please sign in to comment.