CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
cond::service::PoolDBOutputService Class Reference

#include <PoolDBOutputService.h>

Classes

struct  Record
 

Public Member Functions

template<typename T >
void appendSinceTime (T *payloadObj, cond::Time_t sinceTime, const std::string &recordName, bool withlogging=false)
 
void appendSinceTime (const std::string &payloadId, cond::Time_t sinceTime, const std::string &recordName, bool withlogging=false)
 
cond::Time_t beginOfTime () const
 
void closeIOV (Time_t lastTill, const std::string &recordName, bool withlogging=false)
 
template<typename T >
void createNewIOV (T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
 
void createNewIOV (const std::string &firstPayloadId, const std::string payloadType, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
 
void createNewIOV (const std::string &firstPayloadId, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
 
cond::Time_t currentTime () const
 
cond::Time_t endOfTime () const
 
bool isNewTagRequest (const std::string &recordName)
 
 PoolDBOutputService (const edm::ParameterSet &iConfig, edm::ActivityRegistry &iAR)
 
void postEndJob ()
 
void postModule (const edm::ModuleDescription &desc)
 
void preBeginLumi (const edm::LuminosityBlockID &, const edm::Timestamp &)
 
void preEventProcessing (const edm::EventID &evtID, const edm::Timestamp &iTime)
 
void preModule (const edm::ModuleDescription &desc)
 
cond::persistency::Session session () const
 
void setLogHeaderForRecord (const std::string &recordName, const std::string &provenance, const std::string &usertext)
 
std::string tag (const std::string &recordName)
 
void tagInfo (const std::string &recordName, cond::TagInfo_t &result)
 
template<typename T >
void writeOne (T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
 
virtual ~PoolDBOutputService ()
 

Private Member Functions

void connect ()
 
void disconnect ()
 
void fillRecord (edm::ParameterSet &pset)
 
void initDB (bool forReading=true)
 
RecordlookUpRecord (const std::string &recordName)
 

Private Attributes

std::map< std::string, Recordm_callbacks
 
bool m_closeIOV
 
cond::Time_t m_currentTime
 
bool m_dbstarted
 
cond::persistency::Session m_session
 
cond::TimeType m_timetype
 
std::string m_timetypestr
 

Detailed Description

Definition at line 38 of file PoolDBOutputService.h.

Constructor & Destructor Documentation

PoolDBOutputService::PoolDBOutputService ( const edm::ParameterSet iConfig,
edm::ActivityRegistry iAR 
)

Definition at line 36 of file PoolDBOutputService.cc.

References cond::DEFAULT_DB, fillRecord(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), m_closeIOV, m_session, m_timetype, m_timetypestr, postEndJob(), postModule(), preBeginLumi(), preEventProcessing(), preModule(), cond::persistency::ConnectionPool::setParameters(), AlCaHLTBitMon_QueryRunRegistry::string, cond::time::timeTypeFromName(), convertXMLtoSQLite_cfg::toPut, cond::UNKNOWN_DB, edm::ActivityRegistry::watchPostEndJob(), edm::ActivityRegistry::watchPostModule(), edm::ActivityRegistry::watchPreBeginLumi(), edm::ActivityRegistry::watchPreModule(), and edm::ActivityRegistry::watchPreProcessEvent().

36  :
37  m_timetypestr(""),
38  m_currentTime( 0 ),
39  m_session(),
40  //m_logConnectionString(""),
41  //m_logdb(),
42  m_dbstarted( false ),
43  m_callbacks(),
44  //m_newtags(),
45  m_closeIOV(false)//,
46  //m_logheaders()
47 {
48  m_closeIOV=iConfig.getUntrackedParameter<bool>("closeIOV",m_closeIOV);
49 
50  m_timetypestr=iConfig.getUntrackedParameter< std::string >("timetype","runnumber");
51  m_timetype = cond::time::timeTypeFromName( m_timetypestr );
52 
53  edm::ParameterSet connectionPset = iConfig.getParameter<edm::ParameterSet>("DBParameters");
55  connection.setParameters( connectionPset );
56  connection.configure();
57  std::string connectionString = iConfig.getParameter<std::string>("connect");
58  BackendType backType = (BackendType) iConfig.getUntrackedParameter<int>("dbFormat", DEFAULT_DB );
59  if( backType == UNKNOWN_DB ) backType = DEFAULT_DB;
60  m_session = connection.createSession( connectionString, true, backType );
61 
62  //if( iConfig.exists("logconnect") ){
63  // m_logConnectionString = iConfig.getUntrackedParameter<std::string>("logconnect");
64  // cond::DbSession logSession = connection.createSession();
65  // m_logdb.reset( new cond::Logger( logSession ) );
66  //}
67 
68  typedef std::vector< edm::ParameterSet > Parameters;
69  Parameters toPut=iConfig.getParameter<Parameters>("toPut");
70  for(Parameters::iterator itToPut = toPut.begin(); itToPut != toPut.end(); ++itToPut)
71  fillRecord( *itToPut);
72 
73 
79 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void watchPostEndJob(PostEndJob::slot_type const &iSlot)
void fillRecord(edm::ParameterSet &pset)
void watchPostModule(PostModule::slot_type const &iSlot)
void watchPreProcessEvent(PreProcessEvent::slot_type const &iSlot)
void preBeginLumi(const edm::LuminosityBlockID &, const edm::Timestamp &)
void watchPreModule(PreModule::slot_type const &iSlot)
void setParameters(const edm::ParameterSet &connectionPset)
vector< ParameterSet > Parameters
TimeType timeTypeFromName(const std::string &name)
Definition: Time.cc:24
cond::persistency::Session m_session
BackendType
Definition: Types.h:23
void postModule(const edm::ModuleDescription &desc)
void preModule(const edm::ModuleDescription &desc)
static constexpr BackendType DEFAULT_DB
Definition: Types.h:24
void watchPreBeginLumi(PreBeginLumi::slot_type const &iSlot)
std::map< std::string, Record > m_callbacks
void preEventProcessing(const edm::EventID &evtID, const edm::Timestamp &iTime)
PoolDBOutputService::~PoolDBOutputService ( )
virtual

Definition at line 152 of file PoolDBOutputService.cc.

152  {
153 }

Member Function Documentation

template<typename T >
void cond::service::PoolDBOutputService::appendSinceTime ( T payloadObj,
cond::Time_t  sinceTime,
const std::string &  recordName,
bool  withlogging = false 
)
inline

Definition at line 112 of file PoolDBOutputService.h.

References m_session, ecalTPGAnalyzer_cfg::recordName, cond::persistency::Session::storePayload(), and cond::throwException().

Referenced by SiStripBadChannelBuilder::algoAnalyze(), DBWriter::analyze(), SiStripDetVOffFakeBuilder::analyze(), SiStripNoisesBuilder::analyze(), SiStripPedestalsBuilder::analyze(), SiStripSummaryBuilder::analyze(), SiStripThresholdBuilder::analyze(), SiStripApvGainBuilder::analyze(), SiPixelLorentzAngleDB::analyze(), SiStripNoiseNormalizedWithApvGainBuilder::analyze(), SiStripApvGainBuilderFromTag::analyze(), SiStripFEDErrorsDQM::analyze(), EcalTestDevDB::analyze(), PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL::beginJob(), PhysicsPerformanceDBWriterFromFile_WPandPayload_IOV::beginJob(), JetCorrectorDBWriter::beginJob(), PhysicsPerformanceDBWriterFromFile_WPandPayload::beginJob(), SiStripFedCablingBuilder::beginRun(), EcalDQMStatusWriter::beginRun(), CocoaDBMgr::DumpCocoaResults(), BeamSpotWrite2DB::endJob(), StoreEcalCondition::endJob(), CentralityTableProducer::endJob(), SiStripFedCablingManipulator::endRun(), HLTPrescaleRecorder::endRun(), l1t::DataWriter::updateIOV(), CaloGeometryDBWriter::write(), BeamFitter::write2DB(), AlCaRecoTriggerBitsRcdUpdate::writeBitsToDB(), SiPixelHistoricInfoEDAClient::writeDB(), SiPixelHistoricInfoDQMClient::writeDB(), CaloGeometryDBWriter::writeIndexed(), and writeOne().

115  {
116  if( !payloadObj ) throwException( "Provided payload pointer is invalid.","PoolDBOutputService::appendSinceTime");
117  appendSinceTime( m_session.storePayload( *payloadObj ),
118  sinceTime,
119  recordName,
120  withlogging);
121  }
void appendSinceTime(T *payloadObj, cond::Time_t sinceTime, const std::string &recordName, bool withlogging=false)
cond::persistency::Session m_session
void throwException(std::string const &message, std::string const &methodName)
Definition: Exception.cc:17
cond::Hash storePayload(const T &payload, const boost::posix_time::ptime &creationTime=boost::posix_time::microsec_clock::universal_time())
Definition: Session.h:155
void PoolDBOutputService::appendSinceTime ( const std::string &  payloadId,
cond::Time_t  sinceTime,
const std::string &  recordName,
bool  withlogging = false 
)

Definition at line 242 of file PoolDBOutputService.cc.

References idDealer::editor, cppFunctionSkipper::exception, cond::persistency::IOVEditor::flush(), cond::persistency::IOVEditor::insert(), AlCaHLTBitMon_QueryRunRegistry::string, and cond::throwException().

245  {
247  Record& myrecord=this->lookUpRecord(recordName);
248  if( myrecord.m_isNewTag ) {
249  cond::throwException(std::string("Cannot append to non-existing tag ") + myrecord.m_tag,
250  "PoolDBOutputService::appendSinceTime");
251  }
252  //if(withlogging){
253  // if( m_logConnectionString.empty() ) {
254  // throw cond::Exception("Log db was not set from PoolDBOutputService::add");
255  // }
256  //}
257 
258  try{
260  editor.insert( time, payloadId );
261  editor.flush();
262 
263  //if(withlogging){
264  // std::string destconnect=m_session.connectionString();
265  // cond::UserLogInfo a=this->lookUpUserLogInfo(recordName);
266  // m_logdb->logOperationNow(a,destconnect,objClass,objToken,myrecord.m_tag,myrecord.timetypestr(),payloadIdx,time);
267  //}
268  }catch(const std::exception& er){
269  //if(withlogging){
270  // std::string destconnect=m_session.connectionString();
271  // cond::UserLogInfo a=this->lookUpUserLogInfo(recordName);
272  // m_logdb->logFailedOperationNow(a,destconnect,objClass,objToken,myrecord.m_tag,myrecord.timetypestr(),payloadIdx,time,std::string(er.what()));
273  //}
275  "PoolDBOutputService::appendSinceTime");
276  }
277  scope.close();
278 }
Transaction & transaction()
Definition: Session.cc:66
Record & lookUpRecord(const std::string &recordName)
cond::persistency::Session m_session
IOVEditor editIov(const std::string &tag)
Definition: Session.cc:120
void insert(cond::Time_t since, const cond::Hash &payloadHash, bool checkType=false)
Definition: IOVEditor.cc:129
void throwException(std::string const &message, std::string const &methodName)
Definition: Exception.cc:17
tuple editor
Definition: idDealer.py:73
cond::Time_t PoolDBOutputService::beginOfTime ( ) const

Definition at line 162 of file PoolDBOutputService.cc.

References cond::TimeTypeSpecs::beginValue, and cond::timeTypeSpecs.

Referenced by SiStripBadChannelBuilder::algoAnalyze(), DBWriter::analyze(), SiStripDetVOffFakeBuilder::analyze(), SiStripNoisesBuilder::analyze(), SiStripSummaryBuilder::analyze(), SiStripThresholdBuilder::analyze(), SiStripPedestalsBuilder::analyze(), SiStripApvGainBuilder::analyze(), SurveyInputTrackerFromDB::analyze(), SiPixelLorentzAngleDB::analyze(), TrackerSystematicMisalignments::analyze(), SiStripNoiseNormalizedWithApvGainBuilder::analyze(), SiStripApvGainBuilderFromTag::analyze(), SiStripFEDErrorsDQM::analyze(), EcalTestDevDB::analyze(), TrackerGeometryCompare::analyze(), XMLGeometryBuilder::beginJob(), GeometricDetLoader::beginJob(), PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL::beginJob(), JetCorrectorDBWriter::beginJob(), PhysicsPerformanceDBWriterFromFile_WPandPayload::beginJob(), WriteOneGeometryFromXML::beginRun(), RPCRecoIdealDBLoader::beginRun(), SiStripFedCablingBuilder::beginRun(), CSCRecoIdealDBLoader::beginRun(), DTRecoIdealDBLoader::beginRun(), PGeometricDetBuilder::beginRun(), PGeometricDetExtraBuilder::beginRun(), GEMRecoIdealDBLoader::beginRun(), EcalDQMStatusWriter::beginRun(), EcalDBCopy::copyToDB(), ESDBCopy::copyToDB(), EcalTPGDBCopy::copyToDB(), CocoaDBMgr::DumpCocoaResults(), PhysicsTools::MVATrainerSave::endJob(), PhysicsTools::MVATrainerContainerSave::endJob(), BeamSpotWrite2DB::endJob(), BeamProfile2DB::endJob(), StoreEcalCondition::endJob(), CentralityTableProducer::endJob(), SiStripFedCablingManipulator::endRun(), DummyCondDBWriter< TObject, TObjectO, TRecord >::endRun(), HLTPrescaleRecorder::endRun(), LaserAlignment::endRunProduce(), MisalignedMuonESProducer::saveToDB(), ConditionDBWriter< SiStripApvGain >::storeOnDb(), l1t::DataWriter::updateIOV(), CaloGeometryDBWriter::write(), BeamFitter::write2DB(), SiPixelHistoricInfoEDAClient::writeDB(), SiPixelHistoricInfoDQMClient::writeDB(), CaloGeometryDBWriter::writeIndexed(), and DTCalibDBUtils::writeToDB().

162  {
164 }
const TimeTypeSpecs timeTypeSpecs[]
Definition: Time.cc:22
Time_t beginValue
Definition: Time.h:45
void PoolDBOutputService::closeIOV ( Time_t  lastTill,
const std::string &  recordName,
bool  withlogging = false 
)

Definition at line 305 of file PoolDBOutputService.cc.

References idDealer::editor, cond::persistency::IOVEditor::flush(), cond::service::PoolDBOutputService::Record::m_isNewTag, cond::service::PoolDBOutputService::Record::m_tag, cond::persistency::IOVEditor::setEndOfValidity(), AlCaHLTBitMon_QueryRunRegistry::string, and cond::throwException().

Referenced by popcon::PopCon::finalize().

306  {
307  // not fully working.. not be used for now...
308  Record & myrecord = lookUpRecord(recordName);
310 
311  if( myrecord.m_isNewTag ) {
312  cond::throwException(std::string("Cannot close non-existing tag ") + myrecord.m_tag,
313  "PoolDBOutputService::closeIOV");
314  }
316  editor.setEndOfValidity( lastTill );
317  editor.flush();
318  scope.close();
319 }
Transaction & transaction()
Definition: Session.cc:66
Record & lookUpRecord(const std::string &recordName)
cond::persistency::Session m_session
IOVEditor editIov(const std::string &tag)
Definition: Session.cc:120
void throwException(std::string const &message, std::string const &methodName)
Definition: Exception.cc:17
tuple editor
Definition: idDealer.py:73
void setEndOfValidity(cond::Time_t validity)
Definition: IOVEditor.cc:100
void cond::service::PoolDBOutputService::connect ( )
private

Referenced by Vispa.Gui.ZoomableScrollArea.ZoomableScrollArea::__init__(), Vispa.Views.PropertyView.BooleanProperty::__init__(), Vispa.Gui.FindDialog.FindDialog::_addScript(), Vispa.Gui.FindDialog.FindDialog::_addStringProperty(), Vispa.Main.Application.Application::_connectSignals(), Vispa.Plugins.ConfigEditor.CodeTableView.CodeTableView::_createItem(), Vispa.Gui.BoxContentDialog.BoxContentDialog::addButton(), Vispa.Gui.ToolBoxContainer.ToolBoxContainer::addWidget(), Vispa.Views.PropertyView.PropertyView::append(), Vispa.Views.PropertyView.PropertyView::appendAddRow(), Vispa.Main.Application.Application::createAction(), Vispa.Views.PropertyView.TextEditWithButtonProperty::createButton(), Vispa.Views.LineDecayView.LineDecayView::createLineDecayContainer(), Vispa.Views.PropertyView.TextEditWithButtonProperty::createLineEdit(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.PropertyView.TextEditWithButtonProperty::createTextEdit(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::filterDialog(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Gui.PortWidget.PortWidget::mouseMoveEvent(), Vispa.Views.PropertyView.BooleanProperty::setChecked(), Vispa.Main.SplitterTab.SplitterTab::setController(), Vispa.Plugins.Browser.BrowserTab.BrowserTab::setController(), Vispa.Views.PropertyView.BooleanProperty::setReadOnly(), Vispa.Views.PropertyView.DropDownProperty::setReadOnly(), Vispa.Views.PropertyView.TextEditWithButtonProperty::setReadOnly(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::setTab(), Vispa.Views.PropertyView.IntegerProperty::setValue(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::switchCenterView(), Vispa.Plugins.EdmBrowser.EdmBrowserTabController.EdmBrowserTabController::updateViewMenu(), and Vispa.Plugins.ConfigEditor.ConfigEditorTabController.ConfigEditorTabController::updateViewMenu().

template<typename T >
void cond::service::PoolDBOutputService::createNewIOV ( T firstPayloadObj,
cond::Time_t  firstSinceTime,
cond::Time_t  firstTillTime,
const std::string &  recordName,
bool  withlogging = false 
)
inline

Definition at line 83 of file PoolDBOutputService.h.

References ora::ClassUtils::demangledName(), m_session, ecalTPGAnalyzer_cfg::recordName, cond::persistency::Session::storePayload(), and cond::throwException().

Referenced by SiStripBadChannelBuilder::algoAnalyze(), DBWriter::analyze(), SiStripDetVOffFakeBuilder::analyze(), SiStripNoisesBuilder::analyze(), SiStripApvGainBuilder::analyze(), SiStripPedestalsBuilder::analyze(), SiStripSummaryBuilder::analyze(), SiStripThresholdBuilder::analyze(), SiPixelLorentzAngleDB::analyze(), SiStripNoiseNormalizedWithApvGainBuilder::analyze(), SiStripApvGainBuilderFromTag::analyze(), SiStripFEDErrorsDQM::analyze(), EcalTestDevDB::analyze(), XMLGeometryBuilder::beginJob(), GeometricDetLoader::beginJob(), PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL::beginJob(), JetCorrectorDBWriter::beginJob(), PhysicsPerformanceDBWriterFromFile_WPandPayload::beginJob(), PhysicsPerformanceDBWriterFromFile_WPandPayload_IOV::beginJob(), WriteOneGeometryFromXML::beginRun(), RPCRecoIdealDBLoader::beginRun(), SiStripFedCablingBuilder::beginRun(), CSCRecoIdealDBLoader::beginRun(), DTRecoIdealDBLoader::beginRun(), PGeometricDetExtraBuilder::beginRun(), PGeometricDetBuilder::beginRun(), GEMRecoIdealDBLoader::beginRun(), EcalDQMStatusWriter::beginRun(), EcalDBCopy::copyToDB(), EcalTPGDBCopy::copyToDB(), ESDBCopy::copyToDB(), CocoaDBMgr::DumpCocoaResults(), PhysicsTools::MVATrainerSave::endJob(), PhysicsTools::MVATrainerContainerSave::endJob(), BeamSpotWrite2DB::endJob(), BeamProfile2DB::endJob(), StoreEcalCondition::endJob(), CentralityTableProducer::endJob(), SiStripFedCablingManipulator::endRun(), HLTPrescaleRecorder::endRun(), l1t::DataWriter::updateIOV(), CaloGeometryDBWriter::write(), BeamFitter::write2DB(), AlCaRecoTriggerBitsRcdUpdate::writeBitsToDB(), SiPixelHistoricInfoEDAClient::writeDB(), SiPixelHistoricInfoDQMClient::writeDB(), CaloGeometryDBWriter::writeIndexed(), and writeOne().

87  {
88  if( !firstPayloadObj ) throwException( "Provided payload pointer is invalid.","PoolDBOutputService::createNewIOV");
89  createNewIOV( m_session.storePayload( *firstPayloadObj ),
90  cond::demangledName(typeid(T)),
91  firstSinceTime,
92  firstTillTime,
93  recordName,
94  withlogging);
95  }
std::string demangledName(const std::type_info &typeInfo)
Definition: ClassUtils.cc:82
cond::persistency::Session m_session
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
void throwException(std::string const &message, std::string const &methodName)
Definition: Exception.cc:17
cond::Hash storePayload(const T &payload, const boost::posix_time::ptime &creationTime=boost::posix_time::microsec_clock::universal_time())
Definition: Session.h:155
long double T
void PoolDBOutputService::createNewIOV ( const std::string &  firstPayloadId,
const std::string  payloadType,
cond::Time_t  firstSinceTime,
cond::Time_t  firstTillTime,
const std::string &  recordName,
bool  withlogging = false 
)

Definition at line 172 of file PoolDBOutputService.cc.

References idDealer::editor, cppFunctionSkipper::exception, cond::persistency::IOVEditor::flush(), cond::persistency::IOVEditor::insert(), cond::OFFLINE, cond::persistency::IOVEditor::setDescription(), AlCaHLTBitMon_QueryRunRegistry::string, and cond::throwException().

177  {
179  Record& myrecord=this->lookUpRecord(recordName);
180  if(!myrecord.m_isNewTag) {
181  cond::throwException( myrecord.m_tag + " is not a new tag", "PoolDBOutputService::createNewIOV");
182  }
183  std::string iovToken;
184  //if(withlogging){
185  // if( m_logConnectionString.empty() ) {
186  // throw cond::db::Exception("Log db was not set from PoolDBOutputService::createNewIOV",
187  // "PoolDBOutputService::createNewIOV");
188  // }
189  //}
190 
191  try{
192  // FIX ME: synchronization type and description have to be passed as the other parameters?
193  cond::persistency::IOVEditor editor = m_session.createIov( payloadType, myrecord.m_tag, myrecord.m_timetype, cond::OFFLINE );
194  editor.setDescription( "New Tag" );
195  editor.insert( firstSinceTime, firstPayloadId );
196  editor.flush();
197  myrecord.m_isNewTag=false;
198  //if(withlogging){
199  // std::string destconnect=m_session.connectionString();
200  // cond::UserLogInfo a=this->lookUpUserLogInfo(recordName);
201  // m_logdb->logOperationNow(a,destconnect,objClass,objToken,myrecord.m_tag,myrecord.timetypestr(),payloadIdx,firstSinceTime);
202  //}
203  }catch(const std::exception& er){
204  //if(withlogging){
205  // std::string destconnect=m_session.connectionString();
206  // cond::UserLogInfo a=this->lookUpUserLogInfo(recordName);
207  // m_logdb->logFailedOperationNow(a,destconnect,objClass,objToken,myrecord.m_tag,myrecord.timetypestr(),payloadIdx,firstSinceTime,std::string(er.what()));
208  //}
209  cond::throwException(std::string(er.what()) + " from PoolDBOutputService::createNewIOV ",
210  "PoolDBOutputService::createNewIOV");
211  }
212  scope.close();
213 }
void setDescription(const std::string &description)
Definition: IOVEditor.cc:111
Transaction & transaction()
Definition: Session.cc:66
Record & lookUpRecord(const std::string &recordName)
cond::persistency::Session m_session
void insert(cond::Time_t since, const cond::Hash &payloadHash, bool checkType=false)
Definition: IOVEditor.cc:129
void throwException(std::string const &message, std::string const &methodName)
Definition: Exception.cc:17
tuple editor
Definition: idDealer.py:73
IOVEditor createIov(const std::string &tag, cond::TimeType timeType, cond::SynchronizationType synchronizationType=cond::OFFLINE)
Definition: Session.h:151
void PoolDBOutputService::createNewIOV ( const std::string &  firstPayloadId,
cond::Time_t  firstSinceTime,
cond::Time_t  firstTillTime,
const std::string &  recordName,
bool  withlogging = false 
)

Definition at line 216 of file PoolDBOutputService.cc.

References idDealer::editor, cppFunctionSkipper::exception, cond::persistency::IOVEditor::flush(), cond::persistency::IOVEditor::insert(), cond::OFFLINE, cond::persistency::IOVEditor::setDescription(), AlCaHLTBitMon_QueryRunRegistry::string, and cond::throwException().

220  {
222  Record& myrecord=this->lookUpRecord(recordName);
223  if(!myrecord.m_isNewTag) {
224  cond::throwException( myrecord.m_tag + " is not a new tag", "PoolDBOutputService::createNewIOV");
225  }
226  std::string iovToken;
227  try{
228  // FIX ME: synchronization type and description have to be passed as the other parameters?
229  cond::persistency::IOVEditor editor = m_session.createIovForPayload( firstPayloadId, myrecord.m_tag, myrecord.m_timetype, cond::OFFLINE );
230  editor.setDescription( "New Tag" );
231  editor.insert( firstSinceTime, firstPayloadId );
232  editor.flush();
233  myrecord.m_isNewTag=false;
234  }catch(const std::exception& er){
235  cond::throwException(std::string(er.what()) + " from PoolDBOutputService::createNewIOV ",
236  "PoolDBOutputService::createNewIOV");
237  }
238  scope.close();
239 }
void setDescription(const std::string &description)
Definition: IOVEditor.cc:111
Transaction & transaction()
Definition: Session.cc:66
Record & lookUpRecord(const std::string &recordName)
cond::persistency::Session m_session
IOVEditor createIovForPayload(const Hash &payloadHash, const std::string &tag, cond::TimeType timeType, cond::SynchronizationType synchronizationType=cond::OFFLINE)
Definition: Session.cc:108
void insert(cond::Time_t since, const cond::Hash &payloadHash, bool checkType=false)
Definition: IOVEditor.cc:129
void throwException(std::string const &message, std::string const &methodName)
Definition: Exception.cc:17
tuple editor
Definition: idDealer.py:73
cond::Time_t PoolDBOutputService::currentTime ( ) const

Definition at line 167 of file PoolDBOutputService.cc.

Referenced by SiStripBadChannelBuilder::algoAnalyze(), DBWriter::analyze(), SiStripDetVOffFakeBuilder::analyze(), SiStripNoisesBuilder::analyze(), SiStripApvGainBuilder::analyze(), SiStripPedestalsBuilder::analyze(), SiStripSummaryBuilder::analyze(), SiStripThresholdBuilder::analyze(), SiPixelLorentzAngleDB::analyze(), SiStripNoiseNormalizedWithApvGainBuilder::analyze(), SiStripApvGainBuilderFromTag::analyze(), SiStripFEDErrorsDQM::analyze(), FFTJetCorrectorDBWriter::analyze(), SiStripFedCablingBuilder::beginRun(), CocoaDBMgr::DumpCocoaResults(), BeamSpotWrite2DB::endJob(), SurveyDBUploader::endJob(), Mixing2DB::endJob(), CentralityTableProducer::endJob(), SiStripFedCablingManipulator::endRun(), DummyCondDBWriter< TObject, TObjectO, TRecord >::endRun(), popcon::L1RPCHwConfigSourceHandler::getNewObjects(), popcon::RPCEMapSourceHandler::getNewObjects(), MisalignedTrackerESProducer::produce(), MuonAlignment::saveCSCSurveyToDB(), MuonAlignment::saveCSCtoDB(), MuonAlignment::saveDTSurveyToDB(), MuonAlignment::saveDTtoDB(), TrackerAlignment::saveToDB(), ConditionDBWriter< SiStripApvGain >::setTime(), CaloGeometryDBWriter::write(), WriteESAlignments::write(), BeamFitter::write2DB(), SiPixelHistoricInfoEDAClient::writeDB(), SiPixelHistoricInfoDQMClient::writeDB(), GlobalTrackerMuonAlignment::writeGlPosRcd(), CaloGeometryDBWriter::writeIndexed(), and DTCalibDBUtils::writeToDB().

167  {
168  return m_currentTime;
169 }
void cond::service::PoolDBOutputService::disconnect ( )
private
cond::Time_t PoolDBOutputService::endOfTime ( ) const

Definition at line 157 of file PoolDBOutputService.cc.

References cond::TimeTypeSpecs::endValue, and cond::timeTypeSpecs.

Referenced by SiStripBadChannelBuilder::algoAnalyze(), DBWriter::analyze(), SiStripDetVOffFakeBuilder::analyze(), SiStripNoisesBuilder::analyze(), SiStripApvGainBuilder::analyze(), SiStripPedestalsBuilder::analyze(), SiStripSummaryBuilder::analyze(), SiStripThresholdBuilder::analyze(), SiPixelLorentzAngleDB::analyze(), SiStripNoiseNormalizedWithApvGainBuilder::analyze(), SiStripApvGainBuilderFromTag::analyze(), SiStripFEDErrorsDQM::analyze(), EcalTestDevDB::analyze(), XMLGeometryBuilder::beginJob(), GeometricDetLoader::beginJob(), PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL::beginJob(), JetCorrectorDBWriter::beginJob(), PhysicsPerformanceDBWriterFromFile_WPandPayload::beginJob(), WriteOneGeometryFromXML::beginRun(), RPCRecoIdealDBLoader::beginRun(), SiStripFedCablingBuilder::beginRun(), CSCRecoIdealDBLoader::beginRun(), DTRecoIdealDBLoader::beginRun(), PGeometricDetExtraBuilder::beginRun(), PGeometricDetBuilder::beginRun(), GEMRecoIdealDBLoader::beginRun(), EcalDQMStatusWriter::beginRun(), EcalDBCopy::copyToDB(), ESDBCopy::copyToDB(), EcalTPGDBCopy::copyToDB(), CocoaDBMgr::DumpCocoaResults(), PhysicsTools::MVATrainerSave::endJob(), PhysicsTools::MVATrainerContainerSave::endJob(), BeamSpotWrite2DB::endJob(), BeamProfile2DB::endJob(), StoreEcalCondition::endJob(), CentralityTableProducer::endJob(), SiStripFedCablingManipulator::endRun(), HLTPrescaleRecorder::endRun(), l1t::DataWriter::updateIOV(), CaloGeometryDBWriter::write(), BeamFitter::write2DB(), AlCaRecoTriggerBitsRcdUpdate::writeBitsToDB(), SiPixelHistoricInfoEDAClient::writeDB(), SiPixelHistoricInfoDQMClient::writeDB(), CaloGeometryDBWriter::writeIndexed(), and writeOne().

157  {
159 }
const TimeTypeSpecs timeTypeSpecs[]
Definition: Time.cc:22
Time_t endValue
Definition: Time.h:46
void PoolDBOutputService::fillRecord ( edm::ParameterSet pset)
private

Definition at line 15 of file PoolDBOutputService.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), m_callbacks, cond::service::PoolDBOutputService::Record::m_closeIOV, m_closeIOV, cond::service::PoolDBOutputService::Record::m_idName, cond::service::PoolDBOutputService::Record::m_tag, cond::service::PoolDBOutputService::Record::m_timetype, m_timetypestr, AlCaHLTBitMon_QueryRunRegistry::string, and cond::time::timeTypeFromName().

Referenced by PoolDBOutputService().

15  {
16  Record thisrecord;
17 
18  thisrecord.m_idName = pset.getParameter<std::string>("record");
19  thisrecord.m_tag = pset.getParameter<std::string>("tag");
20 
21  thisrecord.m_closeIOV =
22  pset.getUntrackedParameter<bool>("closeIOV", m_closeIOV);
23 
24  //thisrecord.m_timetype=cond::findSpecs(pset.getUntrackedParameter< std::string >("timetype",m_timetypestr)).type;
25  thisrecord.m_timetype = cond::time::timeTypeFromName( pset.getUntrackedParameter< std::string >("timetype",m_timetypestr) );
26 
27  m_callbacks.insert(std::make_pair(thisrecord.m_idName,thisrecord));
28 
29  // *** THE LOGGING has still to be defined and implemented.
30  //if( !m_logConnectionString.empty() ){
31  // cond::UserLogInfo userloginfo;
32  // m_logheaders.insert(std::make_pair(thisrecord.m_idName,userloginfo));
33  //}
34 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
TimeType timeTypeFromName(const std::string &name)
Definition: Time.cc:24
std::map< std::string, Record > m_callbacks
void PoolDBOutputService::initDB ( bool  forReading = true)
private

Definition at line 98 of file PoolDBOutputService.cc.

References cppFunctionSkipper::exception, AlCaHLTBitMon_QueryRunRegistry::string, and cond::throwException().

Referenced by writeOne().

99 {
100  m_session.transaction().start(false);
102  try{
103  if(!forReading) {
105  }
106  //init logdb if required
107  //if(!m_logConnectionString.empty()){
108  // m_logdb->connect( m_logConnectionString );
109  // m_logdb->createLogDBIfNonExist();
110  //}
111  } catch( const std::exception& er ){
112  cond::throwException( std::string(er.what()),"PoolDBOutputService::initDB" );
113  }
114  scope.close();
115  m_dbstarted=true;
116 }
void start(bool readOnly=true)
Definition: Session.cc:22
Transaction & transaction()
Definition: Session.cc:66
cond::persistency::Session m_session
void throwException(std::string const &message, std::string const &methodName)
Definition: Exception.cc:17
bool PoolDBOutputService::isNewTagRequest ( const std::string &  recordName)

Definition at line 92 of file PoolDBOutputService.cc.

References cond::service::PoolDBOutputService::Record::m_isNewTag.

Referenced by SiStripBadChannelBuilder::algoAnalyze(), DBWriter::analyze(), SiStripDetVOffFakeBuilder::analyze(), SiStripNoisesBuilder::analyze(), SiStripApvGainBuilder::analyze(), SiStripPedestalsBuilder::analyze(), SiStripSummaryBuilder::analyze(), SiStripThresholdBuilder::analyze(), SiPixelLorentzAngleDB::analyze(), SiStripNoiseNormalizedWithApvGainBuilder::analyze(), SiStripApvGainBuilderFromTag::analyze(), SiStripFEDErrorsDQM::analyze(), EcalTestDevDB::analyze(), XMLGeometryBuilder::beginJob(), GeometricDetLoader::beginJob(), PhysicsPerformanceDBWriterTFormula_fromfile_WPandPL::beginJob(), JetCorrectorDBWriter::beginJob(), PhysicsPerformanceDBWriterFromFile_WPandPayload::beginJob(), PhysicsPerformanceDBWriterFromFile_WPandPayload_IOV::beginJob(), WriteOneGeometryFromXML::beginRun(), RPCRecoIdealDBLoader::beginRun(), SiStripFedCablingBuilder::beginRun(), CSCRecoIdealDBLoader::beginRun(), DTRecoIdealDBLoader::beginRun(), PGeometricDetBuilder::beginRun(), PGeometricDetExtraBuilder::beginRun(), GEMRecoIdealDBLoader::beginRun(), EcalDQMStatusWriter::beginRun(), CocoaDBMgr::DumpCocoaResults(), BeamSpotWrite2DB::endJob(), StoreEcalCondition::endJob(), CentralityTableProducer::endJob(), SiStripFedCablingManipulator::endRun(), AlcaBeamSpotHarvester::endRun(), HLTPrescaleRecorder::endRun(), popcon::PopCon::initialize(), ConditionDBWriter< SiStripApvGain >::storeOnDb(), l1t::DataWriter::updateIOV(), CaloGeometryDBWriter::write(), BeamFitter::write2DB(), AlCaRecoTriggerBitsRcdUpdate::writeBitsToDB(), SiPixelHistoricInfoEDAClient::writeDB(), SiPixelHistoricInfoDQMClient::writeDB(), CaloGeometryDBWriter::writeIndexed(), writeOne(), and DTCalibDBUtils::writeToDB().

92  {
93  Record& myrecord=this->lookUpRecord(recordName);
94  return myrecord.m_isNewTag;
95 }
Record & lookUpRecord(const std::string &recordName)
cond::service::PoolDBOutputService::Record & PoolDBOutputService::lookUpRecord ( const std::string &  recordName)
private

Definition at line 281 of file PoolDBOutputService.cc.

References cond::throwException().

281  {
282  if (!m_dbstarted) this->initDB( false );
284  std::map<std::string,Record>::iterator it=m_callbacks.find(recordName);
285  if(it==m_callbacks.end()) {
286  cond::throwException("The record \""+recordName +"\" has not been registered.","PoolDBOutputService::lookUpRecord");
287  }
288  if( !m_session.existsIov( it->second.m_tag) ){
289  it->second.m_isNewTag=true;
290  } else {
291  it->second.m_isNewTag=false;
292  }
293  scope.close();
294  return it->second;
295 }
void initDB(bool forReading=true)
Transaction & transaction()
Definition: Session.cc:66
cond::persistency::Session m_session
void throwException(std::string const &message, std::string const &methodName)
Definition: Exception.cc:17
bool existsIov(const std::string &tag)
Definition: Session.cc:88
std::map< std::string, Record > m_callbacks
void PoolDBOutputService::postEndJob ( )

Definition at line 119 of file PoolDBOutputService.cc.

Referenced by PoolDBOutputService().

120 {
121  if( m_dbstarted) {
123  m_dbstarted = false;
124  }
125 }
Transaction & transaction()
Definition: Session.cc:66
cond::persistency::Session m_session
void PoolDBOutputService::postModule ( const edm::ModuleDescription desc)

Definition at line 149 of file PoolDBOutputService.cc.

Referenced by PoolDBOutputService().

149  {
150 }
void PoolDBOutputService::preBeginLumi ( const edm::LuminosityBlockID iLumiid,
const edm::Timestamp iTime 
)

Definition at line 142 of file PoolDBOutputService.cc.

References cond::lumiid, and edm::LuminosityBlockID::value().

Referenced by PoolDBOutputService().

142  {
143  if( m_timetype == cond::lumiid ){
144  m_currentTime=iLumiid.value();
145  }
146 }
boost::uint64_t value() const
void PoolDBOutputService::preEventProcessing ( const edm::EventID evtID,
const edm::Timestamp iTime 
)

Definition at line 128 of file PoolDBOutputService.cc.

References edm::EventID::run(), cond::runnumber, cond::timestamp, and edm::Timestamp::value().

Referenced by PoolDBOutputService().

129 {
130  if( m_timetype == cond::runnumber ){//runnumber
131  m_currentTime=iEvtid.run();
132  }else if( m_timetype == cond::timestamp ){ //timestamp
133  m_currentTime=iTime.value();
134  }
135 }
TimeValue_t value() const
Definition: Timestamp.h:56
void PoolDBOutputService::preModule ( const edm::ModuleDescription desc)

Definition at line 138 of file PoolDBOutputService.cc.

Referenced by PoolDBOutputService().

138  {
139 }
cond::persistency::Session PoolDBOutputService::session ( ) const
void PoolDBOutputService::setLogHeaderForRecord ( const std::string &  recordName,
const std::string &  provenance,
const std::string &  usertext 
)

Definition at line 323 of file PoolDBOutputService.cc.

Referenced by popcon::PopCon::write().

324 {
325  //cond::UserLogInfo& myloginfo=this->lookUpUserLogInfo(recordName);
326  //myloginfo.provenance=dataprovenance;
327  //myloginfo.usertext=usertext;
328 }
std::string PoolDBOutputService::tag ( const std::string &  recordName)
void PoolDBOutputService::tagInfo ( const std::string &  recordName,
cond::TagInfo_t result 
)

Definition at line 339 of file PoolDBOutputService.cc.

References cond::persistency::IOVProxy::getLast(), o2o::iov, prof2calltree::last, cond::TagInfo_t::lastInterval, cond::TagInfo_t::lastPayloadToken, cond::service::PoolDBOutputService::Record::m_tag, cond::TagInfo_t::name, cond::Iov_t::payloadId, GlobalPosition_Frontier_DevDB_cff::record, cond::persistency::IOVProxy::sequenceSize(), cond::Iov_t::since, cond::TagInfo_t::size, and cond::Iov_t::till.

Referenced by popcon::PopCon::initialize(), l1t::DataWriter::lastPayloadToken(), and l1t::DataWriter::updateIOV().

339  {
340  //
342  result.name=record.m_tag;
343  //use iovproxy to find out.
345  result.size=iov.sequenceSize();
346  if (result.size>0) {
347  cond::Iov_t last = iov.getLast();
348  result.lastInterval = cond::ValidityInterval( last.since, last.till );
349  result.lastPayloadToken = last.payloadId;
350  }
351 }
Time_t since
Definition: Types.h:46
size_t size
Definition: Types.h:67
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:19
std::string name
Definition: Types.h:63
cond::ValidityInterval lastInterval
Definition: Types.h:65
IOVProxy readIov(const std::string &tag, bool full=false)
Definition: Session.cc:81
tuple iov
Definition: o2o.py:307
Record & lookUpRecord(const std::string &recordName)
Hash payloadId
Definition: Types.h:48
cond::persistency::Session m_session
std::string lastPayloadToken
Definition: Types.h:66
Time_t till
Definition: Types.h:47
template<typename T >
void cond::service::PoolDBOutputService::writeOne ( T payload,
Time_t  time,
const std::string &  recordName,
bool  withlogging = false 
)
inline

Definition at line 65 of file PoolDBOutputService.h.

References appendSinceTime(), createNewIOV(), ora::ClassUtils::demangledName(), endOfTime(), initDB(), isNewTagRequest(), m_dbstarted, m_session, cond::persistency::Session::storePayload(), AlCaHLTBitMon_QueryRunRegistry::string, and cond::throwException().

Referenced by SurveyInputTrackerFromDB::analyze(), TrackerSystematicMisalignments::analyze(), FFTJetCorrectorDBWriter::analyze(), TrackerGeometryCompare::analyze(), MoveFlatParamsToDB::analyze(), DTUserKeyedConfigHandler::chkConfigList(), DTKeyedConfigHandler::chkConfigList(), EcalDBCopy::copyToDB(), SurveyDBUploader::endJob(), Mixing2DB::endJob(), DTKeyedConfigDBInit::endJob(), SiStripLorentzAngleCalibration::endOfJob(), SiStripBackplaneCalibration::endOfJob(), SiPixelLorentzAngleCalibration::endOfJob(), AlcaBeamSpotHarvester::endRun(), DummyCondDBWriter< TObject, TObjectO, TRecord >::endRun(), LaserAlignment::endRunProduce(), MisalignedTrackerESProducer::produce(), MuonAlignment::saveCSCSurveyToDB(), MuonAlignment::saveCSCtoDB(), MuonAlignment::saveDTSurveyToDB(), MuonAlignment::saveDTtoDB(), TrackerAlignment::saveToDB(), MisalignedMuonESProducer::saveToDB(), ConditionDBWriter< SiStripApvGain >::storeOnDb(), WriteESAlignments::write(), AlignmentProducer::writeDB(), GlobalTrackerMuonAlignment::writeGlPosRcd(), popcon::PopCon::writeOne(), and DTCalibDBUtils::writeToDB().

65  {
66  if( !payload ) throwException( "Provided payload pointer is invalid.","PoolDBOutputService::writeOne");
67  if (!m_dbstarted) this->initDB( false );
68  Hash payloadId = m_session.storePayload( *payload );
69  std::string payloadType = cond::demangledName(typeid(T));
71  createNewIOV(payloadId, payloadType, time, endOfTime(), recordName, withlogging);
72  } else {
73  appendSinceTime(payloadId, time, recordName, withlogging);
74  }
75  }
void initDB(bool forReading=true)
std::string demangledName(const std::type_info &typeInfo)
Definition: ClassUtils.cc:82
void appendSinceTime(T *payloadObj, cond::Time_t sinceTime, const std::string &recordName, bool withlogging=false)
bool isNewTagRequest(const std::string &recordName)
std::string Hash
Definition: Types.h:38
cond::persistency::Session m_session
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
void throwException(std::string const &message, std::string const &methodName)
Definition: Exception.cc:17
cond::Hash storePayload(const T &payload, const boost::posix_time::ptime &creationTime=boost::posix_time::microsec_clock::universal_time())
Definition: Session.h:155
long double T

Member Data Documentation

std::map<std::string, Record> cond::service::PoolDBOutputService::m_callbacks
private

Definition at line 200 of file PoolDBOutputService.h.

Referenced by fillRecord().

bool cond::service::PoolDBOutputService::m_closeIOV
private

Definition at line 202 of file PoolDBOutputService.h.

Referenced by fillRecord(), and PoolDBOutputService().

cond::Time_t cond::service::PoolDBOutputService::m_currentTime
private

Definition at line 193 of file PoolDBOutputService.h.

bool cond::service::PoolDBOutputService::m_dbstarted
private

Definition at line 198 of file PoolDBOutputService.h.

Referenced by writeOne().

cond::persistency::Session cond::service::PoolDBOutputService::m_session
private
cond::TimeType cond::service::PoolDBOutputService::m_timetype
private

Definition at line 191 of file PoolDBOutputService.h.

Referenced by PoolDBOutputService().

std::string cond::service::PoolDBOutputService::m_timetypestr
private

Definition at line 192 of file PoolDBOutputService.h.

Referenced by fillRecord(), and PoolDBOutputService().