#include <QTest.h>
Public Member Functions | |
Comp2RefEqualH (const std::string &name) | |
float | runTest (const MonitorElement *me) |
Static Public Member Functions | |
static std::string | getAlgoName (void) |
Comp2RefEqualH::Comp2RefEqualH | ( | const std::string & | name | ) | [inline] |
Definition at line 172 of file QTest.h.
References getAlgoName(), and QCriterion::setAlgoName().
: SimpleTest(name,true) { setAlgoName( getAlgoName() ); }
static std::string Comp2RefEqualH::getAlgoName | ( | void | ) | [inline, static] |
Definition at line 176 of file QTest.h.
Referenced by Comp2RefEqualH(), QTestConfigure::EnableComp2RefEqualHTest(), QTestConfigure::enableTests(), and QTestParameterNames::QTestParameterNames().
{ return "Comp2RefEqualH"; }
float Comp2RefEqualH::runTest | ( | const MonitorElement * | me | ) | [virtual] |
Reimplemented from QCriterion.
Definition at line 40 of file QTest.cc.
References newFWLiteAna::bin, cmsMakeMELists::contents, gather_cfg::cout, MonitorElement::DQM_KIND_TH1D, MonitorElement::DQM_KIND_TH1F, MonitorElement::DQM_KIND_TH1S, MonitorElement::DQM_KIND_TH2D, MonitorElement::DQM_KIND_TH2F, MonitorElement::DQM_KIND_TH2S, MonitorElement::DQM_KIND_TH3F, first, MonitorElement::getRefRootObject(), MonitorElement::getRefTH1D(), MonitorElement::getRefTH1F(), MonitorElement::getRefTH1S(), MonitorElement::getRefTH2D(), MonitorElement::getRefTH2F(), MonitorElement::getRefTH2S(), MonitorElement::getRefTH3F(), MonitorElement::getRootObject(), MonitorElement::getTH1D(), MonitorElement::getTH1F(), MonitorElement::getTH1S(), MonitorElement::getTH2D(), MonitorElement::getTH2F(), MonitorElement::getTH2S(), MonitorElement::getTH3F(), h, MonitorElement::kind(), prof2calltree::last, and pileupCalc::nbins.
{ badChannels_.clear(); if (!me) return -1; if (!me->getRootObject() || !me->getRefRootObject()) return -1; TH1* h=0; //initialize histogram pointer TH1* ref_=0; if (verbose_>1) std::cout << "QTest:" << getAlgoName() << "::runTest called on " << me-> getFullname() << "\n"; int nbins=0; int nbinsref=0; //-- TH1F if (me->kind()==MonitorElement::DQM_KIND_TH1F) { nbins = me->getTH1F()->GetXaxis()->GetNbins(); nbinsref = me->getRefTH1F()->GetXaxis()->GetNbins(); h = me->getTH1F(); // access Test histo ref_ = me->getRefTH1F(); //access Ref hiso if (nbins != nbinsref) return -1; } //-- TH1S else if (me->kind()==MonitorElement::DQM_KIND_TH1S) { nbins = me->getTH1S()->GetXaxis()->GetNbins(); nbinsref = me->getRefTH1S()->GetXaxis()->GetNbins(); h = me->getTH1S(); // access Test histo ref_ = me->getRefTH1S(); //access Ref hiso if (nbins != nbinsref) return -1; } //-- TH1D else if (me->kind()==MonitorElement::DQM_KIND_TH1D) { nbins = me->getTH1D()->GetXaxis()->GetNbins(); nbinsref = me->getRefTH1D()->GetXaxis()->GetNbins(); h = me->getTH1D(); // access Test histo ref_ = me->getRefTH1D(); //access Ref hiso if (nbins != nbinsref) return -1; } //-- TH2 else if (me->kind()==MonitorElement::DQM_KIND_TH2F) { nbins = me->getTH2F()->GetXaxis()->GetNbins() * me->getTH2F()->GetYaxis()->GetNbins(); nbinsref = me->getRefTH2F()->GetXaxis()->GetNbins() * me->getRefTH2F()->GetYaxis()->GetNbins(); h = me->getTH2F(); // access Test histo ref_ = me->getRefTH2F(); //access Ref hiso if (nbins != nbinsref) return -1; } //-- TH2 else if (me->kind()==MonitorElement::DQM_KIND_TH2S) { nbins = me->getTH2S()->GetXaxis()->GetNbins() * me->getTH2S()->GetYaxis()->GetNbins(); nbinsref = me->getRefTH2S()->GetXaxis()->GetNbins() * me->getRefTH2S()->GetYaxis()->GetNbins(); h = me->getTH2S(); // access Test histo ref_ = me->getRefTH2S(); //access Ref hiso if (nbins != nbinsref) return -1; } //-- TH2 else if (me->kind()==MonitorElement::DQM_KIND_TH2D) { nbins = me->getTH2D()->GetXaxis()->GetNbins() * me->getTH2D()->GetYaxis()->GetNbins(); nbinsref = me->getRefTH2D()->GetXaxis()->GetNbins() * me->getRefTH2D()->GetYaxis()->GetNbins(); h = me->getTH2D(); // access Test histo ref_ = me->getRefTH2D(); //access Ref hiso if (nbins != nbinsref) return -1; } //-- TH3 else if (me->kind()==MonitorElement::DQM_KIND_TH3F) { nbins = me->getTH3F()->GetXaxis()->GetNbins() * me->getTH3F()->GetYaxis()->GetNbins() * me->getTH3F()->GetZaxis()->GetNbins(); nbinsref = me->getRefTH3F()->GetXaxis()->GetNbins() * me->getRefTH3F()->GetYaxis()->GetNbins() * me->getRefTH3F()->GetZaxis()->GetNbins(); h = me->getTH3F(); // access Test histo ref_ = me->getRefTH3F(); //access Ref hiso if (nbins != nbinsref) return -1; } else { if (verbose_>0) std::cout << "QTest:Comp2RefEqualH" << " ME does not contain TH1F/TH1S/TH1D/TH2F/TH2S/TH2D/TH3F, exiting\n"; return -1; } //-- QUALITY TEST itself int first = 0; // 1 //(use underflow bin) int last = nbins+1; //(use overflow bin) bool failure = false; for (int bin=first;bin<=last;bin++) { double contents = h->GetBinContent(bin); if (contents != ref_->GetBinContent(bin)) { failure = true; DQMChannel chan(bin, 0, 0, contents, h->GetBinError(bin)); badChannels_.push_back(chan); } } if (failure) return 0; return 1; }