CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/CalibTracker/SiStripESProducers/plugins/DBWriter/DummyCondObjPrinter.h

Go to the documentation of this file.
00001 #ifndef CalibTracker_SiStripESProducer_DummyCondObjPrinter_h
00002 #define CalibTracker_SiStripESProducer_DummyCondObjPrinter_h
00003 
00004 // user include files
00005 #include "FWCore/Framework/interface/EDAnalyzer.h"
00006 #include "FWCore/Framework/interface/ESHandle.h"
00007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00008 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00009 #include "FWCore/ServiceRegistry/interface/Service.h"
00010 #include "CondCore/DBCommon/interface/Time.h"
00011 #include "FWCore/Utilities/interface/Exception.h"
00012 #include <string>
00013 
00014 
00015 
00016 template< typename TObject, typename TRecord>
00017 class DummyCondObjPrinter : public edm::EDAnalyzer {
00018 
00019 public:
00020 
00021   explicit DummyCondObjPrinter(const edm::ParameterSet& iConfig);
00022   ~DummyCondObjPrinter();
00023   void analyze(const edm::Event& e, const edm::EventSetup&es);
00024 
00025 
00026  private:
00027   edm::ParameterSet iConfig_;
00028   unsigned long long cacheID;
00029 };
00030 
00031 template< typename TObject, typename TRecord>
00032 DummyCondObjPrinter<TObject,TRecord>::DummyCondObjPrinter(const edm::ParameterSet& iConfig):iConfig_(iConfig),cacheID(0){
00033   edm::LogInfo("DummyCondObjPrinter") << "DummyCondObjPrinter constructor for typename " << typeid(TObject).name() << " and record " << typeid(TRecord).name() << std::endl;
00034 }
00035 
00036 
00037 template< typename TObject, typename TRecord>
00038 DummyCondObjPrinter<TObject,TRecord>::~DummyCondObjPrinter(){
00039  edm::LogInfo("DummyCondObjPrinter") << "DummyCondObjPrinter::~DummyCondObjPrinter()" << std::endl;
00040 }
00041 
00042 template< typename TObject,typename TRecord>
00043 void DummyCondObjPrinter<TObject,TRecord>::analyze(const edm::Event& e, const edm::EventSetup&es){
00044 
00045   if( cacheID == es.get<TRecord>().cacheIdentifier())
00046     return;
00047   
00048   cacheID = es.get<TRecord>().cacheIdentifier();
00049 
00050   edm::ESHandle<TObject> esobj;
00051   es.get<TRecord>().get( esobj );
00052   std::stringstream sSummary, sDebug;
00053   esobj->printSummary(sSummary);
00054   esobj->printDebug(sDebug);
00055 
00056   edm::LogInfo("DummyCondObjPrinter") << "\nPrintSummary \n" << sSummary.str()  << std::endl;
00057   LogDebug("DummyCondObjPrinter") << "\nPrintDebug \n" << sDebug.str()  << std::endl;
00058 }
00059 
00060 #endif