Belle II Software development
MonitoringParticle Class Reference

Public Member Functions

 __init__ (self, particle)
 
 calculateStatistic (self, hist, target)
 
 calculateUniqueStatistic (self, tree)
 

Public Attributes

 particle = particle
 Particle containing its configuration.
 
 mc_count = MonitoringMCCount(particle)
 Dictionary with 'sum', 'std', 'mean', 'min' and 'max' of the MC counts.
 
 module_statistic = MonitoringModuleStatistics(particle)
 Module statistics.
 
 time_per_channel = self.module_statistic.channel_time
 time per channel
 
 time_per_channel_per_module = self.module_statistic.channel_time_per_module
 time per channel per module
 
 total_time = self.module_statistic.particle_time + sum(self.time_per_channel.values())
 total time
 
 total_number_of_channels = len(self.particle.channels)
 Total number of channels.
 
int reconstructed_number_of_channels = 0
 Reconstructed number of channels.
 
 branching_fractions = MonitoringBranchingFractions()
 Branching fractions.
 
 exc_br_per_channel = self.branching_fractions.getExclusive(particle)
 Exclusive branching fractions per channel.
 
 inc_br_per_channel = self.branching_fractions.getInclusive(particle)
 Inclusive branching fraction per channel.
 
dict before_ranking = {}
 Monitoring histogram in PreReconstruction before the ranking-cut.
 
dict after_ranking = {}
 Monitoring histogram in PreReconstruction after the ranking-cut.
 
dict after_vertex = {}
 Monitoring histogram in PreReconstruction after the vertex fit.
 
dict after_classifier = {}
 Monitoring histogram in PostReconstruction after the mva application.
 
dict training_data = {}
 Monitoring histogram for TrainingData Generation only available if Monitoring runs on the training monitoring data.
 
dict ignored_channels = {}
 Dictionary containing whether the channel reconstructed at least one candidate or not.
 
 before_postcut = self.calculateStatistic(hist, self.particle.mvaConfig.target)
 Monitoring histogram in PostReconstruction before the postcut.
 
 before_ranking_postcut = self.calculateStatistic(hist, self.particle.mvaConfig.target)
 Monitoring histogram in PostReconstruction before the ranking postcut.
 
 after_ranking_postcut = self.calculateStatistic(hist, self.particle.mvaConfig.target)
 Monitoring histogram in PostReconstruction after the ranking postcut.
 
 before_tag = self.calculateStatistic(hist, self.particle.mvaConfig.target)
 Statistic object before unique tagging of signals.
 
 final_ntuple = MonitoringNTuple('Monitor_Final.root', f'{plist}')
 Reference to the final ntuple.
 
 after_tag = self.calculateUniqueStatistic(self.final_ntuple.tree)
 Statistic object after unique tagging of signals.
 

Detailed Description

Monitoring object containing all the monitoring information
about a single particle

Definition at line 611 of file monitoring.py.

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self,
particle )
Read the monitoring information of the given particle
@param particle the particle for which the information is read

Definition at line 617 of file monitoring.py.

