CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes

FastTimerServiceClient Class Reference

Inheritance diagram for FastTimerServiceClient:
edm::EDAnalyzer

List of all members.

Public Member Functions

 FastTimerServiceClient (edm::ParameterSet const &)
 ~FastTimerServiceClient ()

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)

Private Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &setup)
void beginJob ()
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup)
void beginRun (edm::Run const &run, edm::EventSetup const &setup)
void endJob ()
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup)
void endRun (edm::Run const &run, edm::EventSetup const &setup)
void fillSummaryPlots ()

Private Attributes

std::string m_dqm_path

Detailed Description

Definition at line 23 of file FastTimerServiceClient.cc.


Constructor & Destructor Documentation

FastTimerServiceClient::FastTimerServiceClient ( edm::ParameterSet const &  config) [explicit]

Definition at line 45 of file FastTimerServiceClient.cc.

                                                                             :
  m_dqm_path( config.getUntrackedParameter<std::string>( "dqmPath", "TimerService") )
{
}
FastTimerServiceClient::~FastTimerServiceClient ( )

Definition at line 50 of file FastTimerServiceClient.cc.

{
}

Member Function Documentation

void FastTimerServiceClient::analyze ( const edm::Event event,
const edm::EventSetup setup 
) [private, virtual]

Implements edm::EDAnalyzer.

Definition at line 55 of file FastTimerServiceClient.cc.

{
}
void FastTimerServiceClient::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 60 of file FastTimerServiceClient.cc.

{
}
void FastTimerServiceClient::beginLuminosityBlock ( edm::LuminosityBlock const &  lumi,
edm::EventSetup const &  setup 
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 81 of file FastTimerServiceClient.cc.

{
}
void FastTimerServiceClient::beginRun ( edm::Run const &  run,
edm::EventSetup const &  setup 
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 70 of file FastTimerServiceClient.cc.

{
}
void FastTimerServiceClient::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 65 of file FastTimerServiceClient.cc.

{
}
void FastTimerServiceClient::endLuminosityBlock ( edm::LuminosityBlock const &  lumi,
edm::EventSetup const &  setup 
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 86 of file FastTimerServiceClient.cc.

References fillSummaryPlots().

void FastTimerServiceClient::endRun ( edm::Run const &  run,
edm::EventSetup const &  setup 
) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 75 of file FastTimerServiceClient.cc.

References fillSummaryPlots().

void FastTimerServiceClient::fillDescriptions ( edm::ConfigurationDescriptions descriptions) [static]

Reimplemented from edm::EDAnalyzer.

Definition at line 168 of file FastTimerServiceClient.cc.

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

                                                                                    {
  // The following says we do not know what parameters are allowed so do no validation
  // Please change this to state exactly what you do use, even if it is no parameters
  edm::ParameterSetDescription desc;
  desc.setUnknown();
  descriptions.addDefault(desc);
}
void FastTimerServiceClient::fillSummaryPlots ( void  ) [private]

Definition at line 92 of file FastTimerServiceClient.cc.

References PDRates::average, DQMStore::book1D(), postValidation_cfi::efficiency, patZpeak::events, DQMStore::get(), MonitorElement::getTH1F(), MonitorElement::getTProfile(), i, label, m_dqm_path, max(), min, n, cppFunctionSkipper::operator, AlCaHLTBitMon_ParallelJobs::p, EgammaValidation_cff::paths, DQMStore::setCurrentFolder(), findQualityFiles::size, lumiQTWidget::t, and pileupDistInMC::total.

Referenced by endLuminosityBlock(), and endRun().

{
  DQMStore * dqm = edm::Service<DQMStore>().operator->();
  if (dqm == 0)
    // cannot access the DQM store
    return;
  
  MonitorElement * me;
  me = dqm->get(m_dqm_path + "/event");
  if (me == 0)
    // no FastTimerService DQM information
    return;
  double events = me->getTH1F()->GetEntries();

  // note: the following (identical) loops need to be kept separate, as any of these group of histograms might be missing
  // if any of them is filled, size will have the total number of paths, and "paths" can be used to extract the list of labels
  dqm->setCurrentFolder(m_dqm_path);
  TProfile const * paths = nullptr;
  uint32_t         size  = 0;

  // extract the list of Paths and EndPaths from the summary plots
  if (( me = dqm->get(m_dqm_path + "/paths_active_time") )) {
    paths = me->getTProfile();
    size  = paths->GetXaxis()->GetNbins();
  } else 
  if (( me = dqm->get(m_dqm_path + "/paths_total_time") )) {
    paths = me->getTProfile();
    size  = paths->GetXaxis()->GetNbins();
  } else
  if (( me = dqm->get(m_dqm_path + "/paths_exclusive_time") )) {
    paths = me->getTProfile();
    size  = paths->GetXaxis()->GetNbins();
  }

  if (paths == nullptr)
    return;

  // for each path, fill histograms with
  //  - the average time spent in each module (total time spent in that module, averaged over all events)
  //  - the running time spent in each module (total time spent in that module, averaged over the events where that module actually ran)
  //  - the "efficiency" of each module (number of time a module succeded divided by the number of times the has run)
  dqm->setCurrentFolder(m_dqm_path + "/Paths");
  for (uint32_t p = 1; p <= size; ++p) {
    // extract the list of Paths and EndPaths from the bin labels of one of the summary plots
    std::string label = paths->GetXaxis()->GetBinLabel(p);
    MonitorElement * me_counter = dqm->get( m_dqm_path + "/Paths/" + label + "_module_counter" );
    MonitorElement * me_total   = dqm->get( m_dqm_path + "/Paths/" + label + "_module_total" );
    if (me_counter == 0 or me_total == 0)
      continue;
    TH1F * counter = me_counter->getTH1F();
    TH1F * total   = me_total  ->getTH1F();
    uint32_t bins = counter->GetXaxis()->GetNbins();
    double   min  = counter->GetXaxis()->GetXmin();
    double   max  = counter->GetXaxis()->GetXmax();
    TH1F * average    = dqm->book1D(label + "_module_average",    label + " module average",    bins, min, max)->getTH1F();
    TH1F * running    = dqm->book1D(label + "_module_running",    label + " module running",    bins, min, max)->getTH1F();
    TH1F * efficiency = dqm->book1D(label + "_module_efficiency", label + " module efficiency", bins, min, max)->getTH1F();
    for (uint32_t i = 1; i <= bins; ++i) {
      const char * module = counter->GetXaxis()->GetBinLabel(i);
      average   ->GetXaxis()->SetBinLabel(i, module);
      running   ->GetXaxis()->SetBinLabel(i, module);
      efficiency->GetXaxis()->SetBinLabel(i, module);
      double t = total  ->GetBinContent(i);
      double n = counter->GetBinContent(i);
      double p = counter->GetBinContent(i+1);
      average   ->SetBinContent(i, t / events);
      if (n) {
        running   ->SetBinContent(i, t / n);
        efficiency->SetBinContent(i, p / n);
      }
    }
  }

}

Member Data Documentation

std::string FastTimerServiceClient::m_dqm_path [private]

Definition at line 31 of file FastTimerServiceClient.cc.

Referenced by fillSummaryPlots().