Skip to content

Commit

Permalink
Added QTests to protobuf files in DQMFileSaverPB
Browse files Browse the repository at this point in the history
  • Loading branch information
andrius committed Jun 24, 2020
1 parent f2b1f81 commit 39dedc6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
5 changes: 5 additions & 0 deletions DQMServices/FileIO/plugins/DQMFileSaverBase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/MessageLogger/interface/JobReport.h"
#include "FWCore/Utilities/interface/TimeOfDay.h"
#include "DataFormats/Histograms/interface/DQMToken.h"

#include "DQMFileSaverBase.h"

Expand Down Expand Up @@ -37,6 +38,10 @@ DQMFileSaverBase::DQMFileSaverBase(const edm::ParameterSet &ps) {

std::unique_lock<std::mutex> lck(initial_fp_lock_);
initial_fp_ = fp;

// This makes sure a file saver runs in a very end
consumesMany<DQMToken, edm::InLumi>();
consumesMany<DQMToken, edm::InRun>();
}

DQMFileSaverBase::~DQMFileSaverBase() = default;
Expand Down
22 changes: 20 additions & 2 deletions DQMServices/FileIO/plugins/DQMFileSaverPB.cc
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,26 @@ void DQMFileSaverPB::savePB(DQMStore* store, std::string const& filename, int ru
histo.set_size(buffer.Length());
histo.set_streamed_histo((void const*)buffer.Buffer(), buffer.Length());

// Save quality reports if this is not in reference section.
// XXX not supported by protobuf files.
// Save quality reports
for (QReport *qr : me->getQReports()) {
std::string result;
// TODO: 64 is likely too short; memory corruption in the old code?
char buf[64];
std::snprintf(buf, sizeof(buf), "qr=st:%d:%.*g:", qr->getStatus(), DBL_DIG + 2, qr->getQTresult());
result = '<' + me->getName() + '.' + qr->getQRName() + '>';
result += buf;
result += qr->getAlgorithm() + ':' + qr->getMessage();
result += "</" + me->getName() + '.' + qr->getQRName() + '>';
TObjString str(result.c_str());

dqmstorepb::ROOTFilePB::Histo& qr_histo = *dqmstore_message.add_histo();
TBufferFile qr_buffer(TBufferFile::kWrite);
qr_buffer.WriteObject(&str);
qr_histo.set_full_pathname(me->getFullname() + '.' + qr->getQRName());
qr_histo.set_flags(static_cast<uint32_t>(MonitorElement::Kind::STRING));
qr_histo.set_size(qr_buffer.Length());
qr_histo.set_streamed_histo((void const*)qr_buffer.Buffer(), qr_buffer.Length());
}

// Save efficiency tag, if any.
// XXX not supported by protobuf files.
Expand Down

0 comments on commit 39dedc6

Please sign in to comment.