Exemplo n.º 1
0
 def __init__(
         self,
         mass,  ## mass is mandatory here! 
         name='Bu',
         mean=5.2791e+00,  ## to be released later 
         sigma=7.2938e-03,  ## to be released later 
         alphaL=1.4499e+00,  ## to be released later 
         alphaR=1.9326e+00,  ## to be released later
         nL=8.7234e+00,  ## to be released later 
         nR=2.0377e+00):  ## to be released later
     ##
     CB2_pdf.__init__(self, name, mass.getMin(), mass.getMax(), mass, mean,
                      sigma, alphaL, alphaR, nL, nR)
Exemplo n.º 2
0
 def __init__(
         self,
         xvar,  ## mass is mandatory here! 
         name='Bd',
         mean=5.2791e+00,  ## to be released later 
         sigma=7.2938e-03,  ## to be released later 
         alphaL=1.4499e+00,  ## to be released later 
         alphaR=1.9326e+00,  ## to be released later
         nL=8.7234e+00,  ## to be released later 
         nR=2.0377e+00):  ## to be released later
     ##
     CB2_pdf.__init__(self, name, xvar, mean, sigma, alphaL, alphaR, nL, nR)
     ## save configuration
     self.config = {
         'xvar': self.xvar,
         'name': self.name,
         'mean': self.mean,
         'sigma': self.sigma,
         'alphaL': self.aL,
         'alphaR': self.aR,
         'nL': self.nL,
         'nR': self.nR,
     }
