CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

L1TGMTClient Class Reference

#include <L1TGMTClient.h>

Inheritance diagram for L1TGMTClient:
edm::EDAnalyzer

List of all members.

Public Member Functions

 L1TGMTClient (const edm::ParameterSet &)
 Constructor.
virtual ~L1TGMTClient ()
 Destructor.

Protected Member Functions

void analyze (const edm::Event &, const edm::EventSetup &)
 Fake Analyze.
void beginJob ()
 BeginJob.
void beginLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &)
void beginRun (const edm::Run &, const edm::EventSetup &)
 BeginRun.
void endJob ()
 Endjob.
void endLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &)
 DQM Client Diagnostic.
void endRun (const edm::Run &, const edm::EventSetup &)
 EndRun.

Private Member Functions

MonitorElementbookClone1D (const std::string &name, const std::string &title, const std::string &hrefName)
MonitorElementbookClone1DVB (const std::string &name, const std::string &title, const std::string &hrefName)
MonitorElementbookClone2D (const std::string &name, const std::string &title, const std::string &hrefName)
TH1F * get1DHisto (std::string meName, DQMStore *dbi)
TH2F * get2DHisto (std::string meName, DQMStore *dbi)
void initialize ()
void makeEfficiency1D (MonitorElement *meeff, std::string heName, std::string hiName)
void makeEfficiency2D (MonitorElement *meeff, std::string heName, std::string hiName)
void makeRatio1D (MonitorElement *mer, std::string h1Name, std::string h2Name)
void processHistograms ()

Private Attributes

DQMStoredbe_
MonitorElementeff_eta_dtcsc
MonitorElementeff_eta_rpc
MonitorElementeff_etaphi_dtcsc
MonitorElementeff_etaphi_rpc
MonitorElementeff_phi_dtcsc
MonitorElementeff_phi_rpc
std::string input_dir_
bool m_runInEndJob
bool m_runInEndLumi
bool m_runInEndRun
bool m_runInEventLoop
std::string monitorName_
std::string output_dir_
edm::ParameterSet parameters_

Detailed Description

Definition at line 12 of file L1TGMTClient.h.


Constructor & Destructor Documentation

L1TGMTClient::L1TGMTClient ( const edm::ParameterSet ps)

Constructor.

Definition at line 11 of file L1TGMTClient.cc.

References initialize(), and parameters_.

                                                    {
    parameters_ = ps;
    initialize();
}
L1TGMTClient::~L1TGMTClient ( ) [virtual]

Destructor.

Definition at line 16 of file L1TGMTClient.cc.

References LogDebug.

                            {
    LogDebug("TriggerDQM") << "[TriggerDQM]: ending... ";
}

Member Function Documentation

void L1TGMTClient::analyze ( const edm::Event iEvent,
const edm::EventSetup evSetup 
) [protected, virtual]

Fake Analyze.

Implements edm::EDAnalyzer.

Definition at line 147 of file L1TGMTClient.cc.

References m_runInEventLoop, and processHistograms().

                                      {

    // there is no loop on events in the offline harvesting step
    // code here will not be executed offline

    if (m_runInEventLoop) {

        processHistograms();
    }

}
void L1TGMTClient::beginJob ( void  ) [protected, virtual]

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 51 of file L1TGMTClient.cc.

References LogDebug.

                            {

    LogDebug("TriggerDQM") << "[TriggerDQM]: Begin Job";

}
void L1TGMTClient::beginLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup evSetup 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 128 of file L1TGMTClient.cc.

                                      {

    // empty

}
void L1TGMTClient::beginRun ( const edm::Run r,
const edm::EventSetup evSetup 
) [protected, virtual]

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 58 of file L1TGMTClient.cc.

