CMS 3D CMS Logo

Public Member Functions | Private Attributes

DummyCondDBWriter< TObject, TObjectO, TRecord > Class Template Reference

#include <DummyCondDBWriter.h>

Inheritance diagram for DummyCondDBWriter< TObject, TObjectO, TRecord >:
edm::EDAnalyzer

List of all members.

Public Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &es)
 DummyCondDBWriter (const edm::ParameterSet &iConfig)
void endRun (const edm::Run &run, const edm::EventSetup &es)
 ~DummyCondDBWriter ()

Private Attributes

unsigned long long cacheID
edm::ParameterSet iConfig_

Detailed Description

template<typename TObject, typename TObjectO, typename TRecord>
class DummyCondDBWriter< TObject, TObjectO, TRecord >

Definition at line 21 of file DummyCondDBWriter.h.


Constructor & Destructor Documentation

template<typename TObject , typename TObjectO , typename TRecord >
DummyCondDBWriter< TObject, TObjectO, TRecord >::DummyCondDBWriter ( const edm::ParameterSet iConfig) [explicit]

Definition at line 37 of file DummyCondDBWriter.h.

References mergeVDriftHistosByStation::name.

                                                                                            :iConfig_(iConfig),cacheID(0){
  edm::LogInfo("DummyCondDBWriter") << "DummyCondDBWriter constructor for typename " << typeid(TObject).name() << " and record " << typeid(TRecord).name() << std::endl;
}
template<typename TObject , typename TObjectO , typename TRecord >
DummyCondDBWriter< TObject, TObjectO, TRecord >::~DummyCondDBWriter ( )

Definition at line 43 of file DummyCondDBWriter.h.

                                                               {
 edm::LogInfo("DummyCondDBWriter") << "DummyCondDBWriter::~DummyCondDBWriter()" << std::endl;
}

Member Function Documentation

template<typename TObject , typename TObjectO , typename TRecord >
void DummyCondDBWriter< TObject, TObjectO, TRecord >::analyze ( const edm::Event e,
const edm::EventSetup es 
) [inline, virtual]

Implements edm::EDAnalyzer.

Definition at line 27 of file DummyCondDBWriter.h.

{};
template<typename TObject , typename TObjectO , typename TRecord >
void DummyCondDBWriter< TObject, TObjectO, TRecord >::endRun ( const edm::Run run,
const edm::EventSetup es 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 48 of file DummyCondDBWriter.h.

References edm::EventSetup::get(), edm::Service< T >::isAvailable(), VarParsing::obj, edm::ESHandle< T >::product(), and edm::RunBase::run().

                                                                                                    {

  std::string rcdName=iConfig_.getParameter<std::string>("record");

  if( cacheID == es.get<TRecord>().cacheIdentifier()){
      edm::LogInfo("DummyCondDBWriter") << "not needed to store objects with Record "<< rcdName << " at run " << run.run() << std::endl;    return;
  }
  cacheID = es.get<TRecord>().cacheIdentifier();

  edm::ESHandle<TObject> esobj;
  es.get<TRecord>().get( esobj );
  TObjectO *obj= new TObjectO(*(esobj.product()));
  cond::Time_t Time_;  
  
  //And now write  data in DB
  edm::Service<cond::service::PoolDBOutputService> dbservice;
  if( dbservice.isAvailable() ){

    std::string openIovAt=iConfig_.getUntrackedParameter<std::string>("OpenIovAt","beginOfTime");
    if(openIovAt=="beginOfTime")
      Time_=dbservice->beginOfTime();
    else if (openIovAt=="currentTime")
      Time_=dbservice->currentTime();
    else
      Time_=iConfig_.getUntrackedParameter<uint32_t>("OpenIovAtTime",1);
    
    dbservice->writeOne(obj, 0, Time_, rcdName);
  } else{
    edm::LogError("SiStripFedCablingBuilder")<<"Service is unavailable"<<std::endl;
  }
}

Member Data Documentation

template<typename TObject , typename TObjectO , typename TRecord >
unsigned long long DummyCondDBWriter< TObject, TObjectO, TRecord >::cacheID [private]

Definition at line 33 of file DummyCondDBWriter.h.

template<typename TObject , typename TObjectO , typename TRecord >
edm::ParameterSet DummyCondDBWriter< TObject, TObjectO, TRecord >::iConfig_ [private]

Definition at line 32 of file DummyCondDBWriter.h.