def run(): """ Analyze data from the MICE experiment This reads in and processes data taken from the MICE experiment. """ # Set up data cards. data_cards_list = [] data_cards_list.append("output_file_name='scalers'\n") # Convert data_cards to string. data_cards = io.StringIO(unicode("".join(data_cards_list))) # Set up the input that reads from DAQ my_input = MAUS.InputCppDAQOfflineData() # Create an empty array of mappers, then populate it # with the functionality you want to use. my_map = MAUS.MapPyGroup() my_map.append(MAUS.MapCppTOFDigits()) my_map.append(MAUS.MapCppTOFSlabHits()) my_map.append(MAUS.MapCppTOFSpacePoints()) # Histogram reducer. reducer = MAUS.ReducePyScalersTable() # Save images as EPS and meta-data as JSON. output_worker = MAUS.OutputPyFile() # Run the workflow. MAUS.Go(my_input, my_map, reducer, output_worker, data_cards)
def run(): """ Create a JSON document and create a histogram. """ if not os.environ.get("MAUS_ROOT_DIR"): raise Exception('InitializeFail', 'MAUS_ROOT_DIR unset!') config = Configuration().getConfigJSON() config_json = json.loads(config) datapath = '%s/src/input/InputCppDAQData' % \ os.environ.get("MAUS_ROOT_DIR") # Set up a run configuration datafile = '05466' if os.environ['MAUS_UNPACKER_VERSION'] == "StepIV": datafile = '06008' config_json["daq_data_path"] = datapath config_json["daq_data_file"] = datafile # Set up data cards. data_cards_list = [] data_cards_list.append("output_file_name='%s'\n" % "scalers") data_cards_list.append("output_file_auto_number=%s\n" % True) data_cards_list.append("daq_data_path='%s'\n" % datapath) data_cards_list.append("daq_data_file='%s'\n" % datafile) data_cards_list.append("DAQ_cabling_by='%s'\n" % "date") data_cards = io.StringIO(unicode("".join(data_cards_list))) print data_cards # Create workers. # inputter = InputCppDAQOfflineData(datapath, datafile) # inputter.birth(json.dumps(config_json)) inputter = InputCppDAQOfflineData() mappers = MAUS.MapPyGroup() mappers.append(MAUS.MapPyDoNothing()) reducer = MAUS.ReducePyScalersTable() outputter = MAUS.OutputPyFile() # Execute the workers. MAUS.Go(inputter, mappers, reducer, outputter, data_cards)