Beispiel #1
0
    del reader  ## attention: reader must be deleted explicitely

    # =========================================================================
    ## B: addTMVAResponse
    #  Much better alternative to TMVA.Reader:
    #  - it has much better performance  :-)
    #  - but it is less flexible with  repsect to varibale  transformation :-(
    # =========================================================================

    from ostap.tools.tmva import addTMVAResponse

    logger.info('dataset SIG: %s' % ds1)
    logger.info('dataset BKG: %s' % ds2)
    addTMVAResponse(ds1,
                    inputs=('var1', 'var2', 'var3'),
                    weights_files=tar_file,
                    prefix='tmva_',
                    suffix='_response')
    addTMVAResponse(ds2,
                    inputs=('var1', 'var2', 'var3'),
                    weights_files=tar_file,
                    prefix='tmva_',
                    suffix='_response')
    # =========================================================================
    ## The END of addTMVAResponse  fragment
    # =========================================================================

    logger.info('dataset SIG: %s' % ds1)
    logger.info('dataset BKG: %s' % ds2)

for m in methods:
Beispiel #2
0
    
    datafile.ls()
    tSignal  = datafile['S']
    tBkg     = datafile['B']

    # =========================================================================
    ## B: addTMVAResponse
    #  Much better alternative to TMVA.Reader:
    #  - it has much better performance  :-) 
    #  - but it is less flexible with  repsect to varibale  transformation :-(
    # =========================================================================
    
    from ostap.tools.tmva import addTMVAResponse
    addTMVAResponse ( tSignal ,
                      inputs        = ( 'var1' ,  'var2' , 'var3' ) ,
                      weights_files = tar_file ,
                      prefix        = 'tmva_'     ,
                      suffix        = '_response' )
    addTMVAResponse ( tBkg    ,
                      inputs        = ( 'var1' ,  'var2' , 'var3' ) ,
                      weights_files = tar_file ,
                      prefix        = 'tmva_'     ,
                      suffix        = '_response' )
    
    # =========================================================================
    ## The END of addTMVAResponse  fragment
    # =========================================================================

# =============================================================================
## read input data file 
with ROOT.TFile.Open( data_file ,'READ') as datafile :