File indexing completed on 2024-04-06 12:02:44
0001 #include "CondTools/DQM/interface/DQMXMLFileSourceHandler.h"
0002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0003 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0004 #include "FWCore/ParameterSet/interface/ParameterSetfwd.h"
0005 #include <iostream>
0006 #include <sstream>
0007 #include <vector>
0008
0009 namespace popcon {
0010 DQMXMLFileSourceHandler::DQMXMLFileSourceHandler(const edm::ParameterSet& pset)
0011 : m_name(pset.getUntrackedParameter<std::string>("name", "DQMXMLFileSourceHandler")),
0012 m_file(pset.getUntrackedParameter<std::string>("XMLFile", "./file.xml")),
0013 m_zip(pset.getUntrackedParameter<bool>("zip", false)),
0014 m_since(pset.getUntrackedParameter<unsigned long long>("firstSince", 1)),
0015 m_debugMode(pset.getUntrackedParameter<bool>("debug", false)) {}
0016
0017 DQMXMLFileSourceHandler::~DQMXMLFileSourceHandler() {}
0018
0019 void DQMXMLFileSourceHandler::getNewObjects() {
0020 edm::LogInfo("DQMXMLFileSourceHandler")
0021 << "[DQMXMLFileSourceHandler::getNewObjects] for PopCon application " << m_name;
0022 if (m_debugMode) {
0023 std::stringstream ss;
0024 ss << "\n------- " << m_name << " - > getNewObjects\n";
0025 if (this->tagInfo().size > 0) {
0026
0027 ss << "\ngot offlineInfo " << this->tagInfo().name << ",\n size " << this->tagInfo().size << ",\n"
0028 << "last object valid since " << this->tagInfo().lastInterval.since << ",\n token "
0029 << this->tagInfo().lastInterval.payloadId << ",\n UserText " << this->userTextLog()
0030 << ";\n last entry info regarding the payload (if existing):"
0031 << ",\n logId" << this->logDBEntry().logId
0032 << ",\n last record with the correct tag (if existing) has been written in the db "
0033 << this->logDBEntry().destinationDB << ",\n provenance " << this->logDBEntry().provenance << ",\n usertext "
0034 << this->logDBEntry().usertext << ",\n iovtag " << this->logDBEntry().iovtag << ",\n timetype "
0035 << this->logDBEntry().iovtimetype << ",\n payload index " << this->logDBEntry().payloadIdx
0036 << ",\n payload class " << this->logDBEntry().payloadClass << ",\n payload token "
0037 << this->logDBEntry().payloadToken << ",\n execution time " << this->logDBEntry().exectime
0038 << ",\n execution message " << this->logDBEntry().execmessage << std::endl;
0039 Ref payload = this->lastPayload();
0040 ss << "size of last payload " << payload->size() << std::endl;
0041 } else {
0042 ss << " First object for this tag " << std::endl;
0043 }
0044 edm::LogInfo("DQMXMLFileSourceHandler") << ss.str();
0045 }
0046 edm::LogInfo("DQMXMLFileSourceHandler") << "runnumber/first since = " << m_since << std::endl;
0047 if (this->tagInfo().size > 0 && m_since <= this->tagInfo().lastInterval.since) {
0048 edm::LogInfo("DQMXMLFileSourceHandler")
0049 << "[DQMXMLFileSourceHandler::getNewObjects] \nthe current starting iov " << m_since
0050 << "\nis not compatible with the last iov (" << this->tagInfo().lastInterval.since << ") open for the object "
0051 << this->logDBEntry().payloadClass << " \nin the db " << this->logDBEntry().destinationDB
0052 << " \n NO TRANSFER NEEDED" << std::endl;
0053 return;
0054 }
0055 edm::LogInfo("DQMXMLFileSourceHandler")
0056 << "[DQMXMLFileSourceHandler::getNewObjects] " << m_name << " getting data to be transferred " << std::endl;
0057 FileBlob* XMLFile = new FileBlob(m_file, m_zip);
0058
0059
0060
0061
0062
0063 if (XMLFile->size() != 0) {
0064 edm::LogInfo("DQMXMLFileSourceHandler") << "setting runnumber/first since = " << m_since << std::endl;
0065 this->m_to_transfer.push_back(std::make_pair(XMLFile, m_since));
0066 } else {
0067 edm::LogError("DQMSummarySourceHandler") << "XML file " << m_file << " does not exist" << std::endl;
0068 delete XMLFile;
0069 }
0070 edm::LogInfo("DQMSummarySourceHandler") << "------- " << m_name << " - > getNewObjects" << std::endl;
0071 }
0072
0073 std::string DQMXMLFileSourceHandler::id() const { return m_name; }
0074 }