Geant4-11
Public Member Functions | Data Fields
mcscorerootio.MCScoreROOTIO Class Reference

Public Member Functions

def __init__ (self, bsize=250)
 
def define_tree (self)
 
def fill_tree (self, vertex)
 

Data Fields

 a_A
 
 a_ke
 
 a_namelist
 
 a_np
 
 a_px
 
 a_py
 
 a_pz
 
 a_x
 
 a_y
 
 a_z
 
 a_Z
 
 maxparticle
 
 ptree
 
 vtree
 

Detailed Description

Definition at line 29 of file mcscorerootio.py.

Constructor & Destructor Documentation

◆ __init__()

def mcscorerootio.MCScoreROOTIO.__init__ (   self,
  bsize = 250 
)

Definition at line 31 of file mcscorerootio.py.

31 def __init__(self, bsize=250):
32 self.maxparticle = bsize # buffer size for #particles/vertex
33

Member Function Documentation

◆ define_tree()

def mcscorerootio.MCScoreROOTIO.define_tree (   self)

Definition at line 35 of file mcscorerootio.py.

35 def define_tree(self):
36 "define ROOT tree"
37 # defining tree header...
38 self.vtree = ROOT.TTree('vertex', 'mc vertex')
39 self.ptree = ROOT.TTree('particle', 'mc particle')
40
41 # vertex...
42 self.a_x = array('d', [0.]); self.vtree.Branch('x', self.a_x, 'x/d')
43 self.a_y = array('d', [0.]); self.vtree.Branch('y', self.a_y, 'y/d')
44 self.a_z = array('d', [0.]); self.vtree.Branch('z', self.a_z, 'z/d')
45
46 #global a_np, a_namelist, a_Z, a_A, a_ke, a_px, a_py, a_pz
47 self.a_np = array('i', [0]); self.ptree.Branch('np', self.a_np, 'np/i')
48
49 self.a_namelist = array('c', self.maxparticle*10*['\0'])
50 # 10 characters/particle
51 self.ptree.Branch('namelist', self.a_namelist, 'namelist/C')
52
53 self.a_Z = array('i', self.maxparticle*[0])
54 self.ptree.Branch('Z', self.a_Z, 'Z[np]/I')
55
56 self.a_A = array('i', self.maxparticle*[0])
57 self.ptree.Branch('A', self.a_A, 'A[np]/i')
58
59 self.a_ke = array('d', self.maxparticle*[0.])
60 self.ptree.Branch('kE', self.a_ke, 'kE[np]/d')
61
62 self.a_px = array('d', self.maxparticle*[0.])
63 self.ptree.Branch('px', self.a_px, 'px[np]/d')
64
65 self.a_py = array('d', self.maxparticle*[0.])
66 self.ptree.Branch('py', self.a_py, 'py[np]/d')
67
68 self.a_pz = array('d', self.maxparticle*[0.])
69 self.ptree.Branch('pz', self.a_pz, 'pz[np]/d')
70

◆ fill_tree()

def mcscorerootio.MCScoreROOTIO.fill_tree (   self,
  vertex 
)

Definition at line 72 of file mcscorerootio.py.

72 def fill_tree(self, vertex):
73 "fill vertex information to ROOT tree"
74 # ------------------------------------------------------------------
75 def push_pname(i0, pname): # local function
76 n = len(pname)
77 for i in xrange(n):
78 self.a_namelist[i0+i] = pname[i]
79 self.a_namelist[i0+n] = ' '
80
81 self.a_x[0] = vertex.x
82 self.a_y[0] = vertex.y
83 self.a_z[0] = vertex.z
84 self.vtree.Fill()
85
86 if vertex.nparticle > self.maxparticle:
87 raise """
88 *** buffer overflow in #particles/vertex.
89 *** please increment buffersize in MCScoreROOTIO(bsize).
90 """, self.maxparticle
91
92 idx_namelist = 0
93 self.a_np[0] = vertex.nparticle
94 for ip in range(vertex.nparticle):
95 particle = vertex.particle_list[ip]
96 push_pname(idx_namelist, particle.name)
97 idx_namelist += (len(particle.name)+1)
98 self.a_Z[ip] = particle.Z
99 self.a_A[ip] = particle.A
100 self.a_ke[ip] = particle.kineticE
101 self.a_px[ip] = particle.px
102 self.a_py[ip] = particle.py
103 self.a_pz[ip] = particle.pz
104
105 self.a_namelist[idx_namelist] = '\0'
106 self.ptree.Fill()
107
108
109# ==================================================================
110# functions
111# ==================================================================

