CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | 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::PoolDBOutputService
m_dbService
 
bool m_IsDestDbCheckedInQueryLog
 
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
 

Detailed Description

Definition at line 34 of file PopCon.h.

Member Typedef Documentation

Definition at line 36 of file PopCon.h.

Constructor & Destructor Documentation

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

Definition at line 10 of file PopCon.cc.

10  :
12  m_targetConnectionString(pset.getUntrackedParameter< std::string >("targetDBConnectionString","")),
13  m_authPath( pset.getUntrackedParameter<std::string>("authenticationPath","")),
14  m_authSys( pset.getUntrackedParameter<int>("authenticationSystem",1)),
15  m_record(pset.getParameter<std::string> ("record")),
17  m_LoggingOn(pset.getUntrackedParameter< bool > ("loggingOn",true)),
18  m_IsDestDbCheckedInQueryLog( pset.getUntrackedParameter< bool >("IsDestDbCheckedInQueryLog",true)),
19  m_close(pset.getUntrackedParameter< bool > ("closeIOV",false)),
20  m_lastTill(pset.getUntrackedParameter< bool > ("lastTill",0))
21  {
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) V4.0\n"
26  << "Please report any problem and feature request through the savannah portal under the category conditions\n" ;
27  }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
Time_t m_lastTill
Definition: PopCon.h:84
bool m_close
Definition: PopCon.h:83
std::string m_record
Definition: PopCon.h:69
cond::persistency::Session m_targetSession
Definition: PopCon.h:61
std::string m_targetConnectionString
Definition: PopCon.h:63
bool m_IsDestDbCheckedInQueryLog
Definition: PopCon.h:75
int m_authSys
Definition: PopCon.h:67
std::string m_authPath
Definition: PopCon.h:65
std::string m_payload_name
Definition: PopCon.h:71
bool m_LoggingOn
Definition: PopCon.h:73
popcon::PopCon::~PopCon ( )
virtual

Definition at line 29 of file PopCon.cc.

References cond::persistency::Transaction::commit(), m_targetConnectionString, m_targetSession, and cond::persistency::Session::transaction().

29  {
30  if( !m_targetConnectionString.empty() ) {
32  }
33  }
Transaction & transaction()
Definition: Session.cc:66
cond::persistency::Session m_targetSession
Definition: PopCon.h:61
std::string m_targetConnectionString
Definition: PopCon.h:63

Member Function Documentation

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

Definition at line 85 of file PopCon.cc.

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().

85  {
86 
87  if (m_close) {
88  // avoid to close it before lastSince
89  if (m_lastTill>lastTill) lastTill=m_lastTill;
90  m_dbService->closeIOV(lastTill,m_record);
91  }
92  if( !m_targetConnectionString.empty() ) {
94  }
95  }
void closeIOV(Time_t lastTill, const std::string &recordName, bool withlogging=false)
Time_t m_lastTill
Definition: PopCon.h:84
bool m_close
Definition: PopCon.h:83
std::string m_record
Definition: PopCon.h:69
Transaction & transaction()
Definition: Session.cc:66
cond::persistency::Session m_targetSession
Definition: PopCon.h:61
std::string m_targetConnectionString
Definition: PopCon.h:63
edm::Service< cond::service::PoolDBOutputService > m_dbService
Definition: PopCon.h:59
cond::persistency::Session popcon::PopCon::initialize ( )
private

Definition at line 36 of file PopCon.cc.

References cond::persistency::ConnectionPool::configure(), cond::persistency::Session::connectionString(), cond::persistency::ConnectionPool::createSession(), Exception, cond::persistency::Session::existsIov(), cond::persistency::IOVProxy::getLast(), o2o::iov, edm::Service< T >::isAvailable(), plotBeamSpotDB::last, cond::TagInfo_t::lastInterval, cond::TagInfo_t::lastPayloadToken, m_authPath, m_authSys, m_dbService, m_logDBEntry, m_payload_name, m_record, m_tag, m_tagInfo, m_targetConnectionString, m_targetSession, cond::TagInfo_t::name, cond::Iov_t::payloadId, cond::LogDBEntry_t::payloadIdx, cond::LogDBEntry_t::provenance, 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().

