CMS 3D CMS Logo

ContentsYRange Class Reference

#include <DQMServices/Core/interface/QTest.h>

Inheritance diagram for ContentsYRange:

SimpleTest QCriterion

List of all members.

Public Member Functions

 ContentsYRange (const std::string &name)
float runTest (const MonitorElement *me)
virtual void setAllowedYRange (float ymin, float ymax)
 set allowed range in Y-axis (default values: histogram's FULL Y-range)
void setUseEmptyBins (unsigned int useEmptyBins)

Static Public Member Functions

static std::string getAlgoName (void)

Protected Member Functions

void setMessage (void)
 set status & message after test has run

Protected Attributes

bool rangeInitialized_
 init-flag for ymin_, ymax_
unsigned int useEmptyBins_
float ymax_
float ymin_
 allowed range in Y-axis


Detailed Description

Definition at line 322 of file QTest.h.


Constructor & Destructor Documentation

ContentsYRange::ContentsYRange ( const std::string &  name  )  [inline]

Definition at line 325 of file QTest.h.

References getAlgoName(), rangeInitialized_, and QCriterion::setAlgoName().

00325                                         : SimpleTest(name,true)
00326   {
00327    rangeInitialized_ = false;
00328    setAlgoName(getAlgoName());
00329   }


Member Function Documentation

static std::string ContentsYRange::getAlgoName ( void   )  [inline, static]

Definition at line 335 of file QTest.h.

Referenced by ContentsYRange(), createYRangeTest(), QTestConfigure::enableTests(), QTestConfigure::EnableYRangeTest(), and QTestParameterNames::QTestParameterNames().

00336   { return "ContentsYRange"; }

float ContentsYRange::runTest ( const MonitorElement me  )  [virtual]

Standard test !

AS quality test !!!

end of AS quality tests

Reimplemented from QCriterion.

Definition at line 443 of file QTest.cc.

References SimpleTest::badChannels_, GenMuonPlsPt100GeV_cfg::cout, MonitorElement::DQM_KIND_TH1F, MonitorElement::DQM_KIND_TH1S, lat::endl(), cmsPerfPublish::fail(), first, MonitorElement::getFullname(), MonitorElement::getRootObject(), MonitorElement::getTH1F(), MonitorElement::getTH1S(), h, MonitorElement::kind(), prof2calltree::last, rangeInitialized_, useEmptyBins_, and ymax_.

00444 {
00445 
00446  badChannels_.clear();
00447 
00448  if (!me) return -1;
00449  if (!me->getRootObject()) return -1;
00450  TH1* h=0; 
00451 
00452  if (me->kind()==MonitorElement::DQM_KIND_TH1F) { 
00453   h = me->getTH1F(); //access Test histo
00454  } 
00455  else if (me->kind()==MonitorElement::DQM_KIND_TH1S) { 
00456   h = me->getTH1S(); //access Test histo
00457  } 
00458  else {
00459  std::cout<< "ContentsYRange ERROR: ME " << me->getFullname() << " does not contain TH1F/TH1S" << std::endl; 
00460  return -1;
00461  } 
00462 
00463   if (!rangeInitialized_ || !h->GetXaxis()) return 1; // all bins are accepted if no initialization
00464   Int_t ncx = h->GetXaxis()->GetNbins();
00465   // do NOT use underflow bin
00466   Int_t first = 1;
00467   // do NOT use overflow bin
00468   Int_t last  = ncx;
00469   // bins outside Y-range
00470   Int_t fail = 0;
00471   Int_t bin;
00472   
00473   if(useEmptyBins_)
00474   {
00475    for (bin = first; bin <= last; ++bin){
00476     Double_t contents = h->GetBinContent(bin);
00477     bool failure = false;
00478     failure = (contents < ymin_ || contents > ymax_); // allowed y-range: [ymin_, ymax_]
00479     if (failure) { 
00480      DQMChannel chan(bin, 0, 0, contents, h->GetBinError(bin));
00481      badChannels_.push_back(chan);
00482      ++fail;
00483     }
00484    }
00485    // return fraction of bins that passed test
00486    return 1.*(ncx - fail)/ncx;
00487   }
00488 
00489   else 
00490   {
00491    for (bin = first; bin <= last; ++bin){
00492     Double_t contents = h->GetBinContent(bin);
00493     bool failure = false;
00494      if(contents) failure = (contents < ymin_ || contents > ymax_); // allowed y-range: [ymin_, ymax_]
00495      if (failure) ++fail;
00496    }
00497    // return fraction of bins that passed test
00498    return 1.*(ncx - fail)/ncx;
00499   }  
00500 //=================== end of ContentsYRange =========// 
00501 }

virtual void ContentsYRange::setAllowedYRange ( float  ymin,
float  ymax 
) [inline, virtual]

set allowed range in Y-axis (default values: histogram's FULL Y-range)

Definition at line 339 of file QTest.h.

References rangeInitialized_, ymax_, and ymin_.

Referenced by createYRangeTest(), and QTestConfigure::EnableYRangeTest().

00340   { ymin_ = ymin; ymax_ = ymax; rangeInitialized_ = true; }

void ContentsYRange::setMessage ( void   )  [inline, protected, virtual]

set status & message after test has run

Reimplemented from SimpleTest.

Definition at line 345 of file QTest.h.

References QCriterion::algoName_, QCriterion::message_, QCriterion::prob_, and QCriterion::qtname_.

00345                         {
00346       std::ostringstream message;
00347       message << " Test " << qtname_ << " (" << algoName_
00348               << "): Bin fraction within Y range = " << prob_;
00349       message_ = message.str();
00350     }

void ContentsYRange::setUseEmptyBins ( unsigned int  useEmptyBins  )  [inline]

Definition at line 333 of file QTest.h.

References useEmptyBins_.

Referenced by QTestConfigure::EnableYRangeTest().

00333 { useEmptyBins_ = useEmptyBins; }


Member Data Documentation

bool ContentsYRange::rangeInitialized_ [protected]

init-flag for ymin_, ymax_

Definition at line 355 of file QTest.h.

Referenced by ContentsYRange(), runTest(), and setAllowedYRange().

unsigned int ContentsYRange::useEmptyBins_ [protected]

Definition at line 357 of file QTest.h.

Referenced by runTest(), and setUseEmptyBins().

float ContentsYRange::ymax_ [protected]

Definition at line 353 of file QTest.h.

Referenced by runTest(), and setAllowedYRange().

float ContentsYRange::ymin_ [protected]

allowed range in Y-axis

Definition at line 353 of file QTest.h.

Referenced by setAllowedYRange().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:16:47 2009 for CMSSW by  doxygen 1.5.4