Skip to content

Commit

Permalink
typo and effective beta doc
Browse files Browse the repository at this point in the history
  • Loading branch information
JoschD committed Nov 12, 2024
1 parent aee9255 commit 37162ca
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions omc3/scripts/kmod_lumi_imbalance.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
K-Mod Luminosity Imbalance
--------------------------
Calculate the luminosity imbalance from the averaged K-modulation results.
Calculate the luminosity imbalance from the averaged K-modulation results,
based on the effective betas for two IPs, i.e. assuming that apart from the
beta-function all other parameters are identical for the two IPs.
This script needs the data in the format of the average script `kmod_average.py`,
as the imbalance is calculated over both beams and this data is only available
at that point.
Expand Down Expand Up @@ -183,7 +186,7 @@ def get_lumi_imbalance_df(**kwargs) -> tfs.TfsDataFrame:
Calculate the effective beta stars and the luminosity imbalance from the input dataframes.
Args:
ipA (tfs.TfsDataFrame): ar`TfsDataFrame` with the averaged results from a kmod analysis, for IP_A.
ipA (tfs.TfsDataFrame): a `TfsDataFrame` with the averaged results from a kmod analysis, for IP_A.
ipB (tfs.TfsDataFrame): a `TfsDataFrame` with the averaged results from a kmod analysis, for IP_B.
(Actually, any name that ends with an integer is fine.)
Expand All @@ -207,17 +210,19 @@ def get_lumi_imbalance_df(**kwargs) -> tfs.TfsDataFrame:

def get_imbalance_w_err(ipA_beta: float, ipA_beta_err: float, ipB_beta: float, ipB_beta_err: float) -> tuple[float, float]:
"""
Calculate the luminosity imbalance IP_A / IP_B and its error.
Calculate the luminosity imbalance IP_A / IP_B and its error, based on the effective betas for IP_A and IP_B.
This implies, that all the other beam parameters (see e.g. Eq(17): https://cds.cern.ch/record/941318/files/p361.pdf)
are the same for both IPs.
"""
result = ipB_beta / ipA_beta # inverse due to beta in the denominator for lumi
err = result * np.sqrt((ipB_beta_err/ipB_beta)**2 + (ipA_beta_err/ipA_beta)**2)
return result, err


def get_effective_beta_star_w_err(df_ip: tfs.TfsDataFrame) -> tuple[float]:
""" Calculates the effective beta*,
i.e. the denominator of the luminosity (e.g. Eq(17): https://cds.cern.ch/record/941318/files/p361.pdf)
without any constants, as we only need it for the ratio anyway.
""" Calculates the effective beta*, i.e. the denominator of the luminosity as given in e.g.
Eq(17): https://cds.cern.ch/record/941318/files/p361.pdf , without any constants
as we assume here that these are equal for both IPs, and we only care about the ratio.
"""
b1x, b1y, b2x, b2y = _get_betastar_beams(df_ip)
db1x, db2x, db1y, db2y = _get_betastar_beams(df_ip, errors=True)
Expand Down

0 comments on commit 37162ca

Please sign in to comment.