Skip to content

Commit 16bf438

Browse files
authored
Merge pull request #47398 from mmusich/mm_protect_ITadnOTClusterValidators
protect `Phase2IT{OT}ValidateCluster` against missing input collections
2 parents be966d1 + f3e0943 commit 16bf438

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

Validation/SiTrackerPhase2V/plugins/Phase2ITValidateCluster.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,17 @@ void Phase2ITValidateCluster::fillITHistos(const edm::Event& iEvent,
153153
const std::map<unsigned int, SimTrack>& simTracks) {
154154
// Getting the clusters
155155
const auto& clusterHandle = iEvent.getHandle(clustersToken_);
156+
if (!clusterHandle.isValid()) {
157+
edm::LogWarning("Phase2ITValidateCluster") << "No SiPixelCluster Collection found in the event. Skipping!";
158+
return;
159+
}
160+
156161
// Getting PixelDigiSimLinks
157162
const auto& pixelSimLinksHandle = iEvent.getHandle(simITLinksToken_);
163+
if (!pixelSimLinksHandle.isValid()) {
164+
edm::LogWarning("Phase2ITValidateCluster") << "No PixelDigiSimLinks Collection found in the event. Skipping!";
165+
return;
166+
}
158167

159168
for (const auto& DSVItr : *clusterHandle) {
160169
// Getting the id of detector unit

Validation/SiTrackerPhase2V/plugins/Phase2OTValidateCluster.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,16 @@ void Phase2OTValidateCluster::fillOTHistos(const edm::Event& iEvent,
157157
const std::map<unsigned int, SimTrack>& simTracks) {
158158
// Getting the clusters
159159
const auto& clusterHandle = iEvent.getHandle(clustersToken_);
160+
if (!clusterHandle.isValid()) {
161+
edm::LogWarning("Phase2OTValidateCluster") << "No Phase2TrackerCluster1D Collection found in the event. Skipping!";
162+
return;
163+
}
160164
// Getting PixelDigiSimLinks
161165
const auto& pixelSimLinksHandle = iEvent.getHandle(simOTLinksToken_);
166+
if (!pixelSimLinksHandle.isValid()) {
167+
edm::LogWarning("Phase2OTValidateCluster") << "No PixelDigiSimLinks Collection found in the event. Skipping!";
168+
return;
169+
}
162170

163171
// Number of clusters
164172
std::map<std::string, unsigned int> nPrimarySimHits[3];

0 commit comments

Comments
 (0)