CMS 3D CMS Logo

Public Types | Public Member Functions | Private Member Functions | Private Attributes

popcon::PopCon Class Reference

#include <PopCon.h>

List of all members.

Public Types

typedef cond::Summary Summary
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 m_logDBEntry
bool m_LoggingOn
std::string m_payload_name
std::string m_record
std::string m_tag
cond::TagInfo m_tagInfo

Detailed Description

Definition at line 43 of file PopCon.h.


Member Typedef Documentation

Definition at line 46 of file PopCon.h.

Definition at line 45 of file PopCon.h.


Constructor & Destructor Documentation

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

Definition at line 9 of file PopCon.cc.

                                           :
    m_record(pset.getParameter<std::string> ("record")),
    m_payload_name(pset.getUntrackedParameter<std::string> ("name","")),
    m_LoggingOn(pset.getUntrackedParameter< bool > ("loggingOn",true)),
    m_IsDestDbCheckedInQueryLog(pset.getUntrackedParameter< bool > ("IsDestDbCheckedInQueryLog",true)),
    m_close(pset.getUntrackedParameter< bool > ("closeIOV",false)),
    m_lastTill(pset.getUntrackedParameter< bool > ("lastTill",0))
    {
      //TODO set the policy (cfg or global configuration?)
      //Policy if corrupted data found
      
      edm::LogInfo ("PopCon") << "This is PopCon (Populator of Condition) V4.0\n"
                              << "Please report any problem and feature request through the savannah portal under the category conditions\n" ; 

    }
popcon::PopCon::~PopCon ( ) [virtual]

Definition at line 25 of file PopCon.cc.

{}

Member Function Documentation

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

Definition at line 60 of file PopCon.cc.

References m_close, m_dbService, m_lastTill, and m_record.

Referenced by write().

                                       {
    
    if (m_close) {
      // avoid to close it before lastSince
      if (m_lastTill>lastTill) lastTill=m_lastTill;
      m_dbService->closeIOV(lastTill,m_record);
    }
  }
void popcon::PopCon::initialize ( ) [private]

Definition at line 28 of file PopCon.cc.

References gather_cfg::cout, Exception, edm::Service< T >::isAvailable(), cond::TagInfo::lastInterval, m_dbService, m_IsDestDbCheckedInQueryLog, m_logDBEntry, m_payload_name, m_record, m_tag, m_tagInfo, cond::TagInfo::name, cond::LogDBEntry::payloadIdx, cond::LogDBEntry::provenance, and cond::TagInfo::size.

Referenced by write().

                          {     
    edm::LogInfo ("PopCon")<<"payload name "<<m_payload_name<<std::endl;
    if(!m_dbService.isAvailable() ) throw Exception("DBService not available");
    const std::string & connectionStr = m_dbService->session().connectionString();
    m_tag = m_dbService->tag(m_record);
    m_tagInfo.name = m_tag;
    if( !m_dbService->isNewTagRequest(m_record) ) {
      m_dbService->tagInfo(m_record,m_tagInfo);
      // 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;
      }

      edm::LogInfo ("PopCon") << "DB: " << connectionStr << "\n"
                              << "TAG: " << m_tag 
                              << ", last since/till: " <<  m_tagInfo.lastInterval.first
                              << "/" << m_tagInfo.lastInterval.second
                              << ", , size: " << m_tagInfo.size << "\n" 
                              << "Last writer: " <<  m_logDBEntry.provenance 
                              << ", size: " << m_logDBEntry.payloadIdx+1 << std::endl;
    } else {
      edm::LogInfo ("PopCon") << "DB: " << connectionStr << "\n"
                              << "TAG: " << m_tag 
                              << "; First writer to this new tag." << std::endl; 
    }
  }
template<typename Source >
void popcon::PopCon::write ( Source const &  source)

Definition at line 125 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, LaserTracksInput_cfi::source, cond::rpcobgas::time, and cond::userInfo().

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

                                          {
    typedef typename Source::value_type value_type;
    typedef typename Source::Container Container;
    
    initialize();
    std::pair<Container const *, std::string const> ret = source(m_dbService->session(),
                                                                 m_tagInfo,m_logDBEntry); 
    Container const & payloads = *ret.first;
    
    if(m_LoggingOn)
      m_dbService->setLogHeaderForRecord(m_record,source.id(),"PopCon v4.0; " + 
                                         cond::userInfo() + displayIovHelper(payloads) +  ret.second);
    
    displayHelper(payloads);
    
    std::for_each(payloads.begin(),payloads.end(),
                  boost::bind(&popcon::PopCon::writeOne<value_type>,this,
                              boost::bind(&Container::value_type::payload,_1),
                              boost::bind(&Container::value_type::time,_1)
                              )
                   );
    
    
    finalize(payloads.empty() ? Time_t(0): payloads.back().time);
  }
template<typename T >
void popcon::PopCon::writeOne ( T payload,
Time_t  time 
)

Definition at line 92 of file PopCon.h.

References m_dbService, m_LoggingOn, and m_record.

                                                {
    m_dbService->writeOne(payload, time, m_record, m_LoggingOn);
  }

Member Data Documentation

bool popcon::PopCon::m_close [private]

Definition at line 84 of file PopCon.h.

Referenced by finalize().

Definition at line 68 of file PopCon.h.

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

Definition at line 76 of file PopCon.h.

Referenced by initialize().

Definition at line 85 of file PopCon.h.

Referenced by finalize().

Definition at line 82 of file PopCon.h.

Referenced by initialize(), and write().

Definition at line 74 of file PopCon.h.

Referenced by write(), and writeOne().

std::string popcon::PopCon::m_payload_name [private]

Definition at line 72 of file PopCon.h.

Referenced by initialize().

std::string popcon::PopCon::m_record [private]

Definition at line 70 of file PopCon.h.

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

std::string popcon::PopCon::m_tag [private]

Definition at line 78 of file PopCon.h.

Referenced by initialize().

Definition at line 80 of file PopCon.h.

Referenced by initialize(), and write().