3
#################################################################
4
###!!! YOU ARE NOT ALLOWED TO MODIFY THIS FILE DIRECTLY !!!###
5
###!!! PLEASE MAKE A COPY OF THIS FILE WITH THE CP COMMAND !!!###
6
#################################################################
9
Simple example showing use of ReducePyScalersTable and OutputPyJSON.
19
Create a JSON document and create a histogram.
21
# Create sample JSON documents with spills containing data
22
# expected by ReducePyScalersTable.
26
json_doc["daq_data"] = {}
27
json_doc["daq_data"]["V830"] = {}
28
scalers = json_doc["daq_data"]["V830"]
29
scalers["phys_event_number"] = "Sample event %d" % i
30
scalers["time_stamp"] = time.time()
38
scalers["channels"] = hits
39
input_docs.append(json.dumps(json_doc))
40
input_docs.append("\n")
41
input_file = io.StringIO(unicode("".join(input_docs)))
45
data_cards_list.append("output_file_name='%s'\n" % "scalers")
46
data_cards_list.append("output_file_auto_number=%s\n" % True)
47
data_cards = io.StringIO(unicode("".join(data_cards_list)))
50
input_worker = MAUS.InputPyJSON(input_file)
52
mappers = MAUS.MapPyGroup()
53
mappers.append(MAUS.MapPyDoNothing())
55
reducer = MAUS.ReducePyScalersTable()
57
output_worker = MAUS.OutputPyFile()
59
# Execute the workers.
60
MAUS.Go(input_worker, mappers, reducer, output_worker, data_cards)
62
if __name__ == "__main__":