-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUserVsd-Simple.py
44 lines (33 loc) · 1.32 KB
/
UserVsd-Simple.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import ROOT
ROOT.gSystem.Load("libVsdDict.so")
Vfile = ROOT.TFile("UserVsd-Simple.root", "RECREATE")
Vtree = ROOT.TTree("VSD", "Custom plain VSD tree")
pcv = ROOT.std.vector('VsdCandidate')()
candBr = Vtree.Branch("PinkCands", pcv)
umv = ROOT.std.vector('VsdMuon')()
mb = Vtree.Branch("UMuon", umv)
for i in range(10):
pcv.clear()
umv.clear()
for j in range(10 + ROOT.gRandom.Integer(11)):
cnd = ROOT.VsdCandidate(
ROOT.gRandom.Uniform(0.1, 20),
ROOT.gRandom.Uniform(-2.5, 2.5),
ROOT.gRandom.Uniform(-ROOT.TMath.Pi(), ROOT.TMath.Pi()),
(1 if ROOT.gRandom.Rndm() > 0.5 else -1))
cnd.name = f"Candidate_{j}"
cnd.setPos(ROOT.gRandom.Uniform(0.1, 20),ROOT.gRandom.Uniform(0.1, 20), ROOT.gRandom.Uniform(0.1, 20))
pcv.push_back(cnd)
for j in range(5):
muon = ROOT.VsdMuon(
ROOT.gRandom.Uniform(0.1, 20),
ROOT.gRandom.Uniform(-2.5, 2.5),
ROOT.gRandom.Uniform(-ROOT.TMath.Pi(), ROOT.TMath.Pi()),
(1 if ROOT.gRandom.Rndm() > 0.5 else -1))
muon.name = f"Muon_{j}"
muon.setPos(ROOT.gRandom.Uniform(0.1, 20),ROOT.gRandom.Uniform(0.1, 20), ROOT.gRandom.Uniform(0.1, 20))
umv.push_back(muon)
Vtree.Fill()
# Save the TTree to a file and close it
Vtree.Write()
Vfile.Close()