Exemplo n.º 3
0
    def __init__(self,
                 mass,
                 name='Y',
                 power=0,
                 m1s=None,
                 sigma=None,
                 alphaL=1.5462,
                 alphaR=1.6952,
                 nL=1.3110,
                 nR=1.5751e+01):

        #
        PDF.__init__(self, name, mass)
        #
        if 9460. in self.mass and 10023. in self.mass and 10355. in self.mass:
            gev_ = 1000
        elif 9.460 in self.mass and 10.023 in self.mass and 10.355 in self.mass:
            gev_ = 1
        else:
            raise AttributeError("Illegal mass range %s<m<%s" % self.xminmax())

        m_y1s = 9.46030 * gev_
        s_y1s = 4.03195e-02 * gev_
        dm_y2s = 10.02326 * gev_ - m_y1s
        dm_y3s = 10.3552 * gev_ - m_y1s

        # =====================================================================

        # =====================================================================
        ## Y(1S)
        # =====================================================================
        self.__aL = self.make_var(alphaL, "aL_%s" % name,
                                  "#alpha_{L}(%s)" % name, alphaL, 1.5462, 0.1,
                                  10)
        self.__nL = self.make_var(nL, "nL_%s" % name, "n_{L}(%s)" % name, nL,
                                  1.3119, 1.e-5, 25)
        self.__aR = self.make_var(alphaR, "aR_%s" % name,
                                  "#alpha_{R}(%s)" % name, alphaR, 1.6952e+00,
                                  0.1, 10)
        self.__nR = self.make_var(nR, "nR_%s" % name, "n_{R}(%s)" % name, nR,
                                  1.5751e+01, 1.e-5, 25)

        self.__m1s = self.make_var(m1s, "m1S_%s" % name, "mass Y1S(%s)" % name,
                                   m1s, m_y1s, m_y1s - 0.15 * s_y1s,
                                   m_y1s + 0.15 * s_y1s)

        self.__s1s = self.make_var(sigma, "s1S_%s" % name,
                                   "sigma Y1S(%s)" % name, sigma, s_y1s,
                                   0.3 * s_y1s, 4 * s_y1s)
        self.__sigma = self.__s1s

        self.__Y1S = CB2_pdf(name + '1S',
                             xvar=self.mass,
                             mean=self.__m1s,
                             sigma=self.__s1s,
                             alphaL=self.__aL,
                             alphaR=self.__aR,
                             nL=self.__nL,
                             nR=self.__nR)

        # =====================================================================
        ## Y(2S)
        # =====================================================================
        self.__dm2s = self.make_var(None, "dm2s" + name, "dm2s(%s)" % name,
                                    dm_y2s, dm_y2s - 0.20 * s_y1s,
                                    dm_y2s + 0.20 * s_y1s)

        self.__aset11 = ROOT.RooArgList(self.__m1s, self.__dm2s)
        self.__m2s = ROOT.RooFormulaVar(
            "m_" + name + '2S', "m2s(%s)" % name,
            "%s+%s" % (self.__m1s.GetName(), self.__dm2s.GetName()),
            self.__aset11)

        self.__aset12 = ROOT.RooArgList(self.__sigma, self.__m1s, self.__m2s)
        self.s2s = ROOT.RooFormulaVar(
            "sigma_" + name + '2S', "#sigma_{Y2S}(%s)" % name,
            "%s*(%s/%s)" % (self.__sigma.GetName(), self.__m2s.GetName(),
                            self.__m1s.GetName()), self.__aset12)

        self.__Y2S = CB2_pdf(name + '2S',
                             xvar=self.mass,
                             mean=self.__m2s,
                             sigma=self.__s2s,
                             alphaL=self.__aL,
                             alphaR=self.__aR,
                             nL=self.__nL,
                             nR=self.__nR)

        # =====================================================================
        ## Y(3S)
        # =====================================================================
        self.__dm3s = self.make_var(None, "dm3s" + name, "dm3s(%s)" % name,
                                    dm_y3s, dm_y3s - 0.20 * s_y1s,
                                    dm_y3s + 0.20 * s_y1s)

        self.__aset21 = ROOT.RooArgList(self.__m1s, self.__dm3s)
        self.__m3s = ROOT.RooFormulaVar(
            "m_" + name + '(3S)', "m3s(%s)" % name,
            "%s+%s" % (self.__m1s.GetName(), self.__dm3s.GetName()),
            self.__aset21)

        self.__aset22 = ROOT.RooArgList(self.__sigma, self.__m1s, self.__m3s)
        self.__s3s = ROOT.RooFormulaVar(
            "sigma_" + name + '3S', "#sigma_{Y3S}(%s)" % name,
            "%s*(%s/%s)" % (self.__sigma.GetName(), self.__m3s.GetName(),
                            self.__m1s.GetName()), self.__aset22)

        self.__Y3S = CB2_pdf(name + '3S',
                             xvar=self.mass,
                             mean=self.__m3s,
                             sigma=self.__s3s,
                             alphaL=self.__aL,
                             alphaR=self.__aR,
                             nL=self.__nL,
                             nR=self.__nR)

        #
        ## the actual signal PDFs
        #
        self.__y1s = self.__Y1S.pdf
        self.__y2s = self.__Y2S.pdf
        self.__y3s = self.__Y3S.pdf

        ## use helper function to create background
        self.background = self.make_bkg(power, 'Bkg%s' % name, self.mass)

        self.__n1s = self.make_var(None, "N1S" + name, "Signal(Y1S)", None,
                                   1000, 0, 1.e+7)
        self.__n2s = self.make_var(None, "N2S" + name, "Signal(Y2S)", None,
                                   300, 0, 1.e+6)
        self.__n3s = self.make_var(None, "N3S" + name, "Signal(Y3S)", None,
                                   100, 0, 1.e+6)
        self.__b = self.make_var(None, "B" + name, "Background", None, 100, 0,
                                 1.e+8)

        self.alist1 = ROOT.RooArgList(self.__y1s, self.__y2s, self.__y3s)
        self.alist2 = ROOT.RooArgList(self.__n1s, self.__n2s, self.__n3s)

        self.alist1.add(self.background.pdf)
        self.alist2.add(self.__b)

        self.pdf = ROOT.RooAddPdf("manca_%s" % name, "manca(%s)" % name,
                                  self.alist1, self.alist2)

        self.__dm2s.setConstant(True)
        self.__dm3s.setConstant(True)

        self._splots = []

        self.s1_name = self.N1S.GetName()
        self.s2_name = self.N2S.GetName()
        self.s3_name = self.N3S.GetName()
        self.b_name = self.B.GetName()

        #
        ## finally declare components
        #
        self.signals().add(self.__y1s)
        self.signals().add(self.__y2s)
        self.signals().add(self.__y3s)
        self.backgrounds().add(self.background.pdf)

        ## save configurtaion
        self.config = {
            'mass': self.mass,
            'name': self.name,
            'power': self.power,
            'm1s': self.m1s,
            'sigma': self.sigma,
            'alphaL': self.aL,
            'alphaR': self.aR,
            'nL': self.nL,
            'nR': self.nR,
        }
