示例#1
0
    def start_process(self):
        """
        The function given to the process to start the calculation.
        Do not call by yourself.
        Resets the logging system, logs onto console and a file and sets the queues
        (the result queue and the process queue) correctly.
        """

        if not self.path:
            return

        try:
            if self.random_seed is not None:
                basf2.set_random_seed(self.random_seed)

            basf2.reset_log()
            basf2.logging.zero_counters()
            basf2.log_to_file(self.log_file_name)
            basf2.process(self.path)
            self.result_queue.put(
                "ipython.statistics",
                Basf2CalculationQueueStatistics(basf2.statistics))
        except:
            raise
        finally:
            self.progress_queue_remote.send("end")
示例#2
0
def simulation(input_file, output_file):
    my_path = b2.create_path()
    print(f"Number of processes: {b2.get_nprocesses()}")

    # load input ROOT file
    ma.inputMdst(environmentType="default", filename=input_file, path=my_path)
    """
        Loads the specified ROOT (DST/mDST/muDST) files with the RootInput module.

        The correct environment (e.g. magnetic field settings) are determined from the specified environment type.
        The currently available environments are:

        - 'MC5': for analysis of Belle II MC samples produced with releases prior to build-2016-05-01.
          This environment sets the constant magnetic field (B = 1.5 T)
        - 'MC6': for analysis of Belle II MC samples produced with build-2016-05-01 or newer but prior to release-00-08-00
        - 'MC7': for analysis of Belle II MC samples produced with build-2016-05-01 or newer but prior to release-00-08-00
        - 'MC8', for analysis of Belle II MC samples produced with release-00-08-00 or newer but prior to release-02-00-00
        - 'MC9', for analysis of Belle II MC samples produced with release-00-08-00 or newer but prior to release-02-00-00
        - 'MC10', for analysis of Belle II MC samples produced with release-00-08-00 or newer but prior to release-02-00-00
        - 'default': for analysis of Belle II MC samples produced with releases with release-02-00-00 or newer.
          This environment sets the default magnetic field (see geometry settings)
        - 'Belle': for analysis of converted (or during of conversion of) Belle MC/DATA samples
        - 'None': for analysis of generator level information or during simulation/my_reconstruction of
          previously generated events

        Note that there is no difference between MC6 and MC7. Both are given for sake of completion.
        The same is true for MC8, MC9 and MC10

        Parameters:
            environmentType (str): type of the environment to be loaded
            filename (str): the name of the file to be loaded
            path (basf2.Path): modules are added to this path
            skipNEvents (int): N events of the input files are skipped
            entrySequences (list(str)): The number sequences (e.g. 23:42,101) defining
                the entries which are processed for each inputFileName.
            parentLevel (int): Number of generations of parent files (files used as input when creating a file) to be read
    """

    # In case of conflict with geometry, you may use this line instead:
    # analysis_main.add_module("RootInput", inputFileName='B2A101-Y4SEventGeneration-evtgen.root')

    # simulation
    si.add_simulation(path=my_path)

    # my_reconstruction
    re.add_reconstruction(path=my_path)

    # dump in MDST format
    mdst.add_mdst_output(path=my_path, mc=True, filename=output_file)

    # Show progress of processing
    progress = b2.register_module("ProgressBar")
    my_path.add_module(progress)

    # Process the events
    b2.process(my_path)
    print(b2.statistics)
示例#3
0
def main(input_file,output_file, channel,isdata):
    path = makeFSPs(input_file, isdata)
    if channel == 'kst0mumu':
        Kst0mumu(path)
#        ft.flavorTagger(particleLists=['B0:kst0mumu'],
#                        belleOrBelle2="Belle2", weightFiles=weightfiles, path=path)
        b_vars = vc.deltae_mbc + vc.mc_truth + vc.kinematics
        variablesToNtuple('B0:kst0Jpsi', variables=b_vars, filename='B0:kst0Jpsi_mumu.root', treename='tree', path=path)
        gv.varKst0mumu(path, output_file)
    elif channel == 'kst0ee':
        Kst0ee(path)
