Пример #1
0
def run():
    """ Run the macro
    """

    # This input generates empty spills, to be filled by the beam maker later on
    my_input = MAUS.InputPySpillGenerator()

    # Create an empty array of mappers, then populate it
    # with the functionality you want to use.
    my_map = MAUS.MapPyGroup()
    my_map.append(MAUS.MapPyBeamMaker())  # beam construction
    my_map.append(MAUS.MapCppSimulation())  #  geant4 simulation
    my_map.append(MAUS.MapCppTOFMCDigitizer())  # TOF MC Digitizer
    #my_map.append(MAUS.MapCppTOFSlabHits())  # TOF SlabHit Reco
    #my_map.append(MAUS.MapCppTOFSpacePoints())  # TOF SpacePoint Reco
    my_map.append(MAUS.MapCppKLMCDigitizer())  # KL MC Digitizer
    my_map.append(MAUS.MapCppKLCellHits())  # KL CellHit Reco
    # can specify datacards here or by using appropriate command line calls
    datacards = io.StringIO(u"")

    reducer = MAUS.ReducePyDoNothing()

    # Then construct a MAUS output component - filename comes from datacards
    my_output = MAUS.OutputPyJSON()

    # The Go() drives all the components you pass in, then check the file
    # (default simulation.out) for output

    MAUS.Go(my_input, my_map, reducer, my_output, datacards)
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)
Пример #3
0
def run():
    """ Run the macro
    """

    # This input generates empty spills, to be filled by the beam maker later on
    my_input = MAUS.InputPySpillGenerator()
    # my_input = MAUS.InputCppRoot()

    # Create an empty array of mappers, then populate it
    # with the functionality you want to use.
    my_map = MAUS.MapPyGroup()
    my_map.append(MAUS.MapPyBeamMaker()) # beam construction
    my_map.append(MAUS.MapCppSimulation())  #  geant4 simulation
    # my_map.append(MAUS.MapCppTrackerMCNoise())  # SciFi noise
    my_map.append(MAUS.MapCppTrackerMCDigitization())  # SciFi electronics
    my_map.append(MAUS.MapCppTrackerRecon())  # SciFi recon
    # can specify datacards here or by using appropriate command line calls
    datacards = io.StringIO(u"")

    # reducer = MAUS.ReduceCppPatternRecognition() # Turn on event display
    reducer = MAUS.ReducePyDoNothing()

    # Then construct a MAUS output component - filename comes from datacards
    # my_output = MAUS.OutputPyJSON()
    my_output = MAUS.OutputCppRoot()

    # The Go() drives all the components you pass in, then check the file
    # (default simulation.out) for output

    MAUS.Go(my_input, my_map, reducer, my_output, datacards)
Пример #4
0
def run(data_path, run_num):
    """Analyze data from the MICE experiment

    This will read in and process data taken from the MICE experiment. It will
    eventually include things like cabling information, calibrations, and fits.
    """

    # Here you specify the path to the data and also the file you want to
    # analyze.

    my_input = MAUS.InputCppDAQOfflineData(data_path, data_file)

    # Create an empty array of mappers, then populate it
    # with the functionality you want to use.
    my_map = MAUS.MapPyGroup()
    my_map.append(MAUS.MapCppTrackerDigits())
    my_map.append(MAUS.MapCppTrackerRecon())

    reducer = MAUS.ReduceCppTracker()
    #reducer = MAUS.ReducePyDoNothing()
    # reducer = MAUS.ReduceCppTrackerErrorLog()

    output_file = open("unpacked_1901", 'w')  #  Uncompressed
    my_output = MAUS.OutputPyJSON(output_file)

    # The Go() drives all the components you pass in then put all the output
    # into a file called 'mausput'
    MAUS.Go(my_input, my_map, reducer, my_output)
