Skip to content

Commit

Permalink
add protection against missing input collections in Phase2IT{OT}Monit…
Browse files Browse the repository at this point in the history
…orCluster
  • Loading branch information
mmusich committed Sep 19, 2023
1 parent b51b519 commit ecc4d62
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions DQM/SiTrackerPhase2/plugins/Phase2ITMonitorCluster.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ void Phase2ITMonitorCluster::dqmBeginRun(const edm::Run& iRun, const edm::EventS
void Phase2ITMonitorCluster::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
// Getting the clusters
const auto& itPixelClusterHandle = iEvent.getHandle(itPixelClusterToken_);

if (!itPixelClusterHandle.isValid()) {
edm::LogWarning("Phase2ITMonitorCluster") << "No SiPixelCluster Collection found in the event. Skipping!";
return;
}

// Number of clusters
std::map<std::string, unsigned int> nClsmap;
unsigned int nclusGlobal = 0;
Expand Down
6 changes: 6 additions & 0 deletions DQM/SiTrackerPhase2/plugins/Phase2OTMonitorCluster.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ void Phase2OTMonitorCluster::dqmBeginRun(const edm::Run& iRun, const edm::EventS
void Phase2OTMonitorCluster::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
// Getting the clusters
const auto& clusterHandle = iEvent.getHandle(clustersToken_);

if (!clusterHandle.isValid()) {
edm::LogWarning("Phase2OTMonitorCluster") << "No Phase2TrackerCluster1D Collection found in the event. Skipping!";
return;
}

// Number of clusters
std::map<std::string, unsigned int> nClustersCounter_P; //map of detidkey vs #cls
std::map<std::string, unsigned int> nClustersCounter_S; //map of detidkey vs #cls
Expand Down

0 comments on commit ecc4d62

Please sign in to comment.