Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-11-11 03:56:57

0001 // user include files
0002 #include "FWCore/Framework/interface/Frameworkfwd.h"
0003 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0004 #include "FWCore/Framework/interface/Event.h"
0005 #include "FWCore/Framework/interface/EventSetup.h"
0006 #include "FWCore/Framework/interface/ESHandle.h"
0007 #include "FWCore/ServiceRegistry/interface/Service.h"
0008 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0009 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0010 #include "CondFormats/SiStripObjects/interface/SiStripThreshold.h"
0011 #include "CondFormats/DataRecord/interface/SiStripThresholdRcd.h"
0012 
0013 // system include files
0014 #include <memory>
0015 #include <iostream>
0016 #include <cstdio>
0017 #include <sys/time.h>
0018 
0019 class SiStripThresholdReader : public edm::one::EDAnalyzer<> {
0020 public:
0021   explicit SiStripThresholdReader(const edm::ParameterSet&);
0022   ~SiStripThresholdReader() override = default;
0023 
0024   void analyze(const edm::Event&, const edm::EventSetup&) override;
0025 
0026 private:
0027   uint32_t printdebug_;
0028   const edm::ESGetToken<SiStripThreshold, SiStripThresholdRcd> thresholdToken_;
0029 };
0030 
0031 using namespace std;
0032 using namespace cms;
0033 
0034 SiStripThresholdReader::SiStripThresholdReader(const edm::ParameterSet& iConfig)
0035     : printdebug_(iConfig.getUntrackedParameter<uint32_t>("printDebug", 3)), thresholdToken_(esConsumes()) {}
0036 
0037 void SiStripThresholdReader::analyze(const edm::Event& e, const edm::EventSetup& iSetup) {
0038   const auto& thresholds = iSetup.getData(thresholdToken_);
0039   edm::LogInfo("SiStripThresholdReader") << "[SiStripThresholdReader::analyze] End Reading SiStripThreshold"
0040                                          << std::endl;
0041 
0042   std::vector<uint32_t> detid;
0043   thresholds.getDetIds(detid);
0044   edm::LogInfo("Number of detids ") << detid.size() << std::endl;
0045   if (printdebug_)
0046     for (size_t id = 0; id < detid.size() && id < printdebug_; id++) {
0047       SiStripThreshold::Range range = thresholds.getRange(detid[id]);
0048 
0049       //int strip=0;
0050       float old_clusTh = -1, old_lowTh = -1, old_highTh = -1, old_FirstStrip = -1;
0051       for (int it = 0; it < 768; it++) {
0052         SiStripThreshold::Data data = thresholds.getData(it, range);
0053         std::stringstream ss;
0054         data.print(ss);
0055         if (old_clusTh != data.getClusth() || old_lowTh != data.getLth() || old_highTh != data.getHth() ||
0056             old_FirstStrip != data.getFirstStrip()) {
0057           edm::LogInfo("SiStripThresholdReader")
0058               << "detid: " << detid[id] << " \t"
0059               << "strip: " << it << " \t" << ss.str() << "FirstStrip_and_Hth: " << data.FirstStrip_and_Hth << " \n"
0060               << std::endl;
0061           old_lowTh = data.getLth();
0062           old_highTh = data.getHth();
0063           old_clusTh = data.getClusth();
0064           old_FirstStrip = data.getFirstStrip();
0065         }
0066       }
0067     }
0068 }
0069 
0070 #include "FWCore/PluginManager/interface/ModuleDef.h"
0071 #include "FWCore/Framework/interface/MakerMacros.h"
0072 
0073 DEFINE_FWK_MODULE(SiStripThresholdReader);