References bookClone1D(), bookClone1DVB(), bookClone2D(), dbe_, eff_eta_dtcsc, eff_eta_rpc, eff_etaphi_dtcsc, eff_etaphi_rpc, eff_phi_dtcsc, eff_phi_rpc, MonitorElement::getTH1F(), MonitorElement::getTH2F(), output_dir_, MonitorElement::setAxisTitle(), and DQMStore::setCurrentFolder().

                                                                         {

    // booking histograms in the output_dir_

    dbe_->setCurrentFolder(output_dir_);

    eff_eta_dtcsc = bookClone1DVB("eff_eta_dtcsc", "efficiency DTCSC vs eta",
            "eta_DTCSC_and_RPC");

    if (eff_eta_dtcsc != 0) {
        eff_eta_dtcsc->setAxisTitle("eta", 1);
        if (!eff_eta_dtcsc->getTH1F()->GetSumw2N())
          eff_eta_dtcsc->getTH1F()->Sumw2();

    }

    eff_eta_rpc = bookClone1DVB("eff_eta_rpc", "efficiency RPC vs eta",
            "eta_DTCSC_and_RPC");

    if (eff_eta_rpc != 0) {
        eff_eta_rpc->setAxisTitle("eta", 1);
        if (!eff_eta_rpc->getTH1F()->GetSumw2N())
          eff_eta_rpc->getTH1F()->Sumw2();

    }

    eff_phi_dtcsc = bookClone1D("eff_phi_dtcsc", "efficiency DTCSC vs phi",
            "phi_DTCSC_and_RPC");

    if (eff_phi_dtcsc != 0) {
        eff_phi_dtcsc->setAxisTitle("phi (deg)", 1);
        if (!eff_phi_dtcsc->getTH1F()->GetSumw2N())
          eff_phi_dtcsc->getTH1F()->Sumw2();

    }

    eff_phi_rpc = bookClone1D("eff_phi_rpc", "efficiency RPC vs phi",
            "phi_DTCSC_and_RPC");

    if (eff_phi_rpc != 0) {
        eff_phi_rpc->setAxisTitle("phi (deg)", 1);
        if (!eff_phi_rpc->getTH1F()->GetSumw2N())
          eff_phi_rpc->getTH1F()->Sumw2();

    }

    eff_etaphi_dtcsc = bookClone2D("eff_etaphi_dtcsc",
            "efficiency DTCSC vs eta and phi", "etaphi_DTCSC_and_RPC");

    if (eff_etaphi_dtcsc != 0) {
        eff_etaphi_dtcsc->setAxisTitle("eta", 1);
        eff_etaphi_dtcsc->setAxisTitle("phi (deg)", 2);
        if (!eff_etaphi_dtcsc->getTH2F()->GetSumw2N())
          eff_etaphi_dtcsc->getTH2F()->Sumw2();

    }

    eff_etaphi_rpc = bookClone2D("eff_etaphi_rpc",
            "efficiency RPC vs eta and phi", "etaphi_DTCSC_and_RPC");

    if (eff_etaphi_rpc != 0) {
        eff_etaphi_rpc->setAxisTitle("eta", 1);
        eff_etaphi_rpc->setAxisTitle("phi (deg)", 2);
        if (!eff_etaphi_rpc->getTH2F()->GetSumw2N())
          eff_etaphi_rpc->getTH2F()->Sumw2();

    }
}
MonitorElement * L1TGMTClient::bookClone1D ( const std::string &  name,
const std::string &  title,
const std::string &  hrefName 
) [private]

Definition at line 298 of file L1TGMTClient.cc.

References DQMStore::book1D(), dbe_, get1DHisto(), cmsDownloadME::href, input_dir_, and LogDebug.

Referenced by beginRun().

                                                           {

    MonitorElement* me;

    TH1F* href = get1DHisto(input_dir_ + "/" + hrefName, dbe_);

    if (href) {
        LogDebug("TriggerDQM")
                << "\nL1TGMTClient::bookClone1D: booking histogram "
                << hrefName << std::endl;
        const unsigned nbx = href->GetNbinsX();
        const double xmin = href->GetXaxis()->GetXmin();
        const double xmax = href->GetXaxis()->GetXmax();
        me = dbe_->book1D(name, title, nbx, xmin, xmax);
    } else {
        LogDebug("TriggerDQM")
                << "\nL1TGMTClient::bookClone1D: not able to clone histogram "
                << hrefName << std::endl;
        me = 0;
    }

    return me;
}
MonitorElement * L1TGMTClient::bookClone1DVB ( const std::string &  name,
const std::string &  title,
const std::string &  hrefName 
) [private]