#        ft.flavorTagger(particleLists=['B0:kst0Jpsi'],
#                        belleOrBelle2="Belle2", weightFiles=weightfiles, path=path)
        b_vars = vc.deltae_mbc + vc.mc_truth + vc.kinematics
        variablesToNtuple('B0:kst0Jpsi', variables=b_vars, filename='B0_kst0Jpsi_ee.root', treename='tree', path=path)
        gv.varKst0ee(path, output_file)
#        varKst0ee_brem(path, output_file)
    elif channel == 'kst_ksee':
        Kstee_ks(path)
        ft.flavorTagger(particleLists=['B+:kst_ksee'],
                        belleOrBelle2="Belle2", weightFiles=weightfiles, path=path)
        varKstee_ks(path, output_file)
        varKstee_ks_brem(path, output_file)
    elif channel == 'kst_pi0ee':
        Kstee_pi0(path)
        ft.flavorTagger(particleLists=['B+:kst_pi0ee'],
                        belleOrBelle2="Belle2", weightFiles=weightfiles, path=path)
        varKstee_pi0(path, output_file)
        varKstee_pi0_brem(path, output_file)
    elif channel == 'kst_ksmumu':
        Kstmumu_ks(path)
        ft.flavorTagger(particleLists=['B+:kst_ksmumu'],
                        belleOrBelle2="Belle2", weightFiles=weightfiles, path=path)
        varKstmumu_ks(path, output_file)
    elif channel == 'kst_pi0mumu':
        Kstmumu_pi0(path)
        ft.flavorTagger(particleLists=['B+:kst_pi0mumu'],
                        belleOrBelle2="Belle2", weightFiles=weightfiles, path=path)
        varKstmumu_pi0(path, output_file)
        varKst0mumu(path, output_file)
        varKstmumu_ks(path, output_file)
        varKstmumu_pi0(path, output_file)
        varKst0ee(path, output_file)
        varKstee_ks(path, output_file)
        varKstee_pi0(path, output_file)
    progress = register_module('Progress')
    path.add_module(progress)
    b2.process(path)
    # print out the summary
    print(b2.statistics)
示例#4
0
def submit_generation(n_events, dec_file, out_name, random_seed):
    # Command line args passed as strings, so ensure they're corrected to ints
    n_events = int(n_events)
    random_seed = int(random_seed)
    ge.set_random_seed(random_seed)
    my_path = b2.create_path()
    ma.setupEventInfo(noEvents=n_events, path=my_path)
    ge.add_evtgen_generator(path=my_path,
                            finalstate="signal",
                            signaldecfile=dec_file)
    ma.loadGearbox(path=my_path)
    my_path.add_module("RootOutput", outputFileName=out_name)
    b2.process(path=my_path)
    print(b2.statistics)
示例#5
0
def main(input_file, output_file, channel=None,  isdata=None):
    path = makeFSPs(input_file, isdata)
    if channel == 'kst0mumu':
        gv.Kst0mumu(path)
        ft.flavorTagger(particleLists=['B0:kst0mumu'],
                        belleOrBelle2="Belle2", weightFiles=weightfiles, path=path)
        varKst0mumu(path, output_file)
    elif channel == 'kst0ee':
        Kst0ee(path)
        ft.flavorTagger(particleLists=['B0:kst0ee'],
                        belleOrBelle2="Belle2", weightFiles=weightfiles, path=path)
        varKst0ee(path, output_file)
        varKst0ee_brem(path, output_file)
    elif channel == 'kst_ksee':
        Kstee_ks(path)
        ft.flavorTagger(particleLists=['B+:kst_ksee'],
                        belleOrBelle2="Belle2", weightFiles=weightfiles, path=path)
        varKstee_ks(path, output_file)
        varKstee_ks_brem(path, output_file)
    elif channel == 'kst_pi0ee':
        Kstee_pi0(path)
        ft.flavorTagger(particleLists=['B+:kst_pi0ee'],
                        belleOrBelle2="Belle2", weightFiles=weightfiles, path=path)
        varKstee_pi0(path, output_file)
        varKstee_pi0_brem(path, output_file)
    elif channel == 'kst_ksmumu':
        Kstmumu_ks(path)
        ft.flavorTagger(particleLists=['B+:kst_ksmumu'],
                        belleOrBelle2="Belle2", weightFiles=weightfiles, path=path)
        varKstmumu_ks(path, output_file)
    elif channel == 'kst_pi0mumu':
        Kstmumu_pi0(path)
        ft.flavorTagger(particleLists=['B+:kst_pi0mumu'],
                        belleOrBelle2="Belle2", weightFiles=weightfiles, path=path)
        varKstmumu_pi0(path, output_file)
        varKst0mumu(path, output_file)
        varKstmumu_ks(path, output_file)
        varKstmumu_pi0(path, output_file)
        varKst0ee(path, output_file)
        varKstee_ks(path, output_file)
        varKstee_pi0(path, output_file)
    progress = register_module('Progress')
    path.add_module(progress)
    b2.process(path)
    # print out the summary
    print(b2.statistics)
