Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use std::vector<DetId> as data format of SiStrip DetIds with FED errors [13_2_X] #42666

Merged
Merged
Show file tree
Hide file tree
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
24 changes: 18 additions & 6 deletions CalibTracker/SiStripHitEfficiency/plugins/HitEff.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/Exception.h"
#include "Geometry/CommonDetUnit/interface/GeomDet.h"
#include "Geometry/CommonDetUnit/interface/GeomDetType.h"
#include "Geometry/CommonDetUnit/interface/GluedGeomDet.h"
Expand Down Expand Up @@ -81,7 +82,8 @@ HitEff::HitEff(const edm::ParameterSet& conf)
trajTrackAsso_token_(consumes<TrajTrackAssociationCollection>(conf.getParameter<edm::InputTag>("trajectories"))),
clusters_token_(
consumes<edmNew::DetSetVector<SiStripCluster> >(conf.getParameter<edm::InputTag>("siStripClusters"))),
digis_token_(consumes<DetIdCollection>(conf.getParameter<edm::InputTag>("siStripDigis"))),
digisCol_token_(consumes(conf.getParameter<edm::InputTag>("siStripDigis"))),
digisVec_token_(consumes(conf.getParameter<edm::InputTag>("siStripDigis"))),
trackerEvent_token_(consumes<MeasurementTrackerEvent>(conf.getParameter<edm::InputTag>("trackerEvent"))),
topoToken_(esConsumes()),
geomToken_(esConsumes()),
Expand Down Expand Up @@ -247,9 +249,19 @@ void HitEff::analyze(const edm::Event& e, const edm::EventSetup& es) {
const MagneticField* magField_ = &es.getData(magFieldToken_);

// get the list of module IDs with FED-detected errors
edm::Handle<DetIdCollection> fedErrorIds;
//e.getByLabel("siStripDigis", fedErrorIds );
e.getByToken(digis_token_, fedErrorIds);
// - In Aug-2023, the data format was changed from DetIdCollection to DetIdVector.
// - To provide some level of backward-compatibility,
// the plugin checks for both types giving preference to the new format.
// - If only the old format is available, the collection is
// converted to the new format, then used downstream.
auto const& fedErrorIdsCol_h = e.getHandle(digisCol_token_);
auto const& fedErrorIdsVec_h = e.getHandle(digisVec_token_);
if (not fedErrorIdsCol_h.isValid() and not fedErrorIdsVec_h.isValid()) {
throw cms::Exception("InvalidProductSiStripDetIdsWithFEDErrors")
<< "no valid product for SiStrip DetIds with FED errors (see parameter \"siStripDigis\"), "
"neither for new format (DetIdVector) nor old format (DetIdCollection)";
}
auto const& fedErrorIds = fedErrorIdsVec_h.isValid() ? *fedErrorIdsVec_h : fedErrorIdsCol_h->as_vector();

edm::ESHandle<MeasurementTracker> measurementTrackerHandle = es.getHandle(measurementTkToken_);

Expand Down Expand Up @@ -976,8 +988,8 @@ void HitEff::analyze(const edm::Event& e, const edm::EventSetup& es) {
}

//check for FED-detected errors and include those in SiStripQualBad
for (unsigned int ii = 0; ii < fedErrorIds->size(); ii++) {
if (iidd == (*fedErrorIds)[ii].rawId())
for (unsigned int ii = 0; ii < fedErrorIds.size(); ii++) {
if (iidd == fedErrorIds[ii].rawId())
SiStripQualBad = 1;
}

Expand Down
4 changes: 3 additions & 1 deletion CalibTracker/SiStripHitEfficiency/plugins/HitEff.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "CommonTools/UtilAlgos/interface/TFileService.h"
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/DetId/interface/DetIdCollection.h"
#include "DataFormats/DetId/interface/DetIdVector.h"
#include "DataFormats/GeometryCommonDetAlgo/interface/MeasurementError.h"
#include "DataFormats/GeometryCommonDetAlgo/interface/MeasurementVector.h"
#include "DataFormats/GeometryVector/interface/GlobalPoint.h"
Expand Down Expand Up @@ -80,7 +81,8 @@ class HitEff : public edm::one::EDAnalyzer<edm::one::SharedResources> {
const edm::EDGetTokenT<std::vector<Trajectory> > trajectories_token_;
const edm::EDGetTokenT<TrajTrackAssociationCollection> trajTrackAsso_token_;
const edm::EDGetTokenT<edmNew::DetSetVector<SiStripCluster> > clusters_token_;
const edm::EDGetTokenT<DetIdCollection> digis_token_;
const edm::EDGetTokenT<DetIdCollection> digisCol_token_;
const edm::EDGetTokenT<DetIdVector> digisVec_token_;
const edm::EDGetTokenT<MeasurementTrackerEvent> trackerEvent_token_;

// ES tokens
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "DataFormats/Common/interface/DetSetVector.h"
#include "DataFormats/Common/interface/DetSetVectorNew.h"
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/DetId/interface/DetIdCollection.h"
#include "DataFormats/GeometrySurface/interface/TrapezoidalPlaneBounds.h"
#include "DataFormats/GeometryVector/interface/GlobalPoint.h"
#include "DataFormats/GeometryVector/interface/GlobalVector.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "DataFormats/Common/interface/DetSetVectorNew.h"
#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/DetId/interface/DetIdCollection.h"
#include "DataFormats/DetId/interface/DetIdVector.h"
#include "DataFormats/GeometryCommonDetAlgo/interface/MeasurementError.h"
#include "DataFormats/GeometryCommonDetAlgo/interface/MeasurementVector.h"
#include "DataFormats/GeometrySurface/interface/TrapezoidalPlaneBounds.h"
Expand All @@ -41,6 +42,7 @@
#include "FWCore/ParameterSet/interface/ParameterDescription.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/Utilities/interface/Exception.h"
#include "Geometry/CommonDetUnit/interface/GeomDet.h"
#include "Geometry/CommonDetUnit/interface/GeomDetType.h"
#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
Expand Down Expand Up @@ -73,7 +75,7 @@ class SiStripHitEfficiencyWorker : public DQMEDAnalyzer {
const TrackerGeometry* tkgeom,
const StripClusterParameterEstimator& stripCPE,
const SiStripQuality& stripQuality,
const DetIdCollection& fedErrorIds,
const DetIdVector& fedErrorIds,
const edm::Handle<edm::DetSetVector<SiStripRawDigi>>& commonModeDigis,
const edmNew::DetSetVector<SiStripCluster>& theClusters,
int bunchCrossing,
Expand All @@ -92,7 +94,8 @@ class SiStripHitEfficiencyWorker : public DQMEDAnalyzer {
const edm::EDGetTokenT<std::vector<Trajectory>> trajectories_token_;
const edm::EDGetTokenT<TrajTrackAssociationCollection> trajTrackAsso_token_;
const edm::EDGetTokenT<edmNew::DetSetVector<SiStripCluster>> clusters_token_;
const edm::EDGetTokenT<DetIdCollection> digis_token_;
const edm::EDGetTokenT<DetIdCollection> digisCol_token_;
const edm::EDGetTokenT<DetIdVector> digisVec_token_;
const edm::EDGetTokenT<MeasurementTrackerEvent> trackerEvent_token_;

// event setup tokens
Expand Down Expand Up @@ -202,7 +205,8 @@ SiStripHitEfficiencyWorker::SiStripHitEfficiencyWorker(const edm::ParameterSet&
trajTrackAsso_token_(consumes<TrajTrackAssociationCollection>(conf.getParameter<edm::InputTag>("trajectories"))),
clusters_token_(
consumes<edmNew::DetSetVector<SiStripCluster>>(conf.getParameter<edm::InputTag>("siStripClusters"))),
digis_token_(consumes<DetIdCollection>(conf.getParameter<edm::InputTag>("siStripDigis"))),
digisCol_token_(consumes(conf.getParameter<edm::InputTag>("siStripDigis"))),
digisVec_token_(consumes(conf.getParameter<edm::InputTag>("siStripDigis"))),
trackerEvent_token_(consumes<MeasurementTrackerEvent>(conf.getParameter<edm::InputTag>("trackerEvent"))),
tTopoToken_(esConsumes()),
tkGeomToken_(esConsumes()),
Expand Down Expand Up @@ -445,11 +449,23 @@ void SiStripHitEfficiencyWorker::analyze(const edm::Event& e, const edm::EventSe
edm::Handle<edmNew::DetSetVector<SiStripCluster>> theClusters;
e.getByToken(clusters_token_, theClusters);

edm::Handle<DetIdCollection> fedErrorIds;
e.getByToken(digis_token_, fedErrorIds);
// get the list of module IDs with FED-detected errors
// - In Aug-2023, the data format was changed from DetIdCollection to DetIdVector.
// - To provide some level of backward-compatibility,
// the plugin checks for both types giving preference to the new format.
// - If only the old format is available, the collection is
// converted to the new format, then used downstream.
auto const& fedErrorIdsCol_h = e.getHandle(digisCol_token_);
auto const& fedErrorIdsVec_h = e.getHandle(digisVec_token_);
if (not fedErrorIdsCol_h.isValid() and not fedErrorIdsVec_h.isValid()) {
throw cms::Exception("InvalidProductSiStripDetIdsWithFEDErrors")
<< "no valid product for SiStrip DetIds with FED errors (see parameter \"siStripDigis\"), "
"neither for new format (DetIdVector) nor old format (DetIdCollection)";
}
auto const& fedErrorIds = fedErrorIdsVec_h.isValid() ? *fedErrorIdsVec_h : fedErrorIdsCol_h->as_vector();

// fill the calibData with the FEDErrors
for (const auto& fedErr : *fedErrorIds) {
for (const auto& fedErr : fedErrorIds) {
// fill the TkHistoMap occupancy map
calibData_.FEDErrorOccupancy->fill(fedErr.rawId(), 1.);

Expand Down Expand Up @@ -826,7 +842,7 @@ void SiStripHitEfficiencyWorker::analyze(const edm::Event& e, const edm::EventSe
tkgeom,
stripcpe,
stripQuality,
*fedErrorIds,
fedErrorIds,
commonModeDigis,
*theClusters,
e.bunchCrossing(),
Expand All @@ -847,7 +863,7 @@ void SiStripHitEfficiencyWorker::fillForTraj(const TrajectoryAtInvalidHit& tm,
const TrackerGeometry* tkgeom,
const StripClusterParameterEstimator& stripCPE,
const SiStripQuality& stripQuality,
const DetIdCollection& fedErrorIds,
const DetIdVector& fedErrorIds,
const edm::Handle<edm::DetSetVector<SiStripRawDigi>>& commonModeDigis,
const edmNew::DetSetVector<SiStripCluster>& theClusters,
int bunchCrossing,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'keep *_ALCARECOSiStripCalCosmics_*_*',
'keep *_siStripClusters_*_*',
'keep *_siPixelClusters_*_*',
'keep DetIdedmEDCollection_siStripDigis_*_*',
'keep DetIds_siStripDigis_*_*',
'keep L1AcceptBunchCrossings_*_*_*',
'keep L1GlobalTriggerReadoutRecord_gtDigis_*_*',
'keep LumiScalerss_scalersRawToDigi_*_*',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'keep *_ALCARECOSiStripCalMinBiasAAG_*_*',
'keep *_siStripClusters_*_*',
'keep *_siPixelClusters_*_*',
'keep DetIdedmEDCollection_siStripDigis_*_*',
'keep DetIds_siStripDigis_*_*',
'keep L1AcceptBunchCrossings_*_*_*',
'keep L1GlobalTriggerReadoutRecord_gtDigis_*_*',
'keep LumiScalerss_scalersRawToDigi_*_*',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'keep *_ALCARECOSiStripCalMinBiasAAG_*_*',
'keep *_siStripClusters_*_*',
'keep *_siPixelClusters_*_*',
'keep DetIdedmEDCollection_siStripDigis_*_*',
'keep DetIds_siStripDigis_*_*',
'keep L1AcceptBunchCrossings_*_*_*',
'keep L1GlobalTriggerReadoutRecord_gtDigis_*_*',
'keep LumiScalerss_scalersRawToDigi_*_*',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'keep *_ALCARECOSiStripCalMinBias_*_*',
'keep *_siStripClusters_*_*',
'keep *_siPixelClusters_*_*',
'keep DetIdedmEDCollection_siStripDigis_*_*',
'keep DetIds_siStripDigis_*_*',
'keep L1AcceptBunchCrossings_*_*_*',
'keep L1GlobalTriggerReadoutRecord_gtDigis_*_*',
'keep LumiScalerss_scalersRawToDigi_*_*',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'keep *_ALCARECOSiStripCalMinBias_*_*',
'keep *_siStripClusters_*_*',
'keep *_siPixelClusters_*_*',
'keep DetIdedmEDCollection_siStripDigis_*_*',
'keep DetIds_siStripDigis_*_*',
'keep L1AcceptBunchCrossings_*_*_*',
'keep L1GlobalTriggerReadoutRecord_gtDigis_*_*',
'keep LumiScalerss_scalersRawToDigi_*_*',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'keep *_ALCARECOSiStripCalSmallBiasScan_*_*',
'keep *_siStripClusters_*_*',
'keep *_siPixelClusters_*_*',
'keep DetIdedmEDCollection_siStripDigis_*_*',
'keep DetIds_siStripDigis_*_*',
'keep L1AcceptBunchCrossings_*_*_*',
'keep L1GlobalTriggerReadoutRecord_gtDigis_*_*',
'keep LumiScalerss_scalersRawToDigi_*_*',
Expand Down
6 changes: 3 additions & 3 deletions Configuration/EventContent/python/EventContent_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def SwapKeepAndDrop(l):
approxSiStripClusters.toModify(RAWEventContent,
outputCommands = RAWEventContent.outputCommands+[
'keep *_hltSiStripClusters2ApproxClusters_*_*',
'keep DetIdedmEDCollection_hltSiStripRawToDigi_*_*'
'keep DetIds_hltSiStripRawToDigi_*_*'
])

#
Expand Down Expand Up @@ -624,7 +624,7 @@ def SwapKeepAndDrop(l):
approxSiStripClusters.toModify(FEVTDEBUGEventContent,
outputCommands = FEVTDEBUGEventContent.outputCommands+[
'keep *_hltSiStripClusters2ApproxClusters_*_*',
'keep DetIdedmEDCollection_hltSiStripRawToDigi_*_*'
'keep DetIds_hltSiStripRawToDigi_*_*'
])
#
#
Expand All @@ -643,7 +643,7 @@ def SwapKeepAndDrop(l):
approxSiStripClusters.toModify(FEVTDEBUGHLTEventContent,
outputCommands = FEVTDEBUGHLTEventContent.outputCommands+[
'keep *_hltSiStripClusters2ApproxClusters_*_*',
'keep DetIdedmEDCollection_hltSiStripRawToDigi_*_*'
'keep DetIds_hltSiStripRawToDigi_*_*'
])
phase2_muon.toModify(FEVTDEBUGHLTEventContent,
outputCommands = FEVTDEBUGHLTEventContent.outputCommands + ['keep recoMuons_muons1stStep_*_*'])
Expand Down
2 changes: 1 addition & 1 deletion Configuration/Skimming/test/test_EXOHighMET_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
'keep *_hltScoutingPrimaryVertexPacker_*_*',
'keep *_hltScoutingTrackPacker_*_*',
'keep edmTriggerResults_*_*_*',
'keep DetIdedmEDCollection_siStripDigis_*_*',
'keep DetIds_siStripDigis_*_*',
'keep DetIdedmEDCollection_siPixelDigis_*_*',
'keep PixelFEDChanneledmNewDetSetVector_siPixelDigis_*_*',
'keep *_siPixelClusters_*_*',
Expand Down
Loading