SND@LHC Software
Loading...
Searching...
No Matches
muDIS_mergeFiles Namespace Reference

Functions

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

Variables

dict h = {}
 

Function Documentation

◆ hadd()

muDIS_mergeFiles.hadd ( )

Definition at line 30 of file muDIS_mergeFiles.py.

30def hadd():
31 cmd = 'hadd -f muonDIS.root '
32 for i in range(0,12):
33 cmd+= " muonDis_"+str(i)+".root "
34 os.system(cmd)

◆ makePlots()

muDIS_mergeFiles.makePlots (   sTree)

Definition at line 35 of file muDIS_mergeFiles.py.

35def makePlots(sTree):
36 ut.bookHist(h,'muP','muon mom',100,0.,400.)
37 ut.bookHist(h,'nOut','outgoing part',100,-0.5,99.5)
38 ut.bookHist(h,'pos','position',100,-25.,100.,100,-12.,12.,100,-13.,13.)
39 for n in range(sTree.GetEntries()):
40 rc = sTree.GetEvent(n)
41 inMu = sTree.InMuon[0]
42 w = inMu[8]
43 P = ROOT.TMath.Sqrt(inMu[1]**2+inMu[2]**2+inMu[3]**2)
44 rc = h['muP'].Fill(P,w)
45 rc = h['nOut'].Fill(sTree.Particles.GetEntries() )
46 rc = h['pos'].Fill(inMu[7],inMu[5],inMu[6] )

◆ merge()

muDIS_mergeFiles.merge ( )

Definition at line 4 of file muDIS_mergeFiles.py.

4def merge():
5 sTree = ROOT.TChain('DIS')
6 for i in range(0,12):
7 fn = "muonDis_"+str(i)+".root"
8 sTree.AddFile(fn)
9 fm = ROOT.TFile("test.root","recreate")
10 nTree = ROOT.TTree('DIS','muon DIS')
11 iMuon = ROOT.TClonesArray("TVectorD")
12 iMuonBranch = nTree.Branch("InMuon",iMuon,32000,-1)
13 dPart = ROOT.TClonesArray("TVectorD")
14 dPartBranch = nTree.Branch("Particles",dPart,32000,-1)
15 for n in range(sTree.GetEntries()):
16 sTree.GetEvent(n)
17 dPart.Clear()
18 iMuon.Clear()
19 iMuon[0] = sTree.InMuon[0]
20 for part in sTree.Particles:
21 nPart = dPart.GetEntries()
22 if dPart.GetSize() == nPart: dPart.Expand(nPart+10)
23 dPart[nPart] = part
24 dPartBranch.Fill()
25 iMuonBranch.Fill()
26 nTree.Fill()
27 fm.cd()
28 nTree.Write()
29 fm.Close()

◆ test()

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

Definition at line 47 of file muDIS_mergeFiles.py.

47def test(fn = "test.root"):
48 fm = ROOT.TFile(fn)
49 sTree = fm.DIS
50 makePlots(sTree)
51
52

Variable Documentation

◆ h

dict muDIS_mergeFiles.h = {}

Definition at line 3 of file muDIS_mergeFiles.py.