Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AnalysisProductions
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LHCb Data Packages
AnalysisProductions
Merge requests
!1626
Draft: New run3 3body decays
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
Draft: New run3 3body decays
jianqiao/run3_DPA_exotic
into
master
Overview
1
Commits
8
Pipelines
1
Changes
5
1 unresolved thread
Hide all comments
Closed
Jianqiao Wang
requested to merge
jianqiao/run3_DPA_exotic
into
master
6 months ago
Overview
1
Commits
8
Pipelines
1
Changes
5
1 unresolved thread
Hide all comments
Expand
One new decay: B+ -> Jpsi(1S) KS0 pi+ and old decays with DD V0(KS0 and Lambda0)
0
0
Merge request reports
Viewing commit
4b8e1eaf
Prev
Next
Show latest version
5 files
+
712
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
Search (e.g. *.vue) (Ctrl+P)
4b8e1eaf
Two new decays
· 4b8e1eaf
Jianqiao Wang
authored
6 months ago
Run3_b2psiX_3body_withUT/tools/descriptor_writer.py
0 → 100644
+
146
−
0
Options
import
pandas
as
pd
import
numpy
as
np
particle_dict
=
{
"
Lambda_b0
"
:
{
"
abbr
"
:
"
Lb
"
,
"
type
"
:
"
toplevel
"
,
"
daughters
"
:[]},
"
Xi_b-
"
:
{
"
abbr
"
:
"
Xibm
"
,
"
type
"
:
"
toplevel
"
,
"
daughters
"
:[]},
"
Xi_b0
"
:
{
"
abbr
"
:
"
Xib0
"
,
"
type
"
:
"
toplevel
"
,
"
daughters
"
:[]},
"
B0
"
:
{
"
abbr
"
:
"
B0
"
,
"
type
"
:
"
toplevel
"
,
"
daughters
"
:[]},
"
B+
"
:
{
"
abbr
"
:
"
Bp
"
,
"
type
"
:
"
toplevel
"
,
"
daughters
"
:[]},
"
B-
"
:
{
"
abbr
"
:
"
Bm
"
,
"
type
"
:
"
toplevel
"
,
"
daughters
"
:[]},
"
B_s0
"
:
{
"
abbr
"
:
"
Bs
"
,
"
type
"
:
"
toplevel
"
,
"
daughters
"
:[]},
"
J/psi(1S)
"
:
{
"
abbr
"
:
"
Jpsi
"
,
"
type
"
:
"
composite
"
,
"
daughters
"
:
[
"
mu+
"
,
"
mu-
"
]},
"
psi(2S)
"
:
{
"
abbr
"
:
"
psi2S
"
,
"
type
"
:
"
composite
"
,
"
daughters
"
:
[
"
mu+
"
,
"
mu-
"
]},
"
phi(1020)
"
:
{
"
abbr
"
:
"
phi
"
,
"
type
"
:
"
composite
"
,
"
daughters
"
:
[
"
K+
"
,
"
K-
"
]},
"
Lambda0
"
:
{
"
abbr
"
:
"
Lambda
"
,
"
type
"
:
"
composite
"
,
"
daughters
"
:
[
"
p+
"
,
"
pi-
"
]},
"
Lambda~0
"
:
{
"
abbr
"
:
"
Lambda
"
,
"
type
"
:
"
composite
"
,
"
daughters
"
:
[
"
p~-
"
,
"
pi+
"
]},
"
mu+
"
:
{
"
abbr
"
:
"
mup
"
,
"
type
"
:
"
basic
"
,
"
daughters
"
:[]},
"
mu-
"
:
{
"
abbr
"
:
"
mum
"
,
"
type
"
:
"
basic
"
,
"
daughters
"
:[]},
"
e+
"
:
{
"
abbr
"
:
"
ep
"
,
"
type
"
:
"
basic
"
,
"
daughters
"
:[]},
"
e-
"
:
{
"
abbr
"
:
"
em
"
,
"
type
"
:
"
basic
"
,
"
daughters
"
:[]},
"
pi+
"
:
{
"
abbr
"
:
"
Pip
"
,
"
type
"
:
"
basic
"
,
"
daughters
"
:[]},
"
pi-
"
:
{
"
abbr
"
:
"
Pim
"
,
"
type
"
:
"
basic
"
,
"
daughters
"
:[]},
"
K+
"
:
{
"
abbr
"
:
"
Kp
"
,
"
type
"
:
"
basic
"
,
"
daughters
"
:[]},
"
K-
"
:
{
"
abbr
"
:
"
Km
"
,
"
type
"
:
"
basic
"
,
"
daughters
"
:[]},
"
p+
"
:
{
"
abbr
"
:
"
Pp
"
,
"
type
"
:
"
basic
"
,
"
daughters
"
:[]},
"
p~-
"
:
{
"
abbr
"
:
"
Pm
"
,
"
type
"
:
"
basic
"
,
"
daughters
"
:[]},
}
particle_df
=
pd
.
DataFrame
(
particle_dict
).
T
def
descriptor
(
particles
,
cc
=
False
):
decay_descriptor
=
f
"
{
particles
[
0
]
}
->
"
for
particle
in
particles
[
1
:]:
decay_descriptor
+=
f
"
{
particle
}
"
if
cc
:
decay_descriptor
=
f
"
[
{
decay_descriptor
}
]cc
"
return
decay_descriptor
def
decay_branches
(
mother
,
daughters
,
decay_descriptor
):
psi_pos
=
0
phi_pos
=
0
Lambda_pos
=
0
Pm_pos
=
Pp_pos
=
0
Km_pos
=
Kp_pos
=
0
Pim_pos
=
Pip_pos
=
0
mum_pos
=
mup_pos
=
0
em_pos
=
ep_pos
=
0
#if decay_descriptor[0] == "[" or decay_descriptor[-3:] == "]cc":
if
"
cc
"
in
decay_descriptor
[
-
5
:]:
branch_descriptor
=
decay_descriptor
[:
-
2
]
+
"
CC
"
else
:
branch_descriptor
=
decay_descriptor
#if "J/psi(1S)" in decay_descriptor:
# branch_descriptor = branch_descriptor.replace("J/psi(1S)", "(J/psi(1S) -> mu+ mu-)")
#if "psi(2S)" in decay_descriptor:
# branch_descriptor = branch_descriptor.replace("psi(2S)", "(psi(2S) -> mu+ mu-)")
#if "Lambda0" in decay_descriptor:
# branch_descriptor = branch_descriptor.replace("Lambda0", "(Lambda0 -> p+ pi-)")
#if "Lambda~0" in decay_descriptor:
# branch_descriptor = branch_descriptor.replace("Lambda~0", "(Lambda~0 -> p~- pi+)")
for
comp_par
in
particle_df
.
query
(
"
type==
'
composite
'"
).
index
:
if
comp_par
in
decay_descriptor
:
#branch_descriptor = branch_descriptor.replace(comp_par, comp_par + "->" + " ".join(particle_df["daughters"][comp_par]))
branch_descriptor
=
branch_descriptor
.
replace
(
comp_par
,
f
'
(
{
comp_par
}
->
{
"
"
.
join
(
particle_df
[
"
daughters
"
][
comp_par
])
}
)
'
)
branches
=
{
mother
:
branch_descriptor
}
for
daughter
in
daughters
:
if
"
psi
"
in
daughter
:
true_pos
=
branch_descriptor
.
rfind
(
"
(
"
,
0
,
branch_descriptor
.
find
(
"
psi
"
,
psi_pos
))
branches
.
update
({
daughter
:
branch_descriptor
[:
true_pos
]
+
"
^
"
+
branch_descriptor
[
true_pos
:]})
psi_pos
=
branch_descriptor
.
find
(
"
psi
"
,
psi_pos
)
+
len
(
"
psi(nS)
"
)
if
"
phi
"
in
daughter
:
true_pos
=
branch_descriptor
.
rfind
(
"
(
"
,
0
,
branch_descriptor
.
find
(
"
phi
"
,
phi_pos
))
branches
.
update
({
daughter
:
branch_descriptor
[:
true_pos
]
+
"
^
"
+
branch_descriptor
[
true_pos
:]})
phi_pos
=
branch_descriptor
.
find
(
"
phi
"
,
phi_pos
)
+
len
(
"
phi(1020)
"
)
if
"
Lambda
"
in
daughter
:
true_pos
=
branch_descriptor
.
rfind
(
"
(
"
,
0
,
branch_descriptor
.
find
(
"
Lambda
"
,
Lambda_pos
))
branches
.
update
({
daughter
:
branch_descriptor
[:
true_pos
]
+
"
^
"
+
branch_descriptor
[
true_pos
:]})
Lambda_pos
=
branch_descriptor
.
find
(
"
Lambda
"
,
Lambda_pos
)
+
len
(
"
Lambda~0
"
)
if
"
Pp
"
in
daughter
:
true_pos
=
branch_descriptor
.
find
(
"
p+
"
,
Pp_pos
)
branches
.
update
({
daughter
:
branch_descriptor
[:
true_pos
]
+
"
^
"
+
branch_descriptor
[
true_pos
:]})
Pp_pos
=
true_pos
+
len
(
"
p+
"
)
if
"
Pm
"
in
daughter
:
true_pos
=
branch_descriptor
.
find
(
"
p~-
"
,
Pm_pos
)
branches
.
update
({
daughter
:
branch_descriptor
[:
true_pos
]
+
"
^
"
+
branch_descriptor
[
true_pos
:]})
Pm_pos
=
true_pos
+
len
(
"
p~-
"
)
if
"
Kp
"
in
daughter
:
true_pos
=
branch_descriptor
.
find
(
"
K+
"
,
Kp_pos
)
branches
.
update
({
daughter
:
branch_descriptor
[:
true_pos
]
+
"
^
"
+
branch_descriptor
[
true_pos
:]})
Kp_pos
=
true_pos
+
len
(
"
K+
"
)
if
"
Km
"
in
daughter
:
true_pos
=
branch_descriptor
.
find
(
"
K-
"
,
Km_pos
)
branches
.
update
({
daughter
:
branch_descriptor
[:
true_pos
]
+
"
^
"
+
branch_descriptor
[
true_pos
:]})
Km_pos
=
true_pos
+
len
(
"
K-
"
)
if
"
Pip
"
in
daughter
or
"
Hp
"
in
daughter
:
true_pos
=
branch_descriptor
.
find
(
"
pi+
"
,
Pip_pos
)
branches
.
update
({
daughter
:
branch_descriptor
[:
true_pos
]
+
"
^
"
+
branch_descriptor
[
true_pos
:]})
Pip_pos
=
true_pos
+
len
(
"
pi+
"
)
if
"
Pim
"
in
daughter
or
"
Hm
"
in
daughter
:
true_pos
=
branch_descriptor
.
find
(
"
pi-
"
,
Pim_pos
)
branches
.
update
({
daughter
:
branch_descriptor
[:
true_pos
]
+
"
^
"
+
branch_descriptor
[
true_pos
:]})
Pim_pos
=
true_pos
+
len
(
"
pi-
"
)
if
"
mup
"
in
daughter
:
true_pos
=
branch_descriptor
.
find
(
"
mu+
"
,
mup_pos
)
branches
.
update
({
daughter
:
branch_descriptor
[:
true_pos
]
+
"
^
"
+
branch_descriptor
[
true_pos
:]})
mup_pos
=
true_pos
+
len
(
"
mu+
"
)
if
"
mum
"
in
daughter
:
true_pos
=
branch_descriptor
.
find
(
"
mu-
"
,
mum_pos
)
branches
.
update
({
daughter
:
branch_descriptor
[:
true_pos
]
+
"
^
"
+
branch_descriptor
[
true_pos
:]})
mum_pos
=
true_pos
+
len
(
"
mu-
"
)
if
"
ep
"
in
daughter
:
true_pos
=
branch_descriptor
.
find
(
"
e+
"
,
ep_pos
)
branches
.
update
({
daughter
:
branch_descriptor
[:
true_pos
]
+
"
^
"
+
branch_descriptor
[
true_pos
:]})
ep_pos
=
true_pos
+
len
(
"
e+
"
)
if
"
em
"
in
daughter
:
true_pos
=
branch_descriptor
.
find
(
"
e-
"
,
em_pos
)
branches
.
update
({
daughter
:
branch_descriptor
[:
true_pos
]
+
"
^
"
+
branch_descriptor
[
true_pos
:]})
em_pos
=
true_pos
+
len
(
"
e-
"
)
return
branches
def
all_particles
(
particles
):
all_pars
=
[]
for
particle
in
particles
:
all_pars
+=
(
[
particle
]
+
particle_df
[
"
daughters
"
][
particle
])
return
all_pars
#print(all_particles(["B_s0","J/psi(1S)", "p+", "p~-"]))
def
default_names
(
particles
):
names
=
[]
for
particle
in
particles
:
abbr
=
particle_df
[
"
abbr
"
][
particle
]
names
.
append
(
abbr
)
names
+=
[
f
"
{
daughter_abbr
}
_
{
abbr
}
"
for
daughter_abbr
in
particle_df
[
"
abbr
"
][
particle_df
[
"
daughters
"
][
particle
]]]
return
names
def
default_branches
(
particles
,
cc
=
False
):
names
=
default_names
(
particles
)
return
decay_branches
(
names
[
0
],
names
[
1
:],
descriptor
(
particles
,
cc
))
branches
=
default_branches
(
[
"
B+
"
,
"
J/psi(1S)
"
,
"
phi(1020)
"
,
"
K+
"
],
True
)
print
(
branches
)
#branches = decay_branches("Bs", ["Jpsi", "Pp", "Pm", "mup", "mum"], "[B_s0 -> J/psi(1S) p+ p~-]cc")
#print(branches)
#branches = default_names( ["B_s0","J/psi(1S)", "p+", "p~-"])
#print(descriptor(["Lambda_b0", "J/psi(1S)", "p+", "K-"], True))
Loading