Пример #5
0
def run():
    """ Run the macro
    """

    # This input generates empty spills, to be filled by the beam maker later on
    my_input = MAUS.InputPySpillGenerator()

    # Create an empty array of mappers, then populate it
    # with the functionality you want to use.
    my_map = MAUS.MapPyGroup()

    # GEANT4
    my_map.append(MAUS.MapPyBeamMaker()) # beam construction
    my_map.append(MAUS.MapCppSimulation())  #  geant4 simulation

    # Pre detector set up
    my_map.append(MAUS.MapCppMCReconSetup())  #  geant4 simulation

    # SciFi
    my_map.append(MAUS.MapCppTrackerMCDigitization()) # SciFi electronics model
    my_map.append(MAUS.MapCppTrackerClusterRecon()) # SciFi channel clustering
    my_map.append(MAUS.MapCppTrackerSpacePointRecon()) # SciFi spacepoint recon
    my_map.append(MAUS.MapCppTrackerPatternRecognition()) # SciFi track finding
    my_map.append(MAUS.MapCppTrackerTrackFit()) # SciFi track fit

    # Then construct a MAUS output component - filename comes from datacards
    my_output = MAUS.OutputCppRoot()

    # can specify datacards here or by using appropriate command line calls
    datacards = io.StringIO(u"")

    # The Go() drives all the components you pass in, then check the file
    # (default simulation.out) for output
    MAUS.Go(my_input, my_map, MAUS.ReducePyDoNothing(), my_output, datacards)
Пример #6
0
def run():
    """Analyze data from the MICE experiment

    This will read in and process data taken from the MICE experiment. It will
    eventually include things like cabling information, calibrations, and fits.
    """

    # Here you specify the path to the data and also the file you want to
    # analyze.

    my_input = MAUS.InputCppDAQOnlineData()

    # Create an empty array of mappers, then populate it
    # with the functionality you want to use.
    my_map = MAUS.MapPyGroup()
    my_map.append(MAUS.MapPyScalersDump())
    #my_map.append(MAUS.MapCppTOFDigits())
    #my_map.append(MAUS.MapCppTOFSlabHits())
    #my_map.append(MAUS.MapCppTOFSpacePoints())
    #my_map.append(MAUS.MapPyTOFPlot())


    #  The Go() drives all the components you pass in then put all the output
    #  into a file called 'mausput'
    MAUS.Go(my_input, my_map, MAUS.ReducePyDoNothing(), MAUS.OutputPyJSON())
Пример #7
0
def run():
    """ Run the macro """

    my_input = MAUS.InputPySpillGenerator()

    my_map = MAUS.MapPyGroup()
    my_map.append(MAUS.MapPyBeamMaker())  # beam construction
    my_map.append(MAUS.MapCppSimulation())  #  geant4 simulation
    my_map.append(
        MAUS.MapCppTrackerMCDigitization())  # SciFi electronics model
    my_map.append(MAUS.MapCppTrackerClusterRecon())  # SciFi channel clustering
    my_map.append(
        MAUS.MapCppTrackerSpacePointRecon())  # SciFi spacepoint recon
    my_map.append(
        MAUS.MapCppTrackerPatternRecognition())  # SciFi track finding
    my_map.append(MAUS.MapCppTrackerTrackFit())  # SciFi track fit

    datacards = io.StringIO(u"")

    # reducer = MAUS.ReduceCppPatternRecognition()
    reducer = MAUS.ReducePyDoNothing()

    # my_output = MAUS.OutputPyJSON()
    my_output = MAUS.OutputCppRoot()

    MAUS.Go(my_input, my_map, reducer, my_output, datacards)
Пример #8
0
def run():
    """ Run the macro
    """

    # This input generates empty spills, to be filled by the beam maker later on
    my_input = MAUS.InputCppRootData()

    # Create an empty array of mappers, then populate it
    # with the functionality you want to use.
    my_map = MAUS.MapPyGroup()

    # Global
    my_map.append(MAUS.MapCppGlobalReconImport())
    my_map.append(MAUS.MapCppGlobalTrackMatching())

    my_reduce = MAUS.ReducePyDoNothing()

    # Then construct a MAUS output component - filename comes from datacards
    my_output = MAUS.OutputCppRoot()

    # can specify datacards here or by using appropriate command line calls
    datacards = io.StringIO(u"")

    # The Go() drives all the components you pass in, then check the file
    # (default simulation.out) for output
    MAUS.Go(my_input, my_map, my_reduce, my_output, datacards)