Exemplo n.º 4
0
    def __init__(
        self,
        name,
        xvar,  ## x-variable 
        yvar,  ## y-variable 
        phi=None,  ## rotation phase
        ##
        cb1=None,  ## 1st CB2 
        mean1=None,  ## the mean  of the first CB2
        sigma1=None,  ## the sigma of the first CB2
        alphaL1=None,  ## the alphaL parameter for the first CB2 
        alphaR1=None,  ## the alphaR parameter for the first CB2
        nL1=None,  ## the nL parameter     for the first CB2
        nR1=None,  ## the nR parameter     the the first CB2
        ##
        cb2=None,  ## 2nd CB2 
        mean2=None,  ## the mean  of the second CB2
        sigma2=None,  ## the sigma of the second  CB2
        alphaL2=None,  ## the alphaL parameter for the second CB2 
        alphaR2=None,  ## the alphaR parameter for the second CB2
        nL2=None,  ## the nL parameter     for the second CB2
        nR2=None):  ## the nR parameter     the the second CB2

        ## inialize the base
        PDF2.__init__(self, name, xvar, yvar)

        self.__phi = self.make_var(phi, "phi_%s" % name, "phi(%s)" % name, phi,
                                   0, -3.0, +6.0)

        if cb1 and isinstance(cb1, CB2_pdf):
            mean1 = cb1.mean
            sigma1 = cb1.sigma
            alphaL1 = cb1.aL
            alphaR1 = cb1.aR
            nL1 = cb1.nL
            nR1 = cb1.nR

        if cb2 and isinstance(cb2, CB2_pdf):
            mean2 = cb2.mean
            sigma2 = cb2.sigma
            alphaL2 = cb2.aL
            alphaR2 = cb2.aR
            nL2 = cb2.nL
            nR2 = cb2.nR

        ## save areguments
        self.__cb1 = cb1
        self.__cb2 = cb2

        ## create helper Crystal Balls
        self.__cb_1 = CB2_pdf(name + '_X', xvar, mean1, sigma1, alphaL1,
                              alphaR1, nL1, nR1)
        self.__cb_2 = CB2_pdf(name + '_Y', yvar, mean2, sigma2, alphaL2,
                              alphaR2, nL2, nR2)

        ## finally create PDF
        self.pdf = Ostap.Models.Rotated2CrystalBalls(
            'r2cb_%s' % name,
            'Rotated2CBs(%s)' % name,
            self.x,
            self.y,
            self.phi,
            ##
            self.mean1,
            self.sigma1,
            self.aL1,
            self.nL1,
            self.aR1,
            self.nR1,
            ##
            self.mean2,
            self.sigma2,
            self.aL2,
            self.nL2,
            self.aR2,
            self.nR2)

        ## save configuration
        self.config = {
            'name': self.name,
            'xvar': self.xvar,
            'yvar': self.yvar,
            'phi': self.phi,
            ##
            'cb1': self.__cb1,
            'mean1': self.mean1,
            'sigma1': self.sigma1,
            'alphaL1': self.aL1,
            'alphaR1': self.aR1,
            'nL1': self.nL1,
            'nR1': self.nR1,
            ##
            'cb2': self.__cb2,
            'mean2': self.mean2,
            'sigma2': self.sigma2,
            'alphaL2': self.aL2,
            'alphaR2': self.aR2,
            'nL2': self.nL2,
            'nR2': self.nR2
        }
