Ejemplo n.º 1
0
 def __call__ (  self , x , y , z , error = False ) :
     """Get the efficiency
     >>> dataset = ... 
     >>> eff     = ... 
     >>> eff.fitTo ( dataset ) 
     >>> x = 0.15
     >>> y = 90 
     >>> z = 15
     >>> value = eff(x,y,z) 
     """
     from ostap.fitting.roofit import SETVAR
     from ostap.math.ve        import VE 
     xx = float ( x ) 
     yy = float ( y ) 
     zz = float ( z ) 
     if xx in self.xvar and yy in self.yvar and zz in self.zvar :
         with SETVAR ( self.xvar ) :
             with SETVAR ( self.yvar ) :
                 with SETVAR ( self.zvar ) :
                     self.xvar.setVal ( xx )
                     self.yvar.setVal ( yy )
                     self.zvar.setVal ( zz )
                     if error and self.fit_result :
                         e = self.eff_fun.getPropagatedError ( self.fit_result )
                         if 0<= e : return  VE ( v ,  e * e )
                     return v 
     logger.error ('Invalid efficiency, return -1 ') 
     return -1 
Ejemplo n.º 2
0
 def __call__ (  self , x , error = False ) :
     """Get the efficiency
     >>> dataset = ... 
     >>> eff = Efficiency1D( ... )
     >>> eff.fitTo ( dataset ) 
     >>> x = 0.15
     >>> value = eff(x) 
     """
     from ostap.fitting.roofit import SETVAR
     from ostap.math.ve        import VE 
     xx = float ( x ) 
     if xx in self.xvar : 
         with  SETVAR ( self.xvar ) :
             self.xvar.setVal ( xx )                
             v = self.eff_fun.getVal ()
             if error and self.fit_result :
                 e = self.eff_fun.getPropagatedError ( self.fit_result )
                 if 0<= e : return  VE ( v ,  e * e )
             return v 
     logger.error ('Invalid efficiency, return -1 ') 
     return -1