Belle II Software development
PrintCollections Class Reference
Inheritance diagram for PrintCollections:

Public Member Functions

def __init__ (self, queue)
 
def initialize (self)
 
def store_content (self)
 
def event (self)
 
def terminate (self)
 

Public Attributes

 queue
 The queue to handle.
 
 store_content_list
 The contents of the store arrays for some events.
 
 event_number
 The current event number.
 
 total_number_of_events
 The total number of events.
 

Detailed Description

A small module to catch the content of the store array for some events and store them in the queue.

Definition at line 17 of file python_modules.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  queue 
)
Create the module with the given queue.

Definition at line 23 of file python_modules.py.

23 def __init__(self, queue):
24 """
25 Create the module with the given queue.
26 """
27 super().__init__()
28
29 self.queue = queue
30
31 self.store_content_list = []
32
33 self.event_number = 0
34
35 self.total_number_of_events = 0
36

Member Function Documentation

◆ event()

def event (   self)
Write the store array content into a list for later.

Definition at line 62 of file python_modules.py.

62 def event(self):
63 """
64 Write the store array content into a list for later.
65 """
66 if self.total_number_of_events == 0:
67 if self.event_number % 1000 == 0:
68 self.store_content()
69
70 else:
71 current_percentage = 1.0 * self.event_number / self.total_number_of_events
72
73 if 100 * current_percentage % 10 == 0:
74 self.store_content()
75
76 self.event_number += 1
77

◆ initialize()

def initialize (   self)
Get the total number of events from C++

Definition at line 37 of file python_modules.py.

37 def initialize(self):
38 """
39 Get the total number of events from C++
40 """
41 self.total_number_of_events = Belle2.Environment.Instance().getNumberOfEvents()
42
static Environment & Instance()
Static method to get a reference to the Environment instance.
Definition: Environment.cc:28

◆ store_content()

def store_content (   self)
Store the current content of the store array into the internal list.

Definition at line 43 of file python_modules.py.

43 def store_content(self):
44 """
45 Store the current content of the store array into the internal list.
46 """
47 registered_store_arrays = Belle2.PyStoreArray.list()
48 registered_store_objects = Belle2.PyStoreObj.list()
49
50 event_store_content_list = []
51
52 for store_array_name in registered_store_arrays:
53 store_array = Belle2.PyStoreArray(store_array_name)
54 event_store_content_list.append(StoreContent(store_array_name, len(store_array)))
55
56 for store_array_name in registered_store_objects:
57 event_store_content_list.append(StoreContent(store_array_name, 0))
58
59 event_store_content = StoreContentList(content=event_store_content_list, event_number=self.event_number)
60 self.store_content_list.append(event_store_content)
61
A (simplified) python wrapper for StoreArray.
Definition: PyStoreArray.h:72
static std::vector< std::string > list(DataStore::EDurability durability=DataStore::EDurability::c_Event)
Return list of available arrays for given durability.
Definition: PyStoreArray.cc:28
static std::vector< std::string > list(DataStore::EDurability durability=DataStore::EDurability::c_Event)
Return list of available objects for given durability.
Definition: PyStoreObj.cc:28

◆ terminate()

def terminate (   self)
Write the store array contents from the events to the queue.

Definition at line 78 of file python_modules.py.

78 def terminate(self):
79 """
80 Write the store array contents from the events to the queue.
81 """
82 self.queue.put("ipython.store_content", self.store_content_list)
83
84

Member Data Documentation

◆ event_number

event_number

The current event number.

Definition at line 33 of file python_modules.py.

◆ queue

queue

The queue to handle.

Definition at line 29 of file python_modules.py.

◆ store_content_list

store_content_list

The contents of the store arrays for some events.

Definition at line 31 of file python_modules.py.

◆ total_number_of_events

total_number_of_events

The total number of events.

Definition at line 35 of file python_modules.py.


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