Пример #9
0
def run():
    """ Run the macro
    """

    # This input generates empty spills, to be filled by the beam maker later on
    input_file = open('maus_output.json', 'r')
    #
    my_input = MAUS.InputPyJSON(input_file)
    #my_input = MAUS.InputPySpillGenerator()

    # Create an empty array of mappers, then populate it
    # with the functionality you want to use.
    my_map = MAUS.MapPyGroup()
    #my_map.append(MAUS.MapPyBeamMaker()) # beam construction
    #my_map.append(MAUS.MapCppSimulation())  #  geant4 simulation
    my_map.append(
        MAUS.MapCppTrackerMCDigitization())  # SciFi electronics model
    my_map.append(MAUS.MapCppTrackerRecon())  # SciFi recon
    # can specify datacards here or by using appropriate command line calls
    datacards = io.StringIO(u"")

    #reducer = MAUS.ReduceCppTracker()
    reducer = MAUS.ReducePyDoNothing()

    output_file = open("recon_mc", 'w')  #  Uncompressed
    # Then construct a MAUS output component
    my_output = MAUS.OutputPyJSON(output_file)

    # The Go() drives all the components you pass in, then check the file
    # (default simulation.out) for output

    MAUS.Go(my_input, my_map, reducer, my_output, datacards)
Пример #10
0
def run():
    """ Run the macro
    """

    # Use the G4BL JSON chunks as an input to the simulation
    my_input = MAUS.InputPyJSON()

    # Create an empty array of mappers, then populate it
    # with the functionality you want to use.
    my_map = MAUS.MapPyGroup()

    # No need for the beam maker, as we use G4BL chunks
    # my_map.append(MAUS.MapPyBeamMaker()) # beam construction

    # Run the GEANT4 simulation
    my_map.append(MAUS.MapCppSimulation())  #  geant4 simulation

    # Pre detector set up
    my_map.append(MAUS.MapCppMCReconSetup())  #  geant4 simulation

    # TOF
    my_map.append(MAUS.MapCppTOFMCDigitizer())  # TOF MC Digitizer
    my_map.append(MAUS.MapCppTOFSlabHits())  # TOF MC Slab Hits
    my_map.append(MAUS.MapCppTOFSpacePoints())  # TOF Space Points

    # KL
    my_map.append(MAUS.MapCppKLMCDigitizer())  # KL MC Digitizer
    my_map.append(MAUS.MapCppKLCellHits())  # KL CellHit Reco

    # SciFi
    my_map.append(
        MAUS.MapCppTrackerMCDigitization())  # SciFi electronics model
    my_map.append(MAUS.MapCppTrackerClusterRecon())  # SciFi channel clustering
    my_map.append(
        MAUS.MapCppTrackerSpacePointRecon())  # SciFi spacepoint recon
    my_map.append(
        MAUS.MapCppTrackerPatternRecognition())  # SciFi track finding
    my_map.append(MAUS.MapCppTrackerPRSeed())  # Set the Seed from PR
    my_map.append(MAUS.MapCppTrackerTrackFit())  # SciFi track fit

    # EMR
    my_map.append(MAUS.MapCppEMRMCDigitization())  # EMR MC Digitization
    my_map.append(MAUS.MapCppEMRSpacePoints())  # EMR MC Digitization
    my_map.append(MAUS.MapCppEMRRecon())  # EMR Recon

    # Ckov
    my_map.append(MAUS.MapCppCkovMCDigitizer())

    # Global Digits - post detector digitisation

    # Then construct a MAUS output component - filename comes from datacards
    my_output = MAUS.OutputCppRoot()

    # can specify datacards here or by using appropriate command line calls
    datacards = io.StringIO(u"")

    # The Go() drives all the components you pass in, then check the file
    # (default simulation.out) for output
    MAUS.Go(my_input, my_map, MAUS.ReducePyDoNothing(), my_output, datacards)
