CMS 3D CMS Logo

Public Member Functions | Private Attributes

L1TEfficiencyPlotHandler Class Reference

#include <L1TEfficiency_Harvesting.h>

List of all members.

Public Member Functions

void book (bool verbose)
void computeEfficiency (bool verbose)
 L1TEfficiencyPlotHandler (const L1TEfficiencyPlotHandler &handler)
 L1TEfficiencyPlotHandler (std::string dir, std::string plotName, DQMStore *dbe)
 ~L1TEfficiencyPlotHandler ()

Private Attributes

DQMStorem_dbe
std::string m_dir
MonitorElementm_effHisto
std::string m_plotName

Detailed Description

Definition at line 42 of file L1TEfficiency_Harvesting.h.


Constructor & Destructor Documentation

L1TEfficiencyPlotHandler::L1TEfficiencyPlotHandler ( std::string  dir,
std::string  plotName,
DQMStore dbe 
) [inline]

Definition at line 46 of file L1TEfficiency_Harvesting.h.

                                                                              : 
    m_dir(dir), m_plotName(plotName), m_dbe(dbe), m_effHisto(0) { };
L1TEfficiencyPlotHandler::L1TEfficiencyPlotHandler ( const L1TEfficiencyPlotHandler handler)

Definition at line 36 of file L1TEfficiency_Harvesting.cc.

References m_dbe, m_dir, m_effHisto, and m_plotName.

                                                                                          {
  
  m_dir      = handler.m_dir;
  m_plotName = handler.m_plotName;
  m_dbe      = handler.m_dbe;  

  m_effHisto = handler.m_effHisto;

}
L1TEfficiencyPlotHandler::~L1TEfficiencyPlotHandler ( ) [inline]

Definition at line 51 of file L1TEfficiency_Harvesting.h.

{ };

Member Function Documentation

void L1TEfficiencyPlotHandler::book ( bool  verbose)

Definition at line 47 of file L1TEfficiency_Harvesting.cc.

References gather_cfg::cout, MonitorElement::getTH1F(), edm::max(), and edm::min().

                                                {

  if(verbose){
    cout << "[L1TEfficiencyMuons_Harvesting:] Booking efficiency histo for " 
         << m_dir << " and " << m_plotName << endl;
  }
  
  MonitorElement *num = m_dbe->get(m_dir+"/"+m_plotName+"Num");
  MonitorElement *den = m_dbe->get(m_dir+"/"+m_plotName+"Den");

  if (!num || !den) {
 
    if(verbose){
      cout << "[L1TEfficiencyMuons_Harvesting:] "
           << (!num && !den ? "Num && Den" : !num ? "Num" : "Den") 
           << " not gettable. Quitting booking" << endl;
    }
    return;

  }

  TH1F *numH = num->getTH1F();
  TH1F *denH = den->getTH1F();

  if (!numH || !denH) {
 
    if(verbose){
      cout << "[L1TEfficiencyMuons_Harvesting:] "
           << (!numH && !denH ? "Num && Den" : !numH ? "Num" : "Den") 
           << " is not TH1F. Quitting booking" << endl;
    }
    return;

  }

  int nBinsNum = numH->GetNbinsX();
  int nBinsDen = denH->GetNbinsX();

  if (nBinsNum != nBinsDen) {
 
    if(verbose){
      cout << "[L1TEfficiencyMuons_Harvesting:] # bins in num and den is different. Quitting booking" << endl;
    }
    return;

  }

  double min = numH->GetXaxis()->GetXmin();
  double max = numH->GetXaxis()->GetXmax();

  m_dbe->setCurrentFolder(m_dir);
  m_effHisto = m_dbe->book1D(m_plotName,m_plotName,nBinsNum,min,max);

}
void L1TEfficiencyPlotHandler::computeEfficiency ( bool  verbose)

Definition at line 103 of file L1TEfficiency_Harvesting.cc.

References gather_cfg::cout, and MonitorElement::getTH1F().

                                                             {

  if (!m_effHisto)
    return;

  if(verbose){
    cout << "[L1TEfficiencyMuons_Harvesting:] Computing efficiency for " 
         << m_plotName << endl;
  }

  MonitorElement *num = m_dbe->get(m_dir+"/"+m_plotName+"Num");
  MonitorElement *den = m_dbe->get(m_dir+"/"+m_plotName+"Den");

  TH1F *numH = num->getTH1F();
  TH1F *denH = den->getTH1F();

  numH->Sumw2();
  denH->Sumw2();

  TH1F *effH = m_effHisto->getTH1F();

  effH->Divide(numH,denH);

}

Member Data Documentation

Definition at line 63 of file L1TEfficiency_Harvesting.h.

Referenced by L1TEfficiencyPlotHandler().

std::string L1TEfficiencyPlotHandler::m_dir [private]

Definition at line 61 of file L1TEfficiency_Harvesting.h.

Referenced by L1TEfficiencyPlotHandler().

Definition at line 65 of file L1TEfficiency_Harvesting.h.

Referenced by L1TEfficiencyPlotHandler().

std::string L1TEfficiencyPlotHandler::m_plotName [private]

Definition at line 62 of file L1TEfficiency_Harvesting.h.

Referenced by L1TEfficiencyPlotHandler().