CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
popcon::PopCon Class Reference

#include <PopCon.h>

Public Types

typedef cond::Time_t Time_t
 

Public Member Functions

 PopCon (const edm::ParameterSet &pset)
 
template<typename Source >
void write (Source const &source)
 
template<typename T >
void writeOne (T *payload, Time_t time)
 
virtual ~PopCon ()
 

Private Member Functions

void finalize (Time_t lastTill)
 
cond::persistency::Session initialize ()
 

Private Attributes

std::string m_authPath
 
int m_authSys
 
bool m_close
 
edm::Service< cond::service::PoolDBOutputServicem_dbService
 
Time_t m_lastTill
 
cond::LogDBEntry_t m_logDBEntry
 
bool m_LoggingOn
 
std::string m_payload_name
 
std::string m_record
 
std::string m_tag
 
cond::TagInfo_t m_tagInfo
 
std::string m_targetConnectionString
 
cond::persistency::Session m_targetSession
 

Static Private Attributes

static constexpr const char *const s_version = "5.0"
 

Detailed Description

Definition at line 29 of file PopCon.h.

Member Typedef Documentation

◆ Time_t

Definition at line 31 of file PopCon.h.

Constructor & Destructor Documentation

◆ PopCon()

popcon::PopCon::PopCon ( const edm::ParameterSet pset)

Definition at line 12 of file PopCon.cc.

13  : m_targetSession(),
14  m_targetConnectionString(pset.getUntrackedParameter<std::string>("targetDBConnectionString", "")),
15  m_authPath(pset.getUntrackedParameter<std::string>("authenticationPath", "")),
16  m_authSys(pset.getUntrackedParameter<int>("authenticationSystem", 1)),
17  m_record(pset.getParameter<std::string>("record")),
18  m_payload_name(pset.getUntrackedParameter<std::string>("name", "")),
19  m_LoggingOn(pset.getUntrackedParameter<bool>("loggingOn", true)),
20  m_close(pset.getUntrackedParameter<bool>("closeIOV", false)),
21  m_lastTill(pset.getUntrackedParameter<bool>("lastTill", false)) {
22  //TODO set the policy (cfg or global configuration?)
23  //Policy if corrupted data found
24 
25  edm::LogInfo("PopCon") << "This is PopCon (Populator of Condition) v" << s_version << ".\n"
26  << "Please report any problem and feature request through the JIRA project CMSCONDDB.\n";
27  }

References s_version.

◆ ~PopCon()

popcon::PopCon::~PopCon ( )
virtual

Member Function Documentation

◆ finalize()

void popcon::PopCon::finalize ( Time_t  lastTill)
private

Definition at line 73 of file PopCon.cc.

73  {
74  if (m_close) {
75  // avoid to close it before lastSince
76  if (m_lastTill > lastTill)
77  lastTill = m_lastTill;
78  m_dbService->closeIOV(lastTill, m_record);
79  }
80  if (!m_targetConnectionString.empty()) {
82  }
83  }

References cond::service::PoolDBOutputService::closeIOV(), cond::persistency::Transaction::commit(), m_close, m_dbService, m_lastTill, m_record, m_targetConnectionString, m_targetSession, and cond::persistency::Session::transaction().

Referenced by write().

◆ initialize()

cond::persistency::Session popcon::PopCon::initialize ( )
private

Definition at line 35 of file PopCon.cc.

35  {
36  edm::LogInfo("PopCon") << "payload name " << m_payload_name << std::endl;
37  if (!m_dbService.isAvailable())
38  throw Exception("DBService not available");
39  const std::string& connectionStr = m_dbService->session().connectionString();
43  if (m_targetConnectionString.empty())
45  else {
49  connPool.configure();
52  }
55  m_tagInfo.size = iov.sequenceSize();
56  if (m_tagInfo.size > 0) {
58  }
59 
60  edm::LogInfo("PopCon") << "destination DB: " << connectionStr << ", target DB: "
61  << (m_targetConnectionString.empty() ? connectionStr : m_targetConnectionString) << "\n"
62  << "TAG: " << m_tag << ", last since/till: " << m_tagInfo.lastInterval.since << "/"
63  << m_tagInfo.lastInterval.till << ", size: " << m_tagInfo.size << "\n"
64  << std::endl;
65  } else {
66  edm::LogInfo("PopCon") << "destination DB: " << connectionStr << ", target DB: "
67  << (m_targetConnectionString.empty() ? connectionStr : m_targetConnectionString) << "\n"
68  << "TAG: " << m_tag << "; First writer to this new tag." << std::endl;
69  }
70  return m_targetSession;
71  }

