** Warning **

Issuing rollback() due to DESTROY without explicit disconnect() of DBD::mysql::db handle dbname=lxr at /lxr/lib/LXR/Common.pm line 1103.

Last-Modified: Sat, 23 Sep 2022 22:37:42 GMT Content-Type: text/html; charset=utf-8 /CMSSW_12_6_X_2022-09-23-2300/CondTools/RunInfo/plugins/L1TriggerScalerESAnalyzer.cc
Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-07-28 22:45:27

0001 #include <stdexcept>
0002 #include <string>
0003 #include <iostream>
0004 #include <map>
0005 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0006 #include "FWCore/Framework/interface/Event.h"
0007 #include "FWCore/Framework/interface/ESHandle.h"
0008 #include "FWCore/Framework/interface/MakerMacros.h"
0009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0010 #include "FWCore/Framework/interface/EventSetup.h"
0011 
0012 #include "CondFormats/RunInfo/interface/L1TriggerScaler.h"
0013 
0014 #include "CondFormats/DataRecord/interface/L1TriggerScalerRcd.h"
0015 
0016 namespace edmtest {
0017   class L1TriggerScalerESAnalyzer : public edm::one::EDAnalyzer<edm::one::WatchRuns> {
0018   public:
0019     explicit L1TriggerScalerESAnalyzer(edm::ParameterSet const& p)
0020         : scaler1Token_(esConsumes<L1TriggerScaler, L1TriggerScalerRcd, edm::Transition::BeginRun>()),
0021           scaler2Token_(esConsumes<L1TriggerScaler, L1TriggerScalerRcd>()) {
0022       edm::LogVerbatim("L1TriggerScaler") << "L1TriggerScalerESAnalyzer";
0023     }
0024     explicit L1TriggerScalerESAnalyzer(int i)
0025         : scaler1Token_(esConsumes<L1TriggerScaler, L1TriggerScalerRcd, edm::Transition::BeginRun>()),
0026           scaler2Token_(esConsumes<L1TriggerScaler, L1TriggerScalerRcd>()) {
0027       edm::LogVerbatim("L1TriggerScaler") << "L1TriggerScalerESAnalyzer " << i;
0028     }
0029     ~L1TriggerScalerESAnalyzer() override { edm::LogVerbatim("L1TriggerScaler") << "~L1TriggerScalerESAnalyzer "; }
0030     void beginJob() override;
0031     void beginRun(const edm::Run&, const edm::EventSetup& context) override;
0032     void analyze(const edm::Event& e, const edm::EventSetup& c) override;
0033     void endRun(const edm::Run&, const edm::EventSetup& context) override {}
0034 
0035   private:
0036     const edm::ESGetToken<L1TriggerScaler, L1TriggerScalerRcd> scaler1Token_;
0037     const edm::ESGetToken<L1TriggerScaler, L1TriggerScalerRcd> scaler2Token_;
0038   };
0039 
0040   void L1TriggerScalerESAnalyzer::beginRun(const edm::Run&, const edm::EventSetup& context) {
0041     edm::LogVerbatim("L1TriggerScaler") << "###L1TriggerScalerESAnalyzer::beginRun";
0042     const edm::ESHandle<L1TriggerScaler>& L1TriggerScaler_lumiarray = context.getHandle(scaler1Token_);
0043     edm::LogVerbatim("L1TriggerScaler") << " got eshandle with flag " << L1TriggerScaler_lumiarray.isValid()
0044                                         << " got data";
0045   }
0046 
0047   void L1TriggerScalerESAnalyzer::beginJob() {
0048     edm::LogVerbatim("L1TriggerScaler") << "###L1TriggerScalerESAnalyzer::beginJob";
0049   }
0050 
0051   void L1TriggerScalerESAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& context) {
0052     using namespace edm::eventsetup;
0053     edm::LogVerbatim("L1TriggerScaler") << "###L1TriggerScalerESAnalyzer::analyze";
0054 
0055     // Context is not used.
0056     edm::LogVerbatim("L1TriggerScaler") << " I AM IN RUN NUMBER " << e.id().run();
0057     edm::LogVerbatim("L1TriggerScaler") << " ---EVENT NUMBER " << e.id().event();
0058     edm::eventsetup::EventSetupRecordKey recordKey(
0059         edm::eventsetup::EventSetupRecordKey::TypeTag::findType("L1TriggerScalerRcd"));
0060     if (recordKey.type() == edm::eventsetup::EventSetupRecordKey::TypeTag()) {
0061       //record not found
0062       edm::LogVerbatim("L1TriggerScaler") << "Record \"L1TriggerScalerRcd"
0063                                           << "\" does not exist ";
0064     }
0065     const edm::ESHandle<L1TriggerScaler>& l1tr = context.getHandle(scaler2Token_);
0066     edm::LogVerbatim("L1TriggerScaler") << " got eshandle\n got context";
0067     const L1TriggerScaler* l1lumiscaler = l1tr.product();
0068     edm::LogVerbatim("L1TriggerScaler") << "got L1TriggerScaler* ";
0069 
0070     edm::LogVerbatim("L1TriggerScaler") << "print  result";
0071     l1lumiscaler->printRunValue();
0072     l1lumiscaler->printLumiSegmentValues();
0073     l1lumiscaler->printFormat();
0074     l1lumiscaler->printGTAlgoCounts();
0075     l1lumiscaler->printGTAlgoRates();
0076     l1lumiscaler->printGTAlgoPrescaling();
0077     l1lumiscaler->printGTTechCounts();
0078     l1lumiscaler->printGTTechRates();
0079     l1lumiscaler->printGTTechPrescaling();
0080     l1lumiscaler->printGTPartition0TriggerCounts();
0081     l1lumiscaler->printGTPartition0TriggerRates();
0082     l1lumiscaler->printGTPartition0DeadTime();
0083     l1lumiscaler->printGTPartition0DeadTimeRatio();
0084     edm::LogVerbatim("L1TriggerScaler") << "print  finished";
0085   }
0086   DEFINE_FWK_MODULE(L1TriggerScalerESAnalyzer);
0087 }  // namespace edmtest