CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_2_9_HLT1_bphpatch4/src/CondTools/DQM/src/DQMXMLFileSourceHandler.cc

Go to the documentation of this file.
00001 #include "CondTools/DQM/interface/DQMXMLFileSourceHandler.h"
00002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00003 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00004 #include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
00005 #include <iostream>
00006 #include <sstream>
00007 #include <vector>
00008 
00009 namespace popcon {
00010   DQMXMLFileSourceHandler::DQMXMLFileSourceHandler(const edm::ParameterSet & pset):
00011     m_name(pset.getUntrackedParameter<std::string>("name","DQMXMLFileSourceHandler")),
00012     m_file(pset.getUntrackedParameter<std::string>("XMLFile","./file.xml")),
00013     m_zip(pset.getUntrackedParameter<bool>("zip",false)),
00014     m_since(pset.getUntrackedParameter<unsigned long long>("firstSince",1)),
00015     m_debugMode(pset.getUntrackedParameter<bool>("debug",false)) {
00016   }
00017   
00018   DQMXMLFileSourceHandler::~DQMXMLFileSourceHandler() {}
00019   
00020   void DQMXMLFileSourceHandler::getNewObjects() {
00021     edm::LogInfo("DQMXMLFileSourceHandler") << "[DQMXMLFileSourceHandler::getNewObjects] for PopCon application " << m_name;
00022     if(m_debugMode){
00023         std::stringstream ss;
00024         ss << "\n------- " << m_name 
00025            << " - > getNewObjects\n";
00026         if (this->tagInfo().size > 0){
00027           //check what is already inside of the database
00028           ss << "\ngot offlineInfo "<< this->tagInfo().name 
00029              << ",\n size " << this->tagInfo().size 
00030              << ",\n" << this->tagInfo().token 
00031              << ",\n last object valid since " << this->tagInfo().lastInterval.first 
00032              << ",\n token " << this->tagInfo().lastPayloadToken 
00033              << ",\n UserText " << this->userTextLog()
00034              << ";\n last entry info regarding the payload (if existing):" 
00035              << ",\n logId"<<this->logDBEntry().logId 
00036              << ",\n last record with the correct tag (if existing) has been written in the db " << this->logDBEntry().destinationDB
00037              << ",\n provenance " << this->logDBEntry().provenance
00038              << ",\n usertext " << this->logDBEntry().usertext
00039              << ",\n iovtag " << this->logDBEntry().iovtag
00040              << ",\n timetype " << this->logDBEntry().iovtimetype
00041              << ",\n payload index " << this->logDBEntry().payloadIdx
00042              << ",\n payload name " << this->logDBEntry().payloadName 
00043              << ",\n payload token " << this->logDBEntry().payloadToken
00044              << ",\n payload container " << this->logDBEntry().payloadContainer 
00045              << ",\n execution time " << this->logDBEntry().exectime
00046              << ",\n execution message " << this->logDBEntry().execmessage
00047              << std::endl;
00048           Ref payload = this->lastPayload();
00049           ss << "size of last payload " << payload->size() << std::endl;
00050         } else {
00051           ss << " First object for this tag " << std::endl;
00052         }
00053         edm::LogInfo("DQMXMLFileSourceHandler") << ss.str();
00054     }
00055     edm::LogInfo("DQMXMLFileSourceHandler") << "runnumber/first since = " << m_since << std::endl;
00056     if(m_since<=this->tagInfo().lastInterval.first){
00057       edm::LogInfo("DQMXMLFileSourceHandler") 
00058         << "[DQMXMLFileSourceHandler::getNewObjects] \nthe current starting iov " << m_since
00059         << "\nis not compatible with the last iov ("  
00060         << this->tagInfo().lastInterval.first << ") open for the object " 
00061         << this->logDBEntry().payloadName << " \nin the db " 
00062         << this->logDBEntry().destinationDB << " \n NO TRANSFER NEEDED"
00063         << std::endl;
00064       return;
00065       }
00066     edm::LogInfo("DQMXMLFileSourceHandler") 
00067       << "[DQMXMLFileSourceHandler::getNewObjects] " << m_name << " getting data to be transferred "  << std::endl;
00068     FileBlob* XMLFile = new FileBlob(m_file,m_zip);
00069     /*if(!this->tagInfo().size)
00070       m_since=1;
00071     else
00072       if (m_debugMode)
00073       m_since=this->tagInfo().lastInterval.first+1; */
00074     if(XMLFile->size() != 0){
00075       edm::LogInfo("DQMXMLFileSourceHandler") << "setting runnumber/first since = " << m_since << std::endl;
00076       this->m_to_transfer.push_back(std::make_pair(XMLFile,m_since));
00077     } else {
00078       edm::LogError("DQMSummarySourceHandler") << "XML file " << m_file << " does not exist" << std::endl;
00079     }
00080     edm::LogInfo("DQMSummarySourceHandler") << "------- " 
00081                                             << m_name << " - > getNewObjects" 
00082                                             << std::endl;
00083   }
00084   
00085   std::string DQMXMLFileSourceHandler::id() const {return m_name;}
00086 }