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 &payloadToken, 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 &firstPayloadToken, 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)
 
const cond::LoggerqueryLog () const
 
cond::DbSession 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 &result)
 
template<typename T >
void writeOne (T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
 
virtual ~PoolDBOutputService ()
 

Private Member Functions

void add (GetToken const &token, cond::Time_t time, const std::string &recordName, bool withlogging=false)
 
unsigned int appendIOV (cond::DbSession &, Record &record, const std::string &payloadToken, cond::Time_t sinceTime)
 
void connect ()
 
void createNewIOV (GetToken const &token, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
 
void disconnect ()
 
void fillRecord (edm::ParameterSet &pset)
 
void initDB (bool forReading=true)
 
unsigned int insertIOV (cond::DbSession &pooldb, Record &record, const std::string &payloadToken, cond::Time_t tillTime)
 Returns payload location index. More...
 
RecordlookUpRecord (const std::string &recordName)
 
cond::UserLogInfolookUpUserLogInfo (const std::string &recordName)
 

Private Attributes

std::map< std::string, Recordm_callbacks
 
bool m_closeIOV
 
std::string m_connectionString
 
cond::Time_t m_currentTime
 
bool m_dbstarted
 
bool m_freeInsert
 
std::string m_logConnectionString
 
std::auto_ptr< cond::Loggerm_logdb
 
std::map< std::string,
cond::UserLogInfo
m_logheaders
 
std::vector< std::pair
< std::string, std::string > > 
m_newtags
 
cond::DbSession m_session
 
cond::TimeType m_timetype
 
std::string m_timetypestr
 

Detailed Description

Definition at line 89 of file PoolDBOutputService.h.

Constructor & Destructor Documentation

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

Definition at line 44 of file PoolDBOutputService.cc.

References cond::Auth::COND_WRITER_ROLE, cond::DbConnection::configuration(), edm::ParameterSet::exists(), fillRecord(), cond::findSpecs(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), m_closeIOV, m_connectionString, m_freeInsert, m_logConnectionString, m_logdb, m_session, m_timetype, m_timetypestr, cond::DbSession::open(), postEndJob(), postModule(), preBeginLumi(), preEventProcessing(), preModule(), cond::DbConnectionConfiguration::setParameters(), convertXMLtoSQLite_cfg::toPut, cond::TimeTypeSpecs::type, edm::ActivityRegistry::watchPostEndJob(), edm::ActivityRegistry::watchPostModule(), edm::ActivityRegistry::watchPreBeginLumi(), edm::ActivityRegistry::watchPreModule(), and edm::ActivityRegistry::watchPreProcessEvent().

44  :
45  m_timetypestr(""),
46  m_currentTime( 0 ),
48  m_session(),
50  m_logdb(),
51  m_dbstarted( false ),
52  m_callbacks(),
53  m_newtags(),
54  m_closeIOV(false),
55  m_freeInsert(false),
56  m_logheaders()
57 {
58  m_closeIOV=iConfig.getUntrackedParameter<bool>("closeIOV",m_closeIOV);
59 
60  if( iConfig.exists("outOfOrder") ){
61  m_freeInsert=iConfig.getUntrackedParameter<bool>("outOfOrder");
62  }
63 
64  m_timetypestr=iConfig.getUntrackedParameter< std::string >("timetype","runnumber");
66 
67  edm::ParameterSet connectionPset = iConfig.getParameter<edm::ParameterSet>("DBParameters");
68  cond::DbConnection connection;
69  connection.configuration().setParameters( connectionPset );
70  connection.configure();
71 
72  m_connectionString = iConfig.getParameter<std::string>("connect");
73  m_session = connection.createSession();
75 
76  if( iConfig.exists("logconnect") ){
77  m_logConnectionString = iConfig.getUntrackedParameter<std::string>("logconnect");
78  cond::DbSession logSession = connection.createSession();
79  m_logdb.reset( new cond::Logger( logSession ) );
80  }
81 
82  typedef std::vector< edm::ParameterSet > Parameters;
83  Parameters toPut=iConfig.getParameter<Parameters>("toPut");
84  for(Parameters::iterator itToPut = toPut.begin(); itToPut != toPut.end(); ++itToPut)
85  fillRecord( *itToPut);
86 
87 
93 }
std::vector< std::pair< std::string, std::string > > m_newtags
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
void watchPostEndJob(PostEndJob::slot_type const &iSlot)
void open(const std::string &connectionString, bool readOnly=false)
Definition: DbSession.cc:144
void fillRecord(edm::ParameterSet &pset)
std::map< std::string, cond::UserLogInfo > m_logheaders
void watchPostModule(PostModule::slot_type const &iSlot)
void watchPreProcessEvent(PreProcessEvent::slot_type const &iSlot)
DbConnectionConfiguration & configuration()
Definition: DbConnection.cc:89
bool exists(std::string const &parameterName) const
checks if a parameter exists
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 type
Definition: Time.h:41
static const std::string COND_WRITER_ROLE
Definition: Auth.h:18
void postModule(const edm::ModuleDescription &desc)
void preModule(const edm::ModuleDescription &desc)
void watchPreBeginLumi(PreBeginLumi::slot_type const &iSlot)
const TimeTypeSpecs & findSpecs(std::string const &name)
Definition: Time.cc:33
std::map< std::string, Record > m_callbacks
void preEventProcessing(const edm::EventID &evtID, const edm::Timestamp &iTime)
std::auto_ptr< cond::Logger > m_logdb
PoolDBOutputService::~PoolDBOutputService ( )
virtual

Definition at line 168 of file PoolDBOutputService.cc.

168  {
169 }

Member Function Documentation

void PoolDBOutputService::add ( GetToken const &  token,
cond::Time_t  time,
const std::string &  recordName,
bool  withlogging = false 
)
private

Definition at line 243 of file PoolDBOutputService.cc.

References a, cppFunctionSkipper::exception, edm::hlt::Exception, and cond::rpcobgas::time.

Referenced by appendSinceTime().

246  {
247  DbOpenTransaction trans( m_session.transaction() );
248  Record& myrecord=this->lookUpRecord(recordName);
249  if(withlogging){
250  if( m_logConnectionString.empty() ) {
251  throw cond::Exception("Log db was not set from PoolDBOutputService::add");
252  }
253  }
254 
255  std::string objToken;
256  std::string objClass;
257  unsigned int payloadIdx=0;
258 
259  try{
260  objToken = payloadToken(m_session);
261  objClass = m_session.classNameForItem( objToken );
262  payloadIdx= appendIOV(m_session,myrecord,objToken,time);
263  if(withlogging){
264  std::string destconnect=m_session.connectionString();
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();
272  m_logdb->logFailedOperationNow(a,destconnect,objClass,objToken,myrecord.m_tag,myrecord.timetypestr(),payloadIdx,time,std::string(er.what()));
273  }
274  throw cond::Exception(std::string(er.what()) + " from PoolDBOutputService::add ");
275  }
276  trans.ok();
277 }
const std::string & connectionString() const
Definition: DbSession.cc:169
std::string classNameForItem(const std::string &objectId)
Definition: DbSession.cc:277
DbTransaction & transaction()
Definition: DbSession.cc:189
Record & lookUpRecord(const std::string &recordName)
double a
Definition: hdecay.h:121
cond::UserLogInfo & lookUpUserLogInfo(const std::string &recordName)
std::auto_ptr< cond::Logger > m_logdb
unsigned int appendIOV(cond::DbSession &, Record &record, const std::string &payloadToken, cond::Time_t sinceTime)
unsigned int PoolDBOutputService::appendIOV ( cond::DbSession pooldb,
Record record,
const std::string &  payloadToken,
cond::Time_t  sinceTime 
)
private

Definition at line 307 of file PoolDBOutputService.cc.

References cond::IOVEditor::append(), idDealer::editor, edm::hlt::Exception, cond::IOVEditor::freeInsert(), cond::service::PoolDBOutputService::Record::m_closeIOV, cond::service::PoolDBOutputService::Record::m_freeInsert, cond::service::PoolDBOutputService::Record::m_iovtoken, cond::service::PoolDBOutputService::Record::m_isNewTag, cond::service::PoolDBOutputService::Record::m_tag, cond::IOVEditor::stamp(), cond::IOVEditor::updateClosure(), and cond::userInfo().

310  {
311  DbOpenTransaction trans( m_session.transaction() );
312  if( record.m_isNewTag ) {
313  throw cond::Exception(std::string("Cannot append to non-existing tag ") + record.m_tag + std::string(" from PoolDBOutputService::appendIOV"));
314  }
315 
316  cond::IOVEditor editor(pooldb,record.m_iovtoken);
317 
318  unsigned int payloadIdx = record.m_freeInsert ?
319  editor.freeInsert(sinceTime,payloadToken) :
320  editor.append(sinceTime,payloadToken);
321  if (record.m_closeIOV) editor.updateClosure(sinceTime);
322  editor.stamp(cond::userInfo(),false);
323  trans.ok();
324  return payloadIdx;
325 }
DbTransaction & transaction()
Definition: DbSession.cc:189
tuple editor
Definition: idDealer.py:73
std::string userInfo()
Definition: IOVInfo.cc:9
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 156 of file PoolDBOutputService.h.

References add().

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

159  {
160  add( GetTokenFromPointer<T>(payloadObj),
161  sinceTime,
162  recordName,
163  withlogging);
164  }
void add(GetToken const &token, cond::Time_t time, const std::string &recordName, bool withlogging=false)
void cond::service::PoolDBOutputService::appendSinceTime ( const std::string &  payloadToken,
cond::Time_t  sinceTime,
const std::string &  recordName,
bool  withlogging = false 
)
inline

Definition at line 171 of file PoolDBOutputService.h.

References add().

174  {
175  add(GetTrivialToken(payloadToken),
176  sinceTime,
177  recordName,
178  withlogging);
179  }
void add(GetToken const &token, cond::Time_t time, const std::string &recordName, bool withlogging=false)
cond::Time_t PoolDBOutputService::beginOfTime ( ) const

Definition at line 178 of file PoolDBOutputService.cc.

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

Referenced by SiStripBadChannelBuilder::algoAnalyze(), DBWriter::analyze(), SiStripDetVOffFakeBuilder::analyze(), SiStripNoisesBuilder::analyze(), SiStripThresholdBuilder::analyze(), SiStripSummaryBuilder::analyze(), SiStripApvGainBuilder::analyze(), SiStripPedestalsBuilder::analyze(), SurveyInputTrackerFromDB::analyze(), TrackerSystematicMisalignments::analyze(), SiStripNoiseNormalizedWithApvGainBuilder::analyze(), SiPixelLorentzAngleDB::analyze(), SiStripApvGainBuilderFromTag::analyze(), EcalTestDevDB::analyze(), SiStripFEDErrorsDQM::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(), EcalDQMStatusWriter::beginRun(), EcalDBCopy::copyToDB(), ESDBCopy::copyToDB(), EcalTPGDBCopy::copyToDB(), CocoaDBMgr::DumpCocoaResults(), PhysicsTools::MVATrainerSave::endJob(), PhysicsTools::MVATrainerContainerSave::endJob(), BeamSpotWrite2DB::endJob(), CentralityTableProducer::endJob(), BeamProfile2DB::endJob(), StoreEcalCondition::endJob(), SiStripFedCablingManipulator::endRun(), DummyCondDBWriter< TObject, TObjectO, TRecord >::endRun(), HLTPrescaleRecorder::endRun(), LaserAlignment::endRun(), MisalignedMuonESProducer::saveToDB(), ConditionDBWriter< SiStripApvGain >::storeOnDb(), l1t::DataWriter::updateIOV(), CaloGeometryDBWriter::write(), BeamFitter::write2DB(), SiPixelHistoricInfoEDAClient::writeDB(), SiPixelHistoricInfoDQMClient::writeDB(), and DTCalibDBUtils::writeToDB().

178  {
180 }
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 328 of file PoolDBOutputService.cc.

References idDealer::editor, edm::hlt::Exception, cond::service::PoolDBOutputService::Record::m_iovtoken, cond::service::PoolDBOutputService::Record::m_isNewTag, cond::service::PoolDBOutputService::Record::m_tag, record, cond::IOVEditor::stamp(), cond::IOVEditor::updateClosure(), and cond::userInfo().

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

329  {
330  // not fully working.. not be used for now...
332  DbOpenTransaction trans( m_session.transaction() );
333 
334  if( record.m_isNewTag ) {
335  throw cond::Exception(std::string("Cannot close non-existing tag ") + record.m_tag + std::string(" from PoolDBOutputService::closeIOV"));
336  }
337  cond::IOVEditor editor(m_session,record.m_iovtoken);
338  editor.updateClosure(lastTill);
339  editor.stamp(cond::userInfo(),false);
340  trans.ok();
341 }
DbTransaction & transaction()
Definition: DbSession.cc:189
JetCorrectorParameters::Record record
Definition: classes.h:11
Record & lookUpRecord(const std::string &recordName)
tuple editor
Definition: idDealer.py:73
std::string userInfo()
Definition: IOVInfo.cc:9
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 130 of file PoolDBOutputService.h.

Referenced by SiStripBadChannelBuilder::algoAnalyze(), DBWriter::analyze(), SiStripDetVOffFakeBuilder::analyze(), SiStripNoisesBuilder::analyze(), SiStripApvGainBuilder::analyze(), SiStripPedestalsBuilder::analyze(), SiStripSummaryBuilder::analyze(), SiStripThresholdBuilder::analyze(), SiStripNoiseNormalizedWithApvGainBuilder::analyze(), SiPixelLorentzAngleDB::analyze(), SiStripApvGainBuilderFromTag::analyze(), EcalTestDevDB::analyze(), SiStripFEDErrorsDQM::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(), EcalDQMStatusWriter::beginRun(), EcalDBCopy::copyToDB(), ESDBCopy::copyToDB(), EcalTPGDBCopy::copyToDB(), createNewIOV(), CocoaDBMgr::DumpCocoaResults(), PhysicsTools::MVATrainerSave::endJob(), PhysicsTools::MVATrainerContainerSave::endJob(), BeamSpotWrite2DB::endJob(), CentralityTableProducer::endJob(), BeamProfile2DB::endJob(), StoreEcalCondition::endJob(), SiStripFedCablingManipulator::endRun(), HLTPrescaleRecorder::endRun(), l1t::DataWriter::updateIOV(), CaloGeometryDBWriter::write(), BeamFitter::write2DB(), AlCaRecoTriggerBitsRcdUpdate::writeBitsToDB(), SiPixelHistoricInfoEDAClient::writeDB(), and SiPixelHistoricInfoDQMClient::writeDB().

134  {
135  createNewIOV( GetTokenFromPointer<T>(firstPayloadObj),
136  firstSinceTime,
137  firstTillTime,
138  recordName,
139  withlogging);
140  }
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
void cond::service::PoolDBOutputService::createNewIOV ( const std::string &  firstPayloadToken,
cond::Time_t  firstSinceTime,
cond::Time_t  firstTillTime,
const std::string &  recordName,
bool  withlogging = false 
)
inline

Definition at line 142 of file PoolDBOutputService.h.

References createNewIOV().

146  {
147  createNewIOV( GetTrivialToken(firstPayloadToken),
148  firstSinceTime,
149  firstTillTime,
150  recordName,
151  withlogging);
152  }
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
void PoolDBOutputService::createNewIOV ( GetToken const &  token,
cond::Time_t  firstSinceTime,
cond::Time_t  firstTillTime,
const std::string &  recordName,
bool  withlogging = false 
)
private

Definition at line 188 of file PoolDBOutputService.cc.

References a, cond::MetaData::addMapping(), cond::IOVEditor::append(), cond::IOVEditor::create(), idDealer::editor, cppFunctionSkipper::exception, edm::hlt::Exception, cond::IOVEditor::setScope(), cond::IOVEditor::stamp(), cond::IOVSequence::Tag, cond::IOVEditor::token(), and cond::userInfo().

192  {
193  DbOpenTransaction trans( m_session.transaction() );
194  Record& myrecord=this->lookUpRecord(recordName);
195  if(!myrecord.m_isNewTag) {
196  throw cond::Exception(myrecord.m_tag + " is not a new tag from PoolDBOutputService::createNewIOV");
197  }
198  std::string iovToken;
199  if(withlogging){
200  if( m_logConnectionString.empty() ) {
201  throw cond::Exception("Log db was not set from PoolDBOutputService::createNewIOV");
202  }
203  }
204 
205  std::string objToken;
206  std::string objClass;
207  unsigned int payloadIdx=0;
208  try{
210  editor.create(myrecord.m_timetype, firstTillTime);
211  objToken = payloadToken(m_session);
212  objClass = m_session.classNameForItem( objToken );
213  unsigned int payloadIdx=editor.append(firstSinceTime, objToken);
214  iovToken=editor.token();
215  editor.stamp(cond::userInfo(),false);
216  editor.setScope( cond::IOVSequence::Tag );
217 
218  cond::MetaData metadata(m_session);
219 
220  metadata.addMapping(myrecord.m_tag,iovToken,myrecord.m_timetype);
221 
222  m_newtags.push_back( std::pair<std::string,std::string>(myrecord.m_tag,iovToken) );
223  myrecord.m_iovtoken=iovToken;
224  myrecord.m_isNewTag=false;
225  if(withlogging){
226  std::string destconnect=m_session.connectionString();
228  m_logdb->logOperationNow(a,destconnect,objClass,objToken,myrecord.m_tag,myrecord.timetypestr(),payloadIdx,firstSinceTime);
229  }
230  }catch(const std::exception& er){
231  if(withlogging){
232  std::string destconnect=m_session.connectionString();
234  m_logdb->logFailedOperationNow(a,destconnect,objClass,objToken,myrecord.m_tag,myrecord.timetypestr(),payloadIdx,firstSinceTime,std::string(er.what()));
235  }
236  throw cond::Exception(std::string(er.what()) + " from PoolDBOutputService::createNewIOV ");
237  }
238  trans.ok();
239 }
std::vector< std::pair< std::string, std::string > > m_newtags
const std::string & connectionString() const
Definition: DbSession.cc:169
std::string classNameForItem(const std::string &objectId)
Definition: DbSession.cc:277
DbTransaction & transaction()
Definition: DbSession.cc:189
Record & lookUpRecord(const std::string &recordName)
tuple editor
Definition: idDealer.py:73
double a
Definition: hdecay.h:121
std::string userInfo()
Definition: IOVInfo.cc:9
cond::UserLogInfo & lookUpUserLogInfo(const std::string &recordName)
std::auto_ptr< cond::Logger > m_logdb
cond::Time_t PoolDBOutputService::currentTime ( ) const

Definition at line 183 of file PoolDBOutputService.cc.

Referenced by SiStripBadChannelBuilder::algoAnalyze(), DBWriter::analyze(), SiStripDetVOffFakeBuilder::analyze(), SiStripNoisesBuilder::analyze(), SiStripApvGainBuilder::analyze(), SiStripPedestalsBuilder::analyze(), SiStripSummaryBuilder::analyze(), SiStripThresholdBuilder::analyze(), SiStripNoiseNormalizedWithApvGainBuilder::analyze(), SiPixelLorentzAngleDB::analyze(), SiStripApvGainBuilderFromTag::analyze(), SiStripFEDErrorsDQM::analyze(), SiStripFedCablingBuilder::beginRun(), CocoaDBMgr::DumpCocoaResults(), BeamSpotWrite2DB::endJob(), SurveyDBUploader::endJob(), CentralityTableProducer::endJob(), Mixing2DB::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(), and DTCalibDBUtils::writeToDB().

183  {
184  return m_currentTime;
185 }
void cond::service::PoolDBOutputService::disconnect ( )
private
cond::Time_t PoolDBOutputService::endOfTime ( ) const

Definition at line 173 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(), SiStripNoiseNormalizedWithApvGainBuilder::analyze(), SiPixelLorentzAngleDB::analyze(), SiStripApvGainBuilderFromTag::analyze(), EcalTestDevDB::analyze(), SiStripFEDErrorsDQM::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(), EcalDQMStatusWriter::beginRun(), EcalDBCopy::copyToDB(), ESDBCopy::copyToDB(), EcalTPGDBCopy::copyToDB(), CocoaDBMgr::DumpCocoaResults(), PhysicsTools::MVATrainerSave::endJob(), PhysicsTools::MVATrainerContainerSave::endJob(), BeamSpotWrite2DB::endJob(), CentralityTableProducer::endJob(), BeamProfile2DB::endJob(), StoreEcalCondition::endJob(), SiStripFedCablingManipulator::endRun(), HLTPrescaleRecorder::endRun(), l1t::DataWriter::updateIOV(), CaloGeometryDBWriter::write(), BeamFitter::write2DB(), AlCaRecoTriggerBitsRcdUpdate::writeBitsToDB(), SiPixelHistoricInfoEDAClient::writeDB(), SiPixelHistoricInfoDQMClient::writeDB(), and writeOne().

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

Definition at line 22 of file PoolDBOutputService.cc.

References cond::findSpecs(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), m_callbacks, cond::service::PoolDBOutputService::Record::m_closeIOV, m_closeIOV, cond::service::PoolDBOutputService::Record::m_freeInsert, m_freeInsert, cond::service::PoolDBOutputService::Record::m_idName, m_logConnectionString, m_logheaders, cond::service::PoolDBOutputService::Record::m_tag, cond::service::PoolDBOutputService::Record::m_timetype, m_timetypestr, and cond::TimeTypeSpecs::type.

Referenced by PoolDBOutputService().

22  {
23  Record thisrecord;
24 
25  thisrecord.m_idName = pset.getParameter<std::string>("record");
26  thisrecord.m_tag = pset.getParameter<std::string>("tag");
27 
28  thisrecord.m_closeIOV =
29  pset.getUntrackedParameter<bool>("closeIOV", m_closeIOV);
30 
31  thisrecord.m_freeInsert =
32  pset.getUntrackedParameter<bool>("outOfOrder",m_freeInsert);
33 
34  thisrecord.m_timetype=cond::findSpecs(pset.getUntrackedParameter< std::string >("timetype",m_timetypestr)).type;
35 
36  m_callbacks.insert(std::make_pair(thisrecord.m_idName,thisrecord));
37 
38  if( !m_logConnectionString.empty() ){
39  cond::UserLogInfo userloginfo;
40  m_logheaders.insert(std::make_pair(thisrecord.m_idName,userloginfo));
41  }
42 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::map< std::string, cond::UserLogInfo > m_logheaders
TimeType type
Definition: Time.h:41
const TimeTypeSpecs & findSpecs(std::string const &name)
Definition: Time.cc:33
std::map< std::string, Record > m_callbacks
void PoolDBOutputService::initDB ( bool  forReading = true)
private

Definition at line 112 of file PoolDBOutputService.cc.

References cond::IOVNames::container(), cond::IOVSchemaUtility::createIOVContainer(), cppFunctionSkipper::exception, and edm::hlt::Exception.

113 {
114  m_session.transaction().start(false);
115  DbOpenTransaction trans( m_session.transaction() );
116  try{
117  if(!forReading) {
118  cond::IOVSchemaUtility schemaUtil( m_session );
119  schemaUtil.createIOVContainer();
121  }
122  //init logdb if required
123  if(!m_logConnectionString.empty()){
124  m_logdb->connect( m_logConnectionString );
125  m_logdb->createLogDBIfNonExist();
126  }
127  } catch( const std::exception& er ){
128  throw cond::Exception( std::string(er.what()) + " from PoolDBOutputService::initDB" );
129  }
130  trans.ok();
131  m_dbstarted=true;
132 }
DbTransaction & transaction()
Definition: DbSession.cc:189
bool lockContainer(const std::string &name)
Definition: Database.cc:262
int start(bool readOnly=false)
start transaction
static std::string container()
Definition: IOVNames.h:7
ora::Database & storage()
Definition: DbSession.cc:198
std::auto_ptr< cond::Logger > m_logdb
unsigned int cond::service::PoolDBOutputService::insertIOV ( cond::DbSession pooldb,
Record record,
const std::string &  payloadToken,
cond::Time_t  tillTime 
)
private

Returns payload location index.

bool PoolDBOutputService::isNewTagRequest ( const std::string &  recordName)

Definition at line 106 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(), SiStripNoiseNormalizedWithApvGainBuilder::analyze(), SiPixelLorentzAngleDB::analyze(), SiStripApvGainBuilderFromTag::analyze(), EcalTestDevDB::analyze(), SiStripFEDErrorsDQM::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(), EcalDQMStatusWriter::beginRun(), CocoaDBMgr::DumpCocoaResults(), BeamSpotWrite2DB::endJob(), CentralityTableProducer::endJob(), StoreEcalCondition::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(), writeOne(), and DTCalibDBUtils::writeToDB().

106  {
107  Record& myrecord=this->lookUpRecord(recordName);
108  return myrecord.m_isNewTag;
109 }
Record & lookUpRecord(const std::string &recordName)
cond::service::PoolDBOutputService::Record & PoolDBOutputService::lookUpRecord ( const std::string &  recordName)
private

Definition at line 280 of file PoolDBOutputService.cc.

References cond::MetaData::getToken(), and cond::MetaData::hasTag().

280  {
281  if (!m_dbstarted) this->initDB( false );
282  DbOpenTransaction trans( m_session.transaction() );
283  std::map<std::string,Record>::iterator it=m_callbacks.find(recordName);
284  if(it==m_callbacks.end()) {
285  throw cond::UnregisteredRecordException(recordName + " from PoolDBOutputService::lookUpRecord");
286  }
287  cond::MetaData metadata(m_session);
288  if( !metadata.hasTag(it->second.m_tag) ){
289  it->second.m_iovtoken="";
290  it->second.m_isNewTag=true;
291  }else{
292  it->second.m_iovtoken=metadata.getToken(it->second.m_tag);
293  it->second.m_isNewTag=false;
294  }
295  trans.ok();
296  return it->second;
297 }
DbTransaction & transaction()
Definition: DbSession.cc:189
std::map< std::string, Record > m_callbacks
cond::UserLogInfo & PoolDBOutputService::lookUpUserLogInfo ( const std::string &  recordName)
private

Definition at line 299 of file PoolDBOutputService.cc.

299  {
300  std::map<std::string,cond::UserLogInfo>::iterator it=m_logheaders.find(recordName);
301  if(it==m_logheaders.end()) throw cond::Exception("Log db was not set for record " + recordName + " from PoolDBOutputService::lookUpUserLogInfo");
302  return it->second;
303 }
std::map< std::string, cond::UserLogInfo > m_logheaders
void PoolDBOutputService::postEndJob ( )

Definition at line 135 of file PoolDBOutputService.cc.

Referenced by PoolDBOutputService().

136 {
137  if( m_dbstarted) {
139  m_dbstarted = false;
140  }
141 }
DbTransaction & transaction()
Definition: DbSession.cc:189
int commit()
commit transaction.
void PoolDBOutputService::postModule ( const edm::ModuleDescription desc)

Definition at line 165 of file PoolDBOutputService.cc.

Referenced by PoolDBOutputService().

165  {
166 }
void PoolDBOutputService::preBeginLumi ( const edm::LuminosityBlockID iLumiid,
const edm::Timestamp iTime 
)

Definition at line 158 of file PoolDBOutputService.cc.

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

Referenced by PoolDBOutputService().

158  {
159  if( m_timetype == cond::lumiid ){
160  m_currentTime=iLumiid.value();
161  }
162 }
boost::uint64_t value() const
void PoolDBOutputService::preEventProcessing ( const edm::EventID evtID,
const edm::Timestamp iTime 
)

Definition at line 144 of file PoolDBOutputService.cc.

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

Referenced by PoolDBOutputService().

145 {
146  if( m_timetype == cond::runnumber ){//runnumber
147  m_currentTime=iEvtid.run();
148  }else if( m_timetype == cond::timestamp ){ //timestamp
149  m_currentTime=iTime.value();
150  }
151 }
TimeValue_t value() const
Definition: Timestamp.cc:72
void PoolDBOutputService::preModule ( const edm::ModuleDescription desc)

Definition at line 154 of file PoolDBOutputService.cc.

Referenced by PoolDBOutputService().

154  {
155 }
const cond::Logger & PoolDBOutputService::queryLog ( ) const

Definition at line 355 of file PoolDBOutputService.cc.

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

355  {
356  if( !m_logdb.get() ) throw cond::Exception("Log database is not set from PoolDBOutputService::queryLog");
357  return *m_logdb;
358 }
std::auto_ptr< cond::Logger > m_logdb
cond::DbSession PoolDBOutputService::session ( ) const
void PoolDBOutputService::setLogHeaderForRecord ( const std::string &  recordName,
const std::string &  provenance,
const std::string &  usertext 
)

Definition at line 346 of file PoolDBOutputService.cc.

References cond::UserLogInfo::provenance, and cond::UserLogInfo::usertext.

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

347 {
349  myloginfo.provenance=dataprovenance;
350  myloginfo.usertext=usertext;
351 }
std::string usertext
Definition: LogDBEntry.h:9
std::string provenance
Definition: LogDBEntry.h:8
cond::UserLogInfo & lookUpUserLogInfo(const std::string &recordName)
std::string PoolDBOutputService::tag ( const std::string &  recordName)
void PoolDBOutputService::tagInfo ( const std::string &  recordName,
cond::TagInfo result 
)

Definition at line 362 of file PoolDBOutputService.cc.

References cond::IOVProxy::end(), o2o::iov, prof2calltree::last, cond::TagInfo::lastInterval, cond::TagInfo::lastPayloadToken, cond::service::PoolDBOutputService::Record::m_iovtoken, cond::service::PoolDBOutputService::Record::m_tag, cond::TagInfo::name, record, cond::IOVElementProxy::since(), cond::TagInfo::size, cond::IOVProxy::size(), cond::IOVElementProxy::till(), cond::TagInfo::token, and cond::IOVElementProxy::token().

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

362  {
363  //
365  result.name=record.m_tag;
366  result.token=record.m_iovtoken;
367  //use iovproxy to find out.
368  cond::IOVProxy iov(m_session, record.m_iovtoken);
369  result.size=iov.size();
370  if (result.size>0) {
371  // get last object
372  cond::IOVElementProxy last = *(--iov.end());
373  result.lastInterval = cond::ValidityInterval(last.since(), last.till());
374  result.lastPayloadToken=last.token();
375  }
376 }
JetCorrectorParameters::Record record
Definition: classes.h:11
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:19
cond::Time_t till() const
Definition: IOVProxy.h:71
std::string lastPayloadToken
Definition: TagInfo.h:12
std::string name
Definition: TagInfo.h:9
tuple iov
Definition: o2o.py:307
Record & lookUpRecord(const std::string &recordName)
std::string const & token() const
Definition: IOVProxy.h:75
size_t size
Definition: TagInfo.h:13
std::string token
Definition: TagInfo.h:10
cond::Time_t since() const
Definition: IOVProxy.h:67
cond::ValidityInterval lastInterval
Definition: TagInfo.h:11
template<typename T >
void cond::service::PoolDBOutputService::writeOne ( T payload,
Time_t  time,
const std::string &  recordName,
bool  withlogging = false 
)
inline

Definition at line 116 of file PoolDBOutputService.h.

References endOfTime(), isNewTagRequest(), ecalTPGAnalyzer_cfg::recordName, and cond::rpcobgas::time.

Referenced by SurveyInputTrackerFromDB::analyze(), TrackerSystematicMisalignments::analyze(), GBRWrapperMaker::analyze(), TrackerGeometryCompare::analyze(), MoveFlatParamsToDB::analyze(), DTUserKeyedConfigHandler::chkConfigList(), DTKeyedConfigHandler::chkConfigList(), SurveyDBUploader::endJob(), Mixing2DB::endJob(), DTKeyedConfigDBInit::endJob(), DummyCondDBWriter< TObject, TObjectO, TRecord >::endRun(), AlcaBeamSpotHarvester::endRun(), LaserAlignment::endRun(), 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().

116  {
118  createNewIOV<T>(payload, time, endOfTime(), recordName, withlogging);
119  }else{
120  appendSinceTime<T>(payload, time, recordName, withlogging);
121  }
122  }
bool isNewTagRequest(const std::string &recordName)

Member Data Documentation

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

Definition at line 282 of file PoolDBOutputService.h.

Referenced by fillRecord().

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

Definition at line 284 of file PoolDBOutputService.h.

Referenced by fillRecord(), and PoolDBOutputService().

std::string cond::service::PoolDBOutputService::m_connectionString
private

Definition at line 276 of file PoolDBOutputService.h.

Referenced by PoolDBOutputService().

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

Definition at line 274 of file PoolDBOutputService.h.

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

Definition at line 280 of file PoolDBOutputService.h.

bool cond::service::PoolDBOutputService::m_freeInsert
private

Definition at line 285 of file PoolDBOutputService.h.

Referenced by fillRecord(), and PoolDBOutputService().

std::string cond::service::PoolDBOutputService::m_logConnectionString
private

Definition at line 278 of file PoolDBOutputService.h.

Referenced by fillRecord(), and PoolDBOutputService().

std::auto_ptr<cond::Logger> cond::service::PoolDBOutputService::m_logdb
private

Definition at line 279 of file PoolDBOutputService.h.

Referenced by PoolDBOutputService().

std::map<std::string, cond::UserLogInfo> cond::service::PoolDBOutputService::m_logheaders
private

Definition at line 286 of file PoolDBOutputService.h.

Referenced by fillRecord().

std::vector< std::pair<std::string,std::string> > cond::service::PoolDBOutputService::m_newtags
private

Definition at line 283 of file PoolDBOutputService.h.

cond::DbSession cond::service::PoolDBOutputService::m_session
private

Definition at line 277 of file PoolDBOutputService.h.

Referenced by PoolDBOutputService().

cond::TimeType cond::service::PoolDBOutputService::m_timetype
private

Definition at line 272 of file PoolDBOutputService.h.

Referenced by PoolDBOutputService().

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

Definition at line 273 of file PoolDBOutputService.h.

Referenced by fillRecord(), and PoolDBOutputService().