CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

popcon::SiStripDetVOffHandler Class Reference

#include <SiStripDetVOffHandler.h>

Inheritance diagram for popcon::SiStripDetVOffHandler:
popcon::PopConSourceHandler< SiStripDetVOff >

List of all members.

Public Member Functions

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

Private Member Functions

void setForTransfer ()
void setUserTextLog ()

Private Attributes

bool debug_
uint32_t deltaTmin_
uint32_t maxIOVlength_
edm::Service
< SiStripDetVOffBuilder
modHVBuilder
std::string name_
std::vector< std::pair
< SiStripDetVOff
*, cond::Time_t > > 
resultVec

Detailed Description

Definition at line 18 of file SiStripDetVOffHandler.h.


Constructor & Destructor Documentation

popcon::SiStripDetVOffHandler::~SiStripDetVOffHandler ( )

Definition at line 10 of file SiStripDetVOffHandler.cc.

References LogTrace.

                                                    { 
  LogTrace("SiStripDetVOffHandler") << "[SiStripDetVOffHandler::" << __func__ << "] Destructing ...";
}
popcon::SiStripDetVOffHandler::SiStripDetVOffHandler ( const edm::ParameterSet pset)

Definition at line 3 of file SiStripDetVOffHandler.cc.

                                                                               :
  name_(pset.getUntrackedParameter<std::string>("name","SiStripDetVOffHandler")),
  deltaTmin_(pset.getParameter<uint32_t>("DeltaTmin")),
  maxIOVlength_(pset.getParameter<uint32_t>("MaxIOVlength")),
  debug_(pset.getUntrackedParameter<bool>("Debug", false))
{ }

Member Function Documentation

void popcon::SiStripDetVOffHandler::getNewObjects ( ) [virtual]

Implements popcon::PopConSourceHandler< SiStripDetVOff >.

Definition at line 14 of file SiStripDetVOffHandler.cc.

References gather_cfg::cout, findQualityFiles::size, and AlCaHLTBitMon_QueryRunRegistry::string.

{
  std::cout << "[SiStripDetVOffHandler::getNewObjects]" << std::endl;
  
  std::stringstream dbstr;
  dbstr << "\n\n---------------------\n " << name_ 
        << " - > getNewObjects\n"; 
  if (tagInfo().size){
    //check whats already inside of database
    std::string userText("No data");
    size_t splitPoint = logDBEntry().usertext.find_last_of("@");
    if( splitPoint != std::string::npos ) {
      userText = logDBEntry().usertext.substr(splitPoint);
    }
    dbstr << "got offlineInfo" << tagInfo().name << ", size " << tagInfo().size << " " << tagInfo().token 
          << " , last object valid since " 
          << tagInfo().lastInterval.first << " token "   
          << tagInfo().lastPayloadToken << "\n\n UserText " << userTextLog() 
          << "\n LogDBEntry \n" 
          << logDBEntry().logId            << "\n"
          << logDBEntry().destinationDB    << "\n"
          << logDBEntry().provenance       << "\n"
          << logDBEntry().usertext         << "\n"
          << logDBEntry().iovtag           << "\n"
          << logDBEntry().iovtimetype      << "\n"
          << logDBEntry().payloadIdx       << "\n"
          << logDBEntry().payloadClass     << "\n"
          << logDBEntry().payloadToken     << "\n"
          << logDBEntry().exectime         << "\n"
          << logDBEntry().execmessage      << "\n"
          << "\n\n-- user text " << userText;
  } else {
    dbstr << " First object for this tag ";
  }
  dbstr << "\n-------------------------\n";
  edm::LogInfo   ("SiStripDetVOffHandler") << dbstr.str();
  
  // Do the transfer!
  std::cout << "getNewObjects setForTransfer" << std::endl;
  setForTransfer();
  std::cout << "getNewObjects setForTransfer end" << std::endl;
}
std::string popcon::SiStripDetVOffHandler::id ( void  ) const [inline, virtual]

Implements popcon::PopConSourceHandler< SiStripDetVOff >.

Definition at line 24 of file SiStripDetVOffHandler.h.

References name_.

{ return name_;}
void popcon::SiStripDetVOffHandler::setForTransfer ( ) [private]

Definition at line 57 of file SiStripDetVOffHandler.cc.