References cond::persistency::ConnectionPool::configure(), cond::persistency::Session::connectionString(), cond::persistency::ConnectionPool::createSession(), Exception, cond::persistency::Session::existsDatabase(), cond::persistency::Session::existsIov(), cond::service::PoolDBOutputService::forceInit(), cond::persistency::IOVProxy::getLast(), edm::Service< T >::isAvailable(), cond::TagInfo_t::lastInterval, m_authPath, m_authSys, m_dbService, m_payload_name, m_record, m_tag, m_tagInfo, m_targetConnectionString, m_targetSession, cond::TagInfo_t::name, cond::persistency::Session::readIov(), cond::persistency::IOVProxy::sequenceSize(), cond::service::PoolDBOutputService::session(), cond::persistency::ConnectionPool::setAuthenticationPath(), cond::persistency::ConnectionPool::setAuthenticationSystem(), cond::Iov_t::since, cond::TagInfo_t::size, cond::persistency::Transaction::start(), AlCaHLTBitMon_QueryRunRegistry::string, cond::service::PoolDBOutputService::tag(), cond::Iov_t::till, and cond::persistency::Session::transaction().

Referenced by write().

◆ write()

template<typename Source >
void popcon::PopCon::write ( Source const &  source)

Definition at line 107 of file PopCon.h.

107  {
108  typedef typename Source::value_type value_type;
109  typedef typename Source::Container Container;
110 
111  std::pair<Container const*, std::string const> ret = source(initialize(), m_tagInfo, m_logDBEntry);
112  Container const& payloads = *ret.first;
113 
114  if (m_LoggingOn) {
115  std::ostringstream s;
116  s << "PopCon v" << s_version << "; " << displayIovHelper(payloads) << ret.second;
117  //s << "PopCon v" << s_version << "; " << cond::userInfo() << displayIovHelper(payloads) << ret.second;
119  }
121 
122  std::for_each(payloads.begin(),
123  payloads.end(),
124  std::bind(&popcon::PopCon::writeOne<value_type>,
125  this,
126  std::bind(&Container::value_type::payload, std::placeholders::_1),
127  std::bind(&Container::value_type::time, std::placeholders::_1)));
128 
129  finalize(payloads.empty() ? Time_t(0) : payloads.back().time);
130  }

References popcon::displayHelper(), popcon::displayIovHelper(), finalize(), initialize(), m_dbService, m_logDBEntry, m_LoggingOn, m_record, m_tagInfo, jets_cff::payload, tauJetCorrections_cff::payloads, runTheMatrix::ret, alignCSCRings::s, s_version, cond::service::PoolDBOutputService::setLogHeaderForRecord(), source, and protons_cff::time.

Referenced by SiStripPopConDQMEDHarvester< SourceHandler >::dqmEndJob(), pkg.AbstractPkg::generate(), ExTestEcalChannelStatusAnalyzer::write(), HcalSiPMCharacteristicsPopConAnalyzer::write(), HcalSiPMParametersPopConAnalyzer::write(), HcalTPChannelParametersPopConAnalyzer::write(), HcalTPParametersPopConAnalyzer::write(), HcalFrontEndMapPopConAnalyzer::write(), CastorPedestalWidthsPopConAnalyzer::write(), HcalTimeCorrsPopConAnalyzer::write(), HcalFlagHFDigiTimeParamsPopConAnalyzer::write(), HcalValidationCorrsPopConAnalyzer::write(), HcalL1TriggerObjectsPopConAnalyzer::write(), HcalRecoParamsPopConAnalyzer::write(), HcalQIETypesPopConAnalyzer::write(), HcalQIEDataPopConAnalyzer::write(), HcalPFCorrsPopConAnalyzer::write(), HcalPedestalWidthsPopConAnalyzer::write(), HcalPedestalsPopConAnalyzer::write(), HcalMCParamsPopConAnalyzer::write(), HcalElectronicsMapPopConAnalyzer::write(), HcalLUTCorrsPopConAnalyzer::write(), HcalLongRecoParamsPopConAnalyzer::write(), CastorElectronicsMapPopConAnalyzer::write(), HcalGainWidthsPopConAnalyzer::write(), HcalZSThresholdsPopConAnalyzer::write(), HcalTimingParamsPopConAnalyzer::write(), HcalRespCorrsPopConAnalyzer::write(), CastorChannelQualityPopConAnalyzer::write(), HcalDcsValuesPopConAnalyzer::write(), HcalDcsMapPopConAnalyzer::write(), HcalChannelQualityPopConAnalyzer::write(), HcalLutMetadataPopConAnalyzer::write(), CastorRecoParamsPopConAnalyzer::write(), CastorQIEDataPopConAnalyzer::write(), CastorPedestalsPopConAnalyzer::write(), HcalGainsPopConAnalyzer::write(), CastorGainWidthsPopConAnalyzer::write(), CastorSaturationCorrsPopConAnalyzer::write(), CastorGainsPopConAnalyzer::write(), HcalZDCLowGainFractionsPopConAnalyzer::write(), popcon::PopConAnalyzer< HcalTPParametersHandler >::write(), and querying.connection::write_and_commit().

