CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

popcon::DQMHistoryPopConHandler< U > Class Template Reference

#include <DQMHistoryPopConHandler.h>

Inheritance diagram for popcon::DQMHistoryPopConHandler< U >:
popcon::PopConSourceHandler< HDQMSummary >

List of all members.

Public Member Functions

 DQMHistoryPopConHandler (const edm::ParameterSet &pset)
void getNewObjects ()
std::string id () const
 ~DQMHistoryPopConHandler ()

Private Member Functions

bool isTransferNeeded ()
void setForTransfer ()

Private Attributes

edm::Service< U > condObjBuilder
bool m_debugMode
bool m_iovSequence
std::string m_name
unsigned long long m_since

Detailed Description

template<typename U>
class popcon::DQMHistoryPopConHandler< U >

Definition at line 22 of file DQMHistoryPopConHandler.h.


Constructor & Destructor Documentation

template<typename U >
popcon::DQMHistoryPopConHandler< U >::DQMHistoryPopConHandler ( const edm::ParameterSet pset) [inline]

Definition at line 25 of file DQMHistoryPopConHandler.h.

                                                        :
      m_name(pset.getUntrackedParameter<std::string>("name","DQMHistoryPopConHandler")),
      m_since(pset.getUntrackedParameter<uint32_t>("since",5)),
      m_debugMode(pset.getUntrackedParameter<bool>("debug",false)),
      m_iovSequence(pset.getUntrackedParameter<bool>("iovSequence",false)){}; 
template<typename U >
popcon::DQMHistoryPopConHandler< U >::~DQMHistoryPopConHandler ( ) [inline]

Definition at line 33 of file DQMHistoryPopConHandler.h.

{}; 

Member Function Documentation

template<typename U >
void popcon::DQMHistoryPopConHandler< U >::getNewObjects ( ) [inline, virtual]

Implements popcon::PopConSourceHandler< HDQMSummary >.

Definition at line 37 of file DQMHistoryPopConHandler.h.

References popcon::DQMHistoryPopConHandler< U >::condObjBuilder, cond::LogDBEntry::destinationDB, cond::LogDBEntry::execmessage, cond::LogDBEntry::exectime, cond::LogDBEntry::iovtag, cond::LogDBEntry::iovtimetype, popcon::DQMHistoryPopConHandler< U >::isTransferNeeded(), cond::TagInfo::lastInterval, cond::TagInfo::lastPayloadToken, popcon::PopConSourceHandler< HDQMSummary >::logDBEntry(), cond::LogDBEntry::logId, popcon::DQMHistoryPopConHandler< U >::m_name, cond::TagInfo::name, cond::LogDBEntry::payloadClass, cond::LogDBEntry::payloadIdx, cond::LogDBEntry::payloadToken, cond::LogDBEntry::provenance, popcon::DQMHistoryPopConHandler< U >::setForTransfer(), findQualityFiles::size, cond::TagInfo::size, popcon::PopConSourceHandler< HDQMSummary >::tagInfo(), cond::TagInfo::token, cond::LogDBEntry::usertext, and popcon::PopConSourceHandler< HDQMSummary >::userTextLog().

                        {
      edm::LogInfo   ("DQMHistoryPopConHandler") << "[DQMHistoryPopConHandler::getNewObjects] for PopCon application " << m_name;
     
        std::stringstream ss;
        ss << "\n\n------- " << m_name 
           << " - > getNewObjects\n"; 
        if (this->tagInfo().size){
          //check whats already inside of database
          ss << "\ngot offlineInfo"<< this->tagInfo().name 
             << "\n size " << this->tagInfo().size 
             << "\n" << this->tagInfo().token 
             << "\n last object valid since " << this->tagInfo().lastInterval.first 
             << "\n token " << this->tagInfo().lastPayloadToken 
             << "\n UserText " << this->userTextLog()
             << "\n LogDBEntry \n" 
             << this->logDBEntry().logId<< "\n"
             << this->logDBEntry().destinationDB<< "\n"   
             << this->logDBEntry().provenance<< "\n"
             << this->logDBEntry().usertext<< "\n"
             << this->logDBEntry().iovtag<< "\n"
             << this->logDBEntry().iovtimetype<< "\n"
             << this->logDBEntry().payloadIdx<< "\n"
             << this->logDBEntry().payloadClass<< "\n"
             << this->logDBEntry().payloadToken<< "\n"
             << this->logDBEntry().exectime<< "\n"
             << this->logDBEntry().execmessage<< "\n";
          if(this->logDBEntry().usertext!="")
            ss<< "\n-- user text " << this->logDBEntry().usertext.substr(this->logDBEntry().usertext.find_last_of("@")) ;
          
        } else {
          ss << " First object for this tag ";
        }
        edm::LogInfo   ("DQMHistoryPopConHandler") << ss.str();
/*       if (m_debugMode){ */
/*       } */
      
      condObjBuilder->initialize(); 
      
      if (isTransferNeeded())
        setForTransfer();

      edm::LogInfo   ("DQMHistoryPopConHandler") << "[DQMHistoryPopConHandler::getNewObjects] for PopCon application " << m_name << " Done\n--------------\n";
    }
template<typename U >
std::string popcon::DQMHistoryPopConHandler< U >::id ( void  ) const [inline, virtual]
template<typename U >
bool popcon::DQMHistoryPopConHandler< U >::isTransferNeeded ( ) [inline, private]

