CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
SiStripNoisesAndBadCompsChecker Class Reference
Inheritance diagram for SiStripNoisesAndBadCompsChecker:
edm::one::EDAnalyzer< edm::one::SharedResources > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
 SiStripNoisesAndBadCompsChecker (const edm::ParameterSet &iConfig)
 
 ~SiStripNoisesAndBadCompsChecker () override=default
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::SharedResources >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

const edm::ESGetToken< SiStripBadStrip, SiStripBadChannelRcddeadChannelToken_
 
const edm::FileInPath fp_
 
const std::string k_Name_ = "SiStripNoisesAndBadCompsChecker"
 
const std::string k_Record_ = "SiStripNoisesRcd"
 
const edm::ESGetToken< SiStripNoises, SiStripNoisesRcdnoiseToken_
 
const uint32_t printdebug_
 
const bool writePayload_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 23 of file SiStripNoisesAndBadCompsChecker.cc.

Constructor & Destructor Documentation

◆ SiStripNoisesAndBadCompsChecker()

SiStripNoisesAndBadCompsChecker::SiStripNoisesAndBadCompsChecker ( const edm::ParameterSet iConfig)
explicit

Definition at line 44 of file SiStripNoisesAndBadCompsChecker.cc.

References cond::service::PoolDBOutputService::kSharedResource.

45  : writePayload_(iConfig.getUntrackedParameter<bool>("writePayload", true)),
52 }
const edm::ESGetToken< SiStripNoises, SiStripNoisesRcd > noiseToken_
T getUntrackedParameter(std::string const &, T const &) const
const edm::ESGetToken< SiStripBadStrip, SiStripBadChannelRcd > deadChannelToken_
static const std::string kSharedResource
static constexpr char const *const kDefaultFile

◆ ~SiStripNoisesAndBadCompsChecker()

SiStripNoisesAndBadCompsChecker::~SiStripNoisesAndBadCompsChecker ( )
overridedefault

Member Function Documentation

◆ analyze()

void SiStripNoisesAndBadCompsChecker::analyze ( const edm::Event evt,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 54 of file SiStripNoisesAndBadCompsChecker.cc.

References cond::service::PoolDBOutputService::appendOneIOV(), cond::service::PoolDBOutputService::beginOfTime(), submitPVResolutionJobs::count, cond::service::PoolDBOutputService::createOneIOV(), cond::service::PoolDBOutputService::currentTime(), deadChannelToken_, MillePedeFileConverter_cfg::e, fp_, compareTotals::fs, edm::FileInPath::fullPath(), edm::EventSetup::getData(), edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), k_Name_, k_Record_, hgchebackDigitizer_cfi::noise, noiseToken_, getGTfromDQMFile::obj, printdebug_, SiStripDetInfoFileReader::read(), DQM::reader, nano_mu_digi_cff::strip, sistrip::STRIPS_PER_APV, and writePayload_.