Пример #11
0
def run(input_beam, configuration, out_file):
    """run"""
    document_file = io.StringIO(unicode(input_beam))
    my_input = MAUS.InputPyJSON(document_file)
    my_map = MAUS.MapCppSimulation()
    my_output = MAUS.OutputPyJSON(open(out_file, 'w'))
    MAUS.Go(my_input, my_map, MAUS.ReducePyDoNothing(), my_output,
            io.StringIO(unicode(configuration)))
Пример #12
0
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 = []
    # batch mode = runs ROOT in batch mode so that canvases are not displayed
    # 1 = True, Batch Mode
    # 0 = False, Interactive Mode
    # setting it to false/0 will cause canvases to pop up on screen and
    # will get refreshed every N spills set by the refresh_rate data
    # card.
    data_cards_list.append("root_batch_mode='%d'\n" % 1)
    # refresh_rate = once in how many spills should canvases be updated
    data_cards_list.append("refresh_rate='%d'\n" % 1)
    # Add auto-numbering to the image tags. If False then each
    # histogram output for successive spills will have the same tag
    # so there are no spill-specific histograms. This is the
    # recommended use for online reconstruction.
    data_cards_list.append("histogram_auto_number=%s\n" % False)
    # Default image type is eps. For online use, use PNG.
    data_cards_list.append("histogram_image_type=\"png\"\n")
    # Directory for images. Default: $MAUS_WEB_MEDIA_RAW if set
    # else the current directory is used.
    # Uncomment and change the following if you want to hard
    # code a different default path.
    #    data_cards_list.append("image_directory='%s'\n" % os.getcwd())

    # 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.InputCppDAQData()
    #    my_input = MAUS.InputCppDAQOnlineData()
    my_input = MAUS.InputCppDAQOnlineData()  # pylint: disable = E1101

    # Create an empty array of mappers, then populate it
    # with the functionality you want to use.
    my_map = MAUS.MapPyGroup()
    # add ReconSetup map -- analyze_data_offline seems to have it already
    my_map.append(MAUS.MapCppReconSetup())
    my_map.append(MAUS.MapCppTOFDigits())
    my_map.append(MAUS.MapCppTOFSlabHits())
    my_map.append(MAUS.MapCppTOFSpacePoints())
    my_map.append(MAUS.MapCppCkovDigits())
    # Histogram reducer.
    reducer = MAUS.ReducePyDoNothing()
    #reducer = MAUS.ReducePyDoNothing()
    # Save images as EPS and meta-data as JSON.
    #output_worker = MAUS.OutputPyDoNothing()
    output_worker = MAUS.OutputPyJSON()

    # Run the workflow.
    MAUS.Go(my_input, my_map, reducer, output_worker, data_cards)
Пример #13
0
def run():
    """ Run the macro
    """

    # This input generates empty spills, to be filled by the beam maker later on
    my_input = MAUS.InputPySpillGenerator()

    # Create an empty array of mappers, then populate it
    # with the functionality you want to use.
    my_map = MAUS.MapPyGroup()

    # GEANT4
    my_map.append(MAUS.MapPyBeamMaker()) # beam construction
    my_map.append(MAUS.MapCppSimulation())  #  geant4 simulation

    # Pre detector set up
    my_map.append(MAUS.MapPyMCReconSetup())  #  geant4 simulation

    # TOF
    my_map.append(MAUS.MapCppTOFMCDigitizer())  # TOF MC Digitizer
    my_map.append(MAUS.MapCppTOFSlabHits()) # TOF MC Slab Hits
    my_map.append(MAUS.MapCppTOFSpacePoints()) # TOF Space Points

    # SciFi
    my_map.append(MAUS.MapCppTrackerMCDigitization()) # SciFi electronics model
    my_map.append(MAUS.MapCppTrackerRecon()) # SciFi Recon

    # KL
    my_map.append(MAUS.MapCppKLMCDigitizer())  # KL MC Digitizer
    my_map.append(MAUS.MapCppKLCellHits())  # KL CellHit Reco

    # EMR
    my_map.append(MAUS.MapCppEMRMCDigitization())  # EMR MC Digitization
    my_map.append(MAUS.MapCppEMRSpacePoints())
    my_map.append(MAUS.MapCppEMRRecon()) # EMR Recon

    # Ckov
    my_map.append(MAUS.MapCppCkovMCDigitizer())

    # Global
    my_map.append(MAUS.MapCppGlobalReconImport())
    my_map.append(MAUS.MapCppGlobalTrackMatching())

    my_reduce = MAUS.ReducePyDoNothing()

    # Then construct a MAUS output component - filename comes from datacards
    #~ my_output = MAUS.OutputCppRoot()
    my_output = MAUS.OutputPyDoNothing()

    # can specify datacards here or by using appropriate command line calls
    datacards = io.StringIO(u"")

    # The Go() drives all the components you pass in, then check the file
    # (default simulation.out) for output
    MAUS.Go(my_input, my_map, my_reduce, my_output, datacards)
