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)
 
void initialize ()
 

Private Attributes

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
 

Detailed Description

Definition at line 35 of file PopCon.h.

Member Typedef Documentation

Definition at line 37 of file PopCon.h.

Constructor & Destructor Documentation

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

Definition at line 9 of file PopCon.cc.

9  :
10  m_record(pset.getParameter<std::string> ("record")),
12  m_LoggingOn(pset.getUntrackedParameter< bool > ("loggingOn",true)),
13  m_IsDestDbCheckedInQueryLog(pset.getUntrackedParameter< bool > ("IsDestDbCheckedInQueryLog",true)),
14  m_close(pset.getUntrackedParameter< bool > ("closeIOV",false)),
15  m_lastTill(pset.getUntrackedParameter< bool > ("lastTill",0))
16  {
17  //TODO set the policy (cfg or global configuration?)
18  //Policy if corrupted data found
19 
20  edm::LogInfo ("PopCon") << "This is PopCon (Populator of Condition) V4.0\n"
21  << "Please report any problem and feature request through the savannah portal under the category conditions\n" ;
22 
23  }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
Time_t m_lastTill
Definition: PopCon.h:77
bool m_close
Definition: PopCon.h:76
std::string m_record
Definition: PopCon.h:62
bool m_IsDestDbCheckedInQueryLog
Definition: PopCon.h:68
std::string m_payload_name
Definition: PopCon.h:64
bool m_LoggingOn
Definition: PopCon.h:66
popcon::PopCon::~PopCon ( )
virtual

Definition at line 25 of file PopCon.cc.

25 {}

Member Function Documentation

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

Definition at line 62 of file PopCon.cc.

References cond::service::PoolDBOutputService::closeIOV(), m_close, m_dbService, m_lastTill, and m_record.

Referenced by write().

62  {
63 
64  if (m_close) {
65  // avoid to close it before lastSince
66  if (m_lastTill>lastTill) lastTill=m_lastTill;
67  m_dbService->closeIOV(lastTill,m_record);
68  }
69  }
void closeIOV(Time_t lastTill, const std::string &recordName, bool withlogging=false)
Time_t m_lastTill
Definition: PopCon.h:77
bool m_close
Definition: PopCon.h:76
std::string m_record
Definition: PopCon.h:62
edm::Service< cond::service::PoolDBOutputService > m_dbService
Definition: PopCon.h:60
void popcon::PopCon::initialize ( )
private

m_dbService->queryLog().LookupLastEntryByTag(m_tag, m_logDBEntry); if(m_IsDestDbCheckedInQueryLog) { m_dbService->queryLog().LookupLastEntryByTag(m_tag, connectionStr , m_logDBEntry); std::cout << " ------ log info searched in the same db: " << connectionStr << "------" <<std::endl; } else { m_dbService->queryLog().LookupLastEntryByTag(m_tag , m_logDBEntry); std::cout << " ------ log info found in another db " << "------" <<std::endl; }

Definition at line 28 of file PopCon.cc.

References cond::persistency::Session::connectionString(), edm::hlt::Exception, edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), cond::TagInfo_t::lastInterval, m_dbService, m_payload_name, m_record, m_tag, m_tagInfo, cond::TagInfo_t::name, cond::service::PoolDBOutputService::session(), cond::TagInfo_t::size, AlCaHLTBitMon_QueryRunRegistry::string, cond::service::PoolDBOutputService::tag(), and cond::service::PoolDBOutputService::tagInfo().

Referenced by write().

