CMS 3D CMS Logo

DTConfigDBInit.cc

Go to the documentation of this file.
00001 /*
00002  *  See header file for a description of this class.
00003  *
00004  *  $Date: 2007/12/07 15:12:55 $
00005  *  $Revision: 1.2 $
00006  *  \author Paolo Ronchese INFN Padova
00007  *
00008  */
00009 
00010 //-----------------------
00011 // This Class' Header --
00012 //-----------------------
00013 #include "CondTools/DT/plugins/DTConfigDBInit.h"
00014 
00015 //-------------------------------
00016 // Collaborating Class Headers --
00017 //-------------------------------
00018 #include "CondTools/DT/interface/DTDBSession.h"
00019 #include "CondFormats/DTObjects/interface/DTConfigList.h"
00020 #include "CondFormats/DTObjects/interface/DTConfigData.h"
00021 #include "FWCore/Framework/interface/MakerMacros.h"
00022 
00023 //---------------
00024 // C++ Headers --
00025 //---------------
00026 #include <iostream>
00027 
00028 //-------------------
00029 // Initializations --
00030 //-------------------
00031 
00032 
00033 //----------------
00034 // Constructors --
00035 //----------------
00036 DTConfigDBInit::DTConfigDBInit( const edm::ParameterSet& ps ):
00037  name(     ps.getParameter<std::string> ( "name"     ) ),
00038  contact(  ps.getParameter<std::string> ( "contact"  ) ),
00039  catalog(  ps.getParameter<std::string> ( "catalog"  ) ),
00040  authPath( ps.getParameter<std::string> ( "authPath" ) ) {
00041 }
00042 
00043 //--------------
00044 // Destructor --
00045 //--------------
00046 DTConfigDBInit::~DTConfigDBInit() {
00047 }
00048 
00049 //--------------
00050 // Operations --
00051 //--------------
00052 void DTConfigDBInit::beginJob( edm::EventSetup const& c ) {
00053 
00054   DTDBSession* session = new DTDBSession( contact, catalog, authPath );
00055   session->connect( false );
00056 
00057   int dummyId = -999999999;
00058   DTConfigData* dummyConf = new DTConfigData();
00059   dummyConf->setId( dummyId );
00060   cond::TypedRef<DTConfigData> confRef( *session->poolDB(), dummyConf );
00061   confRef.markWrite( "DTConfigData" );
00062 
00063   DTConfigList* confList = new DTConfigList( name );
00064   DTConfigToken token;
00065   token.id  = 0;
00066   token.ref = confRef.token();
00067   confList->set( dummyId, token );
00068   cond::TypedRef<DTConfigList> setRef( *session->poolDB(), confList );
00069   setRef.markWrite( "DTConfigList" );
00070   std::string listToken = setRef.token();
00071   std::cout << "configuration list stored with token: " << std::endl 
00072             << listToken << std::endl;
00073 
00074   session->disconnect();
00075   delete session;
00076   return;
00077 
00078 }
00079 
00080 
00081 void DTConfigDBInit::analyze( const edm::Event& e,
00082                               const edm::EventSetup& c ) {
00083   return;
00084 }
00085 
00086 DEFINE_FWK_MODULE(DTConfigDBInit);
00087 

Generated on Tue Jun 9 17:26:52 2009 for CMSSW by  doxygen 1.5.4