Пример #14
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""))
Пример #15
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)
Пример #16
0
def run(number_of_spills):
    """ Run the macro
    """

    # Here we create a pseudo-file with an event in it.  If you were to copy
    # and paste this to a file, then you could also do:
    #
    #   input_file = open('myFileName.txt', 'r')
    #
    # where the file format has a JSON document per line.  I just toss the file
    # in here for simplicity.
    input_file = io.StringIO(
        number_of_spills *
        u"""{"mc": [{"primary":{"position": { "x": 0.0, "y": -0.0, "z": -5000.0 },"particle_id" : 13,"energy" : 210.0, "random_seed" : 10, "momentum" : { "x":0.0, "y":0.0, "z":1.0 }, "time" : 0.0}}]}\n"""
    )  # pylint: disable=C0301

    my_input = MAUS.InputPyJSON(input_file)

    # Create an empty array of mappers, then populate it
    # with the functionality you want to use.
    my_map = MAUS.MapPyGroup()
    my_map.append(MAUS.MapCppSimulation())  #  geant4 simulation
    my_map.append(MAUS.MapCppTOFMCDigitizer())  #  TOF electronics model
    my_map.append(MAUS.MapCppTrackerMCDigitization())  #   SCiFi electronics

    datacards = io.StringIO(u"keep_steps = True")
    #  You may specify datacards if you wish.  To do so you create a file object
    #  which can either be a StringIO object or a native python file.  If you
    #  want to store your datacards in a file 'datacards.dat' then uncomment:
    # datacards = open('datacards.dat', 'r')

    #  Choose from either a compressed or uncompressed output file
    #
    output_file = open(os.environ["MAUS_ROOT_DIR"] + "/tmp/simulation.out",
                       'w')  #  Uncompressed
    #output_file = gzip.GzipFile("mausput.gz", 'wb')  #  Compressed

    #
    # Then construct a MAUS output component
    my_output = MAUS.OutputPyJSON(output_file)

    #  The Go() drives all the components you pass in, then check the file
    #  'mausput' for the output

    MAUS.Go(my_input, my_map, MAUS.ReducePyDoNothing(), my_output, datacards)
Пример #17
0
def run():
    """
    Analyze data from the MICE experiment
    """

    # 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()

    # Trigger
    my_map.append(MAUS.MapCppReconSetup())

    # Detectors
    my_map.append(MAUS.MapCppTOFDigits())
    my_map.append(MAUS.MapCppTOFSlabHits())
    my_map.append(MAUS.MapCppTOFSpacePoints())

    my_map.append(MAUS.MapCppCkovDigits())

    my_map.append(MAUS.MapCppKLDigits())
    my_map.append(MAUS.MapCppKLCellHits())

    my_map.append(MAUS.MapCppTrackerDigits()) # SciFi real data digitization
    my_map.append(MAUS.MapCppTrackerClusterRecon()) # SciFi channel clustering
    my_map.append(MAUS.MapCppTrackerSpacePointRecon()) # SciFi spacepoint recon
    my_map.append(MAUS.MapCppTrackerPatternRecognition()) # SciFi track finding
    my_map.append(MAUS.MapCppTrackerPRSeed()) # Set the Seed from PR
    my_map.append(MAUS.MapCppTrackerTrackFit()) # SciFi track fit

    my_map.append(MAUS.MapCppEMRPlaneHits())
    my_map.append(MAUS.MapCppEMRSpacePoints())
    my_map.append(MAUS.MapCppEMRRecon())

    my_reduce = MAUS.ReducePyDoNothing()

    #  The Go() drives all the components you pass in then put all the output
    #  into a file called 'mausput'
    MAUS.Go(my_input, my_map, my_reduce, MAUS.OutputCppRoot())
