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>
25using namespace SoftwareTrigger;
41 "Create HLT unit histograms?",
48 TDirectory* oldDirectory =
nullptr;
51 oldDirectory = gDirectory;
86 HLTUnits::max_hlt_units + 1, 0,
87 HLTUnits::max_hlt_units + 1);
91 HLTUnits::max_hlt_units + 1, 0,
92 HLTUnits::max_hlt_units + 1);
96 for (
unsigned int index = 1; index <= HLTUnits::max_hlt_units; index++) {
111 HLTUnits::max_hlt_units + 1, 0,
112 HLTUnits::max_hlt_units + 1);
125 "Processing time [ms] vs nSVDShaperDigits of events passing passive veto",
132 "Processing time [ms] vs nSVDShaperDigits of events not passing passive veto",
139 "Processing time [ms] vs nCDCHits of events passing passive veto",
146 "Processing time [ms] vs nCDCHits of events not passing passive veto",
153 "Processing time [ms] vs nECLDigits of events passing passive veto",
160 "Processing time [ms] vs nECLDigits of events not passing passive veto",
185 FILE* pipe = popen(
"hostname -d",
"r");
188 std::string host =
"";
190 while (fgets(buffer,
sizeof(buffer), pipe) !=
nullptr) {
197 host.erase(std::remove_if(host.begin(), host.end(), ::isspace), host.end());
199 if (host.rfind(
"hlt", 0) == 0 && host.length() == 5) {
200 m_hlt_unit = std::atoi(host.substr(3, 2).c_str());
202 B2WARNING(
"HLT unit number not found");
205 B2WARNING(
"HLT unit number not found");
214 if (not stats.isValid()) {
218 const std::vector<ModuleStatistics>& moduleStatisticsList = stats->getAll();
224 const std::string& statisticsName = moduleStatistics.getName();
236 const int m_param_overviewModuleListIndex = std::distance(
m_param_overviewModuleList.begin(), m_param_overviewModuleListIterator);
237 meanTimes[m_param_overviewModuleListIndex] += statisticsTime;
238 meanMemories[m_param_overviewModuleListIndex] += statisticsMemory;
250 double processingTimeSum = 0.0;
251 double processingTimeMean = 0.0;
254 const std::string& statisticsName = moduleStatistics.getName();
309 }
catch (
const std::exception&) {
319 B2FATAL(
"Histograms were not created. Did you setup a HistoManager?");
325 [](
auto & it) { it.second->Reset(); });
327 [](
auto & it) { it.second->Reset(); });
335 [](
auto & it) { it.second->Reset(); });
337 [](
auto & it) { it.second->Reset(); });
339 [](
auto & it) { it.second->Reset(); });
@ c_Persistent
Object is available during entire execution time.
HistoModule()
Constructor.
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.
const double m_nSVDShaperDigitsNBins
Number of bins for the histograms of nSVDShaperDigits.
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_nECLDigitsMax
Maximum for the histograms of nECLDigits.
TH2F * m_procTimeVsnCDCHitsNotPassiveVeto
Processing time vs nCDCHits distribution of events not passing passive injection veto.
TH2F * m_procTimeVsnSVDShaperDigitsPassiveVeto
Processing time vs nSVDShaperDigits distribution of events passing passive injection veto.
TH1F * m_processingTimeNotPassiveVeto
Processing time distribution of events not passing passive injection veto.
TH2F * m_procTimeVsnCDCHitsPassiveVeto
Processing time vs nCDCHits distribution of events passing passive injection veto.
const double m_fullMemoryMax
Maximum for the histograms of fullMemory.
StoreObjPtr< TRGSummary > m_trgSummary
TRG Summary.
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.
TH2F * m_procTimeVsnECLDigitsNotPassiveVeto
Processing time vs nECLDigits distribution of events not passing passive injection veto.
StoreArray< ECLDigit > m_eclDigits
ECL Digits.
const double m_fullTimeNBins
Number of bins for the histograms of fullTime.
TH2F * m_procTimeVsnSVDShaperDigitsNotPassiveVeto
Processing time vs nSVDShaperDigits distribution of events not passing passive injection veto.
StoreArray< SVDShaperDigit > m_svdShaperDigits
SVD strips.
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.
const double m_nSVDShaperDigitsMax
Maximum for the histograms of nSVDShaperDigits.
double m_lastFullTimeSum
Storage for the last full time sum.
const double m_nCDCHitsNBins
Number of bins for the histograms of nCDCHits.
std::map< unsigned int, TH1F * > m_fullTimePerUnitHistograms
Budget time distribution of events per unit.
TH1F * m_processingTimePassiveVeto
Processing time distribution of events passing passive injection veto.
const double m_fullTimeMax
Maximum for the histograms of fullTime.
StoreArray< CDCHit > m_cdcHits
CDC Hits.
std::string m_param_histogramDirectoryName
Parameter: Directory to put the generated histograms.
std::vector< std::string > m_summaryModuleList
Summary modules of the actual processing.
const double m_nCDCHitsMax
Maximum for the histograms of nCDCHits.
std::map< std::string, TH1F * > m_moduleMemoryHistograms
Memory distribution of certain modules.
const double m_fullMemoryNBins
Number of bins for the histograms of fullMemory.
const double m_nECLDigitsNBins
Number of bins for the histograms of nECLDigits.
TH2F * m_procTimeVsnECLDigitsPassiveVeto
Processing time vs nECLDigits distribution of events passing passive injection veto.
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.