示例#6
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)
    def start_process(self):
        """
        The function given to the process to start the calculation.
        Do not call by yourself.
        Resets the logging system, logs onto console and a file and sets the queues
        (the result queue and the process queue) correctly.
        """

        if not self.path:
            return

        try:
            if self.random_seed is not None:
                basf2.set_random_seed(self.random_seed)

            basf2.reset_log()
            basf2.logging.zero_counters()
            basf2.log_to_file(self.log_file_name)
            basf2.process(self.path)
            self.result_queue.put("ipython.statistics", Basf2CalculationQueueStatistics(basf2.statistics))
        except:
            raise
        finally:
            self.progress_queue_remote.send("end")
示例#8
0
# mp.add_module('VariablesToNtuple', particleList = 'Sigma+:loose',
#               variables=ntuple_vars, treeName='sigma_loose', fileName=sys.argv[2])

# Eff of this cut is about 96% and rejects about 50% of the background for Sigma+
pi0_mass_cut = 'daughter(1, M) >= 0.12 and daughter(1, M) <= 0.15'
ma.cutAndCopyList('Sigma+:good', 'Sigma+:loose', pi0_mass_cut, path=mp)
ma.vertexTree('Sigma+:good',
              0,
              ipConstraint=True,
              massConstraint=[],
              updateAllDaughters=False,
              path=mp)
ma.applyCuts('Sigma+:good', 'M >= 1.16 and M <= 1.22', path=mp)
ma.matchMCTruth('Sigma+:good', path=mp)
mp.add_module('VariablesToNtuple',
              particleList='Sigma+:good',
              variables=ntuple_vars,
              treeName='sigma_good',
              fileName=sys.argv[2])

# # Mass constrain pi0 and update the daughters
# ma.vertexTree('Sigma+:good', 0, ipConstraint = True, massConstraint = [111],
#               updateAllDaughters = True, path = mp)
# ma.matchMCTruth('Sigma+:good', path = mp)
# mp.add_module('VariablesToNtuple', particleList = 'Sigma+:good',
#               variables=ntuple_vars, treeName='sigma_updated', fileName=sys.argv[2])

b2.process(path=mp)

print(b2.statistics)
示例#9
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)
示例#10
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import basf2 as b2  # noqa
import modularAnalysis as ma  # noqa

main = b2.create_path()

main.add_module('RootInput', recovery=True)
main.add_module('RootOutput')

b2.process(main)
示例#11
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)
# variables to ntuple
vars = ['combinationID',
        'deltaPhi',
        'deltaPhiCMS',
        'deltaTheta',
        'charge_0',
        'charge_1',
        'clusterE_0',
        'clusterE_1',
        'clusterTheta_0',
        'clusterTheta_1',
        'clusterPhi_0',
        'clusterPhi_1',
        'clusterECMS_0',
        'clusterECMS_1',
        'clusterPhiCMS_0',
        'clusterPhiCMS_1',
        'clusterThetaCMS_0',
        'clusterThetaCMS_1'
        ]

# store variables
variablesToNtuple('vpho:bhabha', vars, filename='bhabha.root', path=mypath)

# Process the events
b2.process(mypath)

