-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_station.py
More file actions
95 lines (65 loc) · 2.66 KB
/
Copy pathdebug_station.py
File metadata and controls
95 lines (65 loc) · 2.66 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/usr/bin/env python
"""
Study a single station to understand what is happening to that
"""
import os
import subprocess
# basic PyROOT definitions
import ROOT
# definitions of MAUS data structure for PyROOT
import libMausCpp #pylint: disable = W0611
import itertools
import StationStudy
import FrontEndLookup
import ClusterLightYield
import TOFTools
def main():
print "Loading Calibration/Mapping lookups"
# The SciFi calibration
maus_scifi_calibration='%s/files/calibration/scifi_calibration_20150912.txt'\
% os.environ.get("MAUS_ROOT_DIR")
# The SciFi Mapping
maus_scifi_mapping='%s/files/cabling/scifi_mapping_2015-06-18.txt'\
% os.environ.get("MAUS_ROOT_DIR")
lookup = FrontEndLookup.FrontEndLookup(maus_scifi_mapping, maus_scifi_calibration)
LightYield = ClusterLightYield.ClusterLightYield(lookup)
print "Generating some data"
#my_file_name = "/home/ed/MICE/testdata/maus_7333.root"
my_file_name = "/home/ed/MICE/testdata/maus_output_new-mapping-calibration_run7333.root"
output_dir = "07333/"
print "Loading ROOT file", my_file_name
root_file = ROOT.TFile(my_file_name, "READ") # pylint: disable = E1101
print "Setting up data tree"
data = ROOT.MAUS.Data() # pylint: disable = E1101
tree = root_file.Get("Spill")
tree.SetBranchAddress("data", data)
stations = [StationStudy.StationStudy(0,s)for s in range (1,6)] +\
[StationStudy.StationStudy(1,s)for s in range (1,6)]
print "Beginning Processing"
for i in range(tree.GetEntries()):
if i > 500:
break
print "Spill", i
tree.GetEntry(i)
spill = data.GetSpill()
if spill.GetDaqEventType() == "physics_event":
for j, recon_event in enumerate(spill.GetReconEvents()):
spilltime = TOFTools.TimeInSpill(spill,j)
#for cluster in recon_event.GetSciFiEvent().clusters():
#for track in recon_event.GetSciFiEvent().straightprtracks():
# for sp in track.get_spacepoints():
# for cluster in sp.get_channels():
# LightYield.FillCluster(cluster)
#if spilltime < 9.0:
for station in stations:
station.FillRecon(recon_event)
print "Beginning PostProcessing & Plotting."
#LightYield.MakeDrawCanvas()
for station in stations:
station.MakeDrawCanvas()
print ""
print station.MakeResultsDict()
print ""
raw_input("Done, press enter to exit")
if __name__=="__main__":
main()