28  {
29  edm::LogInfo ("PopCon")<<"payload name "<<m_payload_name<<std::endl;
30  if(!m_dbService.isAvailable() ) throw Exception("DBService not available");
31  const std::string & connectionStr = m_dbService->session().connectionString();
47  edm::LogInfo ("PopCon") << "DB: " << connectionStr << "\n"
48  << "TAG: " << m_tag
49  << ", last since/till: " << m_tagInfo.lastInterval.first
50  << "/" << m_tagInfo.lastInterval.second
51  << ", , size: " << m_tagInfo.size << "\n" ;
52  //<< "Last writer: " << m_logDBEntry.provenance
53  // << ", size: " << m_logDBEntry.payloadIdx+1 << std::endl;
54  } else {
55  edm::LogInfo ("PopCon") << "DB: " << connectionStr << "\n"
56  << "TAG: " << m_tag
57  << "; First writer to this new tag." << std::endl;
58  }
59  }
cond::persistency::Session session() const
size_t size
Definition: Types.h:67
std::string m_tag
Definition: PopCon.h:70
std::string m_record
Definition: PopCon.h:62
std::string tag(const std::string &recordName)
std::string name
Definition: Types.h:63
cond::ValidityInterval lastInterval
Definition: Types.h:65
bool isNewTagRequest(const std::string &recordName)
bool isAvailable() const
Definition: Service.h:46
cond::TagInfo_t m_tagInfo
Definition: PopCon.h:72
std::string connectionString()
Definition: Session.cc:186
void tagInfo(const std::string &recordName, cond::TagInfo_t &result)
std::string m_payload_name
Definition: PopCon.h:64
edm::Service< cond::service::PoolDBOutputService > m_dbService
Definition: PopCon.h:60
template<typename Source >
void popcon::PopCon::write ( Source const &  source)

Definition at line 117 of file PopCon.h.

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

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

117  {
118  typedef typename Source::value_type value_type;
119  typedef typename Source::Container Container;
120 
121  initialize();
122  std::pair<Container const *, std::string const> ret = source(m_dbService->session(),
124  Container const & payloads = *ret.first;
125 
126  if(m_LoggingOn)
127  m_dbService->setLogHeaderForRecord(m_record,source.id(),"PopCon v4.0; " +
128  displayIovHelper(payloads) + ret.second);
129  //m_dbService->setLogHeaderForRecord(m_record,source.id(),"PopCon v4.0; " +
130  // cond::userInfo() + displayIovHelper(payloads) + ret.second);
131 
132  displayHelper(payloads);
133 
134  std::for_each(payloads.begin(),payloads.end(),
135  boost::bind(&popcon::PopCon::writeOne<value_type>,this,
136  boost::bind(&Container::value_type::payload,_1),
137  boost::bind(&Container::value_type::time,_1)
138  )
139  );
140 
141 
142  finalize(payloads.empty() ? Time_t(0): payloads.back().time);
143  }
cond::LogDBEntry_t m_logDBEntry
Definition: PopCon.h:74
void finalize(Time_t lastTill)
Definition: PopCon.cc:62
EcalChannelStatus Container
cond::persistency::Session session() const
cond::Time_t Time_t
Definition: PopCon.h:37
std::string m_record
Definition: PopCon.h:62
void displayHelper(Container const &payloads)
Definition: PopCon.h:90
cond::TagInfo_t m_tagInfo
Definition: PopCon.h:72
Container::value_type value_type
void setLogHeaderForRecord(const std::string &recordName, const std::string &provenance, const std::string &usertext)
void initialize()
Definition: PopCon.cc:28
const std::string displayIovHelper(Container const &payloads)
Definition: PopCon.h:98
static std::string const source
Definition: EdmProvDump.cc:43
edm::Service< cond::service::PoolDBOutputService > m_dbService
Definition: PopCon.h:60
bool m_LoggingOn
Definition: PopCon.h:66
template<typename T >
void popcon::PopCon::writeOne ( T payload,
Time_t  time 
)

Definition at line 84 of file PopCon.h.

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

84  {
86  }
std::string m_record
Definition: PopCon.h:62
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
edm::Service< cond::service::PoolDBOutputService > m_dbService
Definition: PopCon.h:60
bool m_LoggingOn
Definition: PopCon.h:66

Member Data Documentation

bool popcon::PopCon::m_close
private

Definition at line 76 of file PopCon.h.

Referenced by finalize().

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

Definition at line 60 of file PopCon.h.

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

bool popcon::PopCon::m_IsDestDbCheckedInQueryLog
private

Definition at line 68 of file PopCon.h.

Time_t popcon::PopCon::m_lastTill
private

Definition at line 77 of file PopCon.h.

Referenced by finalize().

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

Definition at line 74 of file PopCon.h.

Referenced by write().

bool popcon::PopCon::m_LoggingOn
private

Definition at line 66 of file PopCon.h.

Referenced by write(), and writeOne().

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

Definition at line 64 of file PopCon.h.

Referenced by initialize().

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

Definition at line 62 of file PopCon.h.

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

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

Definition at line 70 of file PopCon.h.

Referenced by initialize().

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

Definition at line 72 of file PopCon.h.

Referenced by initialize(), and write().