13 sTree = ROOT.TChain(
"DIS")
14 for i
in range(0, 12):
15 fn =
"muonDis_" + str(i) +
".root"
17 fm = ROOT.TFile(
"test.root",
"recreate")
18 nTree = ROOT.TTree(
"DIS",
"muon DIS")
19 iMuon = ROOT.TClonesArray(
"TVectorD")
20 iMuonBranch = nTree.Branch(
"InMuon", iMuon, 32000, -1)
21 dPart = ROOT.TClonesArray(
"TVectorD")
22 dPartBranch = nTree.Branch(
"Particles", dPart, 32000, -1)
23 for n
in range(sTree.GetEntries()):
27 tca_vec = iMuon.ConstructedAt(0)
28 tca_vec.ResizeTo(sTree.InMuon[0])
29 ROOT.std.swap(tca_vec, sTree.InMuon[0])
30 for part
in sTree.Particles:
32 if dPart.GetSize() == nPart:
33 dPart.Expand(nPart + 10)
34 tca_vec = dPart.ConstructedAt(nPart)
35 tca_vec.ResizeTo(part)
36 ROOT.std.swap(tca_vec, part)
46 cmd =
"hadd -f muonDIS.root "
47 for i
in range(0, 12):
48 cmd +=
" muonDis_" + str(i) +
".root "
53 ut.bookHist(h,
"muP",
"muon mom", 100, 0.0, 400.0)
54 ut.bookHist(h,
"nOut",
"outgoing part", 100, -0.5, 99.5)
55 ut.bookHist(h,
"pos",
"position", 100, -25.0, 100.0, 100, -12.0, 12.0, 100, -13.0, 13.0)
56 for n
in range(sTree.GetEntries()):
58 inMu = sTree.InMuon[0]
60 P = ROOT.TMath.Sqrt(inMu[1] ** 2 + inMu[2] ** 2 + inMu[3] ** 2)
62 h[
"nOut"].Fill(len(sTree.Particles))
63 h[
"pos"].Fill(inMu[7], inMu[5], inMu[6])
66def test(fn: str =
"test.root") ->
None:
None test(str fn="test.root")