39 if(
object.
IsA()->InheritsFrom(
"TH2") ){
41 if(
histogram->GetDimension() != 2 ){
throw dqm_core::BadConfig( ERS_HERE, name,
"Not a 2D-histogram" ); }
42 }
else {
throw dqm_core::BadConfig( ERS_HERE, name,
"does not inherit from TH1/TH2" ); }
52 dqm_core::Result *
result =
new dqm_core::Result(dqm_core::Result::Undefined);
57 double gthreshold = 0., rthreshold = 0.;
61 }
catch( dqm_core::Exception & ex ) {
62 throw dqm_core::BadConfig( ERS_HERE, name, ex.what(), ex );
67 dqm_core::Result*
result =
new dqm_core::Result();
68 std::vector<bin2> redbins;
69 std::vector<bin2> yellowbins;
70 std::vector<bin2> Allbins;
73 TH1D* projected_strip = NULL;
77 int nmax = 0, nbins = 0;
78 double binval = 0., maxval = 0.;
80 double stripavg = 0.,striperr = 0.,striperr2 = 0.,testval = 0.;
87 for(ix = range[0]; ix <= range[1]; ++ix){
92 sprintf(hname,
"%s_py_bin%d",
histogram->GetName(),ix);
93 projected_strip =
histogram->ProjectionY(hname,ix,ix);
109 if(
nmax==0)
for(iy=1;iy<=projected_strip->GetXaxis()->GetNbins();iy++)
if(projected_strip->GetBinContent(iy)>0) nbins += 1;
112 projected_strip->GetMaximumBin(binphi,biny,binz);
113 maxval = projected_strip->GetBinContent(binphi);
120 stripavg = projected_strip->Integral()/(double)nbins;
123 if(nbins<=poissonLimit){
126 striperr = std::sqrt(stripavg);
131 for(iy=1;iy<=projected_strip->GetXaxis()->GetNbins();iy++)
if(projected_strip->GetBinContent(iy)>0) striperr2 += std::pow((projected_strip->GetBinContent(iy)-stripavg),2);
133 striperr = std::sqrt(striperr2)/std::sqrt((
double)nbins);
138 if(striperr>0.) testval = std::abs(maxval-stripavg)/striperr;
143 double phi = projected_strip->GetXaxis()->GetBinCenter(binphi);
144 bin2 onebin = {
eta,
phi,ix,binphi,binval,testval};
145 if(testval > rthreshold) redbins.push_back(onebin);
146 else if(testval > gthreshold) yellowbins.push_back(onebin);
148 Allbins.push_back(onebin);
158 projected_strip->SetBinContent(binphi,0);
164 delete projected_strip;
174 int count_red=0,count_yellow=0;
177 for(
unsigned int i=0;i<redbins.size();i++){
178 if(VisualMode)
continue;
180 sprintf(tmpstr,
"R%i-(eta,phi)[OSRatio]=(%0.3f,%0.3f)[%0.2e]",count_red,redbins[i].m_eta,redbins[i].m_phi,redbins[i].m_deviation);
181 std::string tag = tmpstr;
182 result->tags_[tag] = redbins[i].m_value;
186 if(count_red > NpublishRed)
break;
191 for(
unsigned int i=0;i<yellowbins.size();i++){
192 if(VisualMode)
continue;
193 if(publish && (count_red+count_yellow) < Nmaxpublish ){
194 sprintf(tmpstr,
"Y%i-(eta,phi)[OSRatio]=(%0.3f,%0.3f)[%.2e]",count_yellow,yellowbins[i].m_eta,yellowbins[i].m_phi,yellowbins[i].m_deviation);
195 std::string tag = tmpstr;
196 result->tags_[tag] = yellowbins[i].m_value;
200 result->tags_[
"NRedBins"] = count_red;
201 result->tags_[
"NYellowBins"] = count_yellow;
203 if(count_red+count_yellow==0 && Allbins.size()>0){
204 for(
unsigned int i=0;i<Allbins.size();i++){
205 sprintf(tmpstr,
"LeadingBin%u-(eta,phi)=(%0.3f,%0.3f)",i,Allbins[i].m_eta,Allbins[i].m_phi);
206 std::string tagtag = tmpstr;
207 result->tags_[tagtag] = Allbins[i].m_value;
211 if(count_red>0)
result->status_ = dqm_core::Result::Red;
212 else if(count_yellow>0)
result->status_ = dqm_core::Result::Yellow;
213 else result->status_ = dqm_core::Result::Green;
static dqm_algorithms::BinContentComp myInstance