Definition at line 324 of file L1TGMTClient.cc.

References DQMStore::book1D(), dbe_, get1DHisto(), cmsDownloadME::href, i, input_dir_, LogDebug, output_dir_, DQMStore::setCurrentFolder(), and fw3dlego::xbins.

Referenced by beginRun().

                                                           {

    MonitorElement* me;

    TH1F* href = get1DHisto(input_dir_ + "/" + hrefName, dbe_);

    if (href) {
        LogDebug("TriggerDQM")
                << "\nL1TGMTClient::bookClone1DVB: booking histogram "
                << hrefName << std::endl;
        int nbx = href->GetNbinsX();
        if (nbx > 99)
            nbx = 99;
        float xbins[100];
        for (int i = 0; i < nbx; i++) {
            xbins[i] = href->GetBinLowEdge(i + 1);
        }
        xbins[nbx] = href->GetXaxis()->GetXmax();

        dbe_->setCurrentFolder(output_dir_);
        me = dbe_->book1D(name, title, nbx, xbins);

    } else {
        LogDebug("TriggerDQM")
                << "\nL1TGMTClient::bookClone1DVB: not able to clone histogram "
                << hrefName << std::endl;
        me = 0;
    }

    return me;
}
MonitorElement * L1TGMTClient::bookClone2D ( const std::string &  name,
const std::string &  title,
const std::string &  hrefName 
) [private]

Definition at line 358 of file L1TGMTClient.cc.

References DQMStore::book2D(), dbe_, get2DHisto(), cmsDownloadME::href, input_dir_, and LogDebug.

Referenced by beginRun().

                                                           {

    MonitorElement* me;

    TH2F* href = get2DHisto(input_dir_ + "/" + hrefName, dbe_);

    if (href) {
        LogDebug("TriggerDQM")
                << "\nL1TGMTClient::bookClone2D: booking histogram "
                << hrefName << std::endl;
        const unsigned nbx = href->GetNbinsX();
        const double xmin = href->GetXaxis()->GetXmin();
        const double xmax = href->GetXaxis()->GetXmax();
        const unsigned nby = href->GetNbinsY();
        const double ymin = href->GetYaxis()->GetXmin();
        const double ymax = href->GetYaxis()->GetXmax();
        me = dbe_->book2D(name, title, nbx, xmin, xmax, nby, ymin, ymax);
    } else {
        LogDebug("TriggerDQM")
                << "\nL1TGMTClient::bookClone2D: not able to clone histogram "
                << hrefName << std::endl;
        me = 0;
    }

    return me;
}
void L1TGMTClient::endJob ( void  ) [protected, virtual]

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 189 of file L1TGMTClient.cc.

References m_runInEndJob, and processHistograms().

void L1TGMTClient::endLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup evSetup 
) [protected, virtual]

DQM Client Diagnostic.

Reimplemented from edm::EDAnalyzer.

Definition at line 136 of file L1TGMTClient.cc.

References m_runInEndLumi, and processHistograms().

void L1TGMTClient::endRun ( const edm::Run r,
const edm::EventSetup evSetup 
) [protected, virtual]

EndRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 179 of file L1TGMTClient.cc.

References m_runInEndRun, and processHistograms().

TH1F * L1TGMTClient::get1DHisto ( std::string  meName,
DQMStore dbi 
) [private]

Definition at line 274 of file L1TGMTClient.cc.

References DQMStore::get(), MonitorElement::getTH1F(), and LogDebug.

Referenced by bookClone1D(), bookClone1DVB(), makeEfficiency1D(), and makeRatio1D().

                                                              {

    MonitorElement * me_ = dbi->get(meName);

    if (!me_) {
        LogDebug("TriggerDQM") << "\nL1TGMTClient: " << meName << " NOT FOUND.";
        return 0;
    }

    return me_->getTH1F();
}
TH2F * L1TGMTClient::get2DHisto ( std::string  meName,
DQMStore dbi 
) [private]

