Belle II Software  release-05-02-19
ClusterEfficiency Class Reference
Inheritance diagram for ClusterEfficiency:
Collaboration diagram for ClusterEfficiency:

Public Member Functions

def initialize (self)
 
def terminate (self)
 
def fill_truehits (self, phi, p, truehits)
 
def event (self)
 

Public Attributes

 rfile
 Output file to store all plots.
 
 profiles
 flat list of all profiles for easy access
 
 eff
 layer/momentum hierachy of all profiles
 

Detailed Description

Plot Efficiency to find a U and V cluster for each given truehit.

Definition at line 32 of file ClusterEfficiency.py.

Member Function Documentation

◆ event()

def event (   self)
Update the efficienies by iterating over all primary particles

Definition at line 146 of file ClusterEfficiency.py.

146  def event(self):
147  """
148  Update the efficienies by iterating over all primary particles
149  """
150  mcparticles = Belle2.PyStoreArray("MCParticles")
151  for mcp in mcparticles:
152  # we only look at primary particles
153  if not mcp.hasStatus(1):
154  continue
155 
156  # let's get the momentum and determine which of the ones we wanted
157  # to generate it is
158  p = mcp.getMomentum()
159  p_gen = None
160  for i in momenta:
161  if abs(p.Mag() - i) < 0.05:
162  p_gen = i
163  break
164 
165  # meh, something strange with the momentum, ignore this one
166  if p_gen is None:
167  B2WARNING("Strange particle momentum: %f, expected one of %s" %
168  (p.Mag(), ", ".join(str() for p in momenta)))
169  continue
170 
171  # and check all truehits
172  pxdtruehits = mcp.getRelationsTo("PXDTrueHits")
173  self.fill_truehits(math.degrees(p.Phi()), p_gen, pxdtruehits)
174  svdtruehits = mcp.getRelationsTo("SVDTrueHits")
175  self.fill_truehits(math.degrees(p.Phi()), p_gen, svdtruehits)
176 
177 # Now let's create a path to simulate our events. We need a bit of statistics but
178 # that's not too bad since we only simulate single muons

◆ fill_truehits()

def fill_truehits (   self,
  phi,
  p,
  truehits 
)
Loop over all truehits for a track with the given angle phi and momentum
p and update the efficiency profiles.

Definition at line 105 of file ClusterEfficiency.py.

◆ initialize()

def initialize (   self)
Create ROOT TProfiles for all layers and momenta.

Definition at line 36 of file ClusterEfficiency.py.

◆ terminate()

def terminate (   self)
Format all profiles and write the ROOT file.

Definition at line 84 of file ClusterEfficiency.py.


The documentation for this class was generated from the following file:
ClusterEfficiency.ClusterEfficiency.event
def event(self)
Definition: ClusterEfficiency.py:146
Belle2::PyStoreArray
a (simplified) python wrapper for StoreArray.
Definition: PyStoreArray.h:58