References mcscorerootio.MCScoreROOTIO.a_A, mcscorerootio.MCScoreROOTIO.a_ke, mcscorerootio.MCScoreROOTIO.a_namelist, mcscorerootio.MCScoreROOTIO.a_np, mcscorerootio.MCScoreROOTIO.a_px, mcscorerootio.MCScoreROOTIO.a_py, mcscorerootio.MCScoreROOTIO.a_pz, mcscorerootio.MCScoreROOTIO.a_x, mcscorerootio.MCScoreROOTIO.a_y, mcscorerootio.MCScoreROOTIO.a_z, mcscorerootio.MCScoreROOTIO.a_Z, mcscorerootio.MCScoreROOTIO.maxparticle, mcscorerootio.MCScoreROOTIO.ptree, and mcscorerootio.MCScoreROOTIO.vtree.

Field Documentation

◆ a_A

mcscorerootio.MCScoreROOTIO.a_A

Definition at line 56 of file mcscorerootio.py.

Referenced by mcscorerootio.MCScoreROOTIO.fill_tree().

◆ a_ke

mcscorerootio.MCScoreROOTIO.a_ke

Definition at line 59 of file mcscorerootio.py.

Referenced by mcscorerootio.MCScoreROOTIO.fill_tree().

◆ a_namelist

mcscorerootio.MCScoreROOTIO.a_namelist

Definition at line 49 of file mcscorerootio.py.

Referenced by mcscorerootio.MCScoreROOTIO.fill_tree().

◆ a_np

mcscorerootio.MCScoreROOTIO.a_np

Definition at line 47 of file mcscorerootio.py.

Referenced by mcscorerootio.MCScoreROOTIO.fill_tree().

◆ a_px

mcscorerootio.MCScoreROOTIO.a_px

Definition at line 62 of file mcscorerootio.py.

Referenced by mcscorerootio.MCScoreROOTIO.fill_tree().

◆ a_py

mcscorerootio.MCScoreROOTIO.a_py

Definition at line 65 of file mcscorerootio.py.

Referenced by mcscorerootio.MCScoreROOTIO.fill_tree().

◆ a_pz

mcscorerootio.MCScoreROOTIO.a_pz

Definition at line 68 of file mcscorerootio.py.

Referenced by mcscorerootio.MCScoreROOTIO.fill_tree().

◆ a_x

mcscorerootio.MCScoreROOTIO.a_x

Definition at line 42 of file mcscorerootio.py.

Referenced by mcscorerootio.MCScoreROOTIO.fill_tree().

◆ a_y

mcscorerootio.MCScoreROOTIO.a_y

Definition at line 43 of file mcscorerootio.py.

Referenced by mcscorerootio.MCScoreROOTIO.fill_tree().

◆ a_z

mcscorerootio.MCScoreROOTIO.a_z

Definition at line 44 of file mcscorerootio.py.

Referenced by mcscorerootio.MCScoreROOTIO.fill_tree().

◆ a_Z

mcscorerootio.MCScoreROOTIO.a_Z

Definition at line 53 of file mcscorerootio.py.

Referenced by mcscorerootio.MCScoreROOTIO.fill_tree().

◆ maxparticle

mcscorerootio.MCScoreROOTIO.maxparticle

Definition at line 32 of file mcscorerootio.py.

Referenced by mcscorerootio.MCScoreROOTIO.fill_tree().

◆ ptree

mcscorerootio.MCScoreROOTIO.ptree

Definition at line 39 of file mcscorerootio.py.

Referenced by mcscorerootio.MCScoreROOTIO.fill_tree().

◆ vtree

mcscorerootio.MCScoreROOTIO.vtree

Definition at line 38 of file mcscorerootio.py.

Referenced by mcscorerootio.MCScoreROOTIO.fill_tree().


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