36  {
37  edm::LogInfo ("PopCon")<<"payload name "<<m_payload_name<<std::endl;
38  if(!m_dbService.isAvailable() ) throw Exception("DBService not available");
39  const std::string & connectionStr = m_dbService->session().connectionString();
43  else {
47  connPool.configure();
50  }
54  m_tagInfo.size = iov.sequenceSize();
55  if( m_tagInfo.size>0 ){
56  cond::Iov_t last = iov.getLast();
59  }
60 
61  //if( m_IsDestDbCheckedInQueryLog ) {
62  //m_dbService->queryLog().LookupLastEntryByTag( m_tag, connectionStr, m_logDBEntry );
63  //std::cout <<" ------ log info searched in the same db: "<< connectionStr << "------" <<std::endl;
64  //} else {
65  //m_dbService->queryLog().LookupLastEntryByTag( m_tag, m_logDBEntry );
66  //std::cout <<" ------ log info found in another db "<< "------" <<std::endl;
67  //}
68 
69  edm::LogInfo ("PopCon") << "DB: " << connectionStr << "\n"
70  << "TAG: " << m_tag
71  << ", last since/till: " << m_tagInfo.lastInterval.first
72  << "/" << m_tagInfo.lastInterval.second
73  << ", , size: " << m_tagInfo.size << "\n"
74  << "Last writer: " << m_logDBEntry.provenance
75  << ", size: " << m_logDBEntry.payloadIdx+1 << std::endl;
76  } else {
77  edm::LogInfo ("PopCon") << "DB: " << connectionStr << "\n"
78  << "TAG: " << m_tag
79  << "; First writer to this new tag." << std::endl;
80  }
81  return m_targetSession;
82  }
cond::LogDBEntry_t m_logDBEntry
Definition: PopCon.h:81
std::string provenance
Definition: Types.h:92
void start(bool readOnly=true)
Definition: Session.cc:22
cond::persistency::Session session() const
Time_t since
Definition: Types.h:54
size_t size
Definition: Types.h:75
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:19
std::string m_tag
Definition: PopCon.h:77
std::string m_record
Definition: PopCon.h:69
Transaction & transaction()
Definition: Session.cc:66
std::string tag(const std::string &recordName)
cond::persistency::Session m_targetSession
Definition: PopCon.h:61
std::string name
Definition: Types.h:71
cond::ValidityInterval lastInterval
Definition: Types.h:73
IOVProxy readIov(const std::string &tag, bool full=false)
Definition: Session.cc:81
tuple iov
Definition: o2o.py:307
void setAuthenticationSystem(int authSysCode)
bool isAvailable() const
Definition: Service.h:46
Hash payloadId
Definition: Types.h:56
Session createSession(const std::string &connectionString, bool writeCapable=false)
std::string m_targetConnectionString
Definition: PopCon.h:63
cond::TagInfo_t m_tagInfo
Definition: PopCon.h:79
std::string connectionString()
Definition: Session.cc:203
int m_authSys
Definition: PopCon.h:67
std::string lastPayloadToken
Definition: Types.h:74
bool existsIov(const std::string &tag)
Definition: Session.cc:97
std::string m_authPath
Definition: PopCon.h:65
unsigned int payloadIdx
Definition: Types.h:96
void setAuthenticationPath(const std::string &p)
std::string m_payload_name
Definition: PopCon.h:71
edm::Service< cond::service::PoolDBOutputService > m_dbService
Definition: PopCon.h:59
Time_t till
Definition: Types.h:55
template<typename Source >
void popcon::PopCon::write ( Source const &  source)

Definition at line 124 of file PopCon.h.

References popcon::displayHelper(), popcon::displayIovHelper(), finalize(), initialize(), m_dbService, m_logDBEntry, m_LoggingOn, m_record, m_tagInfo, tauJetCorrections_cff::payloads, runTheMatrix::ret, cond::service::PoolDBOutputService::setLogHeaderForRecord(), and source.

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

