CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/CondTools/DT/plugins/DTKeyedConfigPopConAnalyzer.cc

Go to the documentation of this file.
00001 #include "CondCore/PopCon/interface/PopConAnalyzer.h"
00002 #include "CondTools/DT/interface/DTKeyedConfigHandler.h"
00003 #include "FWCore/Framework/interface/ESHandle.h"
00004 #include "FWCore/Framework/interface/EventSetup.h"
00005 #include "CondCore/IOVService/interface/KeyList.h"
00006 #include "FWCore/Framework/interface/MakerMacros.h"
00007 #include "CondFormats/DTObjects/interface/DTKeyedConfig.h"
00008 #include "CondFormats/DataRecord/interface/DTKeyedConfigListRcd.h"
00009 
00010 //typedef popcon::PopConAnalyzer<DTKeyedConfigHandler> DTKeyedConfigPopConAnalyzer;
00011 class DTKeyedConfigPopConAnalyzer: public popcon::PopConAnalyzer<DTKeyedConfigHandler> {
00012  public:
00013   DTKeyedConfigPopConAnalyzer(const edm::ParameterSet& pset):
00014     popcon::PopConAnalyzer<DTKeyedConfigHandler>( pset ),
00015     copyData( pset.getParameter<edm::ParameterSet>("Source").
00016                       getUntrackedParameter<bool> ( "copyData", true ) ) 
00017  {}
00018   virtual ~DTKeyedConfigPopConAnalyzer(){}
00019   virtual void analyze(const edm::Event& e, const edm::EventSetup& s){
00020 
00021     if ( !copyData ) return;
00022 
00023     edm::ESHandle<cond::KeyList> klh;
00024     std::cout<<"got eshandle"<<std::endl;
00025     s.get<DTKeyedConfigListRcd>().get(klh);
00026     std::cout<<"got context"<<std::endl;
00027     cond::KeyList const &  kl= *klh.product();
00028     cond::KeyList* list = const_cast<cond::KeyList*>( &kl );
00029     for ( int i = 0; i < list->size(); i++ ) {
00030       if ( list->elem( i ) )
00031            std::cout << list->get<DTKeyedConfig>( i )->getId() << std::endl;
00032     }
00033     DTKeyedConfigHandler::setList( list );
00034 
00035   }
00036  private:
00037   bool copyData;
00038 };
00039 
00040 
00041 DEFINE_FWK_MODULE(DTKeyedConfigPopConAnalyzer);
00042