# print out the summary
print(b2.statistics)
示例#13
0
    ntuple = []
    # May have more feature than needed.
    features = [
        'dr', 'dz', 'cosaXY', 'min_dr', 'min_dz', 'pt', 'pz', 'chiProb', 'p'
    ]
    features += create_aliases_for_selected(['PIDppi', 'PIDpk', 'PIDkpi', 'p'],
                                            'Lambda0 -> ^p+ ^pi-',
                                            prefix=['proton', 'pi'])
    spectator = ['isSignal', 'isPrimarySignal', 'mcPDG', 'genMotherPDG']
    spectator += ['IPX', 'IPY', 'IPZ', 'M', 'p', 'goodBelleLambda', 'distance']
    ntuple = features + spectator
    return ntuple


if __name__ == '__main__':
    infile, outfile = sys.argv[1], sys.argv[2]
    mypath = b2.create_path()
    b2c.convertBelleMdstToBelleIIMdst(infile, path=mypath)
    reconstructLambda('Lambda0:belle',
                      match=True,
                      only='background',
                      path=mypath)
    ntuple = make_ntuple()
    ma.variablesToNtuple('Lambda0:belle',
                         ntuple,
                         'Lambda',
                         outfile,
                         path=mypath)

    b2.process(path=mypath)
示例#14
0
ft_variables = makePretty(['qrOutput(FBDT)', 'qrOutput(FANN)', 'isRelatedRestOfEventB0Flavor', 'qOutput(FANN)', 'rBinBelle(FANN)',  'qOutput(FBDT)', 'rBinBelle(FBDT)',  'EW90', 'pMissCMS', 'cosThetaMissCMS'])
deltat_variables = ['DeltaT', 'DeltaTErr', 'MCDeltaT', 'TagVz', 'TagVzErr','mcTagVz', 'DeltaZ', 'MCTagBFlavor']
cs_variables = makePretty(['R2', 'cosTBTO', 'cosTBz','CleoConeCS(2)','KSFWVariables(hso02)', 'CleoConeCS(4)', 'CleoConeCS(9)','KSFWVariables(hso10)', 'KSFWVariables(hso12)', 'KSFWVariables(hso14)', 'thrustBm', 'thrustOm'])
roe_vars_clean = makePretty(['ROE_E(cleanMask)','ROE_P(cleanMask)', 'ROE_M(cleanMask)', 'ROE_deltae(cleanMask)', 'ROE_mbc(cleanMask)', 'nROE_Tracks(cleanMask)', 'nROE_NeutralECLClusters(cleanMask)', 'ROE_PTheta(cleanMask)', 'ROE_MC_MissFlags(cleanMask)'])
vtx_variables = ['z', 'z_uncertainty', 'pValue']
dalitz_vars = ['m12', 'm13', 'm23']
mix_variables = []#['mixFBDT', 'mixFANN', 'mixTrue']
cluster_variables = ['clusterReg','clusterTiming',
        'clusterErrorTiming','clusterE1E9',
        'clusterE9E21','clusterAbsZernikeMoment40',
        'clusterAbsZernikeMoment51','minC2TDist',
        'clusterTheta','clusterZernikeMVA',
        'clusterSecondMoment','clusterNHits']

track_variables = vc.track + vc.track_hits + vc.pid 

ma.variablesToNtuple('B0:signal',  
        vc.deltae_mbc+kin_variables+ft_variables+deltat_variables+cs_variables+vtx_variables+mix_variables+roe_vars_clean+dalitz_vars+
        ['CSMVA','isContinuumEvent','isNotContinuumEvent','pi0Likeness','etaLikeness']+
        vu.create_aliases_for_selected(list_of_variables=kin_variables, decay_string=  'B0 -> ^pi+ ^pi- [ ^K_S0 -> ^pi+ ^pi- ] ^gamma')+
        vu.create_aliases_for_selected(list_of_variables=track_variables, decay_string=  'B0 -> ^pi+ ^pi- [ K_S0 -> ^pi+ ^pi- ] gamma')+
        vu.create_aliases_for_selected(list_of_variables=cluster_variables, decay_string=  'B0 -> pi+ pi- [ K_S0 -> pi+ pi- ] ^gamma'),
    	filename = outputFilename, path=main_path)
# Process the events

b2.process(main_path)

# print out the summary
print(b2.statistics)
# Adding generator
# This specific event generator will generate either charged final states (charged B mesons)
# or mixed final states (neutal B mesons)
ge.add_evtgen_generator(path=my_path,
                        finalstate='signal',
                        signaldecfile='event_gen.dec')

