ijazz.toys ========== .. py:module:: ijazz.toys Attributes ---------- .. autoapisummary:: ijazz.toys.__doc__ ijazz.toys.mass_z ijazz.toys.gamma_z ijazz.toys.win_z_mc ijazz.toys.win_z_dt Functions --------- .. autoapisummary:: ijazz.toys.decalibrate ijazz.toys.oversmearing ijazz.toys.oversmearing2 ijazz.toys.dataset ijazz.toys.tree_to_df ijazz.toys.tree_to_df_paul ijazz.toys.tree_to_df_fabrice ijazz.toys.detector_smearing ijazz.toys.decal_and_os Module Contents --------------- .. py:data:: __doc__ :value: 'This module allows to create a simple MC simulation of the Z->ee decaywith a gaussian smearing... .. py:data:: mass_z .. py:data:: gamma_z .. py:data:: win_z_mc :value: (50, 130) .. py:data:: win_z_dt :value: (70, 110) .. py:function:: decalibrate(x) Decalibrate the response of the events for the property x. :param x: Input property. :type x: np.ndarray :returns: Decalibrated response. :rtype: tf.Tensor .. py:function:: oversmearing(x) Applies additional oversmearing based on the property x. :param x: Input property. :type x: np.ndarray :returns: Oversmearing values. :rtype: np.ndarray .. py:function:: oversmearing2(x) Return a quadratic oversmearing model as a function of x. .. py:function:: dataset(do_decal, n_toys=100, decalibrate_f=decalibrate, oversmearing_f=oversmearing, smear_property=False, prop_gaus=False, return_smear=False) Create the dataset. :param prop_gaus: If True, generate properties with a Gaussian distribution (mean=45, sigma=25). :type prop_gaus: bool :param do_decal: If True, decalibrate the Z BW events using the `decalibrate_f` and `oversmearing_f` functions. :type do_decal: bool :param n_toys: Number of Monte Carlo toys to generate. :type n_toys: int :param decalibrate_f: Function to apply scale decalibration. :type decalibrate_f: Callable :param oversmearing_f: Function to apply oversmearing. :type oversmearing_f: Callable :param smear_property: If True, smear the properties `x1` and `x2` according to the smearing in the mass. :type smear_property: bool :param prop_gaus: If True, generate properties with a Gaussian shape. :type prop_gaus: bool :param return_smear: If True, return smeared values. :type return_smear: bool :returns: A tuple containing the smeared mass (`mee_smear`), and the properties `x1` and `x2` of the two electrons. If `return_smear` is True, also return the smearing factors `s1` and `s2`. :rtype: Tuple[tf.Tensor, tf.Tensor, tf.Tensor] .. py:function:: tree_to_df(tree, random_R9=True, use_fabrice=False) Convert a ROOT tree to a pandas DataFrame with derived columns. .. py:function:: tree_to_df_paul(tree) Paul's ROOT tree reader with Pythia-like inputs. .. py:function:: tree_to_df_fabrice(tree) Fabrice's ROOT tree reader with Pythia-like inputs. .. py:function:: detector_smearing(x1, x2, mee, sigma=0.02) Adds Gaussian smearing with resolution `sigma` to `x1`, `x2`, and `mee`. :param x1: Variable to apply the smearing (first electron). :type x1: np.ndarray :param x2: Variable to apply the smearing (second electron). :type x2: np.ndarray :param mee: Variable to apply the smearing (dilepton system). :type mee: np.ndarray :param sigma: Gaussian resolution. Defaults to 0.02. :type sigma: float, optional :returns: Smeared variables `x1_smear`, `x2_smear`, and `mee_smear`. :rtype: Tuple[np.ndarray, np.ndarray, np.ndarray] .. py:function:: decal_and_os(x1, x2, pT1, pT2, mee, decalibrate_f=decalibrate, oversmearing_f=oversmearing, decal_kwargs={}, os_kwargs={}) Decalibrate and add oversmearing to pT1, pT2, and mee. :param x1: Variables to use as input for the decalibrate and oversmearing functions (first lepton). :type x1: tuple :param x2: Variables to use as input for the decalibrate and oversmearing functions (second lepton). :type x2: tuple :param pT1: Variable to apply the decalibration and oversmearing (first lepton). :type pT1: float :param pT2: Variable to apply the decalibration and oversmearing (second lepton). :type pT2: float :param mee: Variable to apply the decalibration and oversmearing (dilepton system). :type mee: float :param decalibrate_f: Function to decalibrate the pT. Defaults to `decalibrate`. :type decalibrate_f: Callable :param oversmearing_f: Function to oversmear the pT. Defaults to `oversmearing_all`. :type oversmearing_f: Callable :returns: pT1_smear, pT2_smear, mee_smear, mee_os (mee with only oversmearing). :rtype: Tuple[float, float, float, float]