Belle II Software development
SVDExtraEventStatisticsModule Class Reference
Inheritance diagram for SVDExtraEventStatisticsModule:
PerEventStatisticsGetterModule

Public Member Functions

 __init__ (self, filename)
 
 initialize (self)
 
 event (self)
 
 terminate (self)
 

Public Attributes

 svdSPs = Belle2.PyStoreArray("SVDSpacePoints")
 StoreArray of SVDSpacePoints.
 
 svdclusters = Belle2.PyStoreArray("SVDClusters")
 StoreArray of SVDClusters.
 
 svdstrips = Belle2.PyStoreArray("SVDShaperDigits")
 StoreArray of SVDShaperDigits.
 
 svdZS5strips = Belle2.PyStoreArray("SVDShaperDigitsZS5")
 StoreArray of ZS5 SVDShaperDigits.
 
 tracks = Belle2.PyStoreArray("Tracks")
 StoreArray of Tracks.
 
 svd_sps = np.zeros(1, dtype=np.int32)
 array storing the number of SVDSpacePoints
 
 svd_clusters = np.zeros(1, dtype=np.int32)
 array storing the number of SVDClusters
 
 svd_strips = np.zeros(1, dtype=np.int32)
 array storing the number of SVDShaperDigits
 
 svd_ZS5strips = np.zeros(1, dtype=np.int32)
 array storing the number of ZS5 SVDShaperDigits
 
 svd_tracks = np.zeros(1, dtype=np.int32)
 array storing the number of tracks
 
 output_file_name = output_file_name
 Name of the output file.
 
 tfile = None
 Will host the pointer to the opened TFile later.
 
 statistics = None
 Will host the TTree later.
 
 event_number = np.zeros(3, dtype=float)
 The columns to store the event number.
 
 ttree_inputs = None
 The columns for the statistics TTree (they will be filled in the event function).
 
 last_time_sum = None
 Last recorded sum of event calls for all modules.
 
bool branches_added = False
 A flag to indicate that we have already added the Branches to the TTree (which we will do in the first event)
 
 event_meta_data = ROOT.Belle2.PyStoreObj("EventMetaData")
 The event meta data.
 

Detailed Description

a basf2 python module to export all module time statistics (PerEventStatisticsGetterModule) +
number of SVDSpacePoints, SVDClusters, SVDShaperDigits and SVDSHaperDigitsZS5
into a ROOT TTree written to a file.

Definition at line 29 of file executionTime_utils.py.

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self,
filename )
creates the module
@param filename: name of the rootfile where the TTree is written.

Definition at line 36 of file executionTime_utils.py.

36 def __init__(self, filename):
37 """
38 creates the module
39 @param filename: name of the rootfile where the TTree is written.
40 """
41 super().__init__(filename)
42
43 self.svdSPs = Belle2.PyStoreArray("SVDSpacePoints")
44
45 self.svdclusters = Belle2.PyStoreArray("SVDClusters")
46
47 self.svdstrips = Belle2.PyStoreArray("SVDShaperDigits")
48
49 self.svdZS5strips = Belle2.PyStoreArray("SVDShaperDigitsZS5")
50
51 self.tracks = Belle2.PyStoreArray("Tracks")
52
A (simplified) python wrapper for StoreArray.

Member Function Documentation

◆ event()

event ( self)
 event 

Reimplemented from PerEventStatisticsGetterModule.

Definition at line 88 of file executionTime_utils.py.

88 def event(self):
89 """ event """
90
91 self.svd_sps[0] = self.svdSPs.getEntries()
92 self.svd_clusters[0] = self.svdclusters.getEntries()
93 self.svd_strips[0] = self.svdstrips.getEntries()
94
95 if self.svdZS5strips.isOptional():
96 self.svd_ZS5strips[0] = self.svdZS5strips.getEntries()
97 if self.tracks.isOptional():
98 self.svd_tracks[0] = self.tracks.getEntries()
99
100 super().event()

◆ initialize()

initialize ( self)
Create the needed store object pointer in the DataStore and the TFile with the TTree.

Reimplemented from PerEventStatisticsGetterModule.

Definition at line 53 of file executionTime_utils.py.

