Example #1
0
def run():
    """Run the macro"""

    # This generates events (usually spills) from a root binary file
    my_input = MAUS.InputCppRoot()
    # This outputs events (usually spills) to a json ascii file
    my_output = MAUS.OutputPyJSON()

    # Execute inputter and outputter
    # Mapper and Reducer does nothing
    MAUS.Go(my_input, MAUS.MapPyDoNothing(), MAUS.ReducePyDoNothing(), \
            my_output, io.StringIO(u""))
Example #2
0
def run():
    """ Run the macro
    """

    # Take as input a maus root file.
    my_input = MAUS.InputCppRootData()

    my_output = MAUS.OutputPyDoNothing()

    # datacard specifies the hypothesis for which PDFs are to be made
    datacards = io.StringIO(u"")

    # The Go() drives all the components you pass in
    MAUS.Go(my_input, MAUS.MapPyDoNothing(), MAUS.ReduceCppGlobalPID(),
            my_output, datacards)
Example #3
0
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)