Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 74738
b: "refs/heads/CMSSW_7_1_X"
c: 448d985
h: "refs/heads/CMSSW_7_1_X"
v: v3
  • Loading branch information
Lassi Tuura committed Oct 5, 2009
1 parent fd4927c commit fba821a
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 54 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
refs/heads/gh-pages: 09c786f70121f131b3715aaf3464996502bbeb7e
"refs/heads/CMSSW_7_1_X": 8e112e23281e2b1fef1e1a2fc223ff8a386fe391
"refs/heads/CMSSW_7_1_X": 448d9854b2500db4748ac374c9ad8cb79b209ba0
47 changes: 24 additions & 23 deletions trunk/DQMServices/Core/bin/DumpFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ struct MEInfo
char style;
};

static const char *s_kind[] = {
"INVALID", "INT", "REAL", "STRING",
"TH1F", "TH1S", "TH2F", "TH2S",
"TH3F", "TPROFILE", "TPROFILE2D"
};

static const int FATAL_OPTS = (lat::Signal::FATAL_DEFAULT
& ~(lat::Signal::FATAL_ON_INT
| lat::Signal::FATAL_ON_QUIT
Expand All @@ -39,6 +33,28 @@ onAssertFail(const char *message)
return 'a';
}

static const char *
kindToName(MonitorElement::Kind kind)
{
switch (kind)
{
case MonitorElement::DQM_KIND_INVALID: return "INVALID";
case MonitorElement::DQM_KIND_INT: return "INT";
case MonitorElement::DQM_KIND_REAL: return "REAL";
case MonitorElement::DQM_KIND_STRING: return "STRING";
case MonitorElement::DQM_KIND_TH1F: return "TH1F";
case MonitorElement::DQM_KIND_TH1S: return "TH1S";
case MonitorElement::DQM_KIND_TH1D: return "TH1D";
case MonitorElement::DQM_KIND_TH2F: return "TH2F";
case MonitorElement::DQM_KIND_TH2S: return "TH2S";
case MonitorElement::DQM_KIND_TH2D: return "TH2D";
case MonitorElement::DQM_KIND_TH3F: return "TH3F";
case MonitorElement::DQM_KIND_TPROFILE: return "TPROFILE";
case MonitorElement::DQM_KIND_TPROFILE2D: return "TPROFILE2D";
default: assert(false); return "INTERNAL_ERROR";
}
}

// -------------------------------------------------------------------
// Extract standard parameters from the DQM data.
static void
Expand Down Expand Up @@ -113,21 +129,6 @@ getMEInfo(DQMStore &store, MonitorElement &me, MEInfo &info)
info.name = name;
}

static std::string
tagString(const DQMNet::TagList &tags)
{
std::ostringstream os;
os << '[';
for (size_t i = 0, e = tags.size(); i != e; ++i)
{
if (i > 0)
os << ',';
os << tags[i];
}
os << ']';
return os.str();
}

std::string
hexlify(const std::string &x)
{
Expand Down Expand Up @@ -207,8 +208,8 @@ int main(int argc, char **argv)
<< "' STEP='" << step
<< "' SYSTEM='" << info.system
<< "' CATEGORY='" << info.category
<< "' KIND='" << s_kind[me.kind()]
<< "' TAGS=" << tagString(me.getTags())
<< "' KIND='" << kindToName(me.kind())
<< "' TAG=" << me.getTag()
<< " FLAGS=0x" << std::hex << me.flags() << std::dec
<< " NAME='" << info.name
<< "' DATA='" << hexlify(info.data)
Expand Down
75 changes: 45 additions & 30 deletions trunk/DQMServices/Core/src/DQMService.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,58 +116,73 @@ DQMService::flush(const edm::Event &, const edm::EventSetup &)
// OK, send an update.
if (net_)
{
std::set<std::string> seen;
std::string fullpath;

// Lock the network layer so we can modify the data.
net_->lock();
bool updated = false;

// Find updated contents and update the network cache.
DQMNet::Object o;
DQMStore::MEMap::iterator i, e;
for (i = store_->data_.begin(), e = store_->data_.end(); i != e; ++i)
{
MonitorElement &me = i->second;
const MonitorElement &me = *i;
if (! me.wasUpdated())
continue;

if (filter_ && filter_->search(me.data_.name) < 0)
continue;
fullpath.clear();
fullpath += *me.data_.dirname;
if (! me.data_.dirname->empty())
fullpath += '/';
fullpath += me.data_.objname;

assert(me.data_.object);
if (filter_ && filter_->search(fullpath) < 0)
continue;

DQMNet::Object o;
o.version = version;
o.name = me.data_.name;
o.tags = me.data_.tags;
o.object = 0;
o.reference = 0;
o.flags = me.data_.flags;
o.lastreq = 0;

TBufferFile buffer (TBufferFile::kWrite);
buffer.WriteObject(me.data_.object);
if (me.data_.reference)
buffer.WriteObject(me.data_.reference);
else
buffer.WriteObjectAny(0, 0);

// Save the quality test results.
DQMNet::QReports::iterator qi, qe;
for (qi = me.data_.qreports.begin(), qe = me.data_.qreports.end(); qi != qe; ++qi)
o.tag = me.data_.tag;
o.version = version;
o.dirname = me.data_.dirname;
o.objname = me.data_.objname;
o.scalar.clear();
o.rawdata.clear();
o.qdata.clear();

// Pack object and reference, scalar and quality data.
switch (me.kind())
{
TObjString s (me.qualityTagString(*qi).c_str());
buffer.WriteObject(&s);
case MonitorElement::DQM_KIND_INT:
case MonitorElement::DQM_KIND_REAL:
case MonitorElement::DQM_KIND_STRING:
me.packScalarData(o.scalar, "");
break;

default:
{
TBufferFile buffer(TBufferFile::kWrite);
buffer.WriteObject(me.object_);
if (me.reference_)
buffer.WriteObject(me.reference_);
else
buffer.WriteObjectAny(0, 0);
o.rawdata.resize(buffer.Length());
memcpy(&o.rawdata[0], buffer.Buffer(), buffer.Length());
DQMNet::packQualityData(o.qdata, me.data_.qreports);
break;
}
}

// Save this ensemble to the buffer.
o.rawdata.resize(buffer.Length());
memcpy(&o.rawdata[0], buffer.Buffer(), buffer.Length());
// Update.
net_->updateLocalObject(o);
seen.insert(fullpath);
updated = true;
}

// Find removed contents and clear the network cache.
std::vector<std::string>::iterator ri, re;
for (ri = store_->removed_.begin(), re = store_->removed_.end(); ri != re; ++ri, updated = true)
net_->removeLocalObject(*ri);
if (net_->removeLocalExcept(seen))
updated = true;

// Unlock the network layer.
net_->unlock();
Expand Down

0 comments on commit fba821a

Please sign in to comment.