ma.loadGearbox(path=my_path)

# Set the first parameter to zero if you want to see all the events.
# This will show how many particles are generated in each event.
#ma.printDataStore(0, path=my_path)
# Show the decay chain in each event
#ma.printMCParticles(path=my_path)

# dump generated events in DST format to the output ROOT file
my_path.add_module('RootOutput', outputFileName='event_gen.root')

# Show progress bar
my_path.add_module("ProgressBar")

# Add log file
b2.log_to_file("event_gen.log")

# process all modules added to the analysis_main path
# (note: analysis_main is the default path created in the modularAnalysis.py)
b2.process(path=my_path)

# print out the summary
b2.B2INFO(b2.statistics)
示例#16
0
def reconstruction(input_file, output_file):
    my_path = b2.create_path()
    ma.inputMdst("default", input_file, my_path)

    # Find decay name from the input file name
    decay_name = "_".join(input_file.split("/")[-1].split("_")[0:2])

    # Load configuration file
    config = yaml.safe_load(open("config/reco_config.yaml"))
    options = config[decay_name]

    # Parse list of subdecays in decay chain
    decays = options["sub_decays"]
    decays = DecayList(decays)

    # Create particle lists for final state particles
    fsps = decays.get_fsps()
    for particle in fsps:
        ma.fillParticleList(particle, "", path=my_path)

    # Reconstruct requested decay chains
    for decay in decays:
        ma.reconstructDecay(str(decay), "", path=my_path)

    # Perform truth matching for requested particles
    truth_match_particles = decays.mothers
    for truth_match_particle in truth_match_particles:
        ma.looseMCTruth(truth_match_particle, path=my_path)

    # Perform vertex fitting
    head = decays.get_head()
    vtx_decay_string = decays.get_chain()
    print(vtx_decay_string)

    vx.vertexRave(head, 0, vtx_decay_string, constraint="iptube", path=my_path)

    # ma.rankByLowest("B0", 'chiProb', numBest=3, outputVariable='B_vtx_rank', path=my_path)
    # ma.variables.addAlias('B_vtx_rank', 'extraInfo(B_vtx_rank)')
    ma.buildRestOfEvent(head, path=my_path)

    # Tag-side
    vx.TagV(head, "breco", 0.001, path=my_path)

    ma.buildEventKinematics(path=my_path)
    ma.buildEventShape(path=my_path)

    # Create centre-of-mass frame variables
    cms_kinematics = vu.create_aliases(
        vc.kinematics, "useCMSFrame({variable})", prefix="CMS"
    )

    variables = [
        item
        for sublist in [
            vc.kinematics,
            cms_kinematics,
            vc.deltae_mbc,
            vc.inv_mass,
            vc.event_shape,
            vc.vertex,
            vc.mc_truth,
            vc.mc_kinematics,
            vc.mc_vertex,
            vc.mc_tag_vertex,
        ]
        for item in sublist
    ]

    trees = yaml.safe_load(open("config/tree_names.yaml"))
    for particle in decays.all_particles:
        ma.variablesToNtuple(
            particle,
            variables,
            filename=output_file,
            treename=trees[particle],
            path=my_path,
        )

    b2.process(my_path)
    print(b2.statistics)
示例#17
0
                    dest='out_dir')
args = parser.parse_args()

# Set up output file (not integrated into basf2 command line yet)
if len(args.in_file) > 0:
    out_filename = '{}.h5'.format(
        os.path.splitext(os.path.basename(args.in_file))[0])
else:
    out_filename = 'train_data.h5'
os.makedirs(args.out_dir, exist_ok=True)
outfile = os.path.join(args.out_dir, out_filename)
print("Output file set to:\t" + outfile)

# Main processing
################################################################################
path = ma.create_path()

# Should change to RootInput with keppParents=True
# Don't need the other junk added by inputMdst since we're only dealing with MCParticles
ma.inputMdstList('default', filelist=[args.in_file], path=path)

TrainDataSaver_module = TrainDataSaver(
    evt_num_file=args.evtnum_file,
    output_file=outfile,
    keep_only=args.keep_only,
)
path.add_module(TrainDataSaver_module)

