33 mParameters = iParameters;
46 TH2F* pHistogram = getDifferentialHistogram(iHistName);
47 int nBinsX = pHistogram->GetNbinsX();
48 int nBinsY = pHistogram->GetNbinsY();
49 int nMasked = getNBinsMasked(iHistName);
50 unsigned int nBinsActive = (nBinsX * nBinsY) - nMasked;
64 TH2F*
histo = mHistograms[iHistName].first;
65 vector<pair<int, int> >*
m =
new vector<pair<int, int> >();
68 printf(
"Masked areas for: %s\n", iHistName.c_str());
71 for (
unsigned int i = 0;
i < iMaskedAreas.size();
i++) {
83 if (iTypeUnits == 0) {
84 sTypeUnits =
"Histogram Units";
85 }
else if (iTypeUnits == 1) {
86 sTypeUnits =
"Bin Units";
88 sTypeUnits =
"Unknown Units";
91 "Area %3i: xmin=%6.2f xmax=%6.2f ymin=%6.2f ymax=%6.2f %s\n",
i, xmin, xmax, ymin, ymax, sTypeUnits.c_str());
94 int xfirst, yfirst,
xlast, ylast;
97 if (!(xmin <= xmax)) {
102 if (!(ymin <= ymax)) {
109 if (iTypeUnits == 0) {
111 int globalMaxBin = histo->FindBin(xmax, ymax);
112 int globalMinBin = histo->FindBin(xmax, ymax);
118 histo->GetBinXYZ(globalMinBin, xfirst, yfirst, binZ);
119 histo->GetBinXYZ(globalMaxBin, xlast, ylast, binZ);
123 if (histo->GetXaxis()->GetBinLowEdge(globalMaxBin) ==
xmax) {
126 if (histo->GetYaxis()->GetBinLowEdge(globalMaxBin) ==
ymax) {
141 for (
int x = xfirst;
x <=
xlast;
x++) {
142 for (
int y = yfirst; y <= ylast; y++) {
151 delete[] mMaskedBins[iHistName];
152 mMaskedBins[iHistName] =
m;
164 return (*mMaskedBins[iHistName]);
176 return mMaskedBins[iHistName]->size();
191 vector<pair<int, int> >
m = (*mMaskedBins[iHistName]);
196 for (
unsigned int i = 0;
i < m.size();
i++) {
197 pair<int, int>&
p = m[
i];
198 if (p.first == iStrip) {
199 oHist->SetBinContent(p.first, p.second, 0.0);
205 else if (iAxis == 2) {
206 for (
unsigned int i = 0;
i < m.size();
i++) {
207 pair<int, int>&
p = m[
i];
208 if (p.second == iStrip) {
209 oHist->SetBinContent(p.first, p.second, 0.0);
215 cout <<
"invalid axis" << endl;
233 vector<pair<int, int> >* thisHistMaskedBins = mMaskedBins[iHistName];
235 bool binIsMasked =
false;
237 for (
unsigned int i = 0;
i < thisHistMaskedBins->size();
i++) {
238 if ((*thisHistMaskedBins)[
i].first == iBinX && (*thisHistMaskedBins)[
i].second == iBinY) {
258 bool stripIsMasked =
true;
259 vector<pair<int, int> >* thisHistMaskedBins = mMaskedBins[iHistName];
264 for (
unsigned int i = 0;
i < thisHistMaskedBins->size();
i++) {
265 if ((*thisHistMaskedBins)[
i].first == iBinStrip) {
269 stripIsMasked = getDifferentialHistogram(iHistName)->GetYaxis()->GetNbins() ==
count;
274 for (
unsigned int i = 0;
i < thisHistMaskedBins->size();
i++) {
275 if ((*thisHistMaskedBins)[
i].second == iBinStrip) {
279 stripIsMasked = getDifferentialHistogram(iHistName)->GetXaxis()->GetNbins() ==
count;
282 return stripIsMasked;
296 string iHistLocation) {
297 pair<TH2F*, TH2F*> histPair;
300 TH2F* pHist = getRebinnedHistogram(igetter, iHistName, iHistLocation);
302 if (mHistValid[iHistName]) {
303 histPair.first = pHist;
305 TH2F* histDiff =
new TH2F(*histPair.first);
307 histPair.second = histDiff;
309 mHistograms[iHistName] = histPair;
312 mHistDiffMinus1[iHistName] =
new TH2F(*histDiff);
329 string iHistLocation) {
335 histMonitor =
nullptr;
336 mHistValid[iHistName] =
false;
338 mHistValid[iHistName] =
true;
339 histMonitor =
new TH2F(*(igetter.
get(iHistLocation)->
getTH2F()));
342 int rebinFactorX = 1;
343 int rebinFactorY = 1;
345 vector<ParameterSet> testParameters = mParameters.getParameter<vector<ParameterSet> >(
"testParams");
346 for (
unsigned int i = 0;
i < testParameters.size();
i++) {
347 if (testParameters[
i].getParameter<string>(
"testName") == iHistName) {
356 if (rebinFactorX != 1) {
357 histMonitor->RebinY(rebinFactorX);
359 if (rebinFactorY != 1) {
360 histMonitor->RebinY(rebinFactorY);
376 string iHistLocation,
378 if (mHistValid[iHistName]) {
379 TH2F* histo_curr = getRebinnedHistogram(
380 igetter, iHistLocation, iHistLocation);
382 TH2F* histo_old =
new TH2F(*histo_curr);
383 histo_curr->Add(mHistograms[iHistName].
first, -1.0);
385 mLSListDiff[iHistName].push_back(iLS);
387 delete mHistograms[iHistName].first;
388 mHistograms[iHistName].first = histo_old;
389 mHistograms[iHistName].second->Add(histo_curr);
402 if (mHistValid[iHistName]) {
403 mHistograms[iHistName].second->Add(mHistDiffMinus1[iHistName]);
404 mLSListDiff[iHistName].insert(
405 mLSListDiff[iHistName].
end(), mLSListDiffMinus1[iHistName].
begin(), mLSListDiffMinus1[iHistName].
end());
416 if (mHistValid[iHistName]) {
418 delete mHistDiffMinus1[iHistName];
419 mHistDiffMinus1[iHistName] =
new TH2F(*mHistograms[iHistName].
second);
422 mHistograms[iHistName].second->Reset();
425 mLSListDiffMinus1[iHistName] = mLSListDiff[iHistName];
426 mLSListDiff[iHistName].clear();
450 if (mHistValid[iHistName]) {
451 return mHistograms[iHistName].second;
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)
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
virtual MonitorElement * get(std::string const &fullpath) const
void resetHisto(std::string test)
void updateHistogramEndRun(std::string iHistName)
T getParameter(std::string const &) const
unsigned int getNBinsHistogram(std::string test)
mVerbose(fConfig.getUntrackedParameter< bool >("verbose", false))
void updateHistogramEndLS(DQMStore::IGetter &igetter, std::string test, std::string histo, int iLS)
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)