Belle II Software  release-08-01-10
WriteData Class Reference
Inheritance diagram for WriteData:
Collaboration 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 52 of file genPixelLikelihoods.py.

Member Function Documentation

◆ event()

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

Definition at line 66 of file genPixelLikelihoods.py.

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

◆ initialize()

def initialize (   self)
Inits WriteData object.

Definition at line 61 of file genPixelLikelihoods.py.

◆ terminate()

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

Definition at line 131 of file genPixelLikelihoods.py.


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