b2.process(path)
print(b2.statistics)
    'KSFWVariables(hso22)',
    'KSFWVariables(hso24)',
    'KSFWVariables(hoo0)',
    'KSFWVariables(hoo1)',
    'KSFWVariables(hoo2)',
    'KSFWVariables(hoo3)',
    'KSFWVariables(hoo4)',
    'cleoConeThrust0',
    'cleoConeThrust1',
    'cleoConeThrust2',
    'cleoConeThrust3',
    'cleoConeThrust4',
    'cleoConeThrust5',
    'cleoConeThrust6',
    'cleoConeThrust7',
    'cleoConeThrust8',
]

# Save target variable necessary for training.
targetVar = ['isNotContinuumEvent']

# Create output file.
ma.variablesToNtuple(decayString='B0',
                     variables=trainVars + targetVar,
                     treename='tree',
                     filename=outfile,
                     path=my_path)

b2.process(my_path)
print(b2.statistics)
示例#19
0
#         model_type=model_type,
#         threshold=args.threshold,
#     )
#     dead_path = b2.create_path()
#     NNApplyModule_m.if_false(dead_path)

#     main.add_module(NNApplyModule_m)
#     # Do I need this here?
#     # c1.set_property_flags(b2.ModulePropFlags.PARALLELPROCESSINGCERTIFIED)

# ma.loadGearbox(path=main)
# main.add_module('Geometry', ignoreIfPresent=True, components=['MagneticField'])
simulation.add_simulation(path=main,
                          bkgfiles=glob.glob(args.bkg_dir + '/*.root'))
reconstruction.add_reconstruction(path=main)

# dump generated events in MDST format to the output ROOT file
reconstruction.add_mdst_output(
    path=main,
    mc=True,
    filename='RootOutput.root',
    additionalBranches=['EventExtraInfo'],
)

# Begin processing
################################################################################
main.add_module('ProgressBar')
b2.process(path=main)

print(b2.statistics)
示例#20
0
tauVariables += ['mcErrors', 'genMotherPDG', 'mcPDG', 'isSignal']

# -- track level variables
trackVariables = vc.kinematics + vc.pid + vc.track + vc.track_hits + vc.vertex
trackVariables += [
    'theta', 'cosTheta', 'phi', 'charge', 'clusterE', 'EoverP', 'mcPDG'
]



variableList = vu.create_aliases_for_selected(list_of_variables=eventVariables,
                                              decay_string='^vpho') + \
               vu.create_aliases_for_selected(list_of_variables=tauVariables + ['charge'],
                                              decay_string='vpho -> ^tau+ ^tau-') + \
               vu.create_aliases_for_selected(list_of_variables=trackVariables,
                                              decay_string= decay_chain)

if tauMinus == '1':
    Outputfile = "tautau_mctruthsel_21_test.root"

if tauMinus == '3':
    Outputfile = "tautau_mctruthsel_23_test.root"

ma.variablesToNtuple('vpho:photon_B2SS',
                     variables=variableList,
                     treename='tree',
                     filename=Outputfile,
                     path=my_path)

b2.process(my_path, max_event=50000)
示例#21
0
vm.addAlias('dxDstar',  'dx')
vm.addAlias('dyDstar',  'dy')
vm.addAlias('dzDstar',  'dz')

vm.addAlias('pDstar',  'p')
vm.addAlias('eDstar',  'E')
vm.addAlias('eCmsDstar',  'useCMSFrame(E)')
vm.addAlias('mDstar',  'M')
vm.addAlias('mD', 'daughter(0,M)')
vm.addAlias('slowPiID', 'daughter(1,pionID)')


Vars = [ 'xDstar',  'yDstar',  'zDstar',  'xGenDstar', 'yGenDstar', 'zGenDstar', 'dxDstar', 'dyDstar', 'dzDstar', 'pDstar',  'eDstar',  'eCmsDstar', 'mDstar',  'mD', 'slowPiID']
Vars.append('isSignal')
Vars.append('IPX')
Vars.append('IPCov(0,0)')



# Match to the MC truth information
ma.matchMCTruth('D*+:my', path=path)


ma.variablesToNtuple('D*+:my', Vars, 
                     filename='nTupleNo.root', treename="Dstar", path=path)


b2.process(path, max_event=100000)
print(b2.statistics)