CMS 3D CMS Logo

popcon::PopCon Class Reference

#include <CondCore/PopCon/interface/PopCon.h>

List of all members.

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

Private Attributes

edm::Service
< cond::service::PoolDBOutputService
m_dbService
bool m_IsDestDbCheckedInQueryLog
cond::LogDBEntry m_logDBEntry
bool m_LoggingOn
std::string m_payload_name
std::string m_record
bool m_since
std::string m_tag
cond::TagInfo m_tagInfo


Detailed Description

Definition at line 38 of file PopCon.h.


Member Typedef Documentation

typedef cond::Time_t popcon::PopCon::Time_t

Definition at line 40 of file PopCon.h.


Constructor & Destructor Documentation

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

Definition at line 10 of file PopCon.cc.

00010                                            :
00011     m_record(pset.getParameter<std::string> ("record")),
00012     m_payload_name(pset.getUntrackedParameter<std::string> ("name","")),
00013     m_since(pset.getParameter<bool> ("SinceAppendMode")),
00014     m_LoggingOn(pset.getUntrackedParameter< bool > ("loggingOn",true)),
00015     m_IsDestDbCheckedInQueryLog(pset.getUntrackedParameter< bool > ("IsDestDbCheckedInQueryLog","True"))
00016     {
00017     //TODO set the policy (cfg or global configuration?)
00018     //Policy if corrupted data found
00019 
00020       edm::LogInfo ("PopCon") << "This is PopCon (Populator of Condition) V2.00\n"
00021         << "It is still in active developement\n"
00022                           << "We apologise for the verbosity of the output, for the criptic messages, for the limited functionalities and the poor documentation\n"<<
00023     "Please report any problem and feature request through the savannah portal under the category conditions\n" ; 
00024 
00025     }
  

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

Definition at line 27 of file PopCon.cc.

00027 {}


Member Function Documentation

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

Definition at line 56 of file PopCon.cc.

Referenced by write().

00056                         {
00057   }

void popcon::PopCon::initialize (  )  [private]

Definition at line 30 of file PopCon.cc.

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

Referenced by write().

00030                           {     
00031     edm::LogInfo ("PopCon")<<"payload name "<<m_payload_name<<std::endl;
00032     if(!m_dbService.isAvailable() ) throw Exception("DBService not available");
00033     
00034     m_tag = m_dbService->tag(m_record);
00035     if (!m_dbService->isNewTagRequest(m_record) ) {
00036       m_dbService->tagInfo(m_record,m_tagInfo);
00037       // m_dbService->queryLog().LookupLastEntryByTag(m_tag, m_logDBEntry);
00038       if (m_IsDestDbCheckedInQueryLog ) {
00039        const std::string & connectionStr =m_dbService->connection().connectStr();  m_dbService->queryLog().LookupLastEntryByTag(m_tag, connectionStr , m_logDBEntry);
00040        std::cout << " ------ log info searched in the same db: " <<  connectionStr << "------" <<std::endl;
00041       } else {
00042         m_dbService->queryLog().LookupLastEntryByTag(m_tag , m_logDBEntry);
00043         std::cout << " ------ log info found in another db "  << "------" <<std::endl;
00044       }
00045 
00046       edm::LogInfo ("PopCon") << "TAG, last since/till, size " << m_tag 
00047                 << ", " <<  m_tagInfo.lastInterval.first
00048                 << "/" << m_tagInfo.lastInterval.second
00049                               << ", " << m_tagInfo.size << "\n" <<
00050         "Last writer, size " <<  m_logDBEntry.provenance 
00051                               << ", " << m_logDBEntry.payloadIdx+1 << std::endl;
00052     }
00053   }

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

Definition at line 128 of file PopCon.h.

References popcon::displayHelper(), popcon::displayIovHelper(), finalize(), first, initialize(), m_dbService, m_logDBEntry, m_record, m_since, m_tagInfo, edm::second(), and source.

Referenced by HcalGainWidthsPopConAnalyzer::write(), HcalGainsPopConAnalyzer::write(), popcon::PopConAnalyzer< HcalPedestalWidthsHandler >::write(), HcalRespCorrsPopConAnalyzer::write(), HcalPedestalWidthsPopConAnalyzer::write(), HcalElectronicsMapPopConAnalyzer::write(), HcalPedestalsPopConAnalyzer::write(), HcalChannelQualityPopConAnalyzer::write(), HcalZSThresholdsPopConAnalyzer::write(), and HcalQIEDataPopConAnalyzer::write().

00128                                               {
00129       typedef typename Source::value_type value_type;
00130       typedef typename Source::Container Container;
00131       
00132       initialize();
00133       std::pair<Container const *, std::string const> ret = source(&m_dbService->connection(),
00134                                                                    m_tagInfo,m_logDBEntry); 
00135      Container const & payloads = *ret.first;
00136      m_dbService->setLogHeaderForRecord(m_record,source.id(),"PopCon v2.1; " + displayIovHelper(payloads,m_since ) +  ret.second);
00137      
00138      
00139      displayHelper(payloads,m_since);
00140      std::for_each(payloads.begin(),payloads.end(),
00141                     boost::bind(&popcon::PopCon::writeOne<value_type>,this,
00142                                 boost::bind(&Container::value_type::first,_1),
00143                                 boost::bind(&Container::value_type::second,_1)
00144                                 )
00145                     );
00146      
00147      
00148       finalize();
00149     }

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

Definition at line 87 of file PopCon.h.

References m_dbService, m_LoggingOn, m_record, and m_since.

00087                                                 {
00088     m_dbService->writeOne(payload, time, m_record, m_LoggingOn, m_since);
00089   }


Member Data Documentation

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

Definition at line 61 of file PopCon.h.

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

bool popcon::PopCon::m_IsDestDbCheckedInQueryLog [private]

Definition at line 71 of file PopCon.h.

Referenced by initialize().

cond::LogDBEntry popcon::PopCon::m_logDBEntry [private]

Definition at line 77 of file PopCon.h.

Referenced by initialize(), and write().

bool popcon::PopCon::m_LoggingOn [private]

Definition at line 69 of file PopCon.h.

Referenced by writeOne().

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

Definition at line 65 of file PopCon.h.

Referenced by initialize().

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

Definition at line 63 of file PopCon.h.

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

bool popcon::PopCon::m_since [private]

Definition at line 67 of file PopCon.h.

Referenced by write(), and writeOne().

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

Definition at line 73 of file PopCon.h.

Referenced by initialize().

cond::TagInfo popcon::PopCon::m_tagInfo [private]

Definition at line 75 of file PopCon.h.

Referenced by initialize(), and write().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:50:31 2009 for CMSSW by  doxygen 1.5.4