Definition at line 287 of file L1TGMTClient.cc.

References DQMStore::get(), MonitorElement::getTH2F(), and LogDebug.

Referenced by bookClone2D(), and makeEfficiency2D().

                                                              {
    MonitorElement * me_ = dbi->get(meName);

    if (!me_) {
        LogDebug("TriggerDQM") << "\nL1TGMTClient: " << meName << " NOT FOUND.";
        return 0;
    }
    return me_->getTH2F();
}
void L1TGMTClient::initialize ( ) [private]

Definition at line 21 of file L1TGMTClient.cc.

References dbe_, edm::ParameterSet::getUntrackedParameter(), input_dir_, LogDebug, m_runInEndJob, m_runInEndLumi, m_runInEndRun, m_runInEventLoop, monitorName_, cppFunctionSkipper::operator, output_dir_, and parameters_.

Referenced by L1TGMTClient().

                              {

    // get back-end interface
    dbe_ = edm::Service<DQMStore>().operator->();

    // base folder for the contents of this job
    monitorName_ = parameters_.getUntrackedParameter<std::string> (
            "monitorName", "");
    LogDebug("TriggerDQM") << "Monitor name = " << monitorName_ << std::endl;

    output_dir_ = parameters_.getUntrackedParameter<std::string> ("output_dir",
            "");
    LogDebug("TriggerDQM") << "DQM output dir = " << output_dir_ << std::endl;

    input_dir_ = parameters_.getUntrackedParameter<std::string> ("input_dir",
            "");
    LogDebug("TriggerDQM") << "DQM input dir = " << input_dir_ << std::endl;

    m_runInEventLoop = parameters_.getUntrackedParameter<bool> (
            "runInEventLoop", false);
    m_runInEndLumi = parameters_.getUntrackedParameter<bool> ("runInEndLumi",
            false);
    m_runInEndRun = parameters_.getUntrackedParameter<bool> ("runInEndRun",
            false);
    m_runInEndJob = parameters_.getUntrackedParameter<bool> ("runInEndJob",
            false);

}
void L1TGMTClient::makeEfficiency1D ( MonitorElement meeff,
std::string  heName,
std::string  hiName 
) [private]

Definition at line 222 of file L1TGMTClient.cc.

References dbe_, get1DHisto(), MonitorElement::getTH1F(), input_dir_, LogDebug, output_dir_, and DQMStore::setCurrentFolder().

Referenced by processHistograms().

                          {

    dbe_->setCurrentFolder(output_dir_);

    TH1F* he = get1DHisto(input_dir_ + "/" + heName, dbe_);
    TH1F* hi = get1DHisto(input_dir_ + "/" + hiName, dbe_);

    if (meeff == 0) {
        LogDebug("TriggerDQM")
                << "L1TGMTClient::makeEfficiency1D: monitoring element zero, not able to retrieve histogram"
                << std::endl;
        return;
    }

    TH1F* heff = meeff->getTH1F();

    if (heff && he && hi) {
        TH1F* hall = (TH1F*) he->Clone("hall");
        hall->Add(hi);
        heff->Divide(he, hall, 1., 1., "B");
        delete hall;
    }
}
void L1TGMTClient::makeEfficiency2D ( MonitorElement meeff,
std::string  heName,
std::string  hiName 
) [private]

Definition at line 248 of file L1TGMTClient.cc.

References dbe_, get2DHisto(), MonitorElement::getTH2F(), input_dir_, LogDebug, output_dir_, and DQMStore::setCurrentFolder().

