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

Public Member Functions

def initialize (self)
 
def event (self)
 
def terminate (self)
 

Public Attributes

 data
 A list containing arrays with each event's data.
 

Detailed Description

Data collector module. Gathers TOP Cherenkov photon data for each event.
On terminate(), writes gathered data to given output file.

Attributes:
    data: A list containing AwkwardArrays with each event's data.

Definition at line 51 of file genPixelLikelihoods.py.

Member Function Documentation

◆ event()

def event (   self)
Collects event data about TOP Cherenkov photons.

Definition at line 65 of file genPixelLikelihoods.py.

65 def event(self):
66 """Collects event data about TOP Cherenkov photons."""
67 mcps = Belle2.PyStoreArray("MCParticles")
68 mcp = sorted(mcps, key=lambda x: x.getEnergy(), reverse=True)[0]
69 mcp_pdg = abs(mcp.getPDG())
70 track = mcp.getRelated('Tracks')
71 if not track:
72 print('no related track')
73 return
74 logl = track.getRelated('TOPLikelihoods')
75 if not logl:
76 print('no related loglihoods')
77 return
78 pixlogl = track.getRelated('TOPPixelLikelihoods')
79 if not pixlogl:
80 print('no related pixel loglihoods')
81 return
82 digits = Belle2.PyStoreArray("TOPDigits")
83 if not digits:
84 print('no digits')
85 return
86
87 moduleID = 0
88 photon_detections = []
89 for d in digits:
90 if moduleID == 0:
91 moduleID = d.getModuleID()
92 simhit = d.getRelated("TOPSimHits")
93 if not simhit:
94 continue
95 photon = simhit.getRelated("TOPSimPhotons")
96 if not photon:
97 continue
98
99 chanID = d.getPixelID() - 1 # pixelID is 1-based
100 time = photon.getDetectionTime()
101 point = photon.getEmissionPoint()
102 emitTime = photon.getEmissionTime()
103 photon_detections.append([
104 chanID, time,
105 point.X(), point.Y(), point.Z(), emitTime
106 ])
107
108 self.data.append(
109 awk.fromiter([
110 np.array(pixlogl.getPixelLogL_e()),
111 np.array(pixlogl.getPixelLogL_mu()),
112 np.array(pixlogl.getPixelLogL_pi()),
113 np.array(pixlogl.getPixelLogL_K()),
114 np.array(pixlogl.getPixelLogL_p()),
115 np.array(pixlogl.getPixelSigPhot_e()),
116 np.array(pixlogl.getPixelSigPhot_mu()),
117 np.array(pixlogl.getPixelSigPhot_pi()),
118 np.array(pixlogl.getPixelSigPhot_K()),
119 np.array(pixlogl.getPixelSigPhot_p()),
120 logl.getLogL_e(),
121 logl.getLogL_mu(),
122 logl.getLogL_pi(),
123 logl.getLogL_K(),
124 logl.getLogL_p(),
125 photon_detections,
126 mcp_pdg
127 ])
128 )
129
A (simplified) python wrapper for StoreArray.
Definition: PyStoreArray.h:72

◆ initialize()

def initialize (   self)
Inits WriteData object.

Definition at line 60 of file genPixelLikelihoods.py.

60 def initialize(self):
61 """Inits WriteData object."""
62
63 self.data = []
64

◆ terminate()

def terminate (   self)
Writes data to given output file.

Definition at line 130 of file genPixelLikelihoods.py.

130 def terminate(self):
131 """Writes data to given output file."""
132 awk.save(opts.output, self.data, mode="w")
133
134
135# Suppress messages and warnings during processing:

Member Data Documentation

◆ data

data

A list containing arrays with each event's data.

Definition at line 63 of file genPixelLikelihoods.py.


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