CMS 3D CMS Logo

Public Member Functions | Private Attributes

popcon::SiStripPopConConfigDbObjHandler< T > Class Template Reference

#include <SiStripPopConConfigDbObjHandler.h>

Inheritance diagram for popcon::SiStripPopConConfigDbObjHandler< T >:
popcon::PopConSourceHandler< T >

List of all members.

Public Member Functions

void getNewObjects ()
std::string id () const
bool isTransferNeeded ()
void setForTransfer ()
 SiStripPopConConfigDbObjHandler (const edm::ParameterSet &pset)
 ~SiStripPopConConfigDbObjHandler ()

Private Attributes

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

Detailed Description

template<typename T>
class popcon::SiStripPopConConfigDbObjHandler< T >

Definition at line 27 of file SiStripPopConConfigDbObjHandler.h.


Constructor & Destructor Documentation

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

Definition at line 32 of file SiStripPopConConfigDbObjHandler.h.

                                                                :
      m_name(pset.getUntrackedParameter<std::string>("name","SiStripPopPopConConfigDbObjHandler")),
      m_since(pset.getUntrackedParameter<uint32_t>("since",5)),
      m_debugMode(pset.getUntrackedParameter<bool>("debug",false)){}; 

Definition at line 39 of file SiStripPopConConfigDbObjHandler.h.

{}; 

Member Function Documentation

template<typename T >
void popcon::SiStripPopConConfigDbObjHandler< T >::getNewObjects ( ) [inline, virtual]

Implements popcon::PopConSourceHandler< T >.

Definition at line 43 of file SiStripPopConConfigDbObjHandler.h.

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

                        {
      edm::LogInfo   ("SiStripPopPopConConfigDbObjHandler") << "[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 << "got offlineInfo"<<
            this->tagInfo().name << ", size " << this->tagInfo().size << " " << this->tagInfo().token 
             << " , last object valid since " 
             << this->tagInfo().lastInterval.first << " token "   
             << this->tagInfo().lastPayloadToken << "\n\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().payloadName<< "\n"
             << this->logDBEntry().payloadToken<< "\n"
             << this->logDBEntry().payloadContainer<< "\n"
             << this->logDBEntry().exectime<< "\n"
             << this->logDBEntry().execmessage<< "\n"
             << "\n\n-- user text " << this->logDBEntry().usertext.substr(this->logDBEntry().usertext.find_last_of("@")) ;
        } else {
          ss << " First object for this tag ";
        }
        edm::LogInfo   ("SiStripPopPopConConfigDbObjHandler") << ss.str();
      }
      if (isTransferNeeded())
        setForTransfer();
  
      edm::LogInfo   ("SiStripPopPopConConfigDbObjHandler") << "[getNewObjects] for PopCon application " << m_name << " Done\n--------------\n";
    }
template<typename T >
std::string popcon::SiStripPopConConfigDbObjHandler< T >::id ( void  ) const [inline, virtual]
template<typename T >
bool popcon::SiStripPopConConfigDbObjHandler< T >::isTransferNeeded ( ) [inline]

Definition at line 89 of file SiStripPopConConfigDbObjHandler.h.

References popcon::SiStripPopConConfigDbObjHandler< T >::condObjBuilder, cond::LogDBEntry::destinationDB, label, cond::TagInfo::lastInterval, popcon::PopConSourceHandler< T >::logDBEntry(), popcon::PopConSourceHandler< T >::m_userTextLog, AlCaRecoCosmics_cfg::name, cond::LogDBEntry::payloadName, popcon::PopConSourceHandler< T >::tagInfo(), and cond::LogDBEntry::usertext.

Referenced by popcon::SiStripPopConConfigDbObjHandler< T >::getNewObjects().

                           {


      edm::LogInfo   ("SiStripPopPopConConfigDbObjHandler") << "[isTransferNeeded] checking for transfer: " << typeid(T).name()  <<   std::endl;
      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_first_of("@"));
      else
        ss_logdb << "";

      std::string label="";
      if(typeid(T)==typeid(SiStripFedCabling))
        label="Cabling";

      if(typeid(T)==typeid(SiStripApvGain))
        label="ApvTiming";
      
      if(typeid(T)==typeid(SiStripLatency))
        label="ApvLatency";

      if(!condObjBuilder->checkForCompatibility(ss_logdb,ss,label)){
        //string are equal, no need to do transfer
        edm::LogInfo   ("SiStripPopPopConConfigDbObjHandler") 
          << "[isTransferNeeded] the selected conditions are already uploaded in the last iov ("  
          << this->tagInfo().lastInterval.first << ") open for the object " 
          << this->logDBEntry().payloadName << " in the db " 
          << this->logDBEntry().destinationDB << " parameters: "  << ss_logdb.str() << "\n NO TRANSFER NEEDED";
        return false;
      }
      
      this->m_userTextLog = ss.str();
      edm::LogInfo   ("SiStripPopPopConConfigDbObjHandler") 
        << "[isTransferNeeded] the selected conditions will be uploaded: " << ss.str() 
        << "\n Going to Upload: "<< ss.str()  << "\n Last Upload: " << ss_logdb.str() << "\n Fine";

      return true;
    }
template<typename T >
void popcon::SiStripPopConConfigDbObjHandler< T >::setForTransfer ( ) [inline]

Definition at line 132 of file SiStripPopConConfigDbObjHandler.h.

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

Referenced by popcon::SiStripPopConConfigDbObjHandler< T >::getNewObjects().

                         {
      edm::LogInfo   ("SiStripPopPopConConfigDbObjHandler") << "[setForTransfer] " << m_name << " getting data to be transferred "  << std::endl;
      
      T *obj=0; 
      condObjBuilder->getValue(obj);

      edm::LogInfo   ("SiStripPopPopConConfigDbObjHandler") << "[setForTransfer] " << m_name << " got data to be transferred from condObjBuilder "  << std::endl;

      if(!this->tagInfo().size)
        m_since=1;
      else
        if (m_debugMode)
          m_since=this->tagInfo().lastInterval.first+1; 
      edm::LogInfo   ("SiStripPopPopConConfigDbObjHandler") <<"[setForTransfer] setting since = "<< m_since <<std::endl;

      if (obj!=0){

        edm::LogInfo   ("SiStripPopPopConConfigDbObjHandler") <<"[setForTransfer] filling map m_to_transfer" <<std::endl;
        this->m_to_transfer.push_back(std::make_pair(obj,m_since));
      }else{
        edm::LogError   ("SiStripPopPopConConfigDbObjHandler") <<"[setForTransfer] " << m_name << "  : NULL pointer of obj " << typeid(T).name() << " reported by SiStripCondObjBuilderFromDb\n Transfer aborted"<<std::endl;
      }
    }

Member Data Documentation

template<typename T >
bool popcon::SiStripPopConConfigDbObjHandler< T >::m_debugMode [private]
template<typename T >
std::string popcon::SiStripPopConConfigDbObjHandler< T >::m_name [private]
template<typename T >
unsigned long long popcon::SiStripPopConConfigDbObjHandler< T >::m_since [private]