Referenced by processHistograms().

                          {

    dbe_->setCurrentFolder(output_dir_);

    TH2F* he = get2DHisto(input_dir_ + "/" + heName, dbe_);
    TH2F* hi = get2DHisto(input_dir_ + "/" + hiName, dbe_);

    if (meeff == 0) {
        LogDebug("TriggerDQM")
                << "\nL1TGMTClient::makeEfficiency2D: monitoring element zero, not able to retrieve histogram"
                << std::endl;
        return;
    }

    TH2F* heff = meeff->getTH2F();

    if (heff && he && hi) {
        TH2F* hall = (TH2F*) he->Clone("hall");
        hall->Add(hi);
        heff->Divide(he, hall, 1., 1., "B");
        delete hall;
    }
}
void L1TGMTClient::makeRatio1D ( MonitorElement mer,
std::string  h1Name,
std::string  h2Name 
) [private]

Definition at line 199 of file L1TGMTClient.cc.

References dbe_, get1DHisto(), MonitorElement::getTH1F(), input_dir_, LogDebug, output_dir_, and DQMStore::setCurrentFolder().

                          {

    dbe_->setCurrentFolder(output_dir_);

    TH1F* h1 = get1DHisto(input_dir_ + "/" + h1Name, dbe_);
    TH1F* h2 = get1DHisto(input_dir_ + "/" + h2Name, dbe_);

    if (mer == 0) {
        LogDebug("TriggerDQM")
                << "\nL1TGMTClient::makeRatio1D: monitoring element zero, not able to retrieve histogram"
                << std::endl;
        return;
    }

    TH1F* hr = mer->getTH1F();

    if (hr && h1 && h2) {
        hr->Divide(h1, h2, 1., 1., " ");
    }
}
void L1TGMTClient::processHistograms ( ) [private]

Definition at line 161 of file L1TGMTClient.cc.

References eff_eta_dtcsc, eff_eta_rpc, eff_etaphi_dtcsc, eff_etaphi_rpc, eff_phi_dtcsc, eff_phi_rpc, LogDebug, makeEfficiency1D(), and makeEfficiency2D().

Referenced by analyze(), endJob(), endLuminosityBlock(), and endRun().

                                     {

    LogDebug("TriggerDQM") << "L1TGMTClient: processing..." << std::endl;

    makeEfficiency1D(eff_eta_dtcsc, "eta_DTCSC_and_RPC", "eta_RPC_only");
    makeEfficiency1D(eff_eta_rpc, "eta_DTCSC_and_RPC", "eta_DTCSC_only");

    makeEfficiency1D(eff_phi_dtcsc, "phi_DTCSC_and_RPC", "phi_RPC_only");
    makeEfficiency1D(eff_phi_rpc, "phi_DTCSC_and_RPC", "phi_DTCSC_only");

    makeEfficiency2D(eff_etaphi_dtcsc, "etaphi_DTCSC_and_RPC",
            "etaphi_RPC_only");
    makeEfficiency2D(eff_etaphi_rpc, "etaphi_DTCSC_and_RPC",
            "etaphi_DTCSC_only");

}

Member Data Documentation

Definition at line 78 of file L1TGMTClient.h.

Referenced by beginRun(), and processHistograms().

Definition at line 79 of file L1TGMTClient.h.

Referenced by beginRun(), and processHistograms().

Definition at line 82 of file L1TGMTClient.h.

Referenced by beginRun(), and processHistograms().

Definition at line 83 of file L1TGMTClient.h.

Referenced by beginRun(), and processHistograms().

Definition at line 80 of file L1TGMTClient.h.

Referenced by beginRun(), and processHistograms().

Definition at line 81 of file L1TGMTClient.h.

Referenced by beginRun(), and processHistograms().

std::string L1TGMTClient::input_dir_ [private]

Definition at line 75 of file L1TGMTClient.h.

Referenced by endJob(), and initialize().

Definition at line 73 of file L1TGMTClient.h.

Referenced by endLuminosityBlock(), and initialize().

Definition at line 74 of file L1TGMTClient.h.

Referenced by endRun(), and initialize().

Definition at line 72 of file L1TGMTClient.h.

Referenced by analyze(), and initialize().

std::string L1TGMTClient::monitorName_ [private]

Definition at line 68 of file L1TGMTClient.h.

Referenced by initialize().

std::string L1TGMTClient::output_dir_ [private]

Definition at line 66 of file L1TGMTClient.h.

Referenced by initialize(), and L1TGMTClient().