Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:02:45

0001 /*
0002  *  See header file for a description of this class.
0003  *
0004  *  $Date: 2010/05/14 11:43:08 $
0005  *  $Revision: 1.2 $
0006  *  \author Paolo Ronchese INFN Padova
0007  *
0008  */
0009 
0010 //----------------------
0011 // Base Class Headers --
0012 //----------------------
0013 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0014 //------------------------------------
0015 // Collaborating Class Declarations --
0016 //------------------------------------
0017 #include "FWCore/Framework/interface/Event.h"
0018 #include "FWCore/Framework/interface/EventSetup.h"
0019 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0020 //-------------------------------
0021 // Collaborating Class Headers --
0022 //-------------------------------
0023 #include "CondFormats/DTObjects/interface/DTKeyedConfig.h"
0024 #include "CondFormats/DataRecord/interface/DTKeyedConfigListRcd.h"
0025 #include "CondCore/CondDB/interface/KeyList.h"
0026 #include "FWCore/Framework/interface/ESHandle.h"
0027 #include "FWCore/Framework/interface/MakerMacros.h"
0028 
0029 //-----------------------
0030 // This Class' Header --
0031 //-----------------------
0032 class DTKeyedConfigDBDump : public edm::one::EDAnalyzer<> {
0033 public:
0034   /** Constructor                                                                                                
0035    */
0036   explicit DTKeyedConfigDBDump(const edm::ParameterSet& ps);
0037 
0038   /** Destructor                                                                                                 
0039    */
0040   ~DTKeyedConfigDBDump() override;
0041 
0042   /** Operations 
0043    */
0044   ///
0045   void beginJob() override;
0046   void analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) override;
0047 
0048 private:
0049   edm::ESGetToken<cond::persistency::KeyList, DTKeyedConfigListRcd> perskeylistToken_;
0050 };
0051 //-------------------
0052 // Initializations --
0053 //-------------------
0054 
0055 //----------------
0056 // Constructors --
0057 //----------------
0058 DTKeyedConfigDBDump::DTKeyedConfigDBDump(const edm::ParameterSet& ps) : perskeylistToken_(esConsumes()) {}
0059 
0060 //--------------
0061 // Destructor --
0062 //--------------
0063 DTKeyedConfigDBDump::~DTKeyedConfigDBDump() {}
0064 
0065 //--------------
0066 // Operations --
0067 //--------------
0068 void DTKeyedConfigDBDump::beginJob() { return; }
0069 
0070 void DTKeyedConfigDBDump::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0071   edm::eventsetup::EventSetupRecordKey recordKey(
0072       edm::eventsetup::EventSetupRecordKey::TypeTag::findType("DTKeyedConfigListRcd"));
0073   if (recordKey.type() == edm::eventsetup::EventSetupRecordKey::TypeTag()) {
0074     //record not found
0075     edm::LogWarning("DTKeyedConfigDBDump") << "Record \"DTKeyedConfigListRcd "
0076                                            << "\" does not exist " << std::endl;
0077   }
0078   cond::persistency::KeyList const* kp = &iSetup.getData(perskeylistToken_);
0079   edm::LogInfo("DTKeyedConfigDBDump") << "now load and get" << std::endl;
0080   auto pkc = kp->getUsingKey<DTKeyedConfig>(999999999);
0081   edm::LogInfo("DTKeyedConfigDBDump") << "now check" << std::endl;
0082   if (pkc.get())
0083     edm::LogInfo("DTKeyedConfigDBDump") << pkc->getId() << " " << *(pkc->dataBegin()) << std::endl;
0084   else
0085     edm::LogInfo("DTKeyedConfigDBDump") << "not found" << std::endl;
0086   edm::LogInfo("DTKeyedConfigDBDump") << std::endl;
0087   return;
0088 }
0089 
0090 DEFINE_FWK_MODULE(DTKeyedConfigDBDump);