CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

popcon::SiStripPopConDbObjHandler< T, U > Class Template Reference

#include <SiStripPopConDbObjHandler.h>

Inheritance diagram for popcon::SiStripPopConDbObjHandler< T, U >:
popcon::PopConSourceHandler< T >

List of all members.

Public Member Functions

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

Private Member Functions

std::string getDataType ()
bool isTransferNeeded ()
void setForTransfer ()

Private Attributes

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

Detailed Description

template<typename T, typename U>
class popcon::SiStripPopConDbObjHandler< T, U >

Definition at line 21 of file SiStripPopConDbObjHandler.h.


Constructor & Destructor Documentation

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

Definition at line 24 of file SiStripPopConDbObjHandler.h.

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

Definition at line 31 of file SiStripPopConDbObjHandler.h.

{}; 

Member Function Documentation

template<typename T , typename U >
std::string popcon::SiStripPopConDbObjHandler< T, U >::getDataType ( ) [inline, private]

Definition at line 87 of file SiStripPopConDbObjHandler.h.

References mergeVDriftHistosByStation::name.

{return typeid(T).name();}
template<typename T , typename U >
void popcon::SiStripPopConDbObjHandler< T, U >::getNewObjects ( ) [inline, virtual]

Implements popcon::PopConSourceHandler< T >.

Definition at line 35 of file SiStripPopConDbObjHandler.h.

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

                        {
      edm::LogInfo   ("SiStripPopConDbObjHandler") << "[SiStripPopConDbObjHandler::getNewObjects] for PopCon application " << m_name;
     
      if (m_debugMode){
        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   ("SiStripPopConDbObjHandler") << ss.str();
      }
      
      condObjBuilder->initialize(); 
      
      if (isTransferNeeded())
        setForTransfer();
  
      edm::LogInfo   ("SiStripPopConDbObjHandler") << "[SiStripPopConDbObjHandler::getNewObjects] for PopCon application " << m_name << " Done\n--------------\n";
    }
template<typename T , typename U >
std::string popcon::SiStripPopConDbObjHandler< T, U >::id ( void  ) const [inline, virtual]
template<typename T , typename U >
bool popcon::SiStripPopConDbObjHandler< T, U >::isTransferNeeded ( ) [inline, private]

Definition at line 93 of file SiStripPopConDbObjHandler.h.

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

Referenced by popcon::SiStripPopConDbObjHandler< T, U >::getNewObjects().

                           {

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

      if(m_since<=this->tagInfo().lastInterval.first){
        edm::LogInfo   ("SiStripPopConDbObjHandler") 
          << "[SiStripPopConDbObjHandler::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(condObjBuilder->checkForCompatibility(ss_logdb.str())){
        
        this->m_userTextLog = "@ " + ss.str();
        
        edm::LogInfo   ("SiStripPopConDbObjHandler") 
          << "[SiStripPopConDbObjHandler::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 {
        edm::LogInfo   ("SiStripPopConDbObjHandler") 
          << "[SiStripPopConDbObjHandler::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;
      } 
    }
template<typename T , typename U >
void popcon::SiStripPopConDbObjHandler< T, U >::setForTransfer ( ) [inline, private]

Definition at line 138 of file SiStripPopConDbObjHandler.h.

References popcon::SiStripPopConDbObjHandler< T, U >::condObjBuilder, cond::TagInfo::lastInterval, popcon::SiStripPopConDbObjHandler< T, U >::m_debugMode, popcon::SiStripPopConDbObjHandler< T, U >::m_name, popcon::SiStripPopConDbObjHandler< T, U >::m_since, popcon::PopConSourceHandler< T >::m_to_transfer, mergeVDriftHistosByStation::name, VarParsing::obj, findQualityFiles::size, and popcon::PopConSourceHandler< T >::tagInfo().

Referenced by popcon::SiStripPopConDbObjHandler< T, U >::getNewObjects().

                         {
      edm::LogInfo   ("SiStripPopConDbObjHandler") << "[SiStripPopConDbObjHandler::setForTransfer] " << m_name << " getting data to be transferred "  << std::endl;
      
      T *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   ("SiStripPopConDbObjHandler") <<"setting since = "<< m_since <<std::endl;
        this->m_to_transfer.push_back(std::make_pair(obj,m_since));
      }else{
        edm::LogError   ("SiStripPopConDbObjHandler") <<"[SiStripPopConDbObjHandler::setForTransfer] " << m_name << "  : NULL pointer of obj " << typeid(T).name() << " reported by SiStripCondObjBuilderFromDb\n Transfer aborted"<<std::endl;
      }
    }

Member Data Documentation

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