Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-05-31 22:25:57

0001 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0002 #include "FWCore/Framework/interface/Event.h"
0003 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0004 
0005 #include "FWCore/Framework/interface/EventSetup.h"
0006 #include "FWCore/Framework/interface/ESHandle.h"
0007 
0008 #include "CondFormats/DataRecord/interface/L1TriggerKeyExtRcd.h"
0009 #include "CondFormats/L1TObjects/interface/L1TriggerKeyExt.h"
0010 
0011 class L1TriggerKeyExtViewer : public edm::one::EDAnalyzer<> {
0012 private:
0013   std::string label;
0014   edm::ESGetToken<L1TriggerKeyExt, L1TriggerKeyExtRcd> token_;
0015 
0016 public:
0017   void analyze(const edm::Event&, const edm::EventSetup&) override;
0018 
0019   explicit L1TriggerKeyExtViewer(const edm::ParameterSet& pset)
0020       : label(pset.getParameter<std::string>("label")), token_{esConsumes()} {}
0021 };
0022 
0023 #include <iostream>
0024 using namespace std;
0025 
0026 void L1TriggerKeyExtViewer::analyze(const edm::Event& iEvent, const edm::EventSetup& evSetup) {
0027   L1TriggerKeyExt const& ptr1 = evSetup.getData(token_);
0028 
0029   cout << "L1TriggerKeyExt: parent key = " << ptr1.tscKey() << endl;
0030 
0031   cout << " uGT     key: " << ptr1.subsystemKey(L1TriggerKeyExt::kuGT) << endl;
0032   cout << " uGMT    key: " << ptr1.subsystemKey(L1TriggerKeyExt::kuGMT) << endl;
0033   cout << " CALO    key: " << ptr1.subsystemKey(L1TriggerKeyExt::kCALO) << endl;
0034   cout << " BMTF    key: " << ptr1.subsystemKey(L1TriggerKeyExt::kBMTF) << endl;
0035   cout << " OMTF    key: " << ptr1.subsystemKey(L1TriggerKeyExt::kOMTF) << endl;
0036   cout << " EMTF    key: " << ptr1.subsystemKey(L1TriggerKeyExt::kEMTF) << endl;
0037   cout << " TWINMUX key: " << ptr1.subsystemKey(L1TriggerKeyExt::kTWINMUX) << endl;
0038 
0039   cout << "Records: " << endl;
0040 
0041   L1TriggerKeyExt::RecordToKey::const_iterator itr = ptr1.recordToKeyMap().begin();
0042   L1TriggerKeyExt::RecordToKey::const_iterator end = ptr1.recordToKeyMap().end();
0043 
0044   for (; itr != end; ++itr) {
0045     std::string recordType = itr->first;
0046     std::string objectKey = itr->second;
0047     std::string recordName(recordType, 0, recordType.find_first_of('@'));
0048     cout << " record " << recordName << " key: " << itr->second << endl;
0049   }
0050 
0051   cout << dec << endl;
0052 }
0053 
0054 #include "FWCore/PluginManager/interface/ModuleDef.h"
0055 #include "FWCore/Framework/interface/MakerMacros.h"
0056 #include "FWCore/Framework/interface/ModuleFactory.h"
0057 
0058 DEFINE_FWK_MODULE(L1TriggerKeyExtViewer);