617 def __init__(self, particle):
618 """
619 Read the monitoring information of the given particle
620 @param particle the particle for which the information is read
621 """
622
623 self.particle = particle
624 particlesInStages = fei.core.get_stages_from_particles([particle])
625 stage = 0
626 for i in range(len(particlesInStages)):
627 for iparticle in particlesInStages[i]:
628 if iparticle.identifier == self.particle.identifier:
629 stage = i+1
630 break
631 if stage == 0:
632 raise RuntimeError(f"Could not find particle {self.particle.identifier} in the list of stages.")
633
634
635 self.mc_count = MonitoringMCCount(particle)
636
637 self.module_statistic = MonitoringModuleStatistics(particle)
638
639 self.time_per_channel = self.module_statistic.channel_time
640
641 self.time_per_channel_per_module = self.module_statistic.channel_time_per_module
642
643 self.total_time = self.module_statistic.particle_time + sum(self.time_per_channel.values())
644
645
646 self.total_number_of_channels = len(self.particle.channels)
647
648 self.reconstructed_number_of_channels = 0
649
650
651 self.branching_fractions = MonitoringBranchingFractions()
652
653 self.exc_br_per_channel = self.branching_fractions.getExclusive(particle)
654
655 self.inc_br_per_channel = self.branching_fractions.getInclusive(particle)
656
657
658 self.before_ranking = {}
659
660 self.after_ranking = {}
661
662 self.after_vertex = {}
663
664 self.after_classifier = {}
665
666 self.training_data = {}
667
668 self.ignored_channels = {}
669
670 for channel in self.particle.channels:
671 hist = MonitoringHist('Monitor_PreReconstruction_BeforeRanking.root', f'{channel.label}')
672 self.before_ranking[channel.label] = self.calculateStatistic(hist, channel.mvaConfig.target)
673 hist = MonitoringHist('Monitor_PreReconstruction_AfterRanking.root', f'{channel.label}')
674 self.after_ranking[channel.label] = self.calculateStatistic(hist, channel.mvaConfig.target)
675 hist = MonitoringHist('Monitor_PreReconstruction_AfterVertex.root', f'{channel.label}')
676 self.after_vertex[channel.label] = self.calculateStatistic(hist, channel.mvaConfig.target)
677 hist = MonitoringHist('Monitor_PostReconstruction_AfterMVA.root', f'{channel.label}')
678 self.after_classifier[channel.label] = self.calculateStatistic(hist, channel.mvaConfig.target)
679 if hist.valid and hist.sum(channel.mvaConfig.target) > 0:
680 self.reconstructed_number_of_channels += 1
681 self.ignored_channels[channel.label] = False
682 else:
683 self.ignored_channels[channel.label] = True
684 hist = MonitoringHist('Monitor_TrainingData.root', f'{channel.label}')
685 self.training_data[channel.label] = hist
686
687 plist = removeJPsiSlash(particle.identifier)
688 hist = MonitoringHist('Monitor_PostReconstruction_BeforePostCut.root', f'{plist}')
689
690 self.before_postcut = self.calculateStatistic(hist, self.particle.mvaConfig.target)
691 hist = MonitoringHist('Monitor_PostReconstruction_BeforeRanking.root', f'{plist}')
692
693 self.before_ranking_postcut = self.calculateStatistic(hist, self.particle.mvaConfig.target)
694 hist = MonitoringHist('Monitor_PostReconstruction_AfterRanking.root', f'{plist}')
695
696 self.after_ranking_postcut = self.calculateStatistic(hist, self.particle.mvaConfig.target)
697
698 self.before_tag = self.calculateStatistic(hist, self.particle.mvaConfig.target)
699
700 self.final_ntuple = MonitoringNTuple('Monitor_Final.root', f'{plist}')
701
702 self.after_tag = self.calculateUniqueStatistic(self.final_ntuple.tree)
703
get_stages_from_particles(typing.Sequence[typing.Union[config.Particle, str]] particles)
Definition core.py:878

Member Function Documentation

◆ calculateStatistic()

calculateStatistic ( self,
hist,
target )
Calculate Statistic object where all signal candidates are considered signal

Definition at line 704 of file monitoring.py.

704 def calculateStatistic(self, hist, target):
705 """
706 Calculate Statistic object where all signal candidates are considered signal
707 """
708 nTrueSig = self.mc_count['sum']
709 if not hist.valid:
710 return Statistic(nTrueSig, 0, 0)
711 signal_bins = (hist.centers[target] > 0.5)
712 bckgrd_bins = ~signal_bins
713 nSig = hist.values[target][signal_bins].sum()
714 nBg = hist.values[target][bckgrd_bins].sum()
715 return Statistic(nTrueSig, nSig, nBg)
716

◆ calculateUniqueStatistic()

calculateUniqueStatistic ( self,
tree )
Calculate Static object where only unique signal candidates are considered signal

Definition at line 717 of file monitoring.py.

717 def calculateUniqueStatistic(self, tree):
718 """
719 Calculate Static object where only unique signal candidates are considered signal
720 """
721 nTrueSig = self.mc_count['sum']
722 if not tree:
723 return Statistic(nTrueSig, 0, 0)
724
725 nSig, nBg = 0, 0
726 for entry in tree:
727 if getattr(entry, "extraInfo__bouniqueSignal__bc") == 1:
728 nSig += 1
729 else:
730 nBg += 1
731 return Statistic(nTrueSig, nSig, nBg)