Definition at line 91 of file DQMHistoryPopConHandler.h.

References popcon::DQMHistoryPopConHandler< U >::condObjBuilder, cond::LogDBEntry::destinationDB, cond::TagInfo::lastInterval, popcon::PopConSourceHandler< HDQMSummary >::logDBEntry(), popcon::DQMHistoryPopConHandler< U >::m_iovSequence, popcon::DQMHistoryPopConHandler< U >::m_since, popcon::PopConSourceHandler< HDQMSummary >::m_userTextLog, cond::LogDBEntry::payloadClass, popcon::PopConSourceHandler< HDQMSummary >::tagInfo(), and cond::LogDBEntry::usertext.

Referenced by popcon::DQMHistoryPopConHandler< U >::getNewObjects().

                           {

      edm::LogInfo   ("DQMHistoryPopConHandler") << "[DQMHistoryPopConHandler::isTransferNeeded] checking for transfer " << std::endl;

      if(m_iovSequence && m_since<=this->tagInfo().lastInterval.first){
        edm::LogInfo   ("DQMHistoryPopConHandler") 
          << "[DQMHistoryPopConHandler::isTransferNeeded] \nthe current starting iov " << m_since
          << "\nis not compatible with the last iov ("  
          << this->tagInfo().lastInterval.first << ") open for the object " 
          << this->logDBEntry().payloadClass << " \nin the db " 
          << this->logDBEntry().destinationDB << " \n NO TRANSFER NEEDED";
        return false;
      }
      
      std::stringstream ss_logdb, ss;
      
      //get log information from previous upload
      if (this->logDBEntry().usertext!="")
      ss_logdb << this->logDBEntry().usertext.substr(this->logDBEntry().usertext.find_last_of("@")+2);


      condObjBuilder->getMetaDataString(ss);
     if ((m_iovSequence && condObjBuilder->checkForCompatibility(ss_logdb.str())) || !m_iovSequence){
        
        this->m_userTextLog = "@ " + ss.str();
        
        edm::LogInfo   ("DQMHistoryPopConHandler") 
          << "[DQMHistoryPopConHandler::isTransferNeeded] \nthe selected conditions will be uploaded: " << ss.str()
          << "\n Current MetaData - "<< ss.str()  << "\n Last Uploaded MetaData- " << ss_logdb.str() << "\n Fine";

        return true;
     } else if (m_iovSequence && !condObjBuilder->checkForCompatibility(ss_logdb.str())) {
       edm::LogInfo   ("DQMHistoryPopConHandler") 
         << "[DQMHistoryPopConHandler::isTransferNeeded] \nthe current MetaData conditions " << ss.str() 
         << "\nare not compatible with the MetaData Conditions of the last iov ("  
         << this->tagInfo().lastInterval.first << ") open for the object " 
         << this->logDBEntry().payloadClass << " \nin the db " 
         << this->logDBEntry().destinationDB << " \nConditions: "  << ss_logdb.str() << "\n NO TRANSFER NEEDED";
       return false;
     }
     return false;
    }
template<typename U >
void popcon::DQMHistoryPopConHandler< U >::setForTransfer ( ) [inline, private]

Definition at line 137 of file DQMHistoryPopConHandler.h.

References popcon::DQMHistoryPopConHandler< U >::condObjBuilder, cond::TagInfo::lastInterval, popcon::DQMHistoryPopConHandler< U >::m_debugMode, popcon::DQMHistoryPopConHandler< U >::m_name, popcon::DQMHistoryPopConHandler< U >::m_since, popcon::PopConSourceHandler< HDQMSummary >::m_to_transfer, getGTfromDQMFile::obj, findQualityFiles::size, and popcon::PopConSourceHandler< HDQMSummary >::tagInfo().

Referenced by popcon::DQMHistoryPopConHandler< U >::getNewObjects().

                         {
      edm::LogInfo   ("DQMHistoryPopConHandler") << "[DQMHistoryPopConHandler::setForTransfer] " << m_name << " getting data to be transferred "  << std::endl;
      
      HDQMSummary *obj=0; 
      condObjBuilder->getObj(obj);
 
      if(!this->tagInfo().size)
        m_since=1;
      else
        if (m_debugMode)
          m_since=this->tagInfo().lastInterval.first+1; 

      if (obj!=0){

        edm::LogInfo   ("DQMHistoryPopConHandler") <<"setting since = "<< m_since <<std::endl;
        this->m_to_transfer.push_back(std::make_pair(obj,m_since));
      }else{
        edm::LogError   ("DQMHistoryPopConHandler") <<"[DQMHistoryPopConHandler::setForTransfer] " << m_name << "  : NULL pointer of obj HDQMSummary  reported by SiStripCondObjBuilderFromDb\n Transfer aborted"<<std::endl;
      }
    }

Member Data Documentation

template<typename U >
edm::Service<U> popcon::DQMHistoryPopConHandler< U >::condObjBuilder [private]
template<typename U >
bool popcon::DQMHistoryPopConHandler< U >::m_debugMode [private]
template<typename U >
bool popcon::DQMHistoryPopConHandler< U >::m_iovSequence [private]
template<typename U >
std::string popcon::DQMHistoryPopConHandler< U >::m_name [private]
template<typename U >
unsigned long long popcon::DQMHistoryPopConHandler< U >::m_since [private]