9muonIn =
"/media/Data/HNL/muVetoDIS/muDISVetoCounter.root"
12from array
import array
14PDG = ROOT.TDatabasePDG.Instance()
20 if apid
not in masssq:
21 masssq[apid] = PDG.GetParticle(apid).Mass() ** 2
30fout = ROOT.TFile(
"muonEm_" + str(nJob) +
".root",
"recreate")
31dTree = ROOT.TTree(
"pythia8-Geant4",
"muons for EM studies")
32iMuon = ROOT.TClonesArray(
"TVectorD")
33iMuonBranch = dTree.Branch(
"InMuon", iMuon, 32000, -1)
34dPart = ROOT.TClonesArray(
"TVectorD")
35dPartBranch = dTree.Branch(
"Particles", dPart, 32000, -1)
38fin = ROOT.TFile(muonIn)
41for k
in range(sTree.GetEntries()):
42 rc = sTree.GetEvent(k)
44 px, py, pz = sTree.px, sTree.py, sTree.pz
45 x, y, z = sTree.x, sTree.y, sTree.z
46 pid, w = sTree.id, sTree.w
47 p = ROOT.TMath.Sqrt(px * px + py * py + pz * pz)
49 mu = array(
"d", [pid, px, py, pz, E, x, y, z, w])
50 muPart = ROOT.TVectorD(9, mu)
51 for n
in range(nMult):
54 tca_vec = iMuon.ConstructedAt(0)
55 tca_vec.ResizeTo(muPart)
56 ROOT.std.swap(tca_vec, muPart)
57 m = array(
"d", [pid, px, py, pz, E])
58 part = ROOT.TVectorD(5, m)
61 if dPart.GetSize() == nPart:
62 dPart.Expand(nPart + 10)
63 tca_vec = dPart.ConstructedAt(nPart)
64 tca_vec.ResizeTo(part)
65 ROOT.std.swap(tca_vec, part)
69print(
"created", sTree.GetEntries() * nMult,
" events")