Пример #18
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)
Пример #19
0
def run():
    """ Run the macro """

    my_input = MAUS.InputCppDAQOfflineData()
    # my_input = MAUS.InputPyJSON()

    my_map = MAUS.MapPyGroup()

    my_map.append(MAUS.MapCppTrackerDigits())

    my_map.append(MAUS.MapCppTrackerRecon())  # SciFi recon

    datacards = io.StringIO(u"")

    # my_output = MAUS.OutputPyJSON()
    my_output = MAUS.OutputCppRoot()

    # my_reduce = MAUS.ReducePyDoNothing()
    my_reduce = MAUS.ReduceCppPatternRecognition()

    MAUS.Go(my_input, my_map, my_reduce, my_output, datacards)
Пример #20
0
def run(number_of_spills):  #pylint: disable =W0621
    """Simulate the MICE experiment
    
    This will simulate 'number_of_spills' MICE events through the entirity
    of MICE using Geant4.  At present, TOF and Tracker hits will be digitized.
    """

    # Here we create a pseudo-file with an event in it.  If you were to copy
    # and paste this to a file, then you could also do:
    #
    #   documentFile = open('myFileName.txt', 'r')
    #
    # where the file format has a JSON document per line.  I just toss the file
    # in here for simplicity.
    document_file = io.StringIO(
        number_of_spills *
        u"""{"mc": [{"position": { "x": 0.0, "y": -0.0, "z": -5000 },"particle_id" : 13,"energy" : 210, "random_seed" : 10, "unit_momentum" : { "x":0, "y":0, "z":1 }}]}\n"""
    )  #pylint: disable =C0301

    my_input = MAUS.InputPyJSON(document_file)

    # Create an empty array of mappers, then populate it
    # with the functionality you want to use.
    my_map = MAUS.MapPyGroup()
    my_map.append(MAUS.MapCppSimulation())  #  geant4 simulation
    my_map.append(MAUS.MapCppTOFMCDigitizer())  #  TOF detector digitization
    my_map.append(MAUS.MapCppTrackerMCDigitization())  # tracker digitization

    datacards = io.StringIO(u"keep_tracks = False\n"\
                            "simulation_geometry_filename = \"Stage5.dat\"")
    #  You may specify datacards if you wish.  To do so you create a file object
    #  which can either be a StringIO object or a native python file.  If you
    #  want to store your datacards in a file 'datacards.dat' then uncomment:
    # datacards = open('datacards.dat', 'r')

    #  The Go() drives all the components you pass in, then check the file
    #  'mausput' for the output

    MAUS.Go(my_input, my_map, MAUS.ReducePyDoNothing(), MAUS.OutputPyJSON(),
            datacards)
Пример #21
0
def run():
    """Analyze data from the MICE experiment

    This will read in and process data taken from the MICE experiment. It will
    eventually include things like cabling information, calibrations, and fits.
    """

    # Set up the input that reads from DAQ
    #my_input = MAUS.InputCppDAQData()
    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())
    my_map.append(MAUS.MapCppCkovDigits())
    reducer = MAUS.ReducePyCkov()
    #  The Go() drives all the components you pass in then put all the output
    #  into a file called 'mausput'
    MAUS.Go(my_input, my_map, reducer, MAUS.OutputPyImage())
