From 015b95020f3b49d2c7a8498289a33ee3f8d2977f Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Fri, 28 May 2021 20:34:52 -0500 Subject: [PATCH 1/9] Removed file reading from SiStripQuality The information needed is now in SiStripDetInfo. It is up to the code that constructs a SiStripQuality to get access to a SiStripDetInfo. --- .../SiStripObjects/interface/SiStripDetInfo.h | 71 ++++++++++++++++ .../SiStripObjects/interface/SiStripQuality.h | 24 ++---- .../SiStripObjects/src/SiStripDelay.cc | 1 - .../SiStripObjects/src/SiStripDetInfo.cc | 47 +++++++++++ .../SiStripObjects/src/SiStripQuality.cc | 83 +++++-------------- .../interface/SiStripDetInfoFileReader.h | 29 +++---- .../src/SiStripDetInfoFileReader.cc | 43 ++-------- ...iStripBadModuleConfigurableFakeESSource.cc | 2 +- .../fake/SiStripQualityFakeESSource.cc | 6 +- .../plugins/fake/SiStripQualityFakeESSource.h | 5 +- .../plugins/real/SiStripQualityESProducer.cc | 5 +- .../src/SiStripQualityHelpers.cc | 6 +- .../test/testSiStripQualityESProducer.cc | 12 ++- .../plugins/SiStripHitEffFromCalibTree.cc | 4 +- .../SiStripQualityHotStripIdentifier.cc | 6 +- .../SiStripBadStrip_PayloadInspector.cc | 11 ++- .../SiStripCorrelateBadStripAndNoise.h | 1 + .../SiStripQualityHotStripIdentifierRoot.cc | 13 ++- .../src/SiStripCondObjBuilderFromDb.cc | 2 +- .../test/ClusterizerUnitTesterESProducer.cc | 5 +- 20 files changed, 220 insertions(+), 156 deletions(-) create mode 100644 CalibFormats/SiStripObjects/interface/SiStripDetInfo.h create mode 100644 CalibFormats/SiStripObjects/src/SiStripDetInfo.cc diff --git a/CalibFormats/SiStripObjects/interface/SiStripDetInfo.h b/CalibFormats/SiStripObjects/interface/SiStripDetInfo.h new file mode 100644 index 0000000000000..17152179c4fae --- /dev/null +++ b/CalibFormats/SiStripObjects/interface/SiStripDetInfo.h @@ -0,0 +1,71 @@ +#ifndef CalibFormats_SiStripObjects_SiStripDetInfo_h +#define CalibFormats_SiStripObjects_SiStripDetInfo_h +// -*- C++ -*- +// +// Package: CalibFormats/SiStripObjects +// Class : SiStripDetInfo +// +/**\class SiStripDetInfo SiStripDetInfo.h "SiStripDetInfo.h" + + Description: [one line class summary] + + Usage: + + +*/ +// +// Original Author: Christopher Jones +// Created: Fri, 28 May 2021 20:02:00 GMT +// + +// system include files + +// user include files +#include +#include + +// forward declarations + +class SiStripDetInfo { +public: + struct DetInfo { + DetInfo(){}; + DetInfo(unsigned short _nApvs, double _stripLength, float _thickness) + : nApvs(_nApvs), stripLength(_stripLength), thickness(_thickness){}; + + unsigned short nApvs; + double stripLength; + float thickness; + }; + + SiStripDetInfo(std::map iDetData, std::vector iIDs) noexcept + : detData_{std::move(iDetData)}, detIds_{std::move(iIDs)} {} + + SiStripDetInfo() = default; + ~SiStripDetInfo() = default; + + SiStripDetInfo(const SiStripDetInfo&) = default; + SiStripDetInfo& operator=(const SiStripDetInfo&) = default; + SiStripDetInfo(SiStripDetInfo&&) = default; + SiStripDetInfo& operator=(SiStripDetInfo&&) = default; + + // ---------- const member functions --------------------- + const std::vector& getAllDetIds() const noexcept { return detIds_; } + + const std::pair getNumberOfApvsAndStripLength(uint32_t detId) const; + + const float& getThickness(uint32_t detId) const; + + const std::map& getAllData() const noexcept { return detData_; } + + // ---------- static member functions -------------------- + + // ---------- member functions --------------------------- + +private: + // ---------- member data -------------------------------- + std::map detData_; + std::vector detIds_; +}; + +#endif diff --git a/CalibFormats/SiStripObjects/interface/SiStripQuality.h b/CalibFormats/SiStripObjects/interface/SiStripQuality.h index 9e1a88296b156..a4a230247d2ff 100644 --- a/CalibFormats/SiStripObjects/interface/SiStripQuality.h +++ b/CalibFormats/SiStripObjects/interface/SiStripQuality.h @@ -22,11 +22,12 @@ #include "CondFormats/RunInfo/interface/RunInfo.h" #include "CondFormats/SiStripObjects/interface/SiStripBadStrip.h" #include "CondFormats/SiStripObjects/interface/SiStripDetVOff.h" +#include "CalibFormats/SiStripObjects/interface/SiStripDetInfo.h" #include "FWCore/ParameterSet/interface/FileInPath.h" #include class SiStripDetCabling; -class SiStripDetInfoFileReader; +class SiStripDetInfo; class TrackerTopology; class SiStripQuality final : public SiStripBadStrip { @@ -43,11 +44,12 @@ class SiStripQuality final : public SiStripBadStrip { bool operator()(const BadComponent &p, const uint32_t i) const { return p.detid < i; } }; - SiStripQuality(); // takes default file for SiStripDetInfoFileReader - SiStripQuality(edm::FileInPath &); - SiStripQuality(const SiStripQuality &); // copy constructor + SiStripQuality() = delete; + explicit SiStripQuality(SiStripDetInfo); + SiStripQuality(const SiStripQuality &) = default; + SiStripQuality(SiStripQuality &&) = default; - ~SiStripQuality() override; + ~SiStripQuality() = default; void clear() { v_badstrips.clear(); @@ -76,13 +78,7 @@ class SiStripQuality final : public SiStripBadStrip { void ReduceGranularity(double); - SiStripQuality &operator+=(const SiStripQuality &); - SiStripQuality &operator-=(const SiStripQuality &); - const SiStripQuality operator-(const SiStripQuality &) const; - bool operator==(const SiStripQuality &) const; - bool operator!=(const SiStripQuality &) const; - - edm::FileInPath getFileInPath() const { return FileInPath_; } + SiStripQuality difference(const SiStripQuality &) const; //------- Interface for the user ----------// bool IsModuleUsable(const uint32_t &detid) const; @@ -149,10 +145,8 @@ class SiStripQuality final : public SiStripBadStrip { const std::vector &differentFeds, const bool printDebug); + SiStripDetInfo info_; bool toCleanUp; - edm::FileInPath FileInPath_; - SiStripDetInfoFileReader *reader; - std::vector BadComponentVect; const SiStripDetCabling *SiStripDetCabling_; diff --git a/CalibFormats/SiStripObjects/src/SiStripDelay.cc b/CalibFormats/SiStripObjects/src/SiStripDelay.cc index 72ea0fbc5ba31..bf98bfc9034f6 100644 --- a/CalibFormats/SiStripObjects/src/SiStripDelay.cc +++ b/CalibFormats/SiStripObjects/src/SiStripDelay.cc @@ -8,7 +8,6 @@ // Created: 26/10/2010 #include "CalibFormats/SiStripObjects/interface/SiStripDelay.h" -#include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h" #include "CondFormats/SiStripObjects/interface/SiStripDetSummary.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Utilities/interface/typelookup.h" diff --git a/CalibFormats/SiStripObjects/src/SiStripDetInfo.cc b/CalibFormats/SiStripObjects/src/SiStripDetInfo.cc new file mode 100644 index 0000000000000..8688a2cc61d1d --- /dev/null +++ b/CalibFormats/SiStripObjects/src/SiStripDetInfo.cc @@ -0,0 +1,47 @@ +// -*- C++ -*- +// +// Package: CalibFormats/SiStripObjects +// Class : SiStripDetInfo +// +// Implementation: +// [Notes on implementation] +// +// Original Author: Christopher Jones +// Created: Fri, 28 May 2021 20:10:25 GMT +// + +// system include files + +// user include files +#include "CalibFormats/SiStripObjects/interface/SiStripDetInfo.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +const std::pair SiStripDetInfo::getNumberOfApvsAndStripLength(uint32_t detId) const { + std::map::const_iterator it = detData_.find(detId); + + if (it != detData_.end()) { + return std::pair(it->second.nApvs, it->second.stripLength); + + } else { + std::pair defaultValue(0, 0.); + edm::LogWarning( + "SiStripDetInfoFileReader::getNumberOfApvsAndStripLength - Unable to find requested detid. Returning invalid " + "data ") + << std::endl; + return defaultValue; + } +} + +const float& SiStripDetInfo::getThickness(uint32_t detId) const { + std::map::const_iterator it = detData_.find(detId); + + if (it != detData_.end()) { + return it->second.thickness; + + } else { + static const float defaultValue = 0; + edm::LogWarning("SiStripDetInfo::getThickness - Unable to find requested detid. Returning invalid data ") + << std::endl; + return defaultValue; + } +} diff --git a/CalibFormats/SiStripObjects/src/SiStripQuality.cc b/CalibFormats/SiStripObjects/src/SiStripQuality.cc index 548e881421bc3..8e51ce03e1c3d 100644 --- a/CalibFormats/SiStripObjects/src/SiStripQuality.cc +++ b/CalibFormats/SiStripObjects/src/SiStripQuality.cc @@ -4,7 +4,7 @@ // #include "CalibFormats/SiStripObjects/interface/SiStripDetCabling.h" #include "CalibFormats/SiStripObjects/interface/SiStripQuality.h" -#include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h" +#include "CalibFormats/SiStripObjects/interface/SiStripDetInfo.h" #include "DataFormats/FEDRawData/interface/FEDNumbering.h" #include "DataFormats/SiStripDetId/interface/StripSubdetector.h" #include "DataFormats/TrackerCommon/interface/TrackerTopology.h" @@ -14,60 +14,30 @@ // Needed only for output #include "DataFormats/DetId/interface/DetId.h" -SiStripQuality::SiStripQuality() - : toCleanUp(false), - FileInPath_("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"), +SiStripQuality::SiStripQuality(SiStripDetInfo iInfo) + : info_(std::move(iInfo)), + toCleanUp(false), SiStripDetCabling_(nullptr), printDebug_(false), - useEmptyRunInfo_(false) { - reader = new SiStripDetInfoFileReader(FileInPath_.fullPath()); -} - -SiStripQuality::SiStripQuality(edm::FileInPath &file) - : toCleanUp(false), FileInPath_(file), SiStripDetCabling_(nullptr), printDebug_(false), useEmptyRunInfo_(false) { - reader = new SiStripDetInfoFileReader(FileInPath_.fullPath()); -} - -SiStripQuality::SiStripQuality(const SiStripQuality &other) : SiStripBadStrip::SiStripBadStrip(other) { - FileInPath_ = other.FileInPath_; - reader = new SiStripDetInfoFileReader(*(other.reader)); - toCleanUp = other.toCleanUp; - indexes = other.indexes; - v_badstrips = other.v_badstrips; - BadComponentVect = other.BadComponentVect; - SiStripDetCabling_ = other.SiStripDetCabling_; - printDebug_ = other.printDebug_; - useEmptyRunInfo_ = other.useEmptyRunInfo_; -} - -SiStripQuality::~SiStripQuality() { - LogTrace("SiStripQuality") << "SiStripQuality destructor" << std::endl; - delete reader; -} + useEmptyRunInfo_(false) {} -SiStripQuality &SiStripQuality::operator+=(const SiStripQuality &other) { - this->add(&other); - this->cleanUp(); - this->fillBadComponents(); - return *this; -} - -SiStripQuality &SiStripQuality::operator-=(const SiStripQuality &other) { +SiStripQuality SiStripQuality::difference(const SiStripQuality &other) const { SiStripBadStrip::RegistryIterator rbegin = other.getRegistryVectorBegin(); SiStripBadStrip::RegistryIterator rend = other.getRegistryVectorEnd(); std::vector ovect, vect; uint32_t detid; unsigned short Nstrips; + SiStripQuality retValue(*this); for (SiStripBadStrip::RegistryIterator rp = rbegin; rp != rend; ++rp) { detid = rp->detid; - Nstrips = reader->getNumberOfApvsAndStripLength(detid).first * 128; + Nstrips = info_.getNumberOfApvsAndStripLength(detid).first * 128; SiStripBadStrip::Range orange = SiStripBadStrip::Range(other.getDataVectorBegin() + rp->ibegin, other.getDataVectorBegin() + rp->iend); // Is this detid already in the collections owned by this class? - SiStripBadStrip::Range range = getRange(detid); + SiStripBadStrip::Range range = retValue.getRange(detid); if (range.first != range.second) { // yes, it is vect.clear(); @@ -78,29 +48,18 @@ SiStripQuality &SiStripQuality::operator-=(const SiStripQuality &other) { if (orange.second - orange.first != 1 || data_.firstStrip != 0 || data_.range < Nstrips) { ovect.insert(ovect.end(), orange.first, orange.second); vect.insert(vect.end(), range.first, range.second); - subtract(vect, ovect); + retValue.subtract(vect, ovect); } SiStripBadStrip::Range newrange(vect.begin(), vect.end()); - if (!put_replace(detid, newrange)) + if (!retValue.put_replace(detid, newrange)) edm::LogError("SiStripQuality") << "[" << __PRETTY_FUNCTION__ << "] " << std::endl; } } - cleanUp(); - fillBadComponents(); - return *this; -} - -const SiStripQuality SiStripQuality::operator-(const SiStripQuality &other) const { - return SiStripQuality(*this) -= other; + retValue.cleanUp(); + retValue.fillBadComponents(); + return retValue; } -bool SiStripQuality::operator==(const SiStripQuality &other) const { - SiStripQuality a = (*this) - other; - return a.getRegistryVectorBegin() == a.getRegistryVectorEnd(); -} - -bool SiStripQuality::operator!=(const SiStripQuality &other) const { return !(*this == other); } - void SiStripQuality::add(const SiStripDetVOff *Voff) { std::vector vect; short firstStrip = 0; @@ -114,7 +73,7 @@ void SiStripQuality::add(const SiStripDetVOff *Voff) { for (; iter != iterEnd; ++iter) { vect.clear(); - range = (short)(reader->getNumberOfApvsAndStripLength(*iter).first * 128.); + range = (short)(info_.getNumberOfApvsAndStripLength(*iter).first * 128.); LogTrace("SiStripQuality") << "[add Voff] add detid " << *iter << " first strip " << firstStrip << " range " << range << std::endl; vect.push_back(encode(firstStrip, range)); @@ -203,9 +162,9 @@ void SiStripQuality::add(const SiStripDetCabling *cab) { } void SiStripQuality::addNotConnectedConnectionFromCabling() { - std::map allData = reader->getAllData(); - std::map::const_iterator iter = allData.begin(); - std::map::const_iterator iterEnd = allData.end(); + auto allData = info_.getAllData(); + auto iter = allData.begin(); + auto iterEnd = allData.end(); std::vector vect; short firstStrip = 0; short range = 0; @@ -284,7 +243,7 @@ void SiStripQuality::add(const SiStripBadStrip *base) { void SiStripQuality::add(const uint32_t &detid, const SiStripBadStrip::Range &baserange) { std::vector vect, tmp; - unsigned short Nstrips = reader->getNumberOfApvsAndStripLength(detid).first * 128; + unsigned short Nstrips = info_.getNumberOfApvsAndStripLength(detid).first * 128; // Is this detid already in the collections owned by this class? SiStripBadStrip::Range range = getRange(detid); @@ -327,7 +286,7 @@ void SiStripQuality::compact(unsigned int &detid, std::vector &vec std::vector tmp = vect; vect.clear(); std::stable_sort(tmp.begin(), tmp.end()); - unsigned short Nstrips = reader->getNumberOfApvsAndStripLength(detid).first * 128; + unsigned short Nstrips = info_.getNumberOfApvsAndStripLength(detid).first * 128; compact(tmp, vect, Nstrips); } @@ -539,7 +498,7 @@ void SiStripQuality::fillBadComponents() { BadComponent result; SiStripBadStrip::data fs; - unsigned short Nstrips = reader->getNumberOfApvsAndStripLength(basep->detid).first * 128; + unsigned short Nstrips = info_.getNumberOfApvsAndStripLength(basep->detid).first * 128; // BadModules fs = decode(*(range.first)); diff --git a/CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h b/CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h index 08f7f0d469deb..ae0feed9fe38f 100644 --- a/CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h +++ b/CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h @@ -25,19 +25,12 @@ #include #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "CalibFormats/SiStripObjects/interface/SiStripDetInfo.h" #include class SiStripDetInfoFileReader { public: - struct DetInfo { - DetInfo(){}; - DetInfo(unsigned short _nApvs, double _stripLength, float _thickness) - : nApvs(_nApvs), stripLength(_stripLength), thickness(_thickness){}; - - unsigned short nApvs; - double stripLength; - float thickness; - }; + using DetInfo = SiStripDetInfo::DetInfo; explicit SiStripDetInfoFileReader(){}; explicit SiStripDetInfoFileReader(const edm::ParameterSet&, const edm::ActivityRegistry&); @@ -49,23 +42,23 @@ class SiStripDetInfoFileReader { SiStripDetInfoFileReader& operator=(const SiStripDetInfoFileReader& copy); - const std::vector& getAllDetIds() const { return detIds_; } + SiStripDetInfo const& info() const { return info_; } + + const std::vector& getAllDetIds() const { return info_.getAllDetIds(); } - const std::pair getNumberOfApvsAndStripLength(uint32_t detId) const; + const std::pair getNumberOfApvsAndStripLength(uint32_t detId) const { + return info_.getNumberOfApvsAndStripLength(detId); + } - const float& getThickness(uint32_t detId) const; + const float& getThickness(uint32_t detId) const { return info_.getThickness(detId); } - const std::map& getAllData() const { return detData_; } + const std::map& getAllData() const { return info_.getAllData(); } private: void reader(std::string filePath); std::ifstream inputFile_; - // std::string filePath_; - std::map detData_; - // std::map > detData_; - //std::map detThickness_; - std::vector detIds_; + SiStripDetInfo info_; }; #endif diff --git a/CalibTracker/SiStripCommon/src/SiStripDetInfoFileReader.cc b/CalibTracker/SiStripCommon/src/SiStripDetInfoFileReader.cc index fdcf85082ffe5..66ea6ec127ee4 100644 --- a/CalibTracker/SiStripCommon/src/SiStripDetInfoFileReader.cc +++ b/CalibTracker/SiStripCommon/src/SiStripDetInfoFileReader.cc @@ -13,8 +13,7 @@ using namespace cms; using namespace std; SiStripDetInfoFileReader& SiStripDetInfoFileReader::operator=(const SiStripDetInfoFileReader& copy) { - detData_ = copy.detData_; - detIds_ = copy.detIds_; + info_ = copy.info_; return *this; } @@ -24,10 +23,7 @@ SiStripDetInfoFileReader::SiStripDetInfoFileReader(const edm::ParameterSet& pset reader(fp.fullPath()); } -SiStripDetInfoFileReader::SiStripDetInfoFileReader(const SiStripDetInfoFileReader& copy) { - detData_ = copy.detData_; - detIds_ = copy.detIds_; -} +SiStripDetInfoFileReader::SiStripDetInfoFileReader(const SiStripDetInfoFileReader& copy) : info_{copy.info_} {} SiStripDetInfoFileReader::SiStripDetInfoFileReader(std::string filePath) { reader(filePath); } @@ -38,8 +34,8 @@ void SiStripDetInfoFileReader::reader(std::string filePath) { edm::LogInfo("SiStripDetInfoFileReader") << "filePath " << filePath << std::endl; - detData_.clear(); - detIds_.clear(); + std::map detData_; + std::vector detIds_; inputFile_.open(filePath.c_str()); @@ -88,6 +84,7 @@ void SiStripDetInfoFileReader::reader(std::string filePath) { return; } + info_ = SiStripDetInfo(detData_, detIds_); // int i=0; // for(std::map >::iterator it =detData_.begin(); it!=detData_.end(); it++ ) { // std::cout<< it->first << " " << (it->second).first << " " << (it->second).second< SiStripDetInfoFileReader::getNumberOfApvsAndStripLength(uint32_t detId) const { - std::map::const_iterator it = detData_.find(detId); - - if (it != detData_.end()) { - return std::pair(it->second.nApvs, it->second.stripLength); - - } else { - std::pair defaultValue(0, 0.); - edm::LogWarning( - "SiStripDetInfoFileReader::getNumberOfApvsAndStripLength - Unable to find requested detid. Returning invalid " - "data ") - << endl; - return defaultValue; - } -} - -const float& SiStripDetInfoFileReader::getThickness(uint32_t detId) const { - std::map::const_iterator it = detData_.find(detId); - - if (it != detData_.end()) { - return it->second.thickness; - - } else { - static const float defaultValue = 0; - edm::LogWarning("SiStripDetInfoFileReader::getThickness - Unable to find requested detid. Returning invalid data ") - << endl; - return defaultValue; - } -} diff --git a/CalibTracker/SiStripESProducers/plugins/fake/SiStripBadModuleConfigurableFakeESSource.cc b/CalibTracker/SiStripESProducers/plugins/fake/SiStripBadModuleConfigurableFakeESSource.cc index 439d6c8c22e1c..503f0fc40b173 100644 --- a/CalibTracker/SiStripESProducers/plugins/fake/SiStripBadModuleConfigurableFakeESSource.cc +++ b/CalibTracker/SiStripESProducers/plugins/fake/SiStripBadModuleConfigurableFakeESSource.cc @@ -81,7 +81,7 @@ SiStripBadModuleConfigurableFakeESSource::ReturnType SiStripBadModuleConfigurabl TrackerTopology const& tTopo = iRecord.get(trackTopoToken_); - auto quality = std::make_unique(); + auto quality = std::make_unique(m_detInfoFileReader.info()); if (!m_doByAPVs) { std::vector selDetIds{selectDetectors(&tTopo, m_detInfoFileReader.getAllDetIds())}; diff --git a/CalibTracker/SiStripESProducers/plugins/fake/SiStripQualityFakeESSource.cc b/CalibTracker/SiStripESProducers/plugins/fake/SiStripQualityFakeESSource.cc index 8c2b81808bd45..e9f6b539e96c4 100644 --- a/CalibTracker/SiStripESProducers/plugins/fake/SiStripQualityFakeESSource.cc +++ b/CalibTracker/SiStripESProducers/plugins/fake/SiStripQualityFakeESSource.cc @@ -17,6 +17,7 @@ // #include "CalibTracker/SiStripESProducers/plugins/fake/SiStripQualityFakeESSource.h" +#include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h" SiStripQualityFakeESSource::SiStripQualityFakeESSource(const edm::ParameterSet& iConfig) { setWhatProduced(this); @@ -24,7 +25,10 @@ SiStripQualityFakeESSource::SiStripQualityFakeESSource(const edm::ParameterSet& } std::unique_ptr SiStripQualityFakeESSource::produce(const SiStripQualityRcd& iRecord) { - return std::make_unique(); + edm::FileInPath path("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + SiStripDetInfoFileReader reader(path.fullPath()); + + return std::make_unique(reader.info()); } void SiStripQualityFakeESSource::setIntervalFor(const edm::eventsetup::EventSetupRecordKey&, diff --git a/CalibTracker/SiStripESProducers/plugins/fake/SiStripQualityFakeESSource.h b/CalibTracker/SiStripESProducers/plugins/fake/SiStripQualityFakeESSource.h index 5daed43138dfa..56bfc2af9c20f 100644 --- a/CalibTracker/SiStripESProducers/plugins/fake/SiStripQualityFakeESSource.h +++ b/CalibTracker/SiStripESProducers/plugins/fake/SiStripQualityFakeESSource.h @@ -23,6 +23,8 @@ class SiStripQualityFakeESSource : public edm::ESProducer, public edm::EventSetu public: SiStripQualityFakeESSource(const edm::ParameterSet&); ~SiStripQualityFakeESSource() override{}; + SiStripQualityFakeESSource(const SiStripQualityFakeESSource&) = delete; + const SiStripQualityFakeESSource& operator=(const SiStripQualityFakeESSource&) = delete; std::unique_ptr produce(const SiStripQualityRcd&); @@ -30,9 +32,6 @@ class SiStripQualityFakeESSource : public edm::ESProducer, public edm::EventSetu void setIntervalFor(const edm::eventsetup::EventSetupRecordKey&, const edm::IOVSyncValue& iov, edm::ValidityInterval& iValidity) override; - - SiStripQualityFakeESSource(const SiStripQualityFakeESSource&) = delete; - const SiStripQualityFakeESSource& operator=(const SiStripQualityFakeESSource&) = delete; }; #endif diff --git a/CalibTracker/SiStripESProducers/plugins/real/SiStripQualityESProducer.cc b/CalibTracker/SiStripESProducers/plugins/real/SiStripQualityESProducer.cc index c6ce284dc0100..cc7979158be9e 100644 --- a/CalibTracker/SiStripESProducers/plugins/real/SiStripQualityESProducer.cc +++ b/CalibTracker/SiStripESProducers/plugins/real/SiStripQualityESProducer.cc @@ -30,6 +30,7 @@ #include "DataFormats/SiStripCommon/interface/SiStripConstants.h" #include "CalibFormats/SiStripObjects/interface/SiStripQuality.h" #include "CalibTracker/Records/interface/SiStripDependentRecords.h" +#include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h" #include "CondFormats/RunInfo/interface/RunInfo.h" namespace { @@ -128,7 +129,9 @@ SiStripQualityESProducer::SiStripQualityESProducer(const edm::ParameterSet& iCon } std::unique_ptr SiStripQualityESProducer::produce(const SiStripQualityRcd& iRecord) { - auto quality = std::make_unique(); + edm::FileInPath path("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + SiStripDetInfoFileReader reader(path.fullPath()); + auto quality = std::make_unique(reader.info()); edm::LogInfo("SiStripQualityESProducer") << "produce called"; // Set the debug output level diff --git a/CalibTracker/SiStripESProducers/src/SiStripQualityHelpers.cc b/CalibTracker/SiStripESProducers/src/SiStripQualityHelpers.cc index 361dd21a465fb..643ad5b0c050b 100644 --- a/CalibTracker/SiStripESProducers/src/SiStripQualityHelpers.cc +++ b/CalibTracker/SiStripESProducers/src/SiStripQualityHelpers.cc @@ -3,6 +3,7 @@ #include "CalibFormats/SiStripObjects/interface/SiStripQuality.h" #include "CondFormats/SiStripObjects/interface/SiStripFedCabling.h" +#include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h" #include "CalibTracker/SiStripESProducers/interface/SiStripQualityHelpers.h" using dqm::harvesting::DQMStore; @@ -52,7 +53,10 @@ namespace { std::unique_ptr sistrip::badStripFromFedErr(DQMStore::IGetter& dqmStore, const SiStripFedCabling& fedCabling, float cutoff) { - auto quality = std::make_unique(); + edm::FileInPath path("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + SiStripDetInfoFileReader reader(path.fullPath()); + + auto quality = std::make_unique(reader.info()); dqmStore.cd(); const std::string dname{"SiStrip/ReadoutView"}; const std::string hpath{dname + "/FedIdVsApvId"}; diff --git a/CalibTracker/SiStripESProducers/test/testSiStripQualityESProducer.cc b/CalibTracker/SiStripESProducers/test/testSiStripQualityESProducer.cc index f286375365899..ecbb6ea69fadd 100644 --- a/CalibTracker/SiStripESProducers/test/testSiStripQualityESProducer.cc +++ b/CalibTracker/SiStripESProducers/test/testSiStripQualityESProducer.cc @@ -26,6 +26,10 @@ void testSiStripQualityESProducer::analyze(const edm::Event& e, const edm::Event char canvas[1024] = "\n&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&\n"; + //NOTE: can't guarantee this is what was used to make the SiStripQuality + // can difference be determined without it? + edm::FileInPath path("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + //&&&&&&&&&&&&&&&&&& //First Record //&&&&&&&&&&&&&&&&&& @@ -48,12 +52,12 @@ void testSiStripQualityESProducer::analyze(const edm::Event& e, const edm::Event edm::LogInfo("testSiStripQualityESProducer") << canvas << "[testSiStripQualityESProducer::analyze] Print difference (First - Second) SiStripQuality Rcd" << canvas << std::endl; - const SiStripQuality& tmp1 = *SiStripQualityESH_ - *twoSiStripQualityESH_; + const SiStripQuality& tmp1 = SiStripQualityESH_->difference(*twoSiStripQualityESH_); printObject(&tmp1); edm::LogInfo("testSiStripQualityESProducer") << canvas << "[testSiStripQualityESProducer::analyze] Print difference (Second - First) SiStripQuality Rcd" << canvas << std::endl; - const SiStripQuality& tmp2 = *twoSiStripQualityESH_ - *SiStripQualityESH_; + const SiStripQuality& tmp2 = twoSiStripQualityESH_->difference(*SiStripQualityESH_); printObject(&tmp2); } @@ -65,12 +69,12 @@ void testSiStripQualityESProducer::analyze(const edm::Event& e, const edm::Event edm::LogInfo("testSiStripQualityESProducer") << canvas << "[testSiStripQualityESProducer::analyze] Print difference (Current - Previous) SiStripQuality Rcd" << canvas << std::endl; - const SiStripQuality& tmp1 = *SiStripQualityESH_ - *m_Quality_; + const SiStripQuality& tmp1 = SiStripQualityESH_->difference(*m_Quality_); printObject(&tmp1); edm::LogInfo("testSiStripQualityESProducer") << canvas << "[testSiStripQualityESProducer::analyze] Print difference (Previous - Current) SiStripQuality Rcd" << canvas << std::endl; - const SiStripQuality& tmp2 = *m_Quality_ - *SiStripQualityESH_; + const SiStripQuality& tmp2 = m_Quality_->difference(*SiStripQualityESH_); printObject(&tmp2); } diff --git a/CalibTracker/SiStripHitEfficiency/plugins/SiStripHitEffFromCalibTree.cc b/CalibTracker/SiStripHitEfficiency/plugins/SiStripHitEffFromCalibTree.cc index 5fd45144ce72c..86128633e82a8 100644 --- a/CalibTracker/SiStripHitEfficiency/plugins/SiStripHitEffFromCalibTree.cc +++ b/CalibTracker/SiStripHitEfficiency/plugins/SiStripHitEffFromCalibTree.cc @@ -216,7 +216,7 @@ SiStripHitEffFromCalibTree::SiStripHitEffFromCalibTree(const edm::ParameterSet& if (_showRings) nTEClayers = 7; // number of rings - quality_ = new SiStripQuality; + quality_ = new SiStripQuality(reader->info()); } SiStripHitEffFromCalibTree::~SiStripHitEffFromCalibTree() {} @@ -1104,7 +1104,7 @@ void SiStripHitEffFromCalibTree::makeSQLite() { std::vector BadStripList; unsigned short NStrips; unsigned int id1; - std::unique_ptr pQuality = std::make_unique(); + std::unique_ptr pQuality = std::make_unique(reader->info()); //This is the list of the bad strips, use to mask out entire APVs //Now simply go through the bad hit list and mask out things that //are bad! diff --git a/CalibTracker/SiStripQuality/plugins/SiStripQualityHotStripIdentifier.cc b/CalibTracker/SiStripQuality/plugins/SiStripQualityHotStripIdentifier.cc index e962bd78ef6de..099a25040490f 100644 --- a/CalibTracker/SiStripQuality/plugins/SiStripQualityHotStripIdentifier.cc +++ b/CalibTracker/SiStripQuality/plugins/SiStripQualityHotStripIdentifier.cc @@ -15,6 +15,7 @@ //Insert here the include to the algos #include "CalibTracker/SiStripQuality/interface/SiStripHotStripAlgorithmFromClusterOccupancy.h" +#include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h" SiStripQualityHotStripIdentifier::SiStripQualityHotStripIdentifier(const edm::ParameterSet& iConfig) : ConditionDBWriter(iConfig), @@ -53,7 +54,10 @@ std::unique_ptr SiStripQualityHotStripIdentifier::getNewObject( theIdentifier.setMinNumEntries(parameters.getUntrackedParameter("MinNumEntries", 100)); theIdentifier.setMinNumEntriesPerStrip(parameters.getUntrackedParameter("MinNumEntriesPerStrip", 5)); - SiStripQuality* qobj = new SiStripQuality(); + edm::FileInPath path("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + SiStripDetInfoFileReader reader(path.fullPath()); + + SiStripQuality* qobj = new SiStripQuality(reader.info()); theIdentifier.extractBadStrips(qobj, ClusterPositionHistoMap, stripQuality_); edm::LogInfo("SiStripQualityHotStripIdentifier") diff --git a/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc index 030ac02522bf7..6cd819f1b0465 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc @@ -966,7 +966,10 @@ namespace { auto iov = tag.iovs.front(); std::shared_ptr payload = fetchPayload(std::get<1>(iov)); - SiStripQuality* siStripQuality_ = new SiStripQuality(); + edm::FileInPath path("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + SiStripDetInfoFileReader reader(path.fullPath()); + + SiStripQuality* siStripQuality_ = new SiStripQuality(reader.info()); siStripQuality_->add(payload.get()); siStripQuality_->cleanUp(); siStripQuality_->fillBadComponents(); @@ -1187,7 +1190,9 @@ namespace { // for the total int totNComponents[4][19][4] = {{{0}}}; - SiStripQuality* f_siStripQuality_ = new SiStripQuality(); + edm::FileInPath path("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + SiStripDetInfoFileReader reader(path.fullPath()); + SiStripQuality* f_siStripQuality_ = new SiStripQuality(reader.info()); f_siStripQuality_->add(first_payload.get()); f_siStripQuality_->cleanUp(); f_siStripQuality_->fillBadComponents(); @@ -1195,7 +1200,7 @@ namespace { // call the filler SiStripPI::fillBCArrays(f_siStripQuality_, f_NTkBadComponent, f_NBadComponent, m_trackerTopo); - SiStripQuality* l_siStripQuality_ = new SiStripQuality(); + SiStripQuality* l_siStripQuality_ = new SiStripQuality(reader.info()); l_siStripQuality_->add(last_payload.get()); l_siStripQuality_->cleanUp(); l_siStripQuality_->fillBadComponents(); diff --git a/DQM/SiStripMonitorSummary/plugins/SiStripCorrelateBadStripAndNoise.h b/DQM/SiStripMonitorSummary/plugins/SiStripCorrelateBadStripAndNoise.h index 6fc5b41045035..01276eca321c0 100644 --- a/DQM/SiStripMonitorSummary/plugins/SiStripCorrelateBadStripAndNoise.h +++ b/DQM/SiStripMonitorSummary/plugins/SiStripCorrelateBadStripAndNoise.h @@ -45,6 +45,7 @@ // class TrackerTopology; class TrackerGeometry; +class SiStripDetInfoFileReader; class SiStripCorrelateBadStripAndNoise : public edm::EDAnalyzer { public: explicit SiStripCorrelateBadStripAndNoise(const edm::ParameterSet &); diff --git a/DQMOffline/CalibTracker/plugins/SiStripQualityHotStripIdentifierRoot.cc b/DQMOffline/CalibTracker/plugins/SiStripQualityHotStripIdentifierRoot.cc index 4f8a380293e9d..be26661ee4b34 100644 --- a/DQMOffline/CalibTracker/plugins/SiStripQualityHotStripIdentifierRoot.cc +++ b/DQMOffline/CalibTracker/plugins/SiStripQualityHotStripIdentifierRoot.cc @@ -20,6 +20,7 @@ #include "CalibTracker/SiStripQuality/interface/SiStripHotStripAlgorithmFromClusterOccupancy.h" #include "CalibTracker/SiStripQuality/interface/SiStripBadAPVAlgorithmFromClusterOccupancy.h" #include "CalibTracker/SiStripQuality/interface/SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy.h" +#include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h" SiStripQualityHotStripIdentifierRoot::SiStripQualityHotStripIdentifierRoot(const edm::ParameterSet& iConfig) : ConditionDBWriter(iConfig), @@ -85,7 +86,9 @@ std::unique_ptr SiStripQualityHotStripIdentifierRoot::getNewObj conf_.getUntrackedParameter("WriteOccupancyRootFile", false)); theIdentifier->setTrackerGeometry(tracker_); - SiStripQuality* qobj = new SiStripQuality(); + edm::FileInPath path("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + SiStripDetInfoFileReader reader(path.fullPath()); + SiStripQuality* qobj = new SiStripQuality(reader.info()); theIdentifier->extractBadStrips( qobj, ClusterPositionHistoMap, @@ -130,7 +133,9 @@ std::unique_ptr SiStripQualityHotStripIdentifierRoot::getNewObj conf_.getUntrackedParameter("WriteOccupancyRootFile", false)); theIdentifier2->setTrackerGeometry(tracker_); - SiStripQuality* qobj = new SiStripQuality(); + edm::FileInPath path("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + SiStripDetInfoFileReader reader(path.fullPath()); + SiStripQuality* qobj = new SiStripQuality(reader.info()); theIdentifier2->extractBadAPVs(qobj, ClusterPositionHistoMap, SiStripQuality_); //---------- @@ -181,7 +186,9 @@ std::unique_ptr SiStripQualityHotStripIdentifierRoot::getNewObj parameters.getUntrackedParameter("OccupancyThreshold", 1.E-5)); theIdentifier3->setMinNumOfEvents(); - SiStripQuality* qobj = new SiStripQuality(); + edm::FileInPath path("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + SiStripDetInfoFileReader reader(path.fullPath()); + SiStripQuality* qobj = new SiStripQuality(reader.info()); theIdentifier3->extractBadAPVSandStrips( qobj, ClusterPositionHistoMap, diff --git a/OnlineDB/SiStripESSources/src/SiStripCondObjBuilderFromDb.cc b/OnlineDB/SiStripESSources/src/SiStripCondObjBuilderFromDb.cc index 731c828dc46e2..2978654c1c6ea 100644 --- a/OnlineDB/SiStripESSources/src/SiStripCondObjBuilderFromDb.cc +++ b/OnlineDB/SiStripESSources/src/SiStripCondObjBuilderFromDb.cc @@ -875,7 +875,7 @@ void SiStripCondObjBuilderFromDb::buildFEDRelatedObjects(SiStripConfigDb* const pedestals_ = new SiStripPedestals(); noises_ = new SiStripNoises(); threshold_ = new SiStripThreshold(); - quality_ = new SiStripQuality(); + quality_ = new SiStripQuality(m_reader->info()); i_trackercon detids_end = tc.end(); diff --git a/RecoLocalTracker/SiStripClusterizer/test/ClusterizerUnitTesterESProducer.cc b/RecoLocalTracker/SiStripClusterizer/test/ClusterizerUnitTesterESProducer.cc index 0270825473ffa..95a098e037c54 100644 --- a/RecoLocalTracker/SiStripClusterizer/test/ClusterizerUnitTesterESProducer.cc +++ b/RecoLocalTracker/SiStripClusterizer/test/ClusterizerUnitTesterESProducer.cc @@ -1,8 +1,11 @@ #include "RecoLocalTracker/SiStripClusterizer/test/ClusterizerUnitTesterESProducer.h" +#include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h" ClusterizerUnitTesterESProducer::ClusterizerUnitTesterESProducer(const edm::ParameterSet& conf) { edm::FileInPath testInfo(("RecoLocalTracker/SiStripClusterizer/test/ClusterizerUnitTestDetInfo.dat")); - auto quality = std::make_unique(testInfo); + SiStripDetInfoFileReader reader(testInfo.fullPath()); + + auto quality = std::make_unique(reader.info()); auto apvGain = std::make_unique(); auto noises = std::make_unique(); From 21123535738c0f6fb54eb7596fc421c94607c316 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Fri, 28 May 2021 21:06:44 -0500 Subject: [PATCH 2/9] Removed file reading from SiStripGain This allows dropping dependency on CalibTracker/SiStripCommon. --- CalibFormats/SiStripObjects/BuildFile.xml | 1 - .../SiStripObjects/interface/SiStripGain.h | 15 ++++++++++----- CalibFormats/SiStripObjects/src/SiStripGain.cc | 16 ++++++++-------- CalibFormats/SiStripObjects/test/BuildFile.xml | 1 + .../test/UnitTests/TestSiStripGain.cc | 15 +++++++++++---- .../plugins/real/SiStripGainESProducer.cc | 9 +++++++-- .../plugins/real/SiStripGainSimESProducer.cc | 9 +++++++-- .../test/ClusterizerUnitTesterESProducer.cc | 2 +- 8 files changed, 45 insertions(+), 23 deletions(-) diff --git a/CalibFormats/SiStripObjects/BuildFile.xml b/CalibFormats/SiStripObjects/BuildFile.xml index b6120ab636473..325f0aa1bcb9f 100644 --- a/CalibFormats/SiStripObjects/BuildFile.xml +++ b/CalibFormats/SiStripObjects/BuildFile.xml @@ -1,7 +1,6 @@ - diff --git a/CalibFormats/SiStripObjects/interface/SiStripGain.h b/CalibFormats/SiStripObjects/interface/SiStripGain.h index dbd91f09a3d22..c38e314afbbea 100644 --- a/CalibFormats/SiStripObjects/interface/SiStripGain.h +++ b/CalibFormats/SiStripObjects/interface/SiStripGain.h @@ -40,6 +40,7 @@ #include class TrackerTopology; +class SiStripDetInfo; class SiStripGain { public: @@ -48,22 +49,25 @@ class SiStripGain { const SiStripGain &operator=(const SiStripGain &) = delete; /// Kept for compatibility - inline SiStripGain(const SiStripApvGain &apvgain, const double &factor) : apvgain_(nullptr) { - multiply(apvgain, factor, std::make_pair("", "")); + inline SiStripGain(const SiStripApvGain &apvgain, const double &factor, const SiStripDetInfo &detInfo) + : apvgain_(nullptr) { + multiply(apvgain, factor, std::make_pair("", ""), detInfo); } inline SiStripGain(const SiStripApvGain &apvgain, const double &factor, - const std::pair &recordLabelPair) + const std::pair &recordLabelPair, + const SiStripDetInfo &detInfo) : apvgain_(nullptr) { - multiply(apvgain, factor, recordLabelPair); + multiply(apvgain, factor, recordLabelPair, detInfo); } /// Used to input additional gain values that will be multiplied to the first /// one void multiply(const SiStripApvGain &apvgain, const double &factor, - const std::pair &recordLabelPair); + const std::pair &recordLabelPair, + const SiStripDetInfo &detInfo); // getters // For the product of all apvGains @@ -103,6 +107,7 @@ class SiStripGain { private: void fillNewGain(const SiStripApvGain *apvgain, const double &factor, + SiStripDetInfo const &detInfo, const SiStripApvGain *apvgain2 = nullptr, const double &factor2 = 1.); diff --git a/CalibFormats/SiStripObjects/src/SiStripGain.cc b/CalibFormats/SiStripObjects/src/SiStripGain.cc index 4a85e5f423271..1bc4cc9dec09b 100644 --- a/CalibFormats/SiStripObjects/src/SiStripGain.cc +++ b/CalibFormats/SiStripObjects/src/SiStripGain.cc @@ -8,7 +8,7 @@ // Created: Wed Mar 22 12:24:33 CET 2006 #include "CalibFormats/SiStripObjects/interface/SiStripGain.h" -#include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h" +#include "CalibFormats/SiStripObjects/interface/SiStripDetInfo.h" #include "CondFormats/SiStripObjects/interface/SiStripDetSummary.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/Utilities/interface/typelookup.h" @@ -16,11 +16,12 @@ void SiStripGain::multiply(const SiStripApvGain &apvgain, const double &factor, - const std::pair &recordLabelPair) { + const std::pair &recordLabelPair, + const SiStripDetInfo &detInfo) { // When inserting the first ApvGain if (apvgain_ == nullptr) { if ((factor != 1) && (factor != 0)) { - fillNewGain(&apvgain, factor); + fillNewGain(&apvgain, factor, detInfo); } else { // If the normalization factor is one, no need to create a new // SiStripApvGain @@ -29,7 +30,7 @@ void SiStripGain::multiply(const SiStripApvGain &apvgain, } else { // There is already an ApvGain inside the SiStripGain. Multiply it by the // new one and save the new pointer. - fillNewGain(apvgain_, 1., &apvgain, factor); + fillNewGain(apvgain_, 1., detInfo, &apvgain, factor); } recordLabelPair_.push_back(recordLabelPair); apvgainVector_.push_back(&apvgain); @@ -38,12 +39,11 @@ void SiStripGain::multiply(const SiStripApvGain &apvgain, void SiStripGain::fillNewGain(const SiStripApvGain *apvgain, const double &factor, + const SiStripDetInfo &detInfo, const SiStripApvGain *apvgain2, const double &factor2) { SiStripApvGain *newApvGain = new SiStripApvGain; - edm::FileInPath fp("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); - SiStripDetInfoFileReader reader(fp.fullPath()); - const std::map &DetInfos = reader.getAllData(); + const auto &DetInfos = detInfo.getAllData(); // Loop on the apvgain in input and fill the newApvGain with the // values/factor. @@ -51,7 +51,7 @@ void SiStripGain::fillNewGain(const SiStripApvGain *apvgain, apvgain->getDetIds(detIds); std::vector::const_iterator it = detIds.begin(); for (; it != detIds.end(); ++it) { - std::map::const_iterator detInfoIt = DetInfos.find(*it); + auto detInfoIt = DetInfos.find(*it); if (detInfoIt != DetInfos.end()) { std::vector theSiStripVector; diff --git a/CalibFormats/SiStripObjects/test/BuildFile.xml b/CalibFormats/SiStripObjects/test/BuildFile.xml index 67f9cf2b56196..679e4140b4a1e 100644 --- a/CalibFormats/SiStripObjects/test/BuildFile.xml +++ b/CalibFormats/SiStripObjects/test/BuildFile.xml @@ -10,6 +10,7 @@ + diff --git a/CalibFormats/SiStripObjects/test/UnitTests/TestSiStripGain.cc b/CalibFormats/SiStripObjects/test/UnitTests/TestSiStripGain.cc index cb0095d206760..0ac2a533ae847 100644 --- a/CalibFormats/SiStripObjects/test/UnitTests/TestSiStripGain.cc +++ b/CalibFormats/SiStripObjects/test/UnitTests/TestSiStripGain.cc @@ -12,6 +12,7 @@ #include #include "CalibFormats/SiStripObjects/interface/SiStripGain.h" +#include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h" #ifndef TestSiStripGain_cc #define TestSiStripGain_cc @@ -69,8 +70,11 @@ class TestSiStripGain : public CppUnit::TestFixture { normVector.push_back(norm1); normVector.push_back(norm2); - SiStripGain gain(*apvGain1, norm1, recordLabelPair1); - gain.multiply(*apvGain2, norm2, recordLabelPair2); + edm::FileInPath fp("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + SiStripDetInfoFileReader reader(fp.fullPath()); + + SiStripGain gain(*apvGain1, norm1, recordLabelPair1, reader.info()); + gain.multiply(*apvGain2, norm2, recordLabelPair2, reader.info()); SiStripApvGain::Range range = gain.getRange(detId); // Check multiplication @@ -83,7 +87,10 @@ class TestSiStripGain : public CppUnit::TestFixture { } void apvGainsTest(const float &norm) { - SiStripGain gain(*apvGain1, norm); + edm::FileInPath fp("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + SiStripDetInfoFileReader reader(fp.fullPath()); + + SiStripGain gain(*apvGain1, norm, reader.info()); SiStripApvGain::Range range = gain.getRange(detId); CPPUNIT_ASSERT(float(gain.getApvGain(0, range)) == float(1. / norm)); CPPUNIT_ASSERT(float(gain.getApvGain(1, range)) == float(0.8 / norm)); @@ -91,7 +98,7 @@ class TestSiStripGain : public CppUnit::TestFixture { CPPUNIT_ASSERT(float(gain.getApvGain(3, range)) == float(2. / norm)); checkTag(gain, norm, "", ""); - SiStripGain gain2(*apvGain2, norm); + SiStripGain gain2(*apvGain2, norm, reader.info()); SiStripApvGain::Range range2 = gain2.getRange(detId); CPPUNIT_ASSERT(float(gain2.getApvGain(0, range2)) == float(1. / norm)); CPPUNIT_ASSERT(float(gain2.getApvGain(1, range2)) == float(1. / (norm * 0.8))); diff --git a/CalibTracker/SiStripESProducers/plugins/real/SiStripGainESProducer.cc b/CalibTracker/SiStripESProducers/plugins/real/SiStripGainESProducer.cc index ee7b01af4a81d..8c3986dbd6e71 100644 --- a/CalibTracker/SiStripESProducers/plugins/real/SiStripGainESProducer.cc +++ b/CalibTracker/SiStripESProducers/plugins/real/SiStripGainESProducer.cc @@ -13,6 +13,7 @@ #include "CondFormats/SiStripObjects/interface/SiStripApvGain.h" #include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h" #include "CalibTracker/Records/interface/SiStripDependentRecords.h" +#include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h" #include "SiStripGainFactor.h" @@ -91,14 +92,18 @@ SiStripGainESProducer::SiStripGainESProducer(const edm::ParameterSet& iConfig) : } std::unique_ptr SiStripGainESProducer::produce(const SiStripGainRcd& iRecord) { + edm::FileInPath fp("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + SiStripDetInfoFileReader reader(fp.fullPath()); + const auto& apvGain = gainGetters_[0]->gain(iRecord); // Create a new gain object and insert the ApvGain - auto gain = std::make_unique(apvGain, factor_.get(apvGain, 0), gainGetters_[0]->recordLabel()); + auto gain = + std::make_unique(apvGain, factor_.get(apvGain, 0), gainGetters_[0]->recordLabel(), reader.info()); for (unsigned int i = 1; i < gainGetters_.size(); ++i) { const auto& apvGain = gainGetters_[i]->gain(iRecord); // Add the new ApvGain to the gain object - gain->multiply(apvGain, factor_.get(apvGain, i), gainGetters_[i]->recordLabel()); + gain->multiply(apvGain, factor_.get(apvGain, i), gainGetters_[i]->recordLabel(), reader.info()); } return gain; diff --git a/CalibTracker/SiStripESProducers/plugins/real/SiStripGainSimESProducer.cc b/CalibTracker/SiStripESProducers/plugins/real/SiStripGainSimESProducer.cc index 66c4a70be6e7f..5898befccaadd 100644 --- a/CalibTracker/SiStripESProducers/plugins/real/SiStripGainSimESProducer.cc +++ b/CalibTracker/SiStripESProducers/plugins/real/SiStripGainSimESProducer.cc @@ -13,6 +13,7 @@ #include "CondFormats/SiStripObjects/interface/SiStripApvGain.h" #include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h" #include "CalibTracker/Records/interface/SiStripDependentRecords.h" +#include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h" #include "SiStripGainFactor.h" @@ -56,12 +57,16 @@ SiStripGainSimESProducer::SiStripGainSimESProducer(const edm::ParameterSet& iCon } std::unique_ptr SiStripGainSimESProducer::produce(const SiStripGainSimRcd& iRecord) { + const edm::FileInPath fp("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + const SiStripDetInfoFileReader reader(fp.fullPath()); + const auto& apvGain = iRecord.get(tokenLabels_[0].token_); - auto gain = std::make_unique(apvGain, factor_.get(apvGain, 0), tokenLabels_[0].recordLabel_); + auto gain = + std::make_unique(apvGain, factor_.get(apvGain, 0), tokenLabels_[0].recordLabel_, reader.info()); for (unsigned int i = 1; i < tokenLabels_.size(); ++i) { const auto& apvGain = iRecord.get(tokenLabels_[i].token_); - gain->multiply(apvGain, factor_.get(apvGain, i), tokenLabels_[i].recordLabel_); + gain->multiply(apvGain, factor_.get(apvGain, i), tokenLabels_[i].recordLabel_, reader.info()); } return gain; } diff --git a/RecoLocalTracker/SiStripClusterizer/test/ClusterizerUnitTesterESProducer.cc b/RecoLocalTracker/SiStripClusterizer/test/ClusterizerUnitTesterESProducer.cc index 95a098e037c54..3000e811c7a6a 100644 --- a/RecoLocalTracker/SiStripClusterizer/test/ClusterizerUnitTesterESProducer.cc +++ b/RecoLocalTracker/SiStripClusterizer/test/ClusterizerUnitTesterESProducer.cc @@ -11,7 +11,7 @@ ClusterizerUnitTesterESProducer::ClusterizerUnitTesterESProducer(const edm::Para extractNoiseGainQuality(conf, quality.get(), apvGain.get(), noises.get()); - gain_ = std::make_shared(*apvGain, 1); + gain_ = std::make_shared(*apvGain, 1, reader.info()); quality->cleanUp(); quality->fillBadComponents(); From fa8eceb40cd9406ba134207dedd02824baa5d9be Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Fri, 28 May 2021 21:26:12 -0500 Subject: [PATCH 3/9] code checks --- CalibFormats/SiStripObjects/interface/SiStripQuality.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CalibFormats/SiStripObjects/interface/SiStripQuality.h b/CalibFormats/SiStripObjects/interface/SiStripQuality.h index a4a230247d2ff..bfe4548c39696 100644 --- a/CalibFormats/SiStripObjects/interface/SiStripQuality.h +++ b/CalibFormats/SiStripObjects/interface/SiStripQuality.h @@ -49,7 +49,7 @@ class SiStripQuality final : public SiStripBadStrip { SiStripQuality(const SiStripQuality &) = default; SiStripQuality(SiStripQuality &&) = default; - ~SiStripQuality() = default; + ~SiStripQuality() override = default; void clear() { v_badstrips.clear(); From 4b5e9775b7d315cce20b11fced59370debb1bc1b Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Sat, 29 May 2021 08:04:08 -0500 Subject: [PATCH 4/9] Updated BuildFile.xml files to new dependencies --- Alignment/OfflineValidation/plugins/BuildFile.xml | 1 + CalibTracker/SiStripChannelGain/BuildFile.xml | 1 + CalibTracker/SiStripESProducers/BuildFile.xml | 1 + CalibTracker/SiStripESProducers/plugins/BuildFile.xml | 1 + .../SiStripHitEfficiency/plugins/BuildFile.xml | 1 + CondCore/SiStripPlugins/plugins/BuildFile.xml | 10 ++++++++++ CondCore/SiStripPlugins/test/BuildFile.xml | 1 + DQM/TrackingMonitorSource/plugins/BuildFile.xml | 1 + DQMOffline/CalibTracker/plugins/BuildFile.xml | 1 + OnlineDB/SiStripESSources/plugins/BuildFile.xml | 1 + RecoLocalTracker/SiStripClusterizer/test/BuildFile.xml | 1 + .../SiStripRecHitConverter/plugins/BuildFile.xml | 1 + RecoLocalTracker/SiStripZeroSuppression/BuildFile.xml | 1 + SimTracker/SiStripDigitizer/plugins/BuildFile.xml | 1 + 14 files changed, 23 insertions(+) diff --git a/Alignment/OfflineValidation/plugins/BuildFile.xml b/Alignment/OfflineValidation/plugins/BuildFile.xml index d4a5090ea8a50..9a516c4315241 100644 --- a/Alignment/OfflineValidation/plugins/BuildFile.xml +++ b/Alignment/OfflineValidation/plugins/BuildFile.xml @@ -10,6 +10,7 @@ + diff --git a/CalibTracker/SiStripChannelGain/BuildFile.xml b/CalibTracker/SiStripChannelGain/BuildFile.xml index 467d0e3fbf369..22f878a2adcef 100644 --- a/CalibTracker/SiStripChannelGain/BuildFile.xml +++ b/CalibTracker/SiStripChannelGain/BuildFile.xml @@ -4,6 +4,7 @@ + diff --git a/CalibTracker/SiStripESProducers/BuildFile.xml b/CalibTracker/SiStripESProducers/BuildFile.xml index e0d3ea5b7128c..5fac1ca25d006 100644 --- a/CalibTracker/SiStripESProducers/BuildFile.xml +++ b/CalibTracker/SiStripESProducers/BuildFile.xml @@ -1,4 +1,5 @@ + diff --git a/CalibTracker/SiStripESProducers/plugins/BuildFile.xml b/CalibTracker/SiStripESProducers/plugins/BuildFile.xml index 90e0f65db45ec..a5c4b0f009571 100644 --- a/CalibTracker/SiStripESProducers/plugins/BuildFile.xml +++ b/CalibTracker/SiStripESProducers/plugins/BuildFile.xml @@ -2,6 +2,7 @@ + diff --git a/CalibTracker/SiStripHitEfficiency/plugins/BuildFile.xml b/CalibTracker/SiStripHitEfficiency/plugins/BuildFile.xml index a76a0f3acd1be..fa3fc2a89fecd 100644 --- a/CalibTracker/SiStripHitEfficiency/plugins/BuildFile.xml +++ b/CalibTracker/SiStripHitEfficiency/plugins/BuildFile.xml @@ -12,6 +12,7 @@ + diff --git a/CondCore/SiStripPlugins/plugins/BuildFile.xml b/CondCore/SiStripPlugins/plugins/BuildFile.xml index f4dd06768a787..a42803db8b408 100644 --- a/CondCore/SiStripPlugins/plugins/BuildFile.xml +++ b/CondCore/SiStripPlugins/plugins/BuildFile.xml @@ -2,6 +2,7 @@ + @@ -9,6 +10,7 @@ + @@ -19,6 +21,7 @@ + @@ -28,6 +31,7 @@ + @@ -38,6 +42,7 @@ + @@ -45,6 +50,7 @@ + @@ -55,6 +61,7 @@ + @@ -72,6 +79,7 @@ + @@ -79,6 +87,7 @@ + @@ -87,6 +96,7 @@ + diff --git a/CondCore/SiStripPlugins/test/BuildFile.xml b/CondCore/SiStripPlugins/test/BuildFile.xml index 91856acb355dc..8a15b2b89857f 100644 --- a/CondCore/SiStripPlugins/test/BuildFile.xml +++ b/CondCore/SiStripPlugins/test/BuildFile.xml @@ -4,5 +4,6 @@ + diff --git a/DQM/TrackingMonitorSource/plugins/BuildFile.xml b/DQM/TrackingMonitorSource/plugins/BuildFile.xml index de9e10beeb345..c78b6f7697096 100644 --- a/DQM/TrackingMonitorSource/plugins/BuildFile.xml +++ b/DQM/TrackingMonitorSource/plugins/BuildFile.xml @@ -7,6 +7,7 @@ + diff --git a/DQMOffline/CalibTracker/plugins/BuildFile.xml b/DQMOffline/CalibTracker/plugins/BuildFile.xml index 5778f3bb779d2..4d9d1e2b1f993 100644 --- a/DQMOffline/CalibTracker/plugins/BuildFile.xml +++ b/DQMOffline/CalibTracker/plugins/BuildFile.xml @@ -11,6 +11,7 @@ + diff --git a/OnlineDB/SiStripESSources/plugins/BuildFile.xml b/OnlineDB/SiStripESSources/plugins/BuildFile.xml index d5a38ce745035..eb9fdfde7b49d 100644 --- a/OnlineDB/SiStripESSources/plugins/BuildFile.xml +++ b/OnlineDB/SiStripESSources/plugins/BuildFile.xml @@ -1,4 +1,5 @@ + diff --git a/RecoLocalTracker/SiStripClusterizer/test/BuildFile.xml b/RecoLocalTracker/SiStripClusterizer/test/BuildFile.xml index ed003eaf391a8..deca8322b08b4 100644 --- a/RecoLocalTracker/SiStripClusterizer/test/BuildFile.xml +++ b/RecoLocalTracker/SiStripClusterizer/test/BuildFile.xml @@ -1,5 +1,6 @@ + diff --git a/RecoLocalTracker/SiStripRecHitConverter/plugins/BuildFile.xml b/RecoLocalTracker/SiStripRecHitConverter/plugins/BuildFile.xml index df0f7979aa74f..ea434037fa593 100644 --- a/RecoLocalTracker/SiStripRecHitConverter/plugins/BuildFile.xml +++ b/RecoLocalTracker/SiStripRecHitConverter/plugins/BuildFile.xml @@ -1,5 +1,6 @@ + diff --git a/RecoLocalTracker/SiStripZeroSuppression/BuildFile.xml b/RecoLocalTracker/SiStripZeroSuppression/BuildFile.xml index 7f52cc84a63af..6e1a2b88d6b66 100644 --- a/RecoLocalTracker/SiStripZeroSuppression/BuildFile.xml +++ b/RecoLocalTracker/SiStripZeroSuppression/BuildFile.xml @@ -8,6 +8,7 @@ + diff --git a/SimTracker/SiStripDigitizer/plugins/BuildFile.xml b/SimTracker/SiStripDigitizer/plugins/BuildFile.xml index 91d7d2466808d..3b72fcb43b303 100644 --- a/SimTracker/SiStripDigitizer/plugins/BuildFile.xml +++ b/SimTracker/SiStripDigitizer/plugins/BuildFile.xml @@ -7,5 +7,6 @@ + From bab4b18c542b19a0aab47d4537461d5eacf8bd1a Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Sat, 29 May 2021 08:13:38 -0500 Subject: [PATCH 5/9] Removed unneeded include of FileInPath.h --- CalibFormats/SiStripObjects/interface/SiStripQuality.h | 1 - 1 file changed, 1 deletion(-) diff --git a/CalibFormats/SiStripObjects/interface/SiStripQuality.h b/CalibFormats/SiStripObjects/interface/SiStripQuality.h index bfe4548c39696..9f97d70b3ce9f 100644 --- a/CalibFormats/SiStripObjects/interface/SiStripQuality.h +++ b/CalibFormats/SiStripObjects/interface/SiStripQuality.h @@ -23,7 +23,6 @@ #include "CondFormats/SiStripObjects/interface/SiStripBadStrip.h" #include "CondFormats/SiStripObjects/interface/SiStripDetVOff.h" #include "CalibFormats/SiStripObjects/interface/SiStripDetInfo.h" -#include "FWCore/ParameterSet/interface/FileInPath.h" #include class SiStripDetCabling; From d72179d6dc1a70ecaaa53837f69292edc5e43e9e Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Sat, 29 May 2021 10:09:01 -0500 Subject: [PATCH 6/9] Added missing include of FileInPath.h --- CalibFormats/SiStripObjects/test/UnitTests/TestSiStripGain.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/CalibFormats/SiStripObjects/test/UnitTests/TestSiStripGain.cc b/CalibFormats/SiStripObjects/test/UnitTests/TestSiStripGain.cc index 0ac2a533ae847..29f7825edf74f 100644 --- a/CalibFormats/SiStripObjects/test/UnitTests/TestSiStripGain.cc +++ b/CalibFormats/SiStripObjects/test/UnitTests/TestSiStripGain.cc @@ -13,6 +13,7 @@ #include "CalibFormats/SiStripObjects/interface/SiStripGain.h" #include "CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h" +#include "FWCore/ParameterSet/interface/FileInPath.h" #ifndef TestSiStripGain_cc #define TestSiStripGain_cc From f7d5080f26ac0aa8acd8d160ee89f839c4da1957 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Sat, 29 May 2021 10:09:23 -0500 Subject: [PATCH 7/9] Removed unused Service API from SiStripDetInfoFileReader Although it had the constructor like a Service, the class was never registered to be a Service. --- .../SiStripCommon/interface/SiStripDetInfoFileReader.h | 3 --- CalibTracker/SiStripCommon/src/SiStripDetInfoFileReader.cc | 6 ------ 2 files changed, 9 deletions(-) diff --git a/CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h b/CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h index ae0feed9fe38f..23939b204a0dc 100644 --- a/CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h +++ b/CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h @@ -23,8 +23,6 @@ #include #include #include -#include "FWCore/ServiceRegistry/interface/Service.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" #include "CalibFormats/SiStripObjects/interface/SiStripDetInfo.h" #include @@ -33,7 +31,6 @@ class SiStripDetInfoFileReader { using DetInfo = SiStripDetInfo::DetInfo; explicit SiStripDetInfoFileReader(){}; - explicit SiStripDetInfoFileReader(const edm::ParameterSet&, const edm::ActivityRegistry&); explicit SiStripDetInfoFileReader(std::string filePath); explicit SiStripDetInfoFileReader(const SiStripDetInfoFileReader&); diff --git a/CalibTracker/SiStripCommon/src/SiStripDetInfoFileReader.cc b/CalibTracker/SiStripCommon/src/SiStripDetInfoFileReader.cc index 66ea6ec127ee4..aa229e718a79e 100644 --- a/CalibTracker/SiStripCommon/src/SiStripDetInfoFileReader.cc +++ b/CalibTracker/SiStripCommon/src/SiStripDetInfoFileReader.cc @@ -17,12 +17,6 @@ SiStripDetInfoFileReader& SiStripDetInfoFileReader::operator=(const SiStripDetIn return *this; } -SiStripDetInfoFileReader::SiStripDetInfoFileReader(const edm::ParameterSet& pset, const edm::ActivityRegistry& ar) { - edm::FileInPath fp( - pset.getUntrackedParameter("filePath", "CalibTracker/SiStripCommon/data/SiStripDetInfo.dat")); - reader(fp.fullPath()); -} - SiStripDetInfoFileReader::SiStripDetInfoFileReader(const SiStripDetInfoFileReader& copy) : info_{copy.info_} {} SiStripDetInfoFileReader::SiStripDetInfoFileReader(std::string filePath) { reader(filePath); } From dd09f364623b6a47c913b7a31ace48224966109c Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Sat, 29 May 2021 10:40:33 -0500 Subject: [PATCH 8/9] Added SiStripDetInfoFileReader::kDefaultFile Use the constant in recently changed files. --- .../test/UnitTests/TestSiStripGain.cc | 4 ++-- .../interface/SiStripDetInfoFileReader.h | 1 + .../fake/SiStripQualityFakeESSource.cc | 2 +- .../plugins/real/SiStripGainESProducer.cc | 2 +- .../plugins/real/SiStripGainSimESProducer.cc | 2 +- .../plugins/real/SiStripQualityESProducer.cc | 2 +- .../src/SiStripQualityHelpers.cc | 2 +- .../test/testSiStripQualityESProducer.cc | 4 ---- .../SiStripQualityHotStripIdentifier.cc | 4 ++-- .../SiStripBadStrip_PayloadInspector.cc | 20 +++++++++---------- .../SiStripQualityHotStripIdentifierRoot.cc | 6 +++--- 11 files changed, 23 insertions(+), 26 deletions(-) diff --git a/CalibFormats/SiStripObjects/test/UnitTests/TestSiStripGain.cc b/CalibFormats/SiStripObjects/test/UnitTests/TestSiStripGain.cc index 29f7825edf74f..4e3ff2d7fc782 100644 --- a/CalibFormats/SiStripObjects/test/UnitTests/TestSiStripGain.cc +++ b/CalibFormats/SiStripObjects/test/UnitTests/TestSiStripGain.cc @@ -71,7 +71,7 @@ class TestSiStripGain : public CppUnit::TestFixture { normVector.push_back(norm1); normVector.push_back(norm2); - edm::FileInPath fp("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + edm::FileInPath fp(SiStripDetInfoFileReader::kDefaultFile); SiStripDetInfoFileReader reader(fp.fullPath()); SiStripGain gain(*apvGain1, norm1, recordLabelPair1, reader.info()); @@ -88,7 +88,7 @@ class TestSiStripGain : public CppUnit::TestFixture { } void apvGainsTest(const float &norm) { - edm::FileInPath fp("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + edm::FileInPath fp(SiStripDetInfoFileReader::kDefaultFile); SiStripDetInfoFileReader reader(fp.fullPath()); SiStripGain gain(*apvGain1, norm, reader.info()); diff --git a/CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h b/CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h index 23939b204a0dc..8d6f4cfdd1fee 100644 --- a/CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h +++ b/CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h @@ -30,6 +30,7 @@ class SiStripDetInfoFileReader { public: using DetInfo = SiStripDetInfo::DetInfo; + constexpr static char const * const kDefaultFile = "CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"; explicit SiStripDetInfoFileReader(){}; explicit SiStripDetInfoFileReader(std::string filePath); diff --git a/CalibTracker/SiStripESProducers/plugins/fake/SiStripQualityFakeESSource.cc b/CalibTracker/SiStripESProducers/plugins/fake/SiStripQualityFakeESSource.cc index e9f6b539e96c4..919da97294da5 100644 --- a/CalibTracker/SiStripESProducers/plugins/fake/SiStripQualityFakeESSource.cc +++ b/CalibTracker/SiStripESProducers/plugins/fake/SiStripQualityFakeESSource.cc @@ -25,7 +25,7 @@ SiStripQualityFakeESSource::SiStripQualityFakeESSource(const edm::ParameterSet& } std::unique_ptr SiStripQualityFakeESSource::produce(const SiStripQualityRcd& iRecord) { - edm::FileInPath path("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + edm::FileInPath path(SiStripDetInfoFileReader::kDefaultFile); SiStripDetInfoFileReader reader(path.fullPath()); return std::make_unique(reader.info()); diff --git a/CalibTracker/SiStripESProducers/plugins/real/SiStripGainESProducer.cc b/CalibTracker/SiStripESProducers/plugins/real/SiStripGainESProducer.cc index 8c3986dbd6e71..2d6338a9100b5 100644 --- a/CalibTracker/SiStripESProducers/plugins/real/SiStripGainESProducer.cc +++ b/CalibTracker/SiStripESProducers/plugins/real/SiStripGainESProducer.cc @@ -92,7 +92,7 @@ SiStripGainESProducer::SiStripGainESProducer(const edm::ParameterSet& iConfig) : } std::unique_ptr SiStripGainESProducer::produce(const SiStripGainRcd& iRecord) { - edm::FileInPath fp("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + edm::FileInPath fp(SiStripDetInfoFileReader::kDefaultFile); SiStripDetInfoFileReader reader(fp.fullPath()); const auto& apvGain = gainGetters_[0]->gain(iRecord); diff --git a/CalibTracker/SiStripESProducers/plugins/real/SiStripGainSimESProducer.cc b/CalibTracker/SiStripESProducers/plugins/real/SiStripGainSimESProducer.cc index 5898befccaadd..cf82e95037dc5 100644 --- a/CalibTracker/SiStripESProducers/plugins/real/SiStripGainSimESProducer.cc +++ b/CalibTracker/SiStripESProducers/plugins/real/SiStripGainSimESProducer.cc @@ -57,7 +57,7 @@ SiStripGainSimESProducer::SiStripGainSimESProducer(const edm::ParameterSet& iCon } std::unique_ptr SiStripGainSimESProducer::produce(const SiStripGainSimRcd& iRecord) { - const edm::FileInPath fp("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + const edm::FileInPath fp(SiStripDetInfoFileReader::kDefaultFile); const SiStripDetInfoFileReader reader(fp.fullPath()); const auto& apvGain = iRecord.get(tokenLabels_[0].token_); diff --git a/CalibTracker/SiStripESProducers/plugins/real/SiStripQualityESProducer.cc b/CalibTracker/SiStripESProducers/plugins/real/SiStripQualityESProducer.cc index cc7979158be9e..3b14804cbd684 100644 --- a/CalibTracker/SiStripESProducers/plugins/real/SiStripQualityESProducer.cc +++ b/CalibTracker/SiStripESProducers/plugins/real/SiStripQualityESProducer.cc @@ -129,7 +129,7 @@ SiStripQualityESProducer::SiStripQualityESProducer(const edm::ParameterSet& iCon } std::unique_ptr SiStripQualityESProducer::produce(const SiStripQualityRcd& iRecord) { - edm::FileInPath path("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + edm::FileInPath path(SiStripDetInfoFileReader::kDefaultFile); SiStripDetInfoFileReader reader(path.fullPath()); auto quality = std::make_unique(reader.info()); edm::LogInfo("SiStripQualityESProducer") << "produce called"; diff --git a/CalibTracker/SiStripESProducers/src/SiStripQualityHelpers.cc b/CalibTracker/SiStripESProducers/src/SiStripQualityHelpers.cc index 643ad5b0c050b..69953d1ec4121 100644 --- a/CalibTracker/SiStripESProducers/src/SiStripQualityHelpers.cc +++ b/CalibTracker/SiStripESProducers/src/SiStripQualityHelpers.cc @@ -53,7 +53,7 @@ namespace { std::unique_ptr sistrip::badStripFromFedErr(DQMStore::IGetter& dqmStore, const SiStripFedCabling& fedCabling, float cutoff) { - edm::FileInPath path("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + edm::FileInPath path(SiStripDetInfoFileReader::kDefaultFile); SiStripDetInfoFileReader reader(path.fullPath()); auto quality = std::make_unique(reader.info()); diff --git a/CalibTracker/SiStripESProducers/test/testSiStripQualityESProducer.cc b/CalibTracker/SiStripESProducers/test/testSiStripQualityESProducer.cc index ecbb6ea69fadd..2eadbb7ccfb7d 100644 --- a/CalibTracker/SiStripESProducers/test/testSiStripQualityESProducer.cc +++ b/CalibTracker/SiStripESProducers/test/testSiStripQualityESProducer.cc @@ -26,10 +26,6 @@ void testSiStripQualityESProducer::analyze(const edm::Event& e, const edm::Event char canvas[1024] = "\n&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&\n"; - //NOTE: can't guarantee this is what was used to make the SiStripQuality - // can difference be determined without it? - edm::FileInPath path("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); - //&&&&&&&&&&&&&&&&&& //First Record //&&&&&&&&&&&&&&&&&& diff --git a/CalibTracker/SiStripQuality/plugins/SiStripQualityHotStripIdentifier.cc b/CalibTracker/SiStripQuality/plugins/SiStripQualityHotStripIdentifier.cc index 099a25040490f..953bcb7db6ffa 100644 --- a/CalibTracker/SiStripQuality/plugins/SiStripQualityHotStripIdentifier.cc +++ b/CalibTracker/SiStripQuality/plugins/SiStripQualityHotStripIdentifier.cc @@ -22,7 +22,7 @@ SiStripQualityHotStripIdentifier::SiStripQualityHotStripIdentifier(const edm::Pa dataLabel_(iConfig.getUntrackedParameter("dataLabel", "")), conf_(iConfig), fp_(iConfig.getUntrackedParameter( - "file", edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"))), + "file", edm::FileInPath(SiStripDetInfoFileReader::kDefaultFile))), Cluster_src_(iConfig.getParameter("Cluster_src")), Track_src_(iConfig.getUntrackedParameter("Track_src")), tracksCollection_in_EventTree(iConfig.getUntrackedParameter("RemoveTrackClusters", false)), @@ -54,7 +54,7 @@ std::unique_ptr SiStripQualityHotStripIdentifier::getNewObject( theIdentifier.setMinNumEntries(parameters.getUntrackedParameter("MinNumEntries", 100)); theIdentifier.setMinNumEntriesPerStrip(parameters.getUntrackedParameter("MinNumEntriesPerStrip", 5)); - edm::FileInPath path("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + edm::FileInPath path(SiStripDetInfoFileReader::kDefaultFile); SiStripDetInfoFileReader reader(path.fullPath()); SiStripQuality* qobj = new SiStripQuality(reader.info()); diff --git a/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc b/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc index 6cd819f1b0465..acd7374ff9f13 100644 --- a/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc +++ b/CondCore/SiStripPlugins/plugins/SiStripBadStrip_PayloadInspector.cc @@ -143,7 +143,7 @@ namespace { auto tagname = PlotBase::getTag<0>().name; std::shared_ptr payload = fetchPayload(std::get<1>(iov)); - edm::FileInPath fp_ = edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + edm::FileInPath fp_ = edm::FileInPath(SiStripDetInfoFileReader::kDefaultFile); SiStripDetInfoFileReader* reader = new SiStripDetInfoFileReader(fp_.fullPath()); auto theIOVsince = std::to_string(std::get<0>(iov)); @@ -204,7 +204,7 @@ namespace { auto tagname = PlotBase::getTag<0>().name; std::shared_ptr payload = fetchPayload(std::get<1>(iov)); - edm::FileInPath fp_ = edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + edm::FileInPath fp_ = edm::FileInPath(SiStripDetInfoFileReader::kDefaultFile); SiStripDetInfoFileReader* reader = new SiStripDetInfoFileReader(fp_.fullPath()); auto theIOVsince = std::to_string(std::get<0>(iov)); @@ -258,7 +258,7 @@ namespace { ~SiStripBadStripFractionByRun() override = default; float getFromPayload(SiStripBadStrip& payload) override { - edm::FileInPath fp_ = edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + edm::FileInPath fp_ = edm::FileInPath(SiStripDetInfoFileReader::kDefaultFile); SiStripDetInfoFileReader* reader = new SiStripDetInfoFileReader(fp_.fullPath()); std::vector detid; @@ -301,7 +301,7 @@ namespace { ~SiStripBadStripTIBFractionByRun() override = default; float getFromPayload(SiStripBadStrip& payload) override { - edm::FileInPath fp_ = edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + edm::FileInPath fp_ = edm::FileInPath(SiStripDetInfoFileReader::kDefaultFile); SiStripDetInfoFileReader* reader = new SiStripDetInfoFileReader(fp_.fullPath()); std::vector detid; @@ -347,7 +347,7 @@ namespace { ~SiStripBadStripTOBFractionByRun() override = default; float getFromPayload(SiStripBadStrip& payload) override { - edm::FileInPath fp_ = edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + edm::FileInPath fp_ = edm::FileInPath(SiStripDetInfoFileReader::kDefaultFile); SiStripDetInfoFileReader* reader = new SiStripDetInfoFileReader(fp_.fullPath()); std::vector detid; @@ -393,7 +393,7 @@ namespace { ~SiStripBadStripTIDFractionByRun() override = default; float getFromPayload(SiStripBadStrip& payload) override { - edm::FileInPath fp_ = edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + edm::FileInPath fp_ = edm::FileInPath(SiStripDetInfoFileReader::kDefaultFile); SiStripDetInfoFileReader* reader = new SiStripDetInfoFileReader(fp_.fullPath()); std::vector detid; @@ -439,7 +439,7 @@ namespace { ~SiStripBadStripTECFractionByRun() override = default; float getFromPayload(SiStripBadStrip& payload) override { - edm::FileInPath fp_ = edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + edm::FileInPath fp_ = edm::FileInPath(SiStripDetInfoFileReader::kDefaultFile); SiStripDetInfoFileReader* reader = new SiStripDetInfoFileReader(fp_.fullPath()); std::vector detid; @@ -865,7 +865,7 @@ namespace { std::string lastIOVsince = std::to_string(std::get<0>(lastiov)); std::string firstIOVsince = std::to_string(std::get<0>(firstiov)); - edm::FileInPath fp_ = edm::FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + edm::FileInPath fp_ = edm::FileInPath(SiStripDetInfoFileReader::kDefaultFile); SiStripDetInfoFileReader* reader = new SiStripDetInfoFileReader(fp_.fullPath()); std::string titleMap = @@ -966,7 +966,7 @@ namespace { auto iov = tag.iovs.front(); std::shared_ptr payload = fetchPayload(std::get<1>(iov)); - edm::FileInPath path("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + edm::FileInPath path(SiStripDetInfoFileReader::kDefaultFile); SiStripDetInfoFileReader reader(path.fullPath()); SiStripQuality* siStripQuality_ = new SiStripQuality(reader.info()); @@ -1190,7 +1190,7 @@ namespace { // for the total int totNComponents[4][19][4] = {{{0}}}; - edm::FileInPath path("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + edm::FileInPath path(SiStripDetInfoFileReader::kDefaultFile); SiStripDetInfoFileReader reader(path.fullPath()); SiStripQuality* f_siStripQuality_ = new SiStripQuality(reader.info()); f_siStripQuality_->add(first_payload.get()); diff --git a/DQMOffline/CalibTracker/plugins/SiStripQualityHotStripIdentifierRoot.cc b/DQMOffline/CalibTracker/plugins/SiStripQualityHotStripIdentifierRoot.cc index be26661ee4b34..b1bfa1c1f4247 100644 --- a/DQMOffline/CalibTracker/plugins/SiStripQualityHotStripIdentifierRoot.cc +++ b/DQMOffline/CalibTracker/plugins/SiStripQualityHotStripIdentifierRoot.cc @@ -86,7 +86,7 @@ std::unique_ptr SiStripQualityHotStripIdentifierRoot::getNewObj conf_.getUntrackedParameter("WriteOccupancyRootFile", false)); theIdentifier->setTrackerGeometry(tracker_); - edm::FileInPath path("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + edm::FileInPath path(SiStripDetInfoFileReader::kDefaultFile); SiStripDetInfoFileReader reader(path.fullPath()); SiStripQuality* qobj = new SiStripQuality(reader.info()); theIdentifier->extractBadStrips( @@ -133,7 +133,7 @@ std::unique_ptr SiStripQualityHotStripIdentifierRoot::getNewObj conf_.getUntrackedParameter("WriteOccupancyRootFile", false)); theIdentifier2->setTrackerGeometry(tracker_); - edm::FileInPath path("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + edm::FileInPath path(SiStripDetInfoFileReader::kDefaultFile); SiStripDetInfoFileReader reader(path.fullPath()); SiStripQuality* qobj = new SiStripQuality(reader.info()); theIdentifier2->extractBadAPVs(qobj, ClusterPositionHistoMap, SiStripQuality_); @@ -186,7 +186,7 @@ std::unique_ptr SiStripQualityHotStripIdentifierRoot::getNewObj parameters.getUntrackedParameter("OccupancyThreshold", 1.E-5)); theIdentifier3->setMinNumOfEvents(); - edm::FileInPath path("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"); + edm::FileInPath path(SiStripDetInfoFileReader::kDefaultFile); SiStripDetInfoFileReader reader(path.fullPath()); SiStripQuality* qobj = new SiStripQuality(reader.info()); theIdentifier3->extractBadAPVSandStrips( From f589717429f399c81cb0058136e7ed407c066a66 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Sat, 29 May 2021 14:07:40 -0500 Subject: [PATCH 9/9] code-format --- .../SiStripCommon/interface/SiStripDetInfoFileReader.h | 2 +- .../plugins/SiStripQualityHotStripIdentifier.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h b/CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h index 8d6f4cfdd1fee..eb9074fb25399 100644 --- a/CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h +++ b/CalibTracker/SiStripCommon/interface/SiStripDetInfoFileReader.h @@ -30,7 +30,7 @@ class SiStripDetInfoFileReader { public: using DetInfo = SiStripDetInfo::DetInfo; - constexpr static char const * const kDefaultFile = "CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"; + constexpr static char const* const kDefaultFile = "CalibTracker/SiStripCommon/data/SiStripDetInfo.dat"; explicit SiStripDetInfoFileReader(){}; explicit SiStripDetInfoFileReader(std::string filePath); diff --git a/CalibTracker/SiStripQuality/plugins/SiStripQualityHotStripIdentifier.cc b/CalibTracker/SiStripQuality/plugins/SiStripQualityHotStripIdentifier.cc index 953bcb7db6ffa..a55ebc933d135 100644 --- a/CalibTracker/SiStripQuality/plugins/SiStripQualityHotStripIdentifier.cc +++ b/CalibTracker/SiStripQuality/plugins/SiStripQualityHotStripIdentifier.cc @@ -21,8 +21,8 @@ SiStripQualityHotStripIdentifier::SiStripQualityHotStripIdentifier(const edm::Pa : ConditionDBWriter(iConfig), dataLabel_(iConfig.getUntrackedParameter("dataLabel", "")), conf_(iConfig), - fp_(iConfig.getUntrackedParameter( - "file", edm::FileInPath(SiStripDetInfoFileReader::kDefaultFile))), + fp_(iConfig.getUntrackedParameter("file", + edm::FileInPath(SiStripDetInfoFileReader::kDefaultFile))), Cluster_src_(iConfig.getParameter("Cluster_src")), Track_src_(iConfig.getUntrackedParameter("Track_src")), tracksCollection_in_EventTree(iConfig.getUntrackedParameter("RemoveTrackClusters", false)),