Skip to content

Commit

Permalink
delete lumi based MEs when the LS processing is over
Browse files Browse the repository at this point in the history
move LS histo removal in mergeAndResetMEsLuminositySummaryCache

add function markForDeletion to DQMStore

shrink down the markForDeletion function

fix invalid iterator

move markedToDelete and markToDelete to be private in the MonitorElement class

added a comment to the markToDelete method
  • Loading branch information
deguio committed Oct 17, 2014
1 parent e11f2d9 commit ac24c99
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 4 deletions.
3 changes: 3 additions & 0 deletions DQMServices/Components/src/DQMFileSaver.cc
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit ac24c99

Please sign in to comment.