Exemplo n.º 5
0
    def __init__(self,
                 mass,
                 name='Y',
                 power=0,
                 m1s=None,
                 sigma=None,
                 alphaL=1.5462,
                 alphaR=1.6952,
                 nL=1.3110,
                 nR=1.5751e+01):

        #
        PDF.__init__(self, name)
        #
        if mass.getMin() < 9.460 and 9.60 <= mass.getMax(): gev_ = 1
        elif mass.getMin() < 10. and 10.500 <= mass.getMax(): gev_ = 1
        elif mass.getMin() < 10.0 and 10.200 <= mass.getMax(): gev_ = 1
        elif mass.getMin() < 9460 and 10355 <= mass.getMax(): gev_ = 1000
        elif mass.getMin() < 10000 and 10500 <= mass.getMax(): gev_ = 1000
        elif mass.getMin() < 10000 and 10200 <= mass.getMax(): gev_ = 1000
        else:
            raise TypeError("Illegal mass range %s<m<%s" %
                            (mass.getMin(), mass.getMax()))

        m_y1s = 9.46030 * gev_
        s_y1s = 4.03195e-02 * gev_
        dm_y2s = 10.02326 * gev_ - m_y1s
        dm_y3s = 10.3552 * gev_ - m_y1s

        #
        self.mass = mass

        # =====================================================================
        from ostap.fitting.basic import makeVar
        from ostap.fitting.signals import CB2_pdf

        # =====================================================================
        ## Y(1S)
        # =====================================================================
        self.aL = makeVar(alphaL, "aL_%s" % name, "#alpha_{L}(%s)" % name,
                          alphaL, 1.5462, 0, 10)
        self.nL = makeVar(nL, "nL_%s" % name, "n_{L}(%s)" % name, nL, 1.3119,
                          0, 10)
        self.aR = makeVar(alphaR, "aR_%s" % name, "#alpha_{R}(%s)" % name,
                          alphaR, 1.6952e+00, 0, 10)
        self.nR = makeVar(nR, "nR_%s" % name, "n_{R}(%s)" % name, nR,
                          1.5751e+01, 0, 25)

        self.m1s = makeVar(m1s, "m1S_%s" % name, "mass Y1S(%s)" % name, m1s,
                           m_y1s, m_y1s - 0.15 * s_y1s, m_y1s + 0.15 * s_y1s)

        self.s1s = makeVar(sigma, "s1S_%s" % name, "sigma Y1S(%s)" % name,
                           sigma, s_y1s, 0.3 * s_y1s, 4 * s_y1s)
        self.sigma = self.s1s

        self.Y1S = CB2_pdf(name + '1S',
                           mass.getMin(),
                           mass.getMax(),
                           mass=self.mass,
                           mean=self.m1s,
                           sigma=self.s1s,
                           alphaL=self.aL,
                           alphaR=self.aR,
                           nL=self.nL,
                           nR=self.nR)

        # =====================================================================
        ## Y(2S)
        # =====================================================================
        self.dm2s = makeVar(None, "dm2s" + name, "dm2s(%s)" % name, dm_y2s,
                            dm_y2s - 0.20 * s_y1s, dm_y2s + 0.20 * s_y1s)

        self.aset11 = ROOT.RooArgList(self.m1s, self.dm2s)
        self.m2s = ROOT.RooFormulaVar(
            "m_" + name + '2S', "m2s(%s)" % name,
            "%s+%s" % (self.m1s.GetName(), self.dm2s.GetName()), self.aset11)

        self.aset12 = ROOT.RooArgList(self.sigma, self.m1s, self.m2s)
        self.s2s = ROOT.RooFormulaVar(
            "sigma_" + name + '2S', "#sigma_{Y2S}(%s)" % name, "%s*(%s/%s)" %
            (self.sigma.GetName(), self.m2s.GetName(), self.m1s.GetName()),
            self.aset12)

        self.Y2S = CB2_pdf(name + '2S',
                           mass.getMin(),
                           mass.getMax(),
                           mass=self.mass,
                           mean=self.m2s,
                           sigma=self.s2s,
                           alphaL=self.aL,
                           alphaR=self.aR,
                           nL=self.nL,
                           nR=self.nR)

        # =====================================================================
        ## Y(3S)
        # =====================================================================
        self.dm3s = makeVar(None, "dm3s" + name, "dm3s(%s)" % name, dm_y3s,
                            dm_y3s - 0.20 * s_y1s, dm_y3s + 0.20 * s_y1s)

        self.aset21 = ROOT.RooArgList(self.m1s, self.dm3s)
        self.m3s = ROOT.RooFormulaVar(
            "m_" + name + '(3S)', "m3s(%s)" % name,
            "%s+%s" % (self.m1s.GetName(), self.dm3s.GetName()), self.aset21)

        self.aset22 = ROOT.RooArgList(self.sigma, self.m1s, self.m3s)
        self.s3s = ROOT.RooFormulaVar(
            "sigma_" + name + '3S', "#sigma_{Y3S}(%s)" % name, "%s*(%s/%s)" %
            (self.sigma.GetName(), self.m3s.GetName(), self.m1s.GetName()),
            self.aset22)

        self.Y3S = CB2_pdf(name + '3S',
                           mass.getMin(),
                           mass.getMax(),
                           mass=self.mass,
                           mean=self.m3s,
                           sigma=self.s3s,
                           alphaL=self.aL,
                           alphaR=self.aR,
                           nL=self.nL,
                           nR=self.nR)

        #
        ## the actual signal PDFs
        #
        self.y1s = self.Y1S.pdf
        self.y2s = self.Y2S.pdf
        self.y3s = self.Y3S.pdf

        ## use helper function to create background
        from ostap.fitting.models_bkg import makeBkg
        self.background = makeBkg(power, 'Bkg%s' % name, self.mass)

        self.n1s = makeVar(None, "N1S" + name, "Signal(Y1S)", None, 1000, 0,
                           1.e+7)
        self.n2s = makeVar(None, "N2S" + name, "Signal(Y2S)", None, 300, 0,
                           1.e+6)
        self.n3s = makeVar(None, "N3S" + name, "Signal(Y3S)", None, 100, 0,
                           1.e+6)
        self.b = makeVar(None, "B" + name, "Background", None, 100, 0, 1.e+8)

        self.alist1 = ROOT.RooArgList(self.y1s, self.y2s, self.y3s)
        self.alist2 = ROOT.RooArgList(self.n1s, self.n2s, self.n3s)

        self.alist1.add(self.background.pdf)
        self.alist2.add(self.b)

        self.pdf = ROOT.RooAddPdf("manca_%s" % name, "manca(%s)" % name,
                                  self.alist1, self.alist2)

        self.dm2s.setConstant(True)
        self.dm3s.setConstant(True)

        self._splots = []

        self.s1_name = self.n1s.GetName()
        self.s2_name = self.n2s.GetName()
        self.s3_name = self.n3s.GetName()

        #
        ## finally declare components
        #
        self.signals().add(self.y1s)
        self.signals().add(self.y2s)
        self.signals().add(self.y3s)
        self.backgrounds().add(self.background.pdf)