Skip to content

Commit 4109110

Browse files
committed
Added time and zp to the root tree
1 parent 29fc708 commit 4109110

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

src/pybdsim/Data.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,9 @@ def WriteSamplerDataToROOTFile(inputFileName, outputFileName, samplerName):
769769
y = _np.array([0]).astype(_np.double)
770770
xp = _np.array([0]).astype(_np.double)
771771
yp = _np.array([0]).astype(_np.double)
772+
zp = _np.array([0]).astype(_np.double)
772773
p = _np.array([0]).astype(_np.double)
774+
t = _np.array([0]).astype(_np.double)
773775
partID = _np.array([0]).astype(_np.int32)
774776
weight = _np.array([0]).astype(_np.double)
775777

@@ -780,7 +782,9 @@ def WriteSamplerDataToROOTFile(inputFileName, outputFileName, samplerName):
780782
outputTree.Branch("y", y, "y/D")
781783
outputTree.Branch("xp", xp, "xp/D")
782784
outputTree.Branch("yp", yp, "yp/D")
785+
outputTree.Branch("zp", zp, "zp/D")
783786
outputTree.Branch("p", p, "p/D")
787+
outputTree.Branch("t", t, "t/D")
784788
outputTree.Branch("partID", partID, "partID/I")
785789
outputTree.Branch("weight", weight, "weight/D")
786790

@@ -790,20 +794,25 @@ def WriteSamplerDataToROOTFile(inputFileName, outputFileName, samplerName):
790794
samplerY = sampler.data['y']
791795
samplerXp = sampler.data['xp']
792796
samplerYp = sampler.data['yp']
797+
samplerZp = sampler.data['zp']
793798
samplerP = sampler.data['p']
799+
samplerT = sampler.data['T']
794800
samplerPartID = sampler.data['partID']
795801
samplerWeight = sampler.data['weight']
796802

797803
outputFile.cd()
798804

799-
for i in range(len(samplerX)):
800-
x[0] = samplerX[i]
801-
y[0] = samplerY[i]
802-
xp[0] = samplerXp[i]
803-
yp[0] = samplerYp[i]
804-
p[0] = samplerP[i]
805-
partID[0] = samplerPartID[i]
806-
weight[0] = samplerWeight[i]
805+
for xi, yi, xpi, ypi, zpi, pi, ti, partIDi, weighti in zip(samplerX, samplerY, samplerXp, samplerYp, samplerZp,
806+
samplerP, samplerT, samplerPartID, samplerWeight):
807+
x[0] = xi
808+
y[0] = yi
809+
xp[0] = xpi
810+
yp[0] = ypi
811+
zp[0] = zpi
812+
p[0] = pi
813+
t[0] = ti
814+
partID[0] = partIDi
815+
weight[0] = weighti
807816
outputTree.Fill()
808817

809818
outputTree.Write()

0 commit comments

Comments
 (0)