◆ writeOne()

template<typename T >
void popcon::PopCon::writeOne ( T payload,
Time_t  time 
)

Member Data Documentation

◆ m_authPath

std::string popcon::PopCon::m_authPath
private

Definition at line 55 of file PopCon.h.

Referenced by initialize().

◆ m_authSys

int popcon::PopCon::m_authSys
private

Definition at line 57 of file PopCon.h.

Referenced by initialize().

◆ m_close

bool popcon::PopCon::m_close
private

Definition at line 71 of file PopCon.h.

Referenced by finalize().

◆ m_dbService

edm::Service<cond::service::PoolDBOutputService> popcon::PopCon::m_dbService
private

Definition at line 49 of file PopCon.h.

Referenced by finalize(), initialize(), write(), and writeOne().

◆ m_lastTill

Time_t popcon::PopCon::m_lastTill
private

Definition at line 73 of file PopCon.h.

Referenced by finalize().

◆ m_logDBEntry

cond::LogDBEntry_t popcon::PopCon::m_logDBEntry
private

Definition at line 69 of file PopCon.h.

Referenced by write().

◆ m_LoggingOn

bool popcon::PopCon::m_LoggingOn
private

Definition at line 63 of file PopCon.h.

Referenced by write().

◆ m_payload_name

std::string popcon::PopCon::m_payload_name
private

Definition at line 61 of file PopCon.h.

Referenced by initialize().

◆ m_record

std::string popcon::PopCon::m_record
private

Definition at line 59 of file PopCon.h.

Referenced by finalize(), initialize(), write(), and writeOne().

◆ m_tag

std::string popcon::PopCon::m_tag
private

Definition at line 65 of file PopCon.h.

Referenced by initialize().

◆ m_tagInfo

cond::TagInfo_t popcon::PopCon::m_tagInfo
private

Definition at line 67 of file PopCon.h.

Referenced by initialize(), and write().

◆ m_targetConnectionString

std::string popcon::PopCon::m_targetConnectionString
private

Definition at line 53 of file PopCon.h.

Referenced by finalize(), initialize(), and ~PopCon().

◆ m_targetSession

cond::persistency::Session popcon::PopCon::m_targetSession
private

Definition at line 51 of file PopCon.h.

Referenced by finalize(), initialize(), and ~PopCon().

◆ s_version

constexpr const char *const popcon::PopCon::s_version = "5.0"
staticconstexprprivate

Definition at line 75 of file PopCon.h.

Referenced by PopCon(), and write().

runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:542
popcon::PopCon::m_tag
std::string m_tag
Definition: PopCon.h:65
cond::service::PoolDBOutputService::tag
std::string tag(const std::string &recordName)
Definition: PoolDBOutputService.cc:124
popcon::PopCon::s_version
static constexpr const char *const s_version
Definition: PopCon.h:75
cond::persistency::IOVProxy::getLast
cond::Iov_t getLast()
Definition: IOVProxy.cc:390
cond::persistency::Session::existsIov
bool existsIov(const std::string &tag)
Definition: Session.cc:77
popcon::PopCon::m_authPath
std::string m_authPath
Definition: PopCon.h:55
popcon::displayIovHelper
const std::string displayIovHelper(Container const &payloads)
Definition: PopCon.h:91
cond::service::PoolDBOutputService::closeIOV
void closeIOV(Time_t lastTill, const std::string &recordName)
Definition: PoolDBOutputService.cc:346
popcon::PopCon::m_LoggingOn
bool m_LoggingOn
Definition: PopCon.h:63
protons_cff.time
time
Definition: protons_cff.py:39
popcon::PopCon::m_targetConnectionString
std::string m_targetConnectionString
Definition: PopCon.h:53
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
popcon::PopCon::m_logDBEntry
cond::LogDBEntry_t m_logDBEntry
Definition: PopCon.h:69
cond::persistency::ConnectionPool::createSession
Session createSession(const std::string &connectionString, bool writeCapable=false)
Definition: ConnectionPool.cc:172
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
cond::TagInfo_t::name
std::string name
Definition: Types.h:72
reco::JetExtendedAssociation::Container
edm::AssociationVector< reco::JetRefBaseProd, Values > Container
Definition: JetExtendedAssociation.h:29
popcon::PopCon::m_close
bool m_close
Definition: PopCon.h:71
alignCSCRings.s
s
Definition: alignCSCRings.py:92
cond::Iov_t::till
Time_t till
Definition: Types.h:54
cond::service::PoolDBOutputService::session
cond::persistency::Session session() const
Definition: PoolDBOutputService.cc:92
popcon::PopCon::m_targetSession
cond::persistency::Session m_targetSession
Definition: PopCon.h:51
popcon::PopCon::m_authSys
int m_authSys
Definition: PopCon.h:57
cond::persistency::ConnectionPool
Definition: ConnectionPool.h:35
tauJetCorrections_cff.payloads
payloads
Definition: tauJetCorrections_cff.py:4
source
static const std::string source
Definition: EdmProvDump.cc:47
jets_cff.payload
payload
Definition: jets_cff.py:32
popcon::PopCon::m_payload_name
std::string m_payload_name
Definition: PopCon.h:61
cond::persistency::Session::readIov
IOVProxy readIov(const std::string &tag)
Definition: Session.cc:63
cond::persistency::ConnectionPool::setAuthenticationSystem
void setAuthenticationSystem(int authSysCode)
Definition: ConnectionPool.cc:37
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
cond::persistency::IOVProxy
Definition: IOVProxy.h:92
cond::Iov_t::since
Time_t since
Definition: Types.h:53
popcon::PopCon::m_lastTill
Time_t m_lastTill
Definition: PopCon.h:73
cond::persistency::Session::connectionString
std::string connectionString()
Definition: Session.cc:216
cond::persistency::Transaction::commit
void commit()
Definition: Session.cc:23
cond::persistency::ConnectionPool::setAuthenticationPath
void setAuthenticationPath(const std::string &p)
Definition: ConnectionPool.cc:35
popcon::PopCon::finalize
void finalize(Time_t lastTill)
Definition: PopCon.cc:73
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
cond::persistency::ConnectionPool::configure
void configure()
Definition: ConnectionPool.cc:127
popcon::PopCon::m_record
std::string m_record
Definition: PopCon.h:59
cond::persistency::IOVProxy::sequenceSize
int sequenceSize() const
Definition: IOVProxy.cc:403
cond::TagInfo_t::lastInterval
Iov_t lastInterval
Definition: Types.h:73
cond::persistency::Session::transaction
Transaction & transaction()
Definition: Session.cc:52
cond::persistency::Transaction::start
void start(bool readOnly=true)
Definition: Session.cc:18
cond::service::PoolDBOutputService::setLogHeaderForRecord
void setLogHeaderForRecord(const std::string &recordName, const std::string &provenance, const std::string &usertext)
Definition: PoolDBOutputService.cc:366
popcon::PopCon::m_dbService
edm::Service< cond::service::PoolDBOutputService > m_dbService
Definition: PopCon.h:49
cond::persistency::Session::existsDatabase
bool existsDatabase()
Definition: Session.cc:55
Exception
Definition: hltDiff.cc:245
cond::service::PoolDBOutputService::writeOne
Hash writeOne(const T *payload, Time_t time, const std::string &recordName)
Definition: PoolDBOutputService.h:63
popcon::PopCon::Time_t
cond::Time_t Time_t
Definition: PopCon.h:31
popcon::PopCon::initialize
cond::persistency::Session initialize()
Definition: PopCon.cc:35
popcon::displayHelper
void displayHelper(Container const &payloads)
Definition: PopCon.h:84
popcon::PopCon::m_tagInfo
cond::TagInfo_t m_tagInfo
Definition: PopCon.h:67
cond::service::PoolDBOutputService::forceInit
void forceInit()
Definition: PoolDBOutputService.cc:201
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
cond::TagInfo_t::size
size_t size
Definition: Types.h:74