Go to the documentation of this file.00001 #include "CondTools/DQM/interface/DQMReferenceHistogramRootFileSourceHandler.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 DQMReferenceHistogramRootFileSourceHandler::DQMReferenceHistogramRootFileSourceHandler(const edm::ParameterSet & pset):
00011 m_name(pset.getUntrackedParameter<std::string>("name","DQMReferenceHistogramRootFileSourceHandler")),
00012 m_file(pset.getUntrackedParameter<std::string>("ROOTFile","./file.root")),
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 DQMReferenceHistogramRootFileSourceHandler::~DQMReferenceHistogramRootFileSourceHandler() {}
00019
00020 void DQMReferenceHistogramRootFileSourceHandler::getNewObjects() {
00021 edm::LogInfo("DQMReferenceHistogramRootFileSourceHandler") << "[DQMReferenceHistogramRootFileSourceHandler::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
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 class " << this->logDBEntry().payloadClass
00043 << ",\n payload token " << this->logDBEntry().payloadToken
00044 << ",\n execution time " << this->logDBEntry().exectime
00045 << ",\n execution message " << this->logDBEntry().execmessage
00046 << std::endl;
00047 Ref payload = this->lastPayload();
00048 ss << "size of last payload " << payload->size() << std::endl;
00049 } else {
00050 ss << " First object for this tag " << std::endl;
00051 }
00052 edm::LogInfo("DQMReferenceHistogramRootFileSourceHandler") << ss.str();
00053 }
00054 edm::LogInfo("DQMReferenceHistogramRootFileSourceHandler") << "runnumber/first since = " << m_since << std::endl;
00055 if(m_since<=this->tagInfo().lastInterval.first){
00056 edm::LogInfo("DQMReferenceHistogramRootFileSourceHandler")
00057 << "[DQMReferenceHistogramRootFileSourceHandler::getNewObjects] \nthe current starting iov " << m_since
00058 << "\nis not compatible with the last iov ("
00059 << this->tagInfo().lastInterval.first << ") open for the object "
00060 << this->logDBEntry().payloadClass << " \nin the db "
00061 << this->logDBEntry().destinationDB << " \n NO TRANSFER NEEDED"
00062 << std::endl;
00063 return;
00064 }
00065 edm::LogInfo("DQMReferenceHistogramRootFileSourceHandler")
00066 << "[DQMReferenceHistogramRootFileSourceHandler::getNewObjects] " << m_name << " getting data to be transferred " << std::endl;
00067 FileBlob* rootFile = new FileBlob(m_file,m_zip);
00068
00069
00070
00071
00072
00073 if(rootFile->size() != 0){
00074 edm::LogInfo("DQMReferenceHistogramRootFileSourceHandler") << "setting runnumber/first since = " << m_since << std::endl;
00075 this->m_to_transfer.push_back(std::make_pair(rootFile,m_since));
00076 } else {
00077 edm::LogError("DQMSummarySourceHandler") << "Root file " << m_file << " does not exist" << std::endl;
00078 }
00079 edm::LogInfo("DQMSummarySourceHandler") << "------- "
00080 << m_name << " - > getNewObjects"
00081 << std::endl;
00082 }
00083
00084 std::string DQMReferenceHistogramRootFileSourceHandler::id() const {return m_name;}
00085 }