Skip to content

Commit

Permalink
fix in SiPixelQualityESProducer to support two labelled records
Browse files Browse the repository at this point in the history
  • Loading branch information
ferencek committed Nov 14, 2022
1 parent 69d9c71 commit c61a662
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class SiPixelQualityESProducer : public edm::ESProducer, public edm::EventSetupR

std::unique_ptr<SiPixelQuality> produce(const SiPixelQualityRcd& iRecord);
std::unique_ptr<SiPixelQuality> produceWithLabel(const SiPixelQualityRcd& iRecord);
std::unique_ptr<SiPixelQuality> produceWithLabelRawToDigi(const SiPixelQualityRcd& iRecord);

private:
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey&,
Expand All @@ -66,6 +67,7 @@ class SiPixelQualityESProducer : public edm::ESProducer, public edm::EventSetupR

const Tokens defaultTokens_;
Tokens labelTokens_;
Tokens labelTokens_RawToDigi_;
};

//
Expand All @@ -79,10 +81,19 @@ SiPixelQualityESProducer::SiPixelQualityESProducer(const edm::ParameterSet& conf
auto label =
conf_.exists("siPixelQualityLabel") ? conf_.getParameter<std::string>("siPixelQualityLabel") : std::string{};

if (label == "forDigitizer" || label == "forRawToDigi") {
if (label == "forDigitizer") {
labelTokens_ =
Tokens(setWhatProduced(this, &SiPixelQualityESProducer::produceWithLabel, edm::es::Label(label)), label);
}

label = conf_.exists("siPixelQualityLabel_RawToDigi")
? conf_.getParameter<std::string>("siPixelQualityLabel_RawToDigi")
: std::string{};

if (label == "forRawToDigi") {
labelTokens_RawToDigi_ = Tokens(
setWhatProduced(this, &SiPixelQualityESProducer::produceWithLabelRawToDigi, edm::es::Label(label)), label);
}
findingRecord<SiPixelQualityRcd>();
}

Expand Down Expand Up @@ -119,6 +130,9 @@ std::unique_ptr<SiPixelQuality> SiPixelQualityESProducer::produce(const SiPixelQ
std::unique_ptr<SiPixelQuality> SiPixelQualityESProducer::produceWithLabel(const SiPixelQualityRcd& iRecord) {
return get_pointer(iRecord, labelTokens_);
}
std::unique_ptr<SiPixelQuality> SiPixelQualityESProducer::produceWithLabelRawToDigi(const SiPixelQualityRcd& iRecord) {
return get_pointer(iRecord, labelTokens_RawToDigi_);
}

void SiPixelQualityESProducer::setIntervalFor(const edm::eventsetup::EventSetupRecordKey&,
const edm::IOVSyncValue& iosv,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

siPixelQualityESProducer = cms.ESProducer("SiPixelQualityESProducer",
siPixelQualityLabel = cms.string(""),
siPixelQualityLabel_RawToDigi = cms.string("")
)

from Configuration.ProcessModifiers.siPixelQualityRawToDigi_cff import siPixelQualityRawToDigi
siPixelQualityRawToDigi.toModify(siPixelQualityESProducer,
siPixelQualityLabel = 'forRawToDigi',
siPixelQualityLabel_RawToDigi = 'forRawToDigi',
)

0 comments on commit c61a662

Please sign in to comment.