Member Data Documentation

◆ after_classifier

dict after_classifier = {}

Monitoring histogram in PostReconstruction after the mva application.

Definition at line 664 of file monitoring.py.

◆ after_ranking

dict after_ranking = {}

Monitoring histogram in PreReconstruction after the ranking-cut.

Definition at line 660 of file monitoring.py.

◆ after_ranking_postcut

after_ranking_postcut = self.calculateStatistic(hist, self.particle.mvaConfig.target)

Monitoring histogram in PostReconstruction after the ranking postcut.

Definition at line 696 of file monitoring.py.

◆ after_tag

after_tag = self.calculateUniqueStatistic(self.final_ntuple.tree)

Statistic object after unique tagging of signals.

Definition at line 702 of file monitoring.py.

◆ after_vertex

dict after_vertex = {}

Monitoring histogram in PreReconstruction after the vertex fit.

Definition at line 662 of file monitoring.py.

◆ before_postcut

before_postcut = self.calculateStatistic(hist, self.particle.mvaConfig.target)

Monitoring histogram in PostReconstruction before the postcut.

Definition at line 690 of file monitoring.py.

◆ before_ranking

dict before_ranking = {}

Monitoring histogram in PreReconstruction before the ranking-cut.

Definition at line 658 of file monitoring.py.

◆ before_ranking_postcut

before_ranking_postcut = self.calculateStatistic(hist, self.particle.mvaConfig.target)

Monitoring histogram in PostReconstruction before the ranking postcut.

Definition at line 693 of file monitoring.py.

◆ before_tag

before_tag = self.calculateStatistic(hist, self.particle.mvaConfig.target)

Statistic object before unique tagging of signals.

Definition at line 698 of file monitoring.py.

◆ branching_fractions

branching_fractions = MonitoringBranchingFractions()

Branching fractions.

Definition at line 651 of file monitoring.py.

◆ exc_br_per_channel

exc_br_per_channel = self.branching_fractions.getExclusive(particle)

Exclusive branching fractions per channel.

Definition at line 653 of file monitoring.py.

◆ final_ntuple

final_ntuple = MonitoringNTuple('Monitor_Final.root', f'{plist}')

Reference to the final ntuple.

Definition at line 700 of file monitoring.py.

◆ ignored_channels

dict ignored_channels = {}

Dictionary containing whether the channel reconstructed at least one candidate or not.

Definition at line 668 of file monitoring.py.

◆ inc_br_per_channel

inc_br_per_channel = self.branching_fractions.getInclusive(particle)

Inclusive branching fraction per channel.

Definition at line 655 of file monitoring.py.

◆ mc_count

mc_count = MonitoringMCCount(particle)

Dictionary with 'sum', 'std', 'mean', 'min' and 'max' of the MC counts.

Definition at line 635 of file monitoring.py.

◆ module_statistic

module_statistic = MonitoringModuleStatistics(particle)

Module statistics.

Definition at line 637 of file monitoring.py.

◆ particle

particle = particle

Particle containing its configuration.

Definition at line 623 of file monitoring.py.

◆ reconstructed_number_of_channels

int reconstructed_number_of_channels = 0

Reconstructed number of channels.

Definition at line 648 of file monitoring.py.

◆ time_per_channel

time_per_channel = self.module_statistic.channel_time

time per channel

Definition at line 639 of file monitoring.py.

◆ time_per_channel_per_module

time_per_channel_per_module = self.module_statistic.channel_time_per_module

time per channel per module

Definition at line 641 of file monitoring.py.

◆ total_number_of_channels

total_number_of_channels = len(self.particle.channels)

Total number of channels.

Definition at line 646 of file monitoring.py.

◆ total_time

total_time = self.module_statistic.particle_time + sum(self.time_per_channel.values())

total time

Definition at line 643 of file monitoring.py.

◆ training_data

dict training_data = {}

Monitoring histogram for TrainingData Generation only available if Monitoring runs on the training monitoring data.

Definition at line 666 of file monitoring.py.


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