![]() |
![]() |
#include <BTagValidator.h>
Public Member Functions | |
BTagValidator (const edm::ParameterSet &) | |
~BTagValidator () | |
Private Types | |
typedef std::vector< std::string > | vstring |
Private Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
virtual void | beginJob () |
virtual void | endJob () |
Private Attributes | |
std::string | algorithm_ |
bool | doCompare_ |
std::string | DQMFile_ |
vstring | histogramList_ |
std::string | referenceFilename_ |
std::string | rootFile_ |
_________________________________________________________________ class: BTagValidator.h package: Validation/RecoB
author: Victor Bazterra, UIC Francisco Yumiceva, Fermilab (yumiceva@fnal.gov)
version
________________________________________________________________
Definition at line 33 of file BTagValidator.h.
typedef std::vector<std::string> BTagValidator::vstring [private] |
Definition at line 47 of file BTagValidator.h.
BTagValidator::BTagValidator | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
_________________________________________________________________ class: BTagValidator.cc package: Validation/RecoB
author: Victor Bazterra, UIC Francisco Yumiceva, Fermilab (yumiceva@fnal.gov)
version
________________________________________________________________
Definition at line 33 of file BTagValidator.cc.
References algorithm_, doCompare_, DQMFile_, edm::ParameterSet::getParameter(), edm::getReleaseVersion(), histogramList_, referenceFilename_, and rootFile_.
{ algorithm_ = iConfig.getParameter<std::string>( "algorithm" ); rootFile_ = iConfig.getParameter<std::string>( "rootfile" ); DQMFile_ = iConfig.getParameter<std::string>( "DQMFile" ); TString tversion(edm::getReleaseVersion()); tversion = tversion.Remove(0,1); tversion = tversion.Remove(tversion.Length()-1,tversion.Length()); DQMFile_ = std::string(tversion)+"_"+DQMFile_; histogramList_ = iConfig.getParameter<vstring>( "histogramList" ); referenceFilename_ = iConfig.getParameter<std::string>( "referenceFilename" ); doCompare_ = iConfig.getParameter<bool>( "compareHistograms"); }
BTagValidator::~BTagValidator | ( | ) |
Definition at line 49 of file BTagValidator.cc.
{ }
void BTagValidator::analyze | ( | const edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
virtual void BTagValidator::beginJob | ( | void | ) | [inline, private, virtual] |
void BTagValidator::endJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 65 of file BTagValidator.cc.
References algorithm_, DQMStore::book1D(), DQMStore::book2D(), DQMStore::book3D(), HistoCompare::Compare(), doCompare_, DQMFile_, Exception, mergeVDriftHistosByStation::file, histogramList_, i, cmsCodeRules::cppFunctionSkipper::operator, referenceFilename_, rootFile_, DQMStore::save(), MonitorElement::setAxisTitle(), MonitorElement::setBinContent(), MonitorElement::setBinError(), DQMStore::setCurrentFolder(), HistoCompare::SetReferenceFilename(), DQMStore::showDirStructure(), x, detailsBasic3DVector::y, and z.
{ // Validation section TObject * tObject ; // DQM element MonitorElement* monElement ; MonitorElement* monElementRes; TFile * file = new TFile ( TString ( rootFile_ ) ) ; // comparison HistoCompare hcompare; if (doCompare_) hcompare.SetReferenceFilename(TString(referenceFilename_) ); file->cd(); // get hold of back-end interface DQMStore * dbe = edm::Service<DQMStore>().operator->(); dbe->setCurrentFolder( "RecoBV/"+algorithm_ ); for (std::size_t i=0; i<histogramList_.size(); ++i) { tObject = gDirectory->Get( TString( histogramList_[i] ) ) ; if ( tObject == 0 ) throw cms::Exception("BTagValidator") << "Histogram " << histogramList_[i] << " was not produced in the analysis. "; if ( tObject->IsA()->InheritsFrom( "TH1" ) ) { TH1 * histogram = (TH1*) tObject ; TH1* hresiduals = 0; if (doCompare_) hresiduals = hcompare.Compare(histogram, "/DQMData/"+TString(algorithm_)+"/"+TString(histogram->GetName()) ); file->cd(); monElement = dbe->book1D ( std::string( histogram->GetName() ), std::string( histogram->GetTitle() ), histogram->GetXaxis()->GetNbins(), histogram->GetXaxis()->GetXmin(), histogram->GetXaxis()->GetXmax() ); monElement->setAxisTitle( std::string ( histogram->GetXaxis()->GetTitle()) , 1); monElement->setAxisTitle( std::string ( histogram->GetYaxis()->GetTitle()) , 2); for(Int_t x=0; x<histogram->GetXaxis()->GetNbins(); x++) { monElement->setBinContent ( x, histogram->GetBinContent( x ) ) ; monElement->setBinError ( x, histogram->GetBinError( x ) ) ; } if (doCompare_ && hresiduals!= 0 ) { monElementRes = dbe->book1D ( std::string( hresiduals->GetName() ), std::string( hresiduals->GetTitle() ), hresiduals->GetXaxis()->GetNbins(), hresiduals->GetXaxis()->GetXmin(), hresiduals->GetXaxis()->GetXmax() ); for(Int_t x=0; x<hresiduals->GetXaxis()->GetNbins(); x++) { monElementRes->setBinContent ( x, hresiduals->GetBinContent( x ) ) ; monElementRes->setBinError ( x, hresiduals->GetBinError( x ) ) ; } } } else if ( tObject->IsA()->InheritsFrom( "TH2" ) ) { TH2 * histogram = (TH2*) tObject ; monElement = dbe->book2D ( std::string( histogram->GetName() ), std::string( histogram->GetTitle() ), histogram->GetXaxis()->GetNbins(), histogram->GetXaxis()->GetXmin(), histogram->GetXaxis()->GetXmax(), histogram->GetYaxis()->GetNbins(), histogram->GetYaxis()->GetXmin(), histogram->GetYaxis()->GetXmax() ); monElement->setAxisTitle( std::string ( histogram->GetXaxis()->GetTitle()) , 1); monElement->setAxisTitle( std::string ( histogram->GetYaxis()->GetTitle()) , 2); for(Int_t x=0; x<histogram->GetXaxis()->GetNbins(); x++) for(Int_t y=0; y<histogram->GetYaxis()->GetNbins(); y++) { monElement->setBinContent ( x, y, histogram->GetBinContent( x, y ) ) ; monElement->setBinError ( x, y, histogram->GetBinError( x, y ) ) ; } } else if ( tObject->IsA()->InheritsFrom( "TH3" ) ) { TH3 * histogram = (TH3*) tObject ; monElement = dbe->book3D ( std::string( histogram->GetName() ), std::string( histogram->GetTitle() ), histogram->GetXaxis()->GetNbins(), histogram->GetXaxis()->GetXmin(), histogram->GetXaxis()->GetXmax(), histogram->GetYaxis()->GetNbins(), histogram->GetYaxis()->GetXmin(), histogram->GetYaxis()->GetXmax(), histogram->GetZaxis()->GetNbins(), histogram->GetZaxis()->GetXmin(), histogram->GetZaxis()->GetXmax() ); monElement->setAxisTitle( std::string ( histogram->GetXaxis()->GetTitle()) , 1); monElement->setAxisTitle( std::string ( histogram->GetYaxis()->GetTitle()) , 2); for(Int_t x=0; x<histogram->GetXaxis()->GetNbins(); x++) for(Int_t y=0; y<histogram->GetYaxis()->GetNbins(); y++) for(Int_t z=0; z<histogram->GetZaxis()->GetNbins(); z++) { monElement->setBinContent ( x, y, z, histogram->GetBinContent( x, y, z ) ) ; monElement->setBinError ( x, y, z, histogram->GetBinError( x, y, z ) ) ; } } } dbe->showDirStructure() ; dbe->save(DQMFile_) ; file->Close() ; }
std::string BTagValidator::algorithm_ [private] |
Definition at line 49 of file BTagValidator.h.
Referenced by BTagValidator(), and endJob().
bool BTagValidator::doCompare_ [private] |
Definition at line 54 of file BTagValidator.h.
Referenced by BTagValidator(), and endJob().
std::string BTagValidator::DQMFile_ [private] |
Definition at line 51 of file BTagValidator.h.
Referenced by BTagValidator(), and endJob().
vstring BTagValidator::histogramList_ [private] |
Definition at line 53 of file BTagValidator.h.
Referenced by BTagValidator(), and endJob().
std::string BTagValidator::referenceFilename_ [private] |
Definition at line 52 of file BTagValidator.h.
Referenced by BTagValidator(), and endJob().
std::string BTagValidator::rootFile_ [private] |
Definition at line 50 of file BTagValidator.h.
Referenced by BTagValidator(), and endJob().