db.close()
else:
    logger.info('Existing weights DBASE will be used')

# =============================================================================
## make reweighting iterations

from ostap.tools.reweight import Weight, makeWeights, WeightingPlot, W2Data
from ostap.fitting.selectors import SelectorWithVars, Variable
import ostap.parallel.parallel_fill

# =============================================================================
## configuration of reweighting
weightings = (
    ## variable          address in DB
    Weight.Var('x', 'x-reweight'),
    Weight.Var('y', 'y-reweight'),
    Weight.Var(('x', 'y'), '2D-reweight'),
)

# =============================================================================
## variables to be used in MC-dataset
variables = [
    Variable('x', 'x-var', 0, 20),
    Variable('y', 'y-var', 0, 15),
]
selector = SelectorWithVars(variables,
                            '0<x && x<20 && 0<y && y<20',
                            silence=True)
mctree.process(selector, silent=True)
mcds_ = selector.data  ## dataset
Beispiel #2
0
    db.close()
else :
    logger.info('Existing weights DBASE will be used') 

#
## make reweighting iterations
# 
from ostap.tools.reweight     import Weight, makeWeights, WeightingPlot
from ostap.fitting.selectors  import SelectorWithVars, Variable 

## start iterations:
for iter in range ( 0 , maxIter ) :

    weighting = (
        ## variable          address in DB    
        Weight.Var( accessor = lambda s : s.x , address = 'x-reweight'  ) , 
        )
    
    weighter   = Weight( dbname , weighting )
    ## variables to be used in MC-dataset 
    variables  = [
        Variable ( 'pt_x'   , 'pt_x'   , 0  , 100 , lambda s : s.x ) , 
        Variable ( 'weight' , 'weight' , accessor =  weighter       )  
        ]
    
    #
    ## create new "weighted" mcdataset
    # 
    selector = SelectorWithVars (
        variables ,
        '0<x && x<100 '
Beispiel #3
0
    db.close()
else :
    logger.info('Existing weights DBASE will be used') 
    
#
## make reweigthing iterations
# 
from ostap.tools.reweight      import Weight, makeWeights,  WeightingPlot  
from ostap.fitting.selectors   import SelectorWithVars, Variable 

## start iterations:
for iter in range ( 0 , maxIter ) :

    weightings = (
        ## variable          address in DB    
        Weight.Var ( lambda s : s.x       , 'x-reweight'  ) , 
        Weight.Var ( lambda s : s.y       , 'y-reweight'  ) , 
        Weight.Var ( lambda s : (s.x,s.y) , '2D-reweight' ) , 
        )
    
    weighter   = Weight( dbname , weightings )
    ## variables to be used in MC-dataset 
    variables  = [
        Variable( 'x'      , 'x-var'  , 0  , 20 , lambda s : s.x ) ,  
        Variable( 'y'      , 'y-var'  , 0  , 15 , lambda s : s.y ) , 
        Variable( 'weight' , 'weight' ,    accessor = weighter   )  
        ]
    
    #
    ## create new "weighted" mcdataset
    # 
Beispiel #4
0
    db.close()
else:
    logger.info('Existing weights DBASE will be used')

#
## make reweighting iterations
#
from ostap.tools.reweight import Weight, makeWeights, WeightingPlot
from ostap.fitting.selectors import SelectorWithVars, Variable

## start iterations:
for iter in range(0, maxIter):

    weighting = (
        ## variable          address in DB
        Weight.Var('x', address='x-reweight'), )

    weighter = Weight(dbname, weighting)
    ## variables to be used in MC-dataset
    variables = [
        ## Variable ( 'x'  , 'x-variable' , 0  , 100 , lambda s : s.x ) ,
        Variable('x', 'x-variable', 0, 100),
        Variable('weight', 'weight', accessor=weighter)
    ]

    #
    ## create new "weighted" mcdataset
    #
    selector = SelectorWithVars(variables, '0<x && x<100 ')

    mctree.pprocess(selector, chunk_size=len(mctree) // 20)