Belle II Software  release-08-01-10
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 hierarchy of all profiles
 

Detailed Description

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

Definition at line 37 of file ClusterEfficiency.py.

Member Function Documentation

◆ event()

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

Definition at line 152 of file ClusterEfficiency.py.

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

◆ 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 111 of file ClusterEfficiency.py.

◆ initialize()

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

Definition at line 42 of file ClusterEfficiency.py.

◆ terminate()

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

Definition at line 90 of file ClusterEfficiency.py.


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