File indexing completed on 2024-04-06 12:03:29
0001
0002 #include <iostream>
0003 #include <cstdio>
0004 #include <sys/time.h>
0005
0006
0007 #include "CondFormats/DataRecord/interface/SiStripCondDataRecords.h"
0008 #include "CondFormats/SiStripObjects/interface/SiStripDetVOff.h"
0009 #include "FWCore/Framework/interface/ESHandle.h"
0010 #include "FWCore/Framework/interface/Event.h"
0011 #include "FWCore/Framework/interface/EventSetup.h"
0012 #include "FWCore/Framework/interface/Frameworkfwd.h"
0013 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0014 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0015 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0016 #include "FWCore/ServiceRegistry/interface/Service.h"
0017
0018
0019
0020
0021
0022 class SiStripDetVOffReader : public edm::one::EDAnalyzer<> {
0023 public:
0024 explicit SiStripDetVOffReader(const edm::ParameterSet&);
0025 ~SiStripDetVOffReader() override = default;
0026
0027 void analyze(const edm::Event&, const edm::EventSetup&) override;
0028
0029 private:
0030 const bool printdebug_;
0031 const edm::ESGetToken<SiStripDetVOff, SiStripDetVOffRcd> detVOffToken_;
0032 std::vector<uint32_t> detids;
0033 };
0034
0035 SiStripDetVOffReader::SiStripDetVOffReader(const edm::ParameterSet& iConfig)
0036 : printdebug_(iConfig.getUntrackedParameter<bool>("printDebug", true)), detVOffToken_(esConsumes()) {}
0037
0038 void SiStripDetVOffReader::analyze(const edm::Event& e, const edm::EventSetup& iSetup) {
0039 const auto& detVOff = iSetup.getData(detVOffToken_);
0040 edm::LogInfo("SiStripDetVOffReader") << "[SiStripDetVOffReader::analyze] End Reading SiStripDetVOff" << std::endl;
0041
0042
0043
0044
0045
0046 std::vector<uint32_t> detid;
0047 detVOff.getDetIds(detid);
0048
0049
0050 if (printdebug_) {
0051 for (uint32_t id = 0; id <= detid.size(); id++) {
0052 bool hvflag = detVOff.IsModuleHVOff(detid[id]);
0053 bool lvflag = detVOff.IsModuleLVOff(detid[id]);
0054 bool vflag = detVOff.IsModuleVOff(detid[id]);
0055 if (hvflag == true) {
0056 edm::LogInfo("SiStripDetVOffReader") << "detid: " << detid[id] << " HV\t OFF\n";
0057 } else {
0058 edm::LogInfo("SiStripDetVOffReader") << "detid: " << detid[id] << " HV\t ON\n";
0059 }
0060 if (lvflag == true) {
0061 edm::LogInfo("SiStripDetVOffReader") << "detid: " << detid[id] << " LV\t OFF\n";
0062 } else {
0063 edm::LogInfo("SiStripDetVOffReader") << "detid: " << detid[id] << " LV\t ON\n";
0064 }
0065 if (vflag == true) {
0066 edm::LogInfo("SiStripDetVOffReader") << "detid: " << detid[id] << " V\t OFF\n";
0067 } else {
0068 edm::LogInfo("SiStripDetVOffReader") << "detid: " << detid[id] << " V\t ON\n";
0069 }
0070 }
0071 }
0072 }
0073
0074 #include "FWCore/PluginManager/interface/ModuleDef.h"
0075 #include "FWCore/Framework/interface/MakerMacros.h"
0076
0077 DEFINE_FWK_MODULE(SiStripDetVOffReader);