53 def initialize(self):
54 """
55 Create the needed store object pointer in the DataStore and the TFile with the TTree.
56 """
57
58 super().initialize()
59
60 self.svd_sps = np.zeros(1, dtype=np.int32)
61
62 self.svd_clusters = np.zeros(1, dtype=np.int32)
63
64 self.svd_strips = np.zeros(1, dtype=np.int32)
65
66 self.svd_ZS5strips = np.zeros(1, dtype=np.int32)
67
68 self.svd_tracks = np.zeros(1, dtype=np.int32)
69
70
71 self.statistics.Branch('svdSPs', self.svd_sps[0:], "svdSPs/I")
72
73 self.statistics.Branch('svdClusters', self.svd_clusters[0:], "svdClusters/I")
74
75 self.statistics.Branch('svdStrips', self.svd_strips[0:], "svdStrips/I")
76
77 self.statistics.Branch('svdZS5strips', self.svd_ZS5strips[0:], "svdZS5strips/I")
78
79 self.statistics.Branch('tracks', self.svd_tracks[0:], "tracks/I")
80
81 self.svdSPs.isRequired()
82 self.svdclusters.isRequired()
83 self.svdstrips.isRequired()
84
85 self.svdZS5strips.isOptional()
86 self.tracks.isOptional()
87

◆ terminate()

terminate ( self)
inherited
Write out the merged statistics to the ROOT file.
This should only be called once, as we would end up with different versions otherwise.

Definition at line 130 of file per_event_statistics.py.

130 def terminate(self):
131 """
132 Write out the merged statistics to the ROOT file.
133 This should only be called once, as we would end up with different versions otherwise.
134 """
135 # Always avoid the top-level 'import ROOT'.
136 import ROOT # noqa
137
138 # Change the path a last time
139 old = ROOT.gDirectory
140 self.tfile.cd()
141
142 self.statistics.Write()
143 self.tfile.Close()
144
145 # and back again
146 ROOT.gDirectory = old

Member Data Documentation

◆ branches_added

bool branches_added = False
inherited

A flag to indicate that we have already added the Branches to the TTree (which we will do in the first event)

Definition at line 41 of file per_event_statistics.py.

◆ event_meta_data

event_meta_data = ROOT.Belle2.PyStoreObj("EventMetaData")
inherited

The event meta data.

Definition at line 47 of file per_event_statistics.py.

◆ event_number

event_number = np.zeros(3, dtype=float)
inherited

The columns to store the event number.

Definition at line 34 of file per_event_statistics.py.

◆ last_time_sum

last_time_sum = None
inherited

Last recorded sum of event calls for all modules.

Definition at line 38 of file per_event_statistics.py.

◆ output_file_name

output_file_name = output_file_name
inherited

Name of the output file.

Definition at line 27 of file per_event_statistics.py.

◆ statistics

statistics = None
inherited

Will host the TTree later.

Definition at line 31 of file per_event_statistics.py.

◆ svd_clusters

svd_clusters = np.zeros(1, dtype=np.int32)

array storing the number of SVDClusters

Definition at line 62 of file executionTime_utils.py.

◆ svd_sps

svd_sps = np.zeros(1, dtype=np.int32)

array storing the number of SVDSpacePoints

Definition at line 60 of file executionTime_utils.py.

◆ svd_strips

svd_strips = np.zeros(1, dtype=np.int32)

array storing the number of SVDShaperDigits

Definition at line 64 of file executionTime_utils.py.

◆ svd_tracks

svd_tracks = np.zeros(1, dtype=np.int32)

array storing the number of tracks

Definition at line 68 of file executionTime_utils.py.

◆ svd_ZS5strips

svd_ZS5strips = np.zeros(1, dtype=np.int32)

array storing the number of ZS5 SVDShaperDigits

Definition at line 66 of file executionTime_utils.py.

◆ svdclusters

svdclusters = Belle2.PyStoreArray("SVDClusters")

StoreArray of SVDClusters.

Definition at line 45 of file executionTime_utils.py.

◆ svdSPs

svdSPs = Belle2.PyStoreArray("SVDSpacePoints")

StoreArray of SVDSpacePoints.

Definition at line 43 of file executionTime_utils.py.

◆ svdstrips

svdstrips = Belle2.PyStoreArray("SVDShaperDigits")

StoreArray of SVDShaperDigits.

Definition at line 47 of file executionTime_utils.py.

◆ svdZS5strips

svdZS5strips = Belle2.PyStoreArray("SVDShaperDigitsZS5")

StoreArray of ZS5 SVDShaperDigits.

Definition at line 49 of file executionTime_utils.py.

◆ tfile

tfile = None
inherited

Will host the pointer to the opened TFile later.

Definition at line 29 of file per_event_statistics.py.

◆ tracks

tracks = Belle2.PyStoreArray("Tracks")

StoreArray of Tracks.

Definition at line 51 of file executionTime_utils.py.

◆ ttree_inputs

ttree_inputs = None
inherited

The columns for the statistics TTree (they will be filled in the event function).

Definition at line 36 of file per_event_statistics.py.


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