Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
/*
 *  See header file for a description of this class.
 *
 *  $Date: 2010/06/01 10:34:12 $
 *  $Revision: 1.3 $
 *  \author Paolo Ronchese INFN Padova
 *
 */

//-----------------------
// This Class' Header --
//-----------------------
#include "CondTools/DT/plugins/DTKeyedConfigDBInit.h"

//-------------------------------
// Collaborating Class Headers --
//-------------------------------
#include "CondFormats/DTObjects/interface/DTKeyedConfig.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
#include "CondCore/DBOutputService/interface/KeyedElement.h"

//---------------
// C++ Headers --
//---------------
#include <iostream>

//-------------------
// Initializations --
//-------------------

//----------------
// Constructors --
//----------------
DTKeyedConfigDBInit::DTKeyedConfigDBInit(const edm::ParameterSet& ps)
    : container(ps.getParameter<std::string>("container")), iov(ps.getParameter<std::string>("iov")) {}

//--------------
// Destructor --
//--------------
DTKeyedConfigDBInit::~DTKeyedConfigDBInit() {}

//--------------
// Operations --
//--------------
void DTKeyedConfigDBInit::beginJob() { return; }

void DTKeyedConfigDBInit::analyze(const edm::Event& e, const edm::EventSetup& c) { return; }

void DTKeyedConfigDBInit::endJob() {
  edm::Service<cond::service::PoolDBOutputService> outdb;
  DTKeyedConfig bk;
  bk.setId(999999999);
  bk.add("dummy");
  cond::KeyedElement k(&bk, 999999999);
  outdb->writeOneIOV(*(k.m_obj), k.m_key, container);

  std::vector<cond::Time_t> kl;
  kl.push_back(999999999);
  outdb->writeOneIOV(kl, 1, iov);

  return;
}

DEFINE_FWK_MODULE(DTKeyedConfigDBInit);