33 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;
67 TH2F*
histo = mHistograms[iHistName].first;
68 vector<pair<int,int> >*
m =
new vector<pair<int,int> >();
70 if(
mVerbose){printf(
"Masked areas for: %s\n",iHistName.c_str());}
72 for(
unsigned int i=0;
i<iMaskedAreas.size();
i++) {
85 if (iTypeUnits == 0){sTypeUnits =
"Histogram Units";}
86 else if(iTypeUnits == 1){sTypeUnits =
"Bin Units";}
87 else {sTypeUnits =
"Unknown Units";}
88 printf(
"Area %3i: xmin=%6.2f xmax=%6.2f ymin=%6.2f ymax=%6.2f %s\n",
i,xmin,xmax,ymin,ymax,sTypeUnits.c_str());
91 int xfirst,yfirst,
xlast,ylast;
94 if(!(xmin<=xmax)){
int z=
xmax; xmax=
xmin; xmin=
z;}
95 if(!(ymin<=ymax)){
int z=
ymax; ymax=
ymin; ymin=
z;}
101 int globalMaxBin = histo->FindBin(xmax,ymax);
102 int globalMinBin = histo->FindBin(xmax,ymax);
108 histo->GetBinXYZ(globalMinBin,xfirst,yfirst,binZ);
109 histo->GetBinXYZ(globalMaxBin,xlast ,ylast ,binZ);
113 if(histo->GetXaxis()->GetBinLowEdge(globalMaxBin)==
xmax){xlast--;}
114 if(histo->GetYaxis()->GetBinLowEdge(globalMaxBin)==
ymax){ylast--;}
128 for(
int y=yfirst;
y<=ylast;
y++) {
137 delete[] mMaskedBins[iHistName];
138 mMaskedBins[iHistName]=
m;
151 return (*mMaskedBins[iHistName]);
163 return mMaskedBins[iHistName]->size();
180 vector<pair<int,int> >
m = (*mMaskedBins[iHistName]);
185 for(
unsigned int i=0;
i<m.size();
i++) {
186 pair<int,int> &
p = m[
i];
187 if(p.first==iStrip) {
188 oHist->SetBinContent(p.first,p.second,0.0);
195 for(
unsigned int i=0;
i<m.size();
i++) {
196 pair<int,int> &
p = m[
i];
197 if(p.second==iStrip) {
198 oHist->SetBinContent(p.first,p.second,0.0);
222 vector<pair<int,int> > *thisHistMaskedBins = mMaskedBins[iHistName];
224 bool binIsMasked =
false;
226 for(
unsigned int i=0;
i<thisHistMaskedBins->size();
i++) {
227 if((*thisHistMaskedBins)[
i].first ==iBinX &&
228 (*thisHistMaskedBins)[
i].second==iBinY){
249 bool stripIsMasked =
true;
250 vector<pair<int,int> > *thisHistMaskedBins = mMaskedBins[iHistName];
255 for(
unsigned int i=0;
i<thisHistMaskedBins->size();
i++) {
256 if((*thisHistMaskedBins)[
i].first==iBinStrip){count++;}
258 stripIsMasked = getDifferentialHistogram(iHistName)->GetYaxis()->GetNbins()==
count;
263 for(
unsigned int i=0;
i<thisHistMaskedBins->size();
i++) {
264 if((*thisHistMaskedBins)[
i].second==iBinStrip){count++;}
266 stripIsMasked = getDifferentialHistogram(iHistName)->GetXaxis()->GetNbins()==
count;
269 return stripIsMasked;
284 pair<TH2F*,TH2F*> histPair;
287 TH2F* pHist = getRebinnedHistogram(iHistName,iHistLocation);
289 if(mHistValid[iHistName]){
291 histPair.first = pHist;
293 TH2F* histDiff =
new TH2F(*histPair.first);
295 histPair.second=histDiff;
297 mHistograms[iHistName]=histPair;
300 mHistDiffMinus1[iHistName]=
new TH2F(*histDiff);
325 mHistValid[iHistName] =
false;
328 mHistValid[iHistName] =
true;
329 histMonitor =
new TH2F(*(mDBE->get(iHistLocation)->getTH2F()));
335 vector<ParameterSet> testParameters = mParameters.getParameter< vector<ParameterSet> >(
"testParams");
336 for(
unsigned int i=0 ;
i<testParameters.size() ;
i++){
337 if(testParameters[
i].getParameter<string>(
"testName")==iHistName){
346 if(rebinFactorX!=1){histMonitor->RebinY(rebinFactorX);}
347 if(rebinFactorY!=1){histMonitor->RebinY(rebinFactorY);}
364 if(mHistValid[iHistName]){
366 TH2F* histo_curr = getRebinnedHistogram(iHistLocation,iHistLocation);
368 TH2F* histo_old =
new TH2F(*histo_curr);
369 histo_curr->Add(mHistograms[iHistName].
first,-1.0);
371 mLSListDiff[iHistName].push_back(iLS);
373 delete mHistograms[iHistName].first;
374 mHistograms[iHistName].first=histo_old;
375 mHistograms[iHistName].second->Add(histo_curr);
388 if(mHistValid[iHistName]){
390 mHistograms[iHistName].second->Add(mHistDiffMinus1[iHistName]);
391 mLSListDiff[iHistName].insert(mLSListDiff [iHistName].
end(),
392 mLSListDiffMinus1[iHistName].
begin(),
393 mLSListDiffMinus1[iHistName].
end());
405 if(mHistValid[iHistName]){
408 delete mHistDiffMinus1[iHistName];
409 mHistDiffMinus1[iHistName] =
new TH2F(*mHistograms[iHistName].
second);
412 mHistograms[iHistName].second->Reset();
415 mLSListDiffMinus1[iHistName] = mLSListDiff[iHistName];
416 mLSListDiff [iHistName].clear();
441 if(mHistValid[iHistName]){
return mHistograms[iHistName].second;}
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< int > getLSCertification(std::string iHistName)
TH2F * loadHisto(std::string test, std::string histo)
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)
TH2F * getRebinnedHistogram(std::string iHistName, std::string iHistLocation)
void resetHisto(std::string test)
void updateHistogramEndRun(std::string iHistName)
void updateHistogramEndLS(std::string test, std::string histo, int iLS)
unsigned int getNBinsHistogram(std::string test)
mVerbose(fConfig.getUntrackedParameter< bool >("verbose", false))
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)