References gather_cfg::cout, i, and findQualityFiles::size.

                                                 { 
  edm::LogInfo("SiStripDetVOffHandler") << "[SiStripDetVOffHandler::setForTransfer]" << std::endl;

  // retrieve the last object transferred
  if (tagInfo().size ) {
    Ref payload = lastPayload();
    SiStripDetVOff * lastV = new SiStripDetVOff( *payload );
    modHVBuilder->setLastSiStripDetVOff( lastV, tagInfo().lastInterval.first );
  }

  // build the object!
  resultVec.clear();
  modHVBuilder->BuildDetVOffObj();
  resultVec = modHVBuilder->getModulesVOff(deltaTmin_, maxIOVlength_);

  if (!resultVec.empty()){
    // assume by default that transfer is needed
    unsigned int firstPayload = 0;
    
    // check if there is an existing payload and retrieve if there is
    if (tagInfo().size > 0) {
      Ref payload = lastPayload();
      // resultVec does not contain duplicates, so only need to compare payload with resultVec[0]
      SiStripDetVOff * modV = resultVec[0].first;
      if (*modV == *payload) {
        edm::LogInfo("SiStripDetVOffHandler") << "[SiStripDetVOffHandler::setForTransfer] Transfer of first element not required!";
        cout << "[SiStripDetVOffHandler::setForTransfer] Transfer of first element not required!" << endl;
        firstPayload = 1;
      }
      else {
        cout << "[SiStripDetVOffHandler::setForTransfer] Transfer of first element required" << endl;
      }
    } else {     
      edm::LogInfo("SiStripDetVOffHandler") << "[SiStripDetVOffHandler::setForTransfer] No previous payload";
      cout << "[SiStripDetVOffHandler::setForTransfer] No previous payload" << endl;
    }
 
    setUserTextLog();
    
    for (unsigned int i = firstPayload; i < resultVec.size(); i++) {
      this->m_to_transfer.push_back(resultVec[i]);
    }
    
  } else {
    edm::LogError("SiStripDetVOffHandler") << "[SiStripDetVOffHandler::" << __func__ << "] " 
                                           << name_ << "  : NULL pointer reported by SiStripDetVOffBuilder"
                                           << "\n Transfer aborted"<< std::endl;
  }
}
void popcon::SiStripDetVOffHandler::setUserTextLog ( ) [private]

Definition at line 108 of file SiStripDetVOffHandler.cc.

References j, LogTrace, and cond::time::to_boost().

{
  std::stringstream ss;
  ss << "@@@ Number of payloads transferred " << resultVec.size() << "." << std::endl;
  std::vector< std::pair<SiStripDetVOff*,cond::Time_t> >::const_iterator it = resultVec.begin();
  ss << "time \t #LV off \t #HV off" << std::endl;
  for( ; it != resultVec.end(); ++it ) {
    ss << boost::posix_time::to_iso_extended_string( cond::time::to_boost(it->second) );
    ss << "\t\t  " << it->first->getLVoffCounts() << "\t\t  " << it->first->getHVoffCounts() << std::endl;
  }

  if( debug_ ) {
    ss << "PayloadNo/Badmodules/NoAdded/NoRemoved: ";
    std::vector< std::vector<uint32_t> > payloadStats = modHVBuilder->getPayloadStats();
    for (unsigned int j = 0; j < payloadStats.size(); j++) {
      ss << j << "/" << payloadStats[j][0] << "/" << payloadStats[j][1] << "/" << payloadStats[j][2] << "\t ";
    }
  }
  
  this->m_userTextLog = ss.str();
  
  LogTrace("SiStripDetVOffHandler") << "[SiStripDetVOffHandler::setUserTextLog] " << ss.str();
    
 
}

Member Data Documentation

Definition at line 34 of file SiStripDetVOffHandler.h.

Definition at line 32 of file SiStripDetVOffHandler.h.

Definition at line 33 of file SiStripDetVOffHandler.h.

Definition at line 31 of file SiStripDetVOffHandler.h.

std::string popcon::SiStripDetVOffHandler::name_ [private]

Definition at line 29 of file SiStripDetVOffHandler.h.

Referenced by id().

Definition at line 30 of file SiStripDetVOffHandler.h.