![]() |
![]() |
#include <BTagDifferentialPlot.h>
Definition at line 15 of file BTagDifferentialPlot.h.
Definition at line 19 of file BTagDifferentialPlot.h.
BTagDifferentialPlot::BTagDifferentialPlot | ( | const double & | bEff, |
const ConstVarType & | constVariable, | ||
const std::string & | tagName | ||
) |
Definition at line 20 of file BTagDifferentialPlot.cc.
: fixedBEfficiency ( bEff ) , noProcessing ( false ) , processed(false), constVar(constVariable), constVariableName ( "" ) , diffVariableName ( "" ) , constVariableValue ( 999.9 , 999.9 ) , commonName( "MisidForBEff_" + tagName+"_") , theDifferentialHistoB_d ( 0 ) , theDifferentialHistoB_u ( 0 ) , theDifferentialHistoB_s ( 0 ) , theDifferentialHistoB_c ( 0 ) , theDifferentialHistoB_b ( 0 ) , theDifferentialHistoB_g ( 0 ) , theDifferentialHistoB_ni ( 0 ) , theDifferentialHistoB_dus ( 0 ) , theDifferentialHistoB_dusg ( 0 ) {}
BTagDifferentialPlot::~BTagDifferentialPlot | ( | ) |
Definition at line 37 of file BTagDifferentialPlot.cc.
{ }
void BTagDifferentialPlot::addBinPlotter | ( | JetTagPlotter * | aPlotter | ) | [inline] |
Definition at line 26 of file BTagDifferentialPlot.h.
References theBinPlotters.
{ theBinPlotters.push_back ( aPlotter ) ; }
void BTagDifferentialPlot::bookHisto | ( | ) | [private] |
Definition at line 1066 of file PhotonAnalyzer.cc.
References newFWLiteAna::bin, DQMStore::book1D(), dbe_, max(), min, DQMStore::pwd(), and indexGen::title.
Referenced by process().
{ int histo_index = 0; stringstream histo_number_stream; //determining which folder we're in if(dbe_->pwd().find( "InvMass" ) != string::npos){ histo_index_invMass_++; histo_index = histo_index_invMass_; } if(dbe_->pwd().find( "Efficiencies" ) != string::npos){ histo_index_efficiency_++; histo_index = histo_index_efficiency_; } histo_number_stream << "h_"; if(histo_index<10) histo_number_stream << "0"; histo_number_stream << histo_index; return dbe_->book1D(histo_number_stream.str()+"_"+histoName,title,bin,min,max); }
void BTagDifferentialPlot::epsPlot | ( | const std::string & | name | ) |
void BTagDifferentialPlot::fillHisto | ( | ) | [private] |
Definition at line 265 of file BTagDifferentialPlot.cc.
References diffVariableName, Exception, fixedBEfficiency, EffPurFromHistos::getEffFlavVsBEff_b(), EffPurFromHistos::getEffFlavVsBEff_c(), EffPurFromHistos::getEffFlavVsBEff_d(), EffPurFromHistos::getEffFlavVsBEff_dus(), EffPurFromHistos::getEffFlavVsBEff_dusg(), EffPurFromHistos::getEffFlavVsBEff_g(), EffPurFromHistos::getEffFlavVsBEff_ni(), EffPurFromHistos::getEffFlavVsBEff_s(), EffPurFromHistos::getEffFlavVsBEff_u(), EtaPtBin::getEtaActive(), EtaPtBin::getEtaMax(), EtaPtBin::getEtaMin(), getMistag(), EtaPtBin::getPtActive(), EtaPtBin::getPtMax(), EtaPtBin::getPtMin(), MonitorElement::getTH1F(), theBinPlotters, theDifferentialHistoB_b, theDifferentialHistoB_c, theDifferentialHistoB_d, theDifferentialHistoB_dus, theDifferentialHistoB_dusg, theDifferentialHistoB_g, theDifferentialHistoB_ni, theDifferentialHistoB_s, theDifferentialHistoB_u, and funct::true.
Referenced by process().
{ // loop over bins and find corresponding misid. in the MisIdVs..... histo for ( vector<JetTagPlotter *>::const_iterator iP = theBinPlotters.begin() ; iP != theBinPlotters.end() ; ++iP ) { const EtaPtBin & currentBin = (*iP)->etaPtBin() ; EffPurFromHistos * currentEffPurFromHistos = (*iP)->getEffPurFromHistos() ; // bool isActive = true ; double valueXAxis = -999.99 ; // find right bin based on middle of the interval if ( diffVariableName == "eta" ) { isActive = currentBin.getEtaActive() ; valueXAxis = 0.5 * ( currentBin.getEtaMin() + currentBin.getEtaMax() ) ; } else if ( diffVariableName == "pt" ) { isActive = currentBin.getPtActive() ; valueXAxis = 0.5 * ( currentBin.getPtMin() + currentBin.getPtMax() ) ; } else { throw cms::Exception("Configuration") << "====>>>> BTagDifferentialPlot::fillHisto() : illegal diffVariableName = " << diffVariableName << endl; } // for the moment: ignore inactive bins // (maybe later: if a Bin is inactive -> set value to fill well below left edge of histogram to have it in the underflow) if ( !isActive ) continue ; // to have less lines of code .... vector< pair<TH1F*,TH1F*> > effPurDifferentialPairs ; // all flavours (b is a good cross check! must be constant and = fixed b-efficiency) // get histo; find the bin of the fixed b-efficiency in the histo and get misid; fill effPurDifferentialPairs.push_back ( make_pair ( currentEffPurFromHistos->getEffFlavVsBEff_d() , theDifferentialHistoB_d ->getTH1F() ) ) ; effPurDifferentialPairs.push_back ( make_pair ( currentEffPurFromHistos->getEffFlavVsBEff_u() , theDifferentialHistoB_u ->getTH1F() ) ) ; effPurDifferentialPairs.push_back ( make_pair ( currentEffPurFromHistos->getEffFlavVsBEff_s() , theDifferentialHistoB_s ->getTH1F() ) ) ; effPurDifferentialPairs.push_back ( make_pair ( currentEffPurFromHistos->getEffFlavVsBEff_c() , theDifferentialHistoB_c ->getTH1F() ) ) ; effPurDifferentialPairs.push_back ( make_pair ( currentEffPurFromHistos->getEffFlavVsBEff_b() , theDifferentialHistoB_b ->getTH1F() ) ) ; effPurDifferentialPairs.push_back ( make_pair ( currentEffPurFromHistos->getEffFlavVsBEff_g() , theDifferentialHistoB_g ->getTH1F() ) ) ; effPurDifferentialPairs.push_back ( make_pair ( currentEffPurFromHistos->getEffFlavVsBEff_ni() , theDifferentialHistoB_ni ->getTH1F() ) ) ; effPurDifferentialPairs.push_back ( make_pair ( currentEffPurFromHistos->getEffFlavVsBEff_dus() , theDifferentialHistoB_dus->getTH1F() ) ) ; effPurDifferentialPairs.push_back ( make_pair ( currentEffPurFromHistos->getEffFlavVsBEff_dusg() , theDifferentialHistoB_dusg->getTH1F() ) ) ; for ( vector< pair<TH1F*,TH1F*> >::const_iterator itP = effPurDifferentialPairs.begin() ; itP != effPurDifferentialPairs.end() ; ++itP ) { TH1F * effPurHist = itP->first ; TH1F * diffHist = itP->second ; pair<double, double> mistag = getMistag(fixedBEfficiency, effPurHist); int iBinSet = diffHist->FindBin(valueXAxis) ; diffHist->SetBinContent(iBinSet, mistag.first); diffHist->SetBinError(iBinSet, mistag.second); } } }
TH1F* BTagDifferentialPlot::getDifferentialHistoB_b | ( | ) | [inline] |
Definition at line 47 of file BTagDifferentialPlot.h.
References MonitorElement::getTH1F(), and theDifferentialHistoB_b.
{ return theDifferentialHistoB_b ->getTH1F() ; }
TH1F* BTagDifferentialPlot::getDifferentialHistoB_c | ( | ) | [inline] |
Definition at line 46 of file BTagDifferentialPlot.h.
References MonitorElement::getTH1F(), and theDifferentialHistoB_c.
{ return theDifferentialHistoB_c ->getTH1F() ; }
TH1F* BTagDifferentialPlot::getDifferentialHistoB_d | ( | ) | [inline] |
Definition at line 43 of file BTagDifferentialPlot.h.
References MonitorElement::getTH1F(), and theDifferentialHistoB_d.
{ return theDifferentialHistoB_d ->getTH1F() ; }
TH1F* BTagDifferentialPlot::getDifferentialHistoB_dus | ( | ) | [inline] |
Definition at line 50 of file BTagDifferentialPlot.h.
References MonitorElement::getTH1F(), and theDifferentialHistoB_dus.
{ return theDifferentialHistoB_dus->getTH1F() ; }
TH1F* BTagDifferentialPlot::getDifferentialHistoB_dusg | ( | ) | [inline] |
Definition at line 51 of file BTagDifferentialPlot.h.
References MonitorElement::getTH1F(), and theDifferentialHistoB_dusg.
{ return theDifferentialHistoB_dusg->getTH1F() ; }
TH1F* BTagDifferentialPlot::getDifferentialHistoB_g | ( | ) | [inline] |
Definition at line 48 of file BTagDifferentialPlot.h.
References MonitorElement::getTH1F(), and theDifferentialHistoB_g.
{ return theDifferentialHistoB_g ->getTH1F() ; }
TH1F* BTagDifferentialPlot::getDifferentialHistoB_ni | ( | ) | [inline] |
Definition at line 49 of file BTagDifferentialPlot.h.
References MonitorElement::getTH1F(), and theDifferentialHistoB_ni.
{ return theDifferentialHistoB_ni->getTH1F() ; }
TH1F* BTagDifferentialPlot::getDifferentialHistoB_s | ( | ) | [inline] |
Definition at line 45 of file BTagDifferentialPlot.h.
References MonitorElement::getTH1F(), and theDifferentialHistoB_s.
{ return theDifferentialHistoB_s ->getTH1F() ; }
TH1F* BTagDifferentialPlot::getDifferentialHistoB_u | ( | ) | [inline] |
Definition at line 44 of file BTagDifferentialPlot.h.
References MonitorElement::getTH1F(), and theDifferentialHistoB_u.
{ return theDifferentialHistoB_u ->getTH1F() ; }
pair< double, double > BTagDifferentialPlot::getMistag | ( | const double & | fixedBEfficiency, |
TH1F * | effPurHist | ||
) | [private] |
Definition at line 322 of file BTagDifferentialPlot.cc.
References i.
Referenced by fillHisto().
{ int iBinGet = effPurHist->FindBin ( fixedBEfficiency ) ; double effForBEff = effPurHist->GetBinContent ( iBinGet ) ; double effForBEffErr = effPurHist->GetBinError ( iBinGet ) ; if (effForBEff==0. && effForBEffErr==0.) { // The bin was empty. Could be that it was not filled, as the scan-plot // did not have an entry at the requested value, or that the curve // is above or below. // Fit a plynomial, and evaluate the mistag at the requested value. int fitStatus; try { fitStatus = effPurHist->Fit("pol4", "q"); }catch (...){ return pair<double, double>(effForBEff, effForBEffErr); } if (fitStatus != 0) { edm::LogWarning("BTagDifferentialPlot")<<"Fit failed to hisogram " << effPurHist->GetTitle() << " , perhaps because too few entries = " << effPurHist->GetEntries() <<". This bin will be missing in plots at fixed b efficiency."; // } else { // edm::LogInfo("BTagDifferentialPlot")<<"Fit OK to hisogram " << effPurHist->GetTitle() << " entries = " << effPurHist->GetEntries(); return pair<double, double>(effForBEff, effForBEffErr); } TF1 *myfunc = effPurHist->GetFunction("pol4"); effForBEff = myfunc->Eval(fixedBEfficiency); effPurHist->RecursiveRemove(myfunc); //Error: first non-empty bin on the right and take its error for (int i = iBinGet+1; i< effPurHist->GetNbinsX(); ++i) { if (effPurHist->GetBinContent(i)!=0) { effForBEffErr = effPurHist->GetBinError(i); break; } } } return pair<double, double>(effForBEff, effForBEffErr); }
void BTagDifferentialPlot::plot | ( | const std::string & | name, |
const std::string & | ext | ||
) |
Definition at line 165 of file BTagDifferentialPlot.cc.
References commonName, plot(), and processed.
{ if (!processed) return; TCanvas tc(commonName.c_str(), commonName.c_str()); plot(tc); tc.Print((name + commonName + ext).c_str()); }
void BTagDifferentialPlot::plot | ( | TCanvas & | theCanvas | ) |
Definition at line 45 of file BTagDifferentialPlot.cc.
References MonitorElement::getTH1F(), processed, theDifferentialHistoB_c, theDifferentialHistoB_dus, theDifferentialHistoB_g, and theDifferentialHistoB_ni.
Referenced by epsPlot(), plot(), and psPlot().
{ // thePlotCanvas = new TCanvas( commonName , // commonName , // btppXCanvas , btppYCanvas ) ; // // if ( !btppTitle ) gStyle->SetOptTitle ( 0 ) ; if (!processed) return; //fixme: bool btppNI = false; bool btppColour = true; thePlotCanvas.SetFillColor ( 0 ) ; thePlotCanvas.cd ( 1 ) ; gPad->SetLogy ( 1 ) ; gPad->SetGridx ( 1 ) ; gPad->SetGridy ( 1 ) ; int col_b ; int col_c ; int col_g ; int col_dus ; int col_ni ; int mStyle_b ; int mStyle_c ; int mStyle_g ; int mStyle_dus ; int mStyle_ni ; // marker size (same for all) float mSize = 1.5 ; if ( btppColour ) { col_b = 2 ; col_c = 6 ; col_g = 3 ; col_dus = 4 ; col_ni = 5 ; mStyle_b = 20 ; mStyle_c = 20 ; mStyle_g = 20 ; mStyle_dus = 20 ; mStyle_ni = 20 ; } else { col_b = 1 ; col_c = 1 ; col_g = 1 ; col_dus = 1 ; col_ni = 1 ; mStyle_b = 12 ; mStyle_c = 22 ; mStyle_g = 29 ; mStyle_dus = 20 ; mStyle_ni = 27 ; } // for the moment: plot b (to see what the constant b-efficiency is), c, g, uds // b in red // No, do not plot b (because only visible for the soft leptons) // theDifferentialHistoB_b -> GetXaxis()->SetTitle ( diffVariableName ) ; // theDifferentialHistoB_b -> GetYaxis()->SetTitle ( "non b-jet efficiency" ) ; // theDifferentialHistoB_b -> GetYaxis()->SetTitleOffset ( 1.25 ) ; // theDifferentialHistoB_b -> SetMaximum ( 0.4 ) ; // theDifferentialHistoB_b -> SetMinimum ( 1.e-4 ) ; // theDifferentialHistoB_b -> SetMarkerColor ( col_b ) ; // theDifferentialHistoB_b -> SetLineColor ( col_b ) ; // theDifferentialHistoB_b -> SetMarkerSize ( mSize ) ; // theDifferentialHistoB_b -> SetMarkerStyle ( mStyle_b ) ; // theDifferentialHistoB_b -> SetStats ( false ) ; // theDifferentialHistoB_b -> Draw ( "pe" ) ; // c in magenta theDifferentialHistoB_c ->getTH1F() -> SetMaximum ( 0.4 ) ; theDifferentialHistoB_c ->getTH1F() -> SetMinimum ( 1.e-4 ) ; theDifferentialHistoB_c ->getTH1F() -> SetMarkerColor ( col_c ) ; theDifferentialHistoB_c ->getTH1F() -> SetLineColor ( col_c ) ; theDifferentialHistoB_c ->getTH1F() -> SetMarkerSize ( mSize ) ; theDifferentialHistoB_c ->getTH1F() -> SetMarkerStyle ( mStyle_c ) ; theDifferentialHistoB_c ->getTH1F() -> SetStats ( false ) ; // theDifferentialHistoB_c -> Draw("peSame") ; theDifferentialHistoB_c ->getTH1F()-> Draw("pe") ; // uds in blue theDifferentialHistoB_dus ->getTH1F()-> SetMarkerColor ( col_dus ) ; theDifferentialHistoB_dus ->getTH1F()-> SetLineColor ( col_dus ) ; theDifferentialHistoB_dus ->getTH1F()-> SetMarkerSize ( mSize ) ; theDifferentialHistoB_dus ->getTH1F()-> SetMarkerStyle ( mStyle_dus ) ; theDifferentialHistoB_dus ->getTH1F()-> SetStats ( false ) ; theDifferentialHistoB_dus ->getTH1F()-> Draw("peSame") ; // g in green // only uds not to confuse theDifferentialHistoB_g ->getTH1F()-> SetMarkerColor ( col_g ) ; theDifferentialHistoB_g ->getTH1F()-> SetLineColor ( col_g ) ; theDifferentialHistoB_g ->getTH1F()-> SetMarkerSize ( mSize ) ; theDifferentialHistoB_g ->getTH1F()-> SetMarkerStyle ( mStyle_g ) ; theDifferentialHistoB_g ->getTH1F()-> SetStats ( false ) ; theDifferentialHistoB_g ->getTH1F()-> Draw("peSame") ; // NI if wanted if ( btppNI ) { theDifferentialHistoB_ni ->getTH1F()-> SetMarkerColor ( col_ni ) ; theDifferentialHistoB_ni ->getTH1F()-> SetLineColor ( col_ni ) ; theDifferentialHistoB_ni ->getTH1F()-> SetMarkerSize ( mSize ) ; theDifferentialHistoB_ni ->getTH1F()-> SetMarkerStyle ( mStyle_ni ) ; theDifferentialHistoB_ni ->getTH1F()-> SetStats ( false ) ; theDifferentialHistoB_ni ->getTH1F()-> Draw("peSame") ; } }
void BTagDifferentialPlot::process | ( | ) |
Definition at line 174 of file BTagDifferentialPlot.cc.
References bookHisto(), fillHisto(), noProcessing, processed, and setVariableName().
{ setVariableName () ; // also sets noProcessing if not OK if ( noProcessing ) return ; bookHisto () ; fillHisto () ; processed = true; }
void BTagDifferentialPlot::psPlot | ( | const std::string & | name | ) |
void BTagDifferentialPlot::setVariableName | ( | ) | [private] |
Definition at line 183 of file BTagDifferentialPlot.cc.
References constETA, constPT, constVar, constVariableName, constVariableValue, diffVariableName, and theBinPlotters.
Referenced by process().
{ if ( constVar==constETA ) { constVariableName = "eta" ; diffVariableName = "pt" ; constVariableValue = make_pair ( theBinPlotters[0]->etaPtBin().getEtaMin() , theBinPlotters[0]->etaPtBin().getEtaMax() ) ; } if ( constVar==constPT ) { constVariableName = "pt" ; diffVariableName = "eta" ; constVariableValue = make_pair ( theBinPlotters[0]->etaPtBin().getPtMin() , theBinPlotters[0]->etaPtBin().getPtMax() ) ; } /* std::cout << "====>>>> BTagDifferentialPlot::setVariableName() : set const/diffVariableName to : " << constVariableName << " / " << diffVariableName << endl << "====>>>> constant value interval : " << constVariableValue.first << " - " << constVariableValue.second << endl ; */ }
std::string BTagDifferentialPlot::commonName [private] |
Definition at line 85 of file BTagDifferentialPlot.h.
Referenced by plot().
ConstVarType BTagDifferentialPlot::constVar [private] |
Definition at line 75 of file BTagDifferentialPlot.h.
Referenced by setVariableName().
std::string BTagDifferentialPlot::constVariableName [private] |
Definition at line 77 of file BTagDifferentialPlot.h.
Referenced by setVariableName().
std::pair<double,double> BTagDifferentialPlot::constVariableValue [private] |
Definition at line 82 of file BTagDifferentialPlot.h.
Referenced by setVariableName().
std::string BTagDifferentialPlot::diffVariableName [private] |
Definition at line 79 of file BTagDifferentialPlot.h.
Referenced by fillHisto(), and setVariableName().
double BTagDifferentialPlot::fixedBEfficiency [private] |
Definition at line 69 of file BTagDifferentialPlot.h.
Referenced by fillHisto().
bool BTagDifferentialPlot::noProcessing [private] |
Definition at line 72 of file BTagDifferentialPlot.h.
Referenced by process().
bool BTagDifferentialPlot::processed [private] |
Definition at line 73 of file BTagDifferentialPlot.h.
std::vector<JetTagPlotter *> BTagDifferentialPlot::theBinPlotters [private] |
Definition at line 89 of file BTagDifferentialPlot.h.
Referenced by addBinPlotter(), fillHisto(), and setVariableName().
Definition at line 96 of file BTagDifferentialPlot.h.
Referenced by fillHisto(), and getDifferentialHistoB_b().
Definition at line 95 of file BTagDifferentialPlot.h.
Referenced by fillHisto(), getDifferentialHistoB_c(), and plot().
Definition at line 92 of file BTagDifferentialPlot.h.
Referenced by fillHisto(), and getDifferentialHistoB_d().
Definition at line 99 of file BTagDifferentialPlot.h.
Referenced by fillHisto(), getDifferentialHistoB_dus(), and plot().
Definition at line 100 of file BTagDifferentialPlot.h.
Referenced by fillHisto(), and getDifferentialHistoB_dusg().
Definition at line 97 of file BTagDifferentialPlot.h.
Referenced by fillHisto(), getDifferentialHistoB_g(), and plot().
Definition at line 98 of file BTagDifferentialPlot.h.
Referenced by fillHisto(), getDifferentialHistoB_ni(), and plot().
Definition at line 94 of file BTagDifferentialPlot.h.
Referenced by fillHisto(), and getDifferentialHistoB_s().
Definition at line 93 of file BTagDifferentialPlot.h.
Referenced by fillHisto(), and getDifferentialHistoB_u().