def run():
    """
    Analyze data from the MICE experiment
    """

    # Set up the input that reads from DAQ
    my_input = MAUS.InputCppDAQOnlineData()

    # Create an empty array of mappers, then populate it
    # with the functionality you want to use.
    my_map = MAUS.MapPyGroup()

    # Trigger
    my_map.append(MAUS.MapCppReconSetup())

    # Detectors
    my_map.append(MAUS.MapCppTOFDigits())
    my_map.append(MAUS.MapCppTOFSlabHits())
    my_map.append(MAUS.MapCppTOFSpacePoints())

    my_map.append(MAUS.MapCppCkovDigits())

    my_map.append(MAUS.MapCppKLDigits())
    my_map.append(MAUS.MapCppKLCellHits())

    my_map.append(MAUS.MapCppTrackerDigits())
    my_map.append(MAUS.MapCppTrackerRecon())

    my_map.append(MAUS.MapCppEMRPlaneHits())
    my_map.append(MAUS.MapCppEMRRecon())

    my_reduce = MAUS.ReducePyDoNothing()

    #  The Go() drives all the components you pass in then put all the output
    #  into a file called 'mausput'
    MAUS.Go(my_input, my_map, my_reduce, MAUS.OutputCppRoot())
Пример #23
0
def run():
    """ Run the macro
    """

    # This input generates empty spills, to be filled by the beam maker later on
    my_input = MAUS.InputPySpillGenerator()

    # Create an empty array of mappers, then populate it
    # with the functionality you want to use.
    my_map = MAUS.MapPyGroup()

    # G4beamline
    my_map.append(MAUS.MapPyBeamlineSimulation())

    # GEANT4
    # my_map.append(MAUS.MapPyBeamMaker()) # beam construction
    my_map.append(MAUS.MapCppSimulation())  #  geant4 simulation

    # Pre detector set up
    my_map.append(MAUS.MapPyMCReconSetup())  #  geant4 simulation

    # TOF
    my_map.append(MAUS.MapCppTOFMCDigitizer())  # TOF MC Digitizer
    my_map.append(MAUS.MapCppTOFSlabHits())  # TOF MC Slab Hits
    my_map.append(MAUS.MapCppTOFSpacePoints())  # TOF Space Points

    # KL
    my_map.append(MAUS.MapCppKLMCDigitizer())  # KL MC Digitizer
    my_map.append(MAUS.MapCppKLCellHits())  # KL CellHit Reco

    # SciFi
    # MAUS 2.5.0
    #my_map.append(MAUS.MapCppTrackerMCDigitization()) # SciFi electronics model
    #my_map.append(MAUS.MapCppTrackerRecon()) # SciFi Recon
    my_map.append(
        MAUS.MapCppTrackerMCDigitization())  # SciFi electronics model
    my_map.append(MAUS.MapCppTrackerClusterRecon())  # SciFi channel clustering
    my_map.append(
        MAUS.MapCppTrackerSpacePointRecon())  # SciFi spacepoint recon
    my_map.append(
        MAUS.MapCppTrackerPatternRecognition())  # SciFi track finding
    my_map.append(MAUS.MapCppTrackerPRSeed())  # Set the Seed from PR
    my_map.append(MAUS.MapCppTrackerTrackFit())  # SciFi track fit
    my_map.append(
        MAUS.MapCppTrackerTOFReFit())  # SciFi track refit based on TOF

    # EMR
    my_map.append(MAUS.MapCppEMRMCDigitization())  # EMR MC Digitizer
    my_map.append(MAUS.MapCppEMRSpacePoints())  # EMR Space Points
    my_map.append(MAUS.MapCppEMRRecon())  # EMR Recon

    # Global
    my_map.append(MAUS.MapCppGlobalReconImport())
    my_map.append(MAUS.MapCppGlobalTrackMatching())

    # Then construct a MAUS output component - filename comes from datacards
    my_output = MAUS.OutputCppRoot()

    # can specify datacards here or by using appropriate command line calls
    datacards = io.StringIO(u"")

    # The Go() drives all the components you pass in, then check the file
    # (default simulation.out) for output
    MAUS.Go(my_input, my_map, MAUS.ReducePyDoNothing(), my_output, datacards)