FairShip
Loading...
Searching...
No Matches
muDIS_mergeFiles Namespace Reference

Functions

None merge ()
None hadd ()
None makePlots (sTree)
None test (str fn="test.root")

Variables

dict h = {}

Function Documentation

◆ hadd()

None muDIS_mergeFiles.hadd ( )

Definition at line 36 of file muDIS_mergeFiles.py.

36def hadd() -> None:
37 cmd = "hadd -f muonDIS.root "
38 for i in range(0, 12):
39 cmd += " muonDis_" + str(i) + ".root "
40 os.system(cmd)
41
42

◆ makePlots()

None muDIS_mergeFiles.makePlots ( sTree)

Definition at line 43 of file muDIS_mergeFiles.py.

43def makePlots(sTree) -> None:
44 ut.bookHist(h, "muP", "muon mom", 100, 0.0, 400.0)
45 ut.bookHist(h, "nOut", "outgoing part", 100, -0.5, 99.5)
46 ut.bookHist(h, "pos", "position", 100, -25.0, 100.0, 100, -12.0, 12.0, 100, -13.0, 13.0)
47 for n in range(sTree.GetEntries()):
48 sTree.GetEvent(n)
49 inMu = sTree.InMuon[0]
50 w = inMu[8]
51 P = ROOT.TMath.Sqrt(inMu[1] ** 2 + inMu[2] ** 2 + inMu[3] ** 2)
52 h["muP"].Fill(P, w)
53 h["nOut"].Fill(len(sTree.Particles))
54 h["pos"].Fill(inMu[7], inMu[5], inMu[6])
55
56

◆ merge()

None muDIS_mergeFiles.merge ( )

Definition at line 12 of file muDIS_mergeFiles.py.

12def merge() -> None:
13 sTree = ROOT.TChain("DIS")
14 for i in range(0, 12):
15 fn = "muonDis_" + str(i) + ".root"
16 sTree.AddFile(fn)
17 fm = ROOT.TFile("test.root", "recreate")
18 nTree = ROOT.TTree("DIS", "muon DIS")
19 iMuon = ROOT.TClonesArray("TVectorD")
20 nTree.Branch("InMuon", iMuon, 32000, -1)
21 dPart = ROOT.TClonesArray("TVectorD")
22 nTree.Branch("Particles", dPart, 32000, -1)
23 for n in range(sTree.GetEntries()):
24 sTree.GetEvent(n)
25 dPart.Clear()
26 iMuon.Clear()
27 ut.assignClonesArrayItem(iMuon, 0, sTree.InMuon[0])
28 for part in sTree.Particles:
29 ut.assignClonesArrayItem(dPart, len(dPart), part)
30 nTree.Fill()
31 fm.cd()
32 nTree.Write()
33 fm.Close()
34
35

◆ test()

None muDIS_mergeFiles.test ( str fn = "test.root")

Definition at line 57 of file muDIS_mergeFiles.py.

57def test(fn: str = "test.root") -> None:
58 fm = ROOT.TFile(fn)
59 sTree = fm.DIS
60 makePlots(sTree)

Variable Documentation

◆ h

dict muDIS_mergeFiles.h = {}

Definition at line 9 of file muDIS_mergeFiles.py.