9#include <hlt/softwaretrigger/modules/dqm/StatisticsTimingHLTDQMModule.h>
11#include <framework/datastore/StoreObjPtr.h>
12#include <framework/core/ProcessStatistics.h>
13#include <framework/core/ModuleStatistics.h>
14#include <framework/gearbox/Unit.h>
15#include <hlt/utilities/Units.h>
17#include <TDirectory.h>
24using namespace SoftwareTrigger;
40 "Create HLT unit histograms?",
47 TDirectory* oldDirectory =
nullptr;
50 oldDirectory = gDirectory;
85 HLTUnits::max_hlt_units + 1, 0,
86 HLTUnits::max_hlt_units + 1);
90 HLTUnits::max_hlt_units + 1, 0,
91 HLTUnits::max_hlt_units + 1);
95 for (
unsigned int index = 1; index <= HLTUnits::max_hlt_units; index++) {
110 HLTUnits::max_hlt_units + 1, 0,
111 HLTUnits::max_hlt_units + 1);
128 file.open(HLTUnits::hlt_unit_file);
135 B2WARNING(
"HLT unit number not found");
144 if (not stats.isValid()) {
148 const std::vector<ModuleStatistics>& moduleStatisticsList = stats->getAll();
154 const std::string& statisticsName = moduleStatistics.getName();
166 const int m_param_overviewModuleListIndex = std::distance(
m_param_overviewModuleList.begin(), m_param_overviewModuleListIterator);
167 meanTimes[m_param_overviewModuleListIndex] += statisticsTime;
168 meanMemories[m_param_overviewModuleListIndex] += statisticsMemory;
180 double processingTimeSum = 0.0;
181 double processingTimeMean = 0.0;
184 const std::string& statisticsName = moduleStatistics.getName();
224 B2FATAL(
"Histograms were not created. Did you setup a HistoManager?");
230 [](
auto & it) { it.second->Reset(); });
232 [](
auto & it) { it.second->Reset(); });
240 [](
auto & it) { it.second->Reset(); });
242 [](
auto & it) { it.second->Reset(); });
244 [](
auto & it) { it.second->Reset(); });
@ c_Persistent
Object is available during entire execution time.
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
Keep track of time and memory consumption during processing.
@ c_Event
Counting time/calls in event()
@ c_Total
Sum of the above.
value_type getMemorySum(EStatisticCounters type=c_Total) const
return the total used memory for a given counter
value_type getTimeSum(EStatisticCounters type=c_Total) const
return the sum of all execution times for a given counter
value_type getTimeMean(EStatisticCounters type=c_Total) const
return the mean execution time for a given counter
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
std::map< std::string, TH1F * > m_moduleTimeHistograms
Time distribution of certain modules.
TH1F * m_fullMemoryHistogram
Total memory usage distribution of all events.
const double m_processingTimeNBins
Number of bins for the histograms of processingTime.
TH1F * m_meanTimeHistogram
Mean time of certain modules.
std::map< unsigned int, double > m_lastProcessingTimeSumPerUnit
Storage for the last processing time sum per unit.
int m_hlt_unit
Store HLT unit number on initialization.
const double m_processingTimeMax
Maximum for the histograms of processingTime.
std::map< unsigned int, TH1F * > m_processingTimePerUnitHistograms
Processing time distribution of events per unit.
void initialize() override
Define the histograms.
void event() override
Full the histograms.
double m_lastProcessingTimeSum
Storage for the last processing time sum.
const double m_fullMemoryMax
Maximum for the histograms of fullMemory.
std::vector< std::string > m_param_overviewModuleList
Parameter: which modules should be shown in the overview list.
TH1F * m_fullTimeMeanPerUnitHistogram
Mean budget time of events per unit.
const double m_fullTimeNBins
Number of bins for the histograms of fullTime.
TH1F * m_processingTimeHistogram
Processing time distribution of all events.
std::map< std::string, double > m_lastModuleTimeSum
Storage for the last time sum of certain modules.
void beginRun() override
Reset histogram entries.
TH1F * m_processingTimeMeanPerUnitHistogram
Mean processing time of events per unit.
TH1F * m_meanMemoryHistogram
Mean memory of certain modules.
bool m_param_create_hlt_unit_histograms
Parameter: Create HLT unit number histograms?
std::map< unsigned int, double > m_lastFullTimeSumPerUnit
Storage for the last full time sum per unit.
double m_lastFullTimeSum
Storage for the last full time sum.
std::map< unsigned int, TH1F * > m_fullTimePerUnitHistograms
Budget time distribution of events per unit.
const double m_fullTimeMax
Maximum for the histograms of fullTime.
std::string m_param_histogramDirectoryName
Parameter: Directory to put the generated histograms.
std::vector< std::string > m_summaryModuleList
Summary modules of the actual processing.
std::map< std::string, TH1F * > m_moduleMemoryHistograms
Memory distribution of certain modules.
const double m_fullMemoryNBins
Number of bins for the histograms of fullMemory.
TH1F * m_fullTimeHistogram
Budget time distribution of all events.
TH1F * m_processesPerUnitHistogram
Number of processes per unit.
std::map< unsigned int, TH1F * > m_fullMemoryPerUnitHistograms
Total memory distribution of events per unit.
StatisticsTimingHLTDQMModule()
Constructor for module parameters.
void defineHisto() override
Histogram definition.
Type-safe access to single objects in the data store.
static const double ms
[millisecond]
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.