Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete ME eafter writing v3 73x #5834

Merged
merged 7 commits into from Oct 17, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions DQMServices/Components/src/DQMFileSaver.cc
Expand Up @@ -695,6 +695,9 @@ DQMFileSaver::globalEndLuminosityBlock(const edm::LuminosityBlock & iLS, const e
<< "Internal error, can save files"
<< " only in ROOT format.";
}

// after saving per LS, delete the old LS global histograms.
dbe_->markForDeletion(enableMultiThread_ ? irun : 0, ilumi);
}
}

Expand Down
1 change: 1 addition & 0 deletions DQMServices/Core/interface/DQMNet.h
Expand Up @@ -61,6 +61,7 @@ class DQMNet
static const uint32_t DQM_PROP_DEAD = 0x00080000;
static const uint32_t DQM_PROP_STALE = 0x00100000;
static const uint32_t DQM_PROP_EFFICIENCY_PLOT = 0x00200000;
static const uint32_t DQM_PROP_MARKTODELETE = 0x01000000;

static const uint32_t DQM_MSG_HELLO = 0;
static const uint32_t DQM_MSG_UPDATE_ME = 1;
Expand Down
4 changes: 3 additions & 1 deletion DQMServices/Core/interface/DQMStore.h
Expand Up @@ -629,7 +629,9 @@ class DQMStore
void initializeFrom(const edm::ParameterSet&);
void reset(void);
void forceReset(void);

void markForDeletion(uint32_t run,
uint32_t lumi);

bool extract(TObject *obj, const std::string &dir, bool overwrite, bool collateHistograms);
TObject * extractNextObject(TBufferFile&) const;

Expand Down
9 changes: 9 additions & 0 deletions DQMServices/Core/interface/MonitorElement.h
Expand Up @@ -286,6 +286,15 @@ class MonitorElement
bool isAccumulateEnabled(void) const
{ return data_.flags & DQMNet::DQM_PROP_ACCUMULATE; }

/// true if ME is marked for deletion
bool markedToDelete(void) const
{ return data_.flags & DQMNet::DQM_PROP_MARKTODELETE; }

/// Mark the object for deletion.
/// NB: make sure that the following method is not called simultaneously for the same ME
void markToDelete(void)
{ data_.flags |= DQMNet::DQM_PROP_MARKTODELETE; }

private:
/// reset "was updated" flag
void resetUpdate(void)
Expand Down
56 changes: 53 additions & 3 deletions DQMServices/Core/src/DQMStore.cc
Expand Up @@ -431,9 +431,21 @@ void DQMStore::mergeAndResetMEsLuminositySummaryCache(uint32_t run,
gme = data_.insert(global_me);
assert(gme.second);
}
// make the ME reusable for the next LS
const_cast<MonitorElement*>(&*i)->Reset();
// TODO(rovere): eventually reset the local object and mark it as reusable??
++i;

// check and remove the global lumi based histo belonging to the previous LSs
// if properly flagged as DQMNet::DQM_PROP_MARKTODELETE
global_me.setLumi(1);
std::set<MonitorElement>::const_iterator i_lumi = data_.lower_bound(global_me);
while (i_lumi->data_.lumi != lumi) {
auto temp = i_lumi++;
if (i_lumi->getFullname() == i->getFullname() && i_lumi->markedToDelete())
{
data_.erase(temp);
}
}
}
}

Expand Down Expand Up @@ -2030,6 +2042,44 @@ DQMStore::forceReset(void)
reset_ = true;
}

//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
/** Mark a set of histograms for deletion based on run, lumi and path*/
void
DQMStore::markForDeletion(uint32_t run,
uint32_t lumi)
{

std::string null_str("");
MonitorElement proto(&null_str, null_str, run, 0, 0);
if (enableMultiThread_)
proto.setLumi(lumi);

std::set<MonitorElement>::const_iterator e = data_.end();
std::set<MonitorElement>::const_iterator i = data_.lower_bound(proto);

while (i != e) {
if (i->data_.streamId != 0 ||
i->data_.moduleId != 0)
break;
if ((i->data_.lumi != lumi) && enableMultiThread_)
break;
if (i->data_.run != run)
break;

const_cast<MonitorElement*>(&*i)->markToDelete();

if (verbose_ > 1)
std::cout << "DQMStore::markForDeletion: marked monitor element '"
<< *i->data_.dirname << "/" << i->data_.objname << "'"
<< "flags " << i->data_.flags << "\n";

++i;
}
}


//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -2467,7 +2517,7 @@ void DQMStore::savePB(const std::string &filename,

//reset the ME just written to make it available for the next LS (online)
if (resetMEsAfterWriting)
const_cast<MonitorElement*>(&*mi)->Reset();
const_cast<MonitorElement*>(&*mi)->Reset();
}
}

Expand Down Expand Up @@ -2680,7 +2730,7 @@ DQMStore::save(const std::string &filename,
TObjString(mi->tagLabelString().c_str()).Write();

//reset the ME just written to make it available for the next LS (online)
if(resetMEsAfterWriting)
if (resetMEsAfterWriting)
const_cast<MonitorElement*>(&*mi)->Reset();
}
}
Expand Down