Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:58:25

0001 #include "DQMOffline/RecoB/interface/TagCorrelationPlotter.h"
0002 #include "DQMOffline/RecoB/interface/Tools.h"
0003 
0004 #include <string>
0005 
0006 using namespace std;
0007 using namespace RecoBTag;
0008 
0009 TagCorrelationPlotter::TagCorrelationPlotter(const std::string& tagName1,
0010                                              const std::string& tagName2,
0011                                              const EtaPtBin& etaPtBin,
0012                                              const edm::ParameterSet& pSet,
0013                                              unsigned int mc,
0014                                              bool doCTagPlots,
0015                                              bool finalize,
0016                                              DQMStore::IBooker& ibook)
0017     : BaseBTagPlotter(tagName2 + "_vs_" + tagName1, etaPtBin),
0018       lowerBound1_(pSet.getParameter<double>("Discr1Start")),
0019       lowerBound2_(pSet.getParameter<double>("Discr2Start")),
0020       upperBound1_(pSet.getParameter<double>("Discr1End")),
0021       upperBound2_(pSet.getParameter<double>("Discr2End")),
0022       nBinEffPur_(pSet.getParameter<int>("nBinEffPur")),
0023       startEffPur_(pSet.getParameter<double>("startEffPur")),
0024       endEffPur_(pSet.getParameter<double>("endEffPur")),
0025       createProfile_(pSet.getParameter<bool>("CreateProfile")),
0026       fixedEff_(pSet.getParameter<vector<double>>("fixedEff")),
0027       mcPlots_(mc),
0028       doCTagPlots_(doCTagPlots),
0029       finalize_(finalize) {
0030   if (finalize_)
0031     return;
0032   correlationHisto_ =
0033       std::make_unique<FlavourHistograms2D<double, double>>("correlation" + theExtensionString,
0034                                                             tagName2 + " discr vs " + tagName1 + " discr",
0035                                                             102,
0036                                                             lowerBound1_,
0037                                                             upperBound1_,
0038                                                             102,
0039                                                             lowerBound2_,
0040                                                             upperBound2_,
0041                                                             false,
0042                                                             "TagCorrelation" + theExtensionString,
0043                                                             mc,
0044                                                             createProfile_,
0045                                                             ibook);
0046   correlationHisto_->settitle(tagName1.c_str(), tagName2.c_str());
0047 }
0048 
0049 TagCorrelationPlotter::~TagCorrelationPlotter() {}
0050 
0051 void TagCorrelationPlotter::epsPlot(const std::string& name) { effPurFromHistos2D->epsPlot(name); }
0052 
0053 void TagCorrelationPlotter::analyzeTags(const reco::JetTag& jetTag1,
0054                                         const reco::JetTag& jetTag2,
0055                                         int jetFlavour,
0056                                         float w /*=1*/) {
0057   correlationHisto_->fill(jetFlavour, jetTag1.second, jetTag2.second, w);
0058 }
0059 
0060 void TagCorrelationPlotter::analyzeTags(float discr1, float discr2, int jetFlavour, float w /*=1*/) {
0061   correlationHisto_->fill(jetFlavour, discr1, discr2, w);
0062 }
0063 
0064 void TagCorrelationPlotter::finalize(DQMStore::IBooker& ibook_, DQMStore::IGetter& igetter_) {
0065   correlationHisto_ = std::make_unique<FlavourHistograms2D<double, double>>("correlation" + theExtensionString,
0066                                                                             " discr vs discr",
0067                                                                             102,
0068                                                                             lowerBound1_,
0069                                                                             upperBound1_,
0070                                                                             102,
0071                                                                             lowerBound2_,
0072                                                                             upperBound2_,
0073                                                                             "TagCorrelation" + theExtensionString,
0074                                                                             mcPlots_,
0075                                                                             createProfile_,
0076                                                                             igetter_);
0077 
0078   effPurFromHistos2D = std::make_unique<EffPurFromHistos2D>(*correlationHisto_,
0079                                                             "TagCorrelation" + theExtensionString,
0080                                                             mcPlots_,
0081                                                             ibook_,
0082                                                             nBinEffPur_,
0083                                                             startEffPur_,
0084                                                             endEffPur_);
0085   effPurFromHistos2D->doCTagPlots(doCTagPlots_);
0086   effPurFromHistos2D->compute(ibook_, fixedEff_);
0087 }