34 mParameters = iParameters;
47 TH2F* pHistogram = getDifferentialHistogram(iHistName);
48 int nBinsX = pHistogram->GetNbinsX();
49 int nBinsY = pHistogram->GetNbinsY();
50 int nMasked = getNBinsMasked(iHistName);
51 unsigned int nBinsActive = (nBinsX * nBinsY) - nMasked;
65 TH2F*
histo = mHistograms[iHistName].first;
66 vector<pair<int, int> >*
m =
new vector<pair<int, int> >();
69 printf(
"Masked areas for: %s\n", iHistName.c_str());
72 for (
unsigned int i = 0;
i < iMaskedAreas.size();
i++) {
84 if (iTypeUnits == 0) {
85 sTypeUnits =
"Histogram Units";
86 }
else if (iTypeUnits == 1) {
87 sTypeUnits =
"Bin Units";
89 sTypeUnits =
"Unknown Units";
92 "Area %3i: xmin=%6.2f xmax=%6.2f ymin=%6.2f ymax=%6.2f %s\n",
i, xmin, xmax, ymin, ymax, sTypeUnits.c_str());
95 int xfirst, yfirst,
xlast, ylast;
98 if (!(xmin <= xmax)) {
103 if (!(ymin <= ymax)) {
110 if (iTypeUnits == 0) {
112 int globalMaxBin = histo->FindBin(xmax, ymax);
113 int globalMinBin = histo->FindBin(xmax, ymax);
119 histo->GetBinXYZ(globalMinBin, xfirst, yfirst, binZ);
120 histo->GetBinXYZ(globalMaxBin, xlast, ylast, binZ);
124 if (histo->GetXaxis()->GetBinLowEdge(globalMaxBin) ==
xmax) {
127 if (histo->GetYaxis()->GetBinLowEdge(globalMaxBin) ==
ymax) {
142 for (
int x = xfirst; x <=
xlast; x++) {
143 for (
int y = yfirst; y <= ylast; y++) {
152 delete[] mMaskedBins[iHistName];
153 mMaskedBins[iHistName] =
m;
165 return (*mMaskedBins[iHistName]);
177 return mMaskedBins[iHistName]->size();
192 vector<pair<int, int> >
m = (*mMaskedBins[iHistName]);
197 for (
unsigned int i = 0;
i < m.size();
i++) {
198 pair<int, int>&
p = m[
i];
199 if (p.first == iStrip) {
200 oHist->SetBinContent(p.first, p.second, 0.0);
206 else if (iAxis == 2) {
207 for (
unsigned int i = 0;
i < m.size();
i++) {
208 pair<int, int>&
p = m[
i];
209 if (p.second == iStrip) {
210 oHist->SetBinContent(p.first, p.second, 0.0);
216 cout <<
"invalid axis" << endl;
234 vector<pair<int, int> >* thisHistMaskedBins = mMaskedBins[iHistName];
236 bool binIsMasked =
false;
238 for (
unsigned int i = 0;
i < thisHistMaskedBins->size();
i++) {
239 if ((*thisHistMaskedBins)[
i].first == iBinX && (*thisHistMaskedBins)[
i].second == iBinY) {
259 bool stripIsMasked =
true;
260 vector<pair<int, int> >* thisHistMaskedBins = mMaskedBins[iHistName];
265 for (
unsigned int i = 0;
i < thisHistMaskedBins->size();
i++) {
266 if ((*thisHistMaskedBins)[
i].first == iBinStrip) {
270 stripIsMasked = getDifferentialHistogram(iHistName)->GetYaxis()->GetNbins() ==
count;
275 for (
unsigned int i = 0;
i < thisHistMaskedBins->size();
i++) {
276 if ((*thisHistMaskedBins)[
i].second == iBinStrip) {
280 stripIsMasked = getDifferentialHistogram(iHistName)->GetXaxis()->GetNbins() ==
count;
283 return stripIsMasked;
297 string iHistLocation) {
298 pair<TH2F*, TH2F*> histPair;
301 TH2F* pHist = getRebinnedHistogram(igetter, iHistName, iHistLocation);
303 if (mHistValid[iHistName]) {
304 histPair.first = pHist;
306 TH2F* histDiff =
new TH2F(*histPair.first);
308 histPair.second = histDiff;
310 mHistograms[iHistName] = histPair;
313 mHistDiffMinus1[iHistName] =
new TH2F(*histDiff);
330 string iHistLocation) {
336 histMonitor =
nullptr;
337 mHistValid[iHistName] =
false;
339 mHistValid[iHistName] =
true;
340 histMonitor =
new TH2F(*(igetter.
get(iHistLocation)->
getTH2F()));
343 int rebinFactorX = 1;
344 int rebinFactorY = 1;
346 vector<ParameterSet> testParameters = mParameters.getParameter<vector<ParameterSet> >(
"testParams");
347 for (
unsigned int i = 0;
i < testParameters.size();
i++) {
348 if (testParameters[
i].getParameter<string>(
"testName") == iHistName) {
357 if (rebinFactorX != 1) {
358 histMonitor->RebinY(rebinFactorX);
360 if (rebinFactorY != 1) {
361 histMonitor->RebinY(rebinFactorY);
377 string iHistLocation,
379 if (mHistValid[iHistName]) {
380 TH2F* histo_curr = getRebinnedHistogram(
381 igetter, iHistLocation, iHistLocation);
383 TH2F* histo_old =
new TH2F(*histo_curr);
384 histo_curr->Add(mHistograms[iHistName].
first, -1.0);
386 mLSListDiff[iHistName].push_back(iLS);
388 delete mHistograms[iHistName].first;
389 mHistograms[iHistName].first = histo_old;
390 mHistograms[iHistName].second->Add(histo_curr);
403 if (mHistValid[iHistName]) {
404 mHistograms[iHistName].second->Add(mHistDiffMinus1[iHistName]);
405 mLSListDiff[iHistName].insert(
406 mLSListDiff[iHistName].
end(), mLSListDiffMinus1[iHistName].
begin(), mLSListDiffMinus1[iHistName].
end());
417 if (mHistValid[iHistName]) {
419 delete mHistDiffMinus1[iHistName];
420 mHistDiffMinus1[iHistName] =
new TH2F(*mHistograms[iHistName].
second);
423 mHistograms[iHistName].second->Reset();
426 mLSListDiffMinus1[iHistName] = mLSListDiff[iHistName];
427 mLSListDiff[iHistName].clear();
451 if (mHistValid[iHistName]) {
452 return mHistograms[iHistName].second;
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
virtual TH2F * getTH2F() const
TH2F * loadHisto(DQMStore::IGetter &igetter, std::string test, std::string histo)
TH2F * getRebinnedHistogram(DQMStore::IGetter &igetter, std::string iHistName, std::string iHistLocation)
std::vector< int > getLSCertification(std::string iHistName)
std::vector< std::pair< int, int > > getMaskedBins(std::string test)
int maskBins(std::string test, TH2F *histo, int strip, int axis)
void setMaskedBins(std::string test, const std::vector< edm::ParameterSet > &mask)
L1TOccupancyClientHistogramService()
U second(std::pair< T, U > const &p)
bool isStripMasked(std::string test, int binStrip, int axis)
void resetHisto(std::string test)
void updateHistogramEndRun(std::string iHistName)
unsigned int getNBinsHistogram(std::string test)
void updateHistogramEndLS(DQMStore::IGetter &igetter, std::string test, std::string histo, int iLS)
MonitorElement * get(std::string const &path)
T first(std::pair< T, U > const &p)
unsigned int getNBinsMasked(std::string test)
bool isMasked(std::string test, int x, int y)
TH2F * getDifferentialHistogram(std::string test)