124  {
125  typedef typename Source::value_type value_type;
126  typedef typename Source::Container Container;
127 
128  std::pair<Container const *, std::string const> ret = source(initialize(),
130  Container const & payloads = *ret.first;
131 
132  if(m_LoggingOn)
133  m_dbService->setLogHeaderForRecord(m_record,source.id(),"PopCon v4.0; " +
134  displayIovHelper(payloads) + ret.second);
135  //m_dbService->setLogHeaderForRecord(m_record,source.id(),"PopCon v4.0; " +
136  // cond::userInfo() + displayIovHelper(payloads) + ret.second);
137 
138  displayHelper(payloads);
139 
140  std::for_each(payloads.begin(),payloads.end(),
141  boost::bind(&popcon::PopCon::writeOne<value_type>,this,
142  boost::bind(&Container::value_type::payload,_1),
143  boost::bind(&Container::value_type::time,_1)
144  )
145  );
146 
147 
148  finalize(payloads.empty() ? Time_t(0): payloads.back().time);
149  }
tuple ret
prodAgent to be discontinued
cond::LogDBEntry_t m_logDBEntry
Definition: PopCon.h:81
void finalize(Time_t lastTill)
Definition: PopCon.cc:85
cond::Time_t Time_t
Definition: PopCon.h:36
std::string m_record
Definition: PopCon.h:69
void displayHelper(Container const &payloads)
Definition: PopCon.h:97
cond::TagInfo_t m_tagInfo
Definition: PopCon.h:79
void setLogHeaderForRecord(const std::string &recordName, const std::string &provenance, const std::string &usertext)
cond::persistency::Session initialize()
Definition: PopCon.cc:36
const std::string displayIovHelper(Container const &payloads)
Definition: PopCon.h:105
edm::AssociationVector< reco::JetRefBaseProd, Values > Container
static std::string const source
Definition: EdmProvDump.cc:43
edm::Service< cond::service::PoolDBOutputService > m_dbService
Definition: PopCon.h:59
bool m_LoggingOn
Definition: PopCon.h:73
template<typename T >
void popcon::PopCon::writeOne ( T payload,
Time_t  time 
)

Definition at line 91 of file PopCon.h.

References m_dbService, m_LoggingOn, m_record, and cond::service::PoolDBOutputService::writeOne().

91  {
92  m_dbService->writeOne(payload, time, m_record, m_LoggingOn);
93  }
std::string m_record
Definition: PopCon.h:69
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
edm::Service< cond::service::PoolDBOutputService > m_dbService
Definition: PopCon.h:59
bool m_LoggingOn
Definition: PopCon.h:73

Member Data Documentation

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

Definition at line 65 of file PopCon.h.

Referenced by initialize().

int popcon::PopCon::m_authSys
private

Definition at line 67 of file PopCon.h.

Referenced by initialize().

bool popcon::PopCon::m_close
private

Definition at line 83 of file PopCon.h.

Referenced by finalize().

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

Definition at line 59 of file PopCon.h.

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

bool popcon::PopCon::m_IsDestDbCheckedInQueryLog
private

Definition at line 75 of file PopCon.h.

Time_t popcon::PopCon::m_lastTill
private

Definition at line 84 of file PopCon.h.

Referenced by finalize().

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

Definition at line 81 of file PopCon.h.

Referenced by initialize(), and write().

bool popcon::PopCon::m_LoggingOn
private

Definition at line 73 of file PopCon.h.

Referenced by write(), and writeOne().

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

Definition at line 71 of file PopCon.h.

Referenced by initialize().

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

Definition at line 69 of file PopCon.h.

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

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

Definition at line 77 of file PopCon.h.

Referenced by initialize().

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

Definition at line 79 of file PopCon.h.

Referenced by initialize(), and write().

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

Definition at line 63 of file PopCon.h.

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

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

Definition at line 61 of file PopCon.h.

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