CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/CondTools/DT/plugins/DTKeyedConfigDBDump.cc

Go to the documentation of this file.
00001 /*
00002  *  See header file for a description of this class.
00003  *
00004  *  $Date: 2010/10/25 10:54:52 $
00005  *  $Revision: 1.3 $
00006  *  \author Paolo Ronchese INFN Padova
00007  *
00008  */
00009 
00010 //-----------------------
00011 // This Class' Header --
00012 //-----------------------
00013 #include "CondTools/DT/plugins/DTKeyedConfigDBDump.h"
00014 
00015 //-------------------------------
00016 // Collaborating Class Headers --
00017 //-------------------------------
00018 #include "CondFormats/DTObjects/interface/DTKeyedConfig.h"
00019 #include "CondFormats/DataRecord/interface/DTKeyedConfigListRcd.h"
00020 #include "CondCore/IOVService/interface/KeyList.h"
00021 #include "FWCore/Framework/interface/ESHandle.h"
00022 #include "FWCore/Framework/interface/MakerMacros.h"
00023 
00024 //---------------
00025 // C++ Headers --
00026 //---------------
00027 #include <iostream>
00028 
00029 //-------------------
00030 // Initializations --
00031 //-------------------
00032 
00033 
00034 //----------------
00035 // Constructors --
00036 //----------------
00037 DTKeyedConfigDBDump::DTKeyedConfigDBDump( const edm::ParameterSet& ps ) {
00038 }
00039 
00040 //--------------
00041 // Destructor --
00042 //--------------
00043 DTKeyedConfigDBDump::~DTKeyedConfigDBDump() {
00044 }
00045 
00046 //--------------
00047 // Operations --
00048 //--------------
00049 void DTKeyedConfigDBDump::beginJob() {
00050 
00051   return;
00052 
00053 }
00054 
00055 
00056 void DTKeyedConfigDBDump::analyze( const edm::Event& e,
00057                                    const edm::EventSetup& c ) {
00058   edm::eventsetup::EventSetupRecordKey
00059     recordKey(edm::eventsetup::EventSetupRecordKey::TypeTag::findType("DTKeyedConfigListRcd"));
00060   if( recordKey.type() == edm::eventsetup::EventSetupRecordKey::TypeTag()) {
00061     //record not found
00062     std::cout <<"Record \"DTKeyedConfigListRcd "<<"\" does not exist "<<std::endl;
00063   }
00064   edm::ESHandle<cond::KeyList> klh;
00065   std::cout<<"got eshandle"<<std::endl;
00066   c.get<DTKeyedConfigListRcd>().get(klh);
00067   std::cout<<"got context"<<std::endl;
00068   cond::KeyList const &  kl= *klh.product();
00069   cond::KeyList* kp = const_cast<cond::KeyList*>( &kl );
00070   std::vector<unsigned long long> nkeys;
00071   nkeys.push_back( 999999999 );
00072   std::cout << "now load" << std::endl;
00073   kp->load( nkeys );
00074   std::cout << "now get" << std::endl;
00075   const DTKeyedConfig* pkc = kp->get<DTKeyedConfig>(0);
00076   std::cout << "now check" << std::endl;
00077   if ( pkc != 0 ) std::cout << pkc->getId() << " "
00078                             << *( pkc->dataBegin() ) << std::endl;
00079   else            std::cout << "not found" << std::endl;
00080   std::cout << std::endl;
00081   std::vector<unsigned long long> nvoid;
00082   kp->load( nvoid );
00083   return;
00084 }
00085 
00086 DEFINE_FWK_MODULE(DTKeyedConfigDBDump);
00087