-
Notifications
You must be signed in to change notification settings - Fork 1
/
MakeDateFriendTree.py
executable file
·43 lines (30 loc) · 1023 Bytes
/
MakeDateFriendTree.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
#!/usr/bin/python
import ROOT
import sys
import MyPyRoot
ROOT.gROOT.ProcessLine(".X $MGDODIR/Igor/LoadMGDOIgorXIAClasses.C")
ROOT.gROOT.ProcessLine(".L $MGDODIR/lib/libMGDORoot.so")
ROOT.gROOT.ProcessLine(".L $ORDIR/lib/libORDataObjects.so")
#ROOT.gROOT.ProcessLine( "struct MyStruct {\
# TDatime fDatime; \
#};" )
#mystruct = ROOT.MyStruct()
filelist = sys.argv[:]
del filelist[0]
fSave = ROOT.TFile.Open('DateFriendTree.root', 'RECREATE')
myChain = MyPyRoot.getChainFromList(filelist, 'DGF')
nEntries = myChain.GetEntries()
fDatime = ROOT.TDatime()
myEvent = ROOT.ORDGFEvent()
myHeader = ROOT.ORDGFHeader()
myChain.SetBranchAddress('fDGFHeader', ROOT.AddressOf(myHeader))
dateTree = ROOT.TTree('dateTree','')
dateTree.Branch('fDatime', fDatime)
for i in range(0, nEntries):
myChain.GetEntry(i)
theFileName = myHeader.GetFileName()
year, month, day = MyPyRoot.getDateFromString(theFileName)
fDatime.Set(int(year), int(month), int(day), 0, 0, 0)
dateTree.Fill()
dateTree.Write()
fSave.Close()