Ejemplo n.º 1
0
    def process(self):
        assert get_basf2_git_hash() == self.git_hash

        try:
            import basf2
            import ROOT
        except ImportError:
            raise ImportError("Can not find ROOT or basf2. Can not use the basf2 task.")

        if self.num_processes:
            basf2.set_nprocesses(self.num_processes)

        if self.max_event:
            ROOT.Belle2.Environment.Instance().setNumberEventsOverride(self.max_event)

        path = self.create_path()

        path.add_module("Progress")
        basf2.print_path(path)
        basf2.process(path)

        print(basf2.statistics)
Ejemplo n.º 2
0
main_path.add_module('SeqRootInput', inputFileNames=inputFileName)
main_path.add_module('Progress')
main_path.add_module('ProgressBar')

# set the geometry
main_path.add_module('Gearbox')
main_path.add_module('Geometry', useDB=True)

# unpack bklm raw dawa
main_path.add_module('BKLMUnpacker')

# analyze bklm digits
main_path.add_module('BKLMDigitAnalyzer',
                     outputRootName=outputPath + 'bklmHitmap')

# reconstruct bklm 2d hits
reco = ma.register_module('BKLMReconstructor')
reco.param('Prompt window (ns)', 2000)
main_path.add_module(reco)

# add bklm stand-alone tracking
main_path.add_module('BKLMTracking',
                     StudyEffiMode=True,
                     outputName=outputPath + 'bklmEfficiency_' + date +
                     '.root')

# process the path
b2.print_path(main_path)
b2.process(main_path, 100000)
print(b2.statistics)
Ejemplo n.º 3
0
    )
    stdK("higheff", path=path)
    stdPi("higheff", path=path)
    mA.reconstructDecay('D0:Kpi -> K-:higheff pi+:higheff', '1.7 < M < 1.9', path=path)
    # use try except to have this code work for both the old and new function names for the tree fit
    mA.matchMCTruth('D0:Kpi', path=path)
    mA.reconstructDecay('B- -> D0:Kpi pi-:higheff', f"{mbc_range[0]} < Mbc < {mbc_range[1]}", path=path)
    try:
        vx.treeFit('B+', 0.1, path=path)
    except AttributeError:
        vx.vertexTree('B+', 0.1, path=path)
    mA.setAnalysisConfigParams({"mcMatchingVersion": "BelleII"}, path)
    mA.matchMCTruth('B-', path=path)
    vm.addAlias("p_cms", "useCMSFrame(p)")  # include aliases to test if they work
    vm.addAlias("E_cms", "useCMSFrame(E)")
    mA.variablesToNtuple('D0:Kpi', ['M', 'p', 'E', 'E_cms', 'p_cms', 'daughter(0, kaonID)',
                                    'daughter(1, pionID)', 'isSignal', 'mcErrors'],
                         filename=d_ntuple_filename, treename="D", path=path)
    mA.variablesToNtuple('B-', ['Mbc', 'deltaE', 'isSignal', 'mcErrors', 'M'],
                         filename=b_ntuple_filename, treename="B", path=path)
    return path


if __name__ == '__main__':
    # Use this to execute the analysis path if this file is called as a main
    # file. It can be used to test the analysis path independently of the gbasf2
    # luigi task. But if this module is only imported, the following is not executed.
    path = create_analysis_path()
    basf2.print_path(path)
    basf2.process(path)