Belle II Software development
MonitoringModuleStatistics Class Reference

Public Member Functions

 __init__ (self, particle)
 

Public Attributes

dict channel_time = {}
 the time for each channel
 
dict channel_time_per_module = {}
 the time per module
 
int particle_time = 0
 the time per particle
 

Detailed Description

Reads the module statistics for a single particle from the outputted root file
and puts them into a more accessible format

Definition at line 326 of file monitoring.py.

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self,
particle )
Reads the module statistics from the file named Monitor_ModuleStatistics.root
@param particle the particle for which the statistics are read

Definition at line 332 of file monitoring.py.

332 def __init__(self, particle):
333 """
334 Reads the module statistics from the file named Monitor_ModuleStatistics.root
335 @param particle the particle for which the statistics are read
336 """
337 # Always avoid the top-level 'import ROOT'.
338 import ROOT # noqa
339 root_file = ROOT.TFile.Open('Monitor_ModuleStatistics.root', 'read')
340 persistentTree = root_file.Get('persistent')
341 persistentTree.GetEntry(0)
342 # Clone() needed so we actually own the object (original dies when tfile is deleted)
343 stats = persistentTree.ProcessStatistics.Clone()
344
345 # merge statistics from all persistent trees into 'stats'
346 numEntries = persistentTree.GetEntriesFast()
347 for i in range(1, numEntries):
348 persistentTree.GetEntry(i)
349 stats.merge(persistentTree.ProcessStatistics)
350
351 # TODO .getTimeSum returns always 0 at the moment ?!
352 statistic = {m.getName(): m.getTimeSum(m.c_Event) / 1e9 for m in stats.getAll()}
353
354
355 self.channel_time = {}
356
357 self.channel_time_per_module = {}
358 for channel in particle.channels:
359 if channel.label not in self.channel_time:
360 self.channel_time[channel.label] = 0.0
361 self.channel_time_per_module[channel.label] = {'ParticleCombiner': 0.0,
362 'BestCandidateSelection': 0.0,
363 'PListCutAndCopy': 0.0,
364 'VariablesToExtraInfo': 0.0,
365 'MCMatch': 0.0,
366 'ParticleSelector': 0.0,
367 'MVAExpert': 0.0,
368 'ParticleVertexFitter': 0.0,
369 'TagUniqueSignal': 0.0,
370 'VariablesToHistogram': 0.0,
371 'VariablesToNtuple': 0.0}
372 for key, time in statistic.items():
373 if (channel.decayString in key or channel.name in key):
374 self.channel_time[channel.label] += time
375 for k in self.channel_time_per_module[channel.label]:
376 if k in key:
377 self.channel_time_per_module[channel.label][k] += time
378
379
380 self.particle_time = 0
381 for key, time in statistic.items():
382 if particle.identifier in key:
383 self.particle_time += time
384
385

Member Data Documentation

◆ channel_time

dict channel_time = {}

the time for each channel

Definition at line 355 of file monitoring.py.

◆ channel_time_per_module

dict channel_time_per_module = {}

the time per module

Definition at line 357 of file monitoring.py.

◆ particle_time

int particle_time = 0

the time per particle

Definition at line 380 of file monitoring.py.


The documentation for this class was generated from the following file: