Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Data Fields
mcscorerootio.MCScoreROOTIO Class Reference

Public Member Functions

def __init__
 
def define_tree
 
def fill_tree
 

Data Fields

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

Detailed Description

Definition at line 29 of file mcscorerootio.py.

Constructor & Destructor Documentation

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

Definition at line 31 of file mcscorerootio.py.

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

Member Function Documentation

def mcscorerootio.MCScoreROOTIO.define_tree (   self)

Definition at line 35 of file mcscorerootio.py.

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

Definition at line 72 of file mcscorerootio.py.

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, and mcscorerootio.MCScoreROOTIO.maxparticle.

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

Field Documentation

mcscorerootio.MCScoreROOTIO.a_A

Definition at line 56 of file mcscorerootio.py.

Referenced by mcscorerootio.MCScoreROOTIO.fill_tree().

mcscorerootio.MCScoreROOTIO.a_ke

Definition at line 59 of file mcscorerootio.py.

Referenced by mcscorerootio.MCScoreROOTIO.fill_tree().

mcscorerootio.MCScoreROOTIO.a_namelist

Definition at line 49 of file mcscorerootio.py.

Referenced by mcscorerootio.MCScoreROOTIO.fill_tree().

mcscorerootio.MCScoreROOTIO.a_np

Definition at line 47 of file mcscorerootio.py.

Referenced by mcscorerootio.MCScoreROOTIO.fill_tree().

mcscorerootio.MCScoreROOTIO.a_px

Definition at line 62 of file mcscorerootio.py.

Referenced by mcscorerootio.MCScoreROOTIO.fill_tree().

mcscorerootio.MCScoreROOTIO.a_py

Definition at line 65 of file mcscorerootio.py.

Referenced by mcscorerootio.MCScoreROOTIO.fill_tree().

mcscorerootio.MCScoreROOTIO.a_pz

Definition at line 68 of file mcscorerootio.py.

Referenced by mcscorerootio.MCScoreROOTIO.fill_tree().

mcscorerootio.MCScoreROOTIO.a_x

Definition at line 42 of file mcscorerootio.py.

Referenced by mcscorerootio.MCScoreROOTIO.fill_tree().

mcscorerootio.MCScoreROOTIO.a_y

Definition at line 43 of file mcscorerootio.py.

Referenced by mcscorerootio.MCScoreROOTIO.fill_tree().

mcscorerootio.MCScoreROOTIO.a_z

Definition at line 44 of file mcscorerootio.py.

Referenced by mcscorerootio.MCScoreROOTIO.fill_tree().

mcscorerootio.MCScoreROOTIO.a_Z

Definition at line 53 of file mcscorerootio.py.

Referenced by mcscorerootio.MCScoreROOTIO.fill_tree().

mcscorerootio.MCScoreROOTIO.maxparticle

Definition at line 32 of file mcscorerootio.py.

Referenced by mcscorerootio.MCScoreROOTIO.fill_tree().

mcscorerootio.MCScoreROOTIO.ptree

Definition at line 39 of file mcscorerootio.py.

mcscorerootio.MCScoreROOTIO.vtree

Definition at line 38 of file mcscorerootio.py.


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