from modularAnalysis import printList
from modularAnalysis import fillParticleListsFromMC
from modularAnalysis import printPrimaryMCParticles
from modularAnalysis import printVariableValues
from modularAnalysis import analysis_main


# load input ROOT file
# inputMdst('B0_etapr-eta-gg2pi_KS-pi+pi-_gsim-BKGx0.root')
inputMdst('../root_files/B0_etapr-eta-gg2pi_KS-pi0pi0_gsim-BKGx0.root')
# inputMdst('B0_etapr-eta-gg2pi_KL-_gsim-BKGx0.root')
# inputMdst('B0_etapr-eta-3pi2pi_KS-pi+pi-_gsim-BKGx0.root')

printPrimaryMCParticles()
# print contents of the DataStore before loading MCParticles
printDataStore()

# create and fill gamma/e/mu/pi/K/p ParticleLists
# second argument are the selection criteria: '' means no cut, take all
photons = ('gamma:gen', '')
electrons = ('e-:gen', '')
muons = ('mu-:gen', '')
pions = ('pi-:gen', '')
kaons = ('K-:gen', '')
kaonsneu = ('K_S0:gen', '')
protons = ('anti-p-:gen', '')

fillParticleListsFromMC([photons, electrons, muons, pions, kaons, kaonsneu, protons])

# print contents of the DataStore after loading MCParticles
# the difference is that DataStore now contains StoreArray<Particle>
Example #2
0
from modularAnalysis import printDataStore
from modularAnalysis import printList
from modularAnalysis import fillParticleListsFromMC
from modularAnalysis import printPrimaryMCParticles
from modularAnalysis import printVariableValues
from modularAnalysis import analysis_main

# load input ROOT file
# inputMdst('B0_etapr-eta-gg2pi_KS-pi+pi-_gsim-BKGx0.root')
inputMdst('../root_files/B0_etapr-eta-gg2pi_KS-pi0pi0_gsim-BKGx0.root')
# inputMdst('B0_etapr-eta-gg2pi_KL-_gsim-BKGx0.root')
# inputMdst('B0_etapr-eta-3pi2pi_KS-pi+pi-_gsim-BKGx0.root')

printPrimaryMCParticles()
# print contents of the DataStore before loading MCParticles
printDataStore()

# create and fill gamma/e/mu/pi/K/p ParticleLists
# second argument are the selection criteria: '' means no cut, take all
photons = ('gamma:gen', '')
electrons = ('e-:gen', '')
muons = ('mu-:gen', '')
pions = ('pi-:gen', '')
kaons = ('K-:gen', '')
kaonsneu = ('K_S0:gen', '')
protons = ('anti-p-:gen', '')

fillParticleListsFromMC(
    [photons, electrons, muons, pions, kaons, kaonsneu, protons])

# print contents of the DataStore after loading MCParticles
import modularAnalysis as ma
import variables.collections as vc
import variables.utils as vu
import stdV0s as stdv

# create path
my_path = b2.create_path()

# load input ROOT file
ma.inputMdst(environmentType='default',
             filename=b2.find_file('B2pi0D_D2hh_D2hhh_B2munu.root', 'examples',
                                   False),
             path=my_path)

# print contents of the DataStore before loading Particles
ma.printDataStore(path=my_path)

# create and fill Ks/Lambda0 ParticleLists, using V0s as source
# second argument are the selection criteria: '' means no cut, take all
# the decay chain has to be specified (i.e. the two daughters, as well)
# A vertex fit should also be performed
# In this example a cut on the candidates mass is applied
ma.fillParticleList(decayString='K_S0:V0 -> pi+ pi-',
                    cut='0.3 < M < 0.7',
                    path=my_path)
ma.vertexKFit(list_name='K_S0:V0', conf_level=0.0, path=my_path)
ma.fillParticleList(decayString='Lambda0:V0 -> p+ pi-',
                    cut='0.9 < M < 1.3',
                    path=my_path)
ma.vertexKFit(list_name='Lambda0:V0', conf_level=0.0, path=my_path)
# create path
my_path = b2.create_path()

# load input ROOT file
#ma.inputMdst(environmentType='default',
#            filename=b2.find_file('B2pi0D_D2hh_D2hhh_B2munu.root', 'examples', False),
#            path=my_path)

# You do not have to use reconstructed MC data. The difference is 
# if you use reconstructed root file, there will be more entries in 
# the output of printDataStore(), like tracks and ECL clusters etc.
my_path.add_module("RootInput", inputFileName='event_gen.root')

# print contents of the DataStore before loading MCParticles
ma.printDataStore(-1, path=my_path)

# create and fill gamma/e/mu/pi/K/p ParticleLists
# second argument are the selection criteria: '' means no cut, take all
photons = ('gamma:gen', '')
electrons = ('e-:gen', '')
muons = ('mu-:gen', '')
pions = ('pi-:gen', '')
kaons = ('K-:gen', '')
protons = ('anti-p-:gen', '')

# During event generation, the particle information was written in the root file.
ma.fillParticleListsFromMC([photons, electrons, muons, pions, kaons, protons], path=my_path)

# print contents of the DataStore after loading MCParticles
# the difference is that DataStore now contains StoreArray<Particle>