Skip to content

Commit 27d4dff

Browse files
committed
Add GetTH2PolyArray implementation for DQMStoreStats
1 parent 4fed83b commit 27d4dff

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

DQMServices/Components/plugins/DQMStoreStats.cc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ class DQMStoreStats : public edm::one::EDAnalyzer<edm::one::WatchRuns, edm::one:
338338

339339
private:
340340
int calcstats(int);
341+
std::vector<double> GetTH2PolyArray(TH2Poly* poly);
341342
void calcIgProfDump(Folder&);
342343
void dumpMemoryProfile();
343344
std::pair<unsigned int, unsigned int> readMemoryEntry() const;
@@ -514,6 +515,15 @@ void DQMStoreStats::calcIgProfDump(Folder& root) {
514515
stream << sql_statement << std::endl;
515516
}
516517

518+
std::vector<double> DQMStoreStats::GetTH2PolyArray(TH2Poly* poly) {
519+
int nBins = poly->GetNumberOfBins();
520+
std::vector<double> array(nBins + 1, 0.0); // Initialize with zeros
521+
for (int i = 1; i <= nBins; i++) {
522+
array[i] = poly->GetBinContent(i);
523+
}
524+
return array;
525+
}
526+
517527
///
518528
/// do the stats here and produce output;
519529
///
@@ -668,6 +678,16 @@ int DQMStoreStats::calcstats(int mode = DQMStoreStats::considerAllME) {
668678
getEmptyMetric(it->getTH2I()->GetArray(), it->getNbinsX() + 2, it->getNbinsY() + 2, 0),
669679
it->getNbinsX() * it->getNbinsY() * sizeof(int));
670680
break;
681+
case MonitorElement::Kind::TH2Poly:
682+
std::vector<double> polyArray = GetTH2PolyArray(it->getTH2Poly());
683+
int nBins = polyArray.size() - 1;
684+
currentSubfolder.AddBinsD(
685+
nBins,
686+
getEmptyMetric(polyArray.data(), nBins + 1, 1, 0));
687+
curr->update(nBins,
688+
getEmptyMetric(polyArray.data(), nBins + 1, 1, 0),
689+
nBins * sizeof(double));
690+
break;
671691
case MonitorElement::Kind::TPROFILE2D:
672692
currentSubfolder.AddBinsD(
673693
it->getNbinsX() * it->getNbinsY(),

0 commit comments

Comments
 (0)