54  {
55  SiStripNoises obj; /* this is the output object */
56 
57  unsigned int count{0};
58 
60  const auto& DetInfos = reader.getAllData();
61 
62  auto const& deadChannel = iSetup.getData(deadChannelToken_);
63  auto const& noise = iSetup.getData(noiseToken_);
64 
65  for (const auto& it : DetInfos) {
66  const auto& nAPVs = it.second.nApvs;
67 
68  SiStripNoises::Range detNoiseRange = noise.getRange(it.first);
69 
70  // fill in the information about the dead channels
71  SiStripBadStrip::Range detBadStripRange = deadChannel.getRange(it.first);
72  std::vector<bool> badChannels;
73  badChannels.clear();
74  badChannels.insert(badChannels.begin(), sistrip::STRIPS_PER_APV * nAPVs, false);
75  for (SiStripBadStrip::ContainerIterator it2 = detBadStripRange.first; it2 != detBadStripRange.second; ++it2) {
76  SiStripBadStrip::data fs = deadChannel.decode(*it2);
77  for (int strip = fs.firstStrip; strip < fs.firstStrip + fs.range; ++strip) {
78  badChannels[strip] = true;
79  }
80  }
81 
82  SiStripNoises::InputVector theSiStripVector;
83  for (int strip = 0; strip < sistrip::STRIPS_PER_APV * nAPVs; ++strip) {
84  const auto& theNoise = noise.getNoise(strip, detNoiseRange);
85  if (!badChannels[strip]) {
86  try {
87  noise.verify(strip, detNoiseRange);
88  } catch (cms::Exception& e) {
89  if (count < printdebug_) {
90  edm::LogPrint(k_Name_) << "WARNING: out-of-range "
91  << " detid: " << it.first << " strip: " << strip << " noise:" << theNoise;
92  }
93  count++;
94  }
95  } // is strip is not masked
96  obj.setData(theNoise, theSiStripVector);
97  } // loop on the strips
98 
99  if (!obj.put(it.first, theSiStripVector))
100  edm::LogError(k_Name_) << "[SiStripNoisesAndBadCompsChecker::analyze] detid already exists";
101  } // loop on the detids
102  edm::LogPrint(k_Name_) << "Found " << count << " strips in out-of-bounds!";
103 
104  if (writePayload_) {
105  edm::LogInfo(k_Name_) << "Will write an updated fixed payload";
106 
107  //And now write sistripnoises data in DB
109 
110  if (mydbservice.isAvailable()) {
111  if (mydbservice->isNewTagRequest("SiStripNoisesRcd")) {
112  mydbservice->createOneIOV<SiStripNoises>(obj, mydbservice->beginOfTime(), k_Record_);
113  } else {
114  mydbservice->appendOneIOV<SiStripNoises>(obj, mydbservice->currentTime(), k_Record_);
115  }
116  } else {
117  edm::LogError("SiStripNoisesBuilder") << "Service is unavailable, will not write any output";
118  }
119  }
120 }
const edm::ESGetToken< SiStripNoises, SiStripNoisesRcd > noiseToken_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
std::string fullPath() const
Definition: FileInPath.cc:161
std::vector< unsigned int >::const_iterator ContainerIterator
std::vector< uint16_t > InputVector
Definition: SiStripNoises.h:50
reader
Definition: DQM.py:105
Log< level::Error, false > LogError
void createOneIOV(const T &payload, cond::Time_t firstSinceTime, const std::string &recordName)
const edm::ESGetToken< SiStripBadStrip, SiStripBadChannelRcd > deadChannelToken_
void appendOneIOV(const T &payload, cond::Time_t sinceTime, const std::string &recordName)
bool isNewTagRequest(const std::string &recordName)
SiStripDetInfo read(std::string filePath)
Log< level::Warning, true > LogPrint
Log< level::Info, false > LogInfo
static const uint16_t STRIPS_PER_APV
std::pair< ContainerIterator, ContainerIterator > Range
bool isAvailable() const
Definition: Service.h:40
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripNoises.h:47

◆ fillDescriptions()

void SiStripNoisesAndBadCompsChecker::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 123 of file SiStripNoisesAndBadCompsChecker.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, SiStripDetInfoFileReader::kDefaultFile, and SiStripPI::max.

123  {
125 
126  desc.setComment(
127  "Given a certain Global Tag, checks that the all the unmasked strips, do have a noise within the payload range");
128  desc.addUntracked<bool>("writePayload", true);
130  desc.addUntracked<uint32_t>("printDebug", std::numeric_limits<unsigned int>::max());
131  descriptions.addWithDefaultLabel(desc);
132 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
static constexpr char const *const kDefaultFile

Member Data Documentation

◆ deadChannelToken_

const edm::ESGetToken<SiStripBadStrip, SiStripBadChannelRcd> SiStripNoisesAndBadCompsChecker::deadChannelToken_
private

Definition at line 38 of file SiStripNoisesAndBadCompsChecker.cc.

Referenced by analyze().

◆ fp_

const edm::FileInPath SiStripNoisesAndBadCompsChecker::fp_
private

Definition at line 35 of file SiStripNoisesAndBadCompsChecker.cc.

Referenced by analyze().

◆ k_Name_

const std::string SiStripNoisesAndBadCompsChecker::k_Name_ = "SiStripNoisesAndBadCompsChecker"
private

Definition at line 40 of file SiStripNoisesAndBadCompsChecker.cc.

Referenced by analyze().

◆ k_Record_

const std::string SiStripNoisesAndBadCompsChecker::k_Record_ = "SiStripNoisesRcd"
private

Definition at line 41 of file SiStripNoisesAndBadCompsChecker.cc.

Referenced by analyze().

◆ noiseToken_

const edm::ESGetToken<SiStripNoises, SiStripNoisesRcd> SiStripNoisesAndBadCompsChecker::noiseToken_
private

Definition at line 37 of file SiStripNoisesAndBadCompsChecker.cc.

Referenced by analyze().

◆ printdebug_

const uint32_t SiStripNoisesAndBadCompsChecker::printdebug_
private

Definition at line 36 of file SiStripNoisesAndBadCompsChecker.cc.

Referenced by analyze().

◆ writePayload_

const bool SiStripNoisesAndBadCompsChecker::writePayload_
private

Definition at line 34 of file SiStripNoisesAndBadCompsChecker.cc.

Referenced by analyze().