예제 #1
0
    def _root_in_Tes(self):
        """
        Propagate RootInTES :
        
        - use PhysConf.MicroDST
        - set RooInTES property to all members of user sequence
        
        """
        ##
        itype = self.getProp('InputType').upper()
        if not 'MDST' == itype: return  ## no action
        #
        if not self.isPropertySet('RootInTES'): return  ## no action
        rit = self.getProp('RootInTES')
        if rit in ('', '/', '/Event', '/Event/'): return  ## no action
        #
        ## call uDstConf
        #
        from PhysConf.MicroDST import uDstConf
        uDstConf(rit, logger=getLogger('PhysConf.MicroDST'))  ## use it!
        #
        ## setup RootInTES property for mainSeq
        if not hasattr(self, 'mainSeq'): return
        ms = self.mainSeq

        def _set_root_in_tes_(s, root):
            #
            if isinstance(s, str): return
            prps = s.getProperties().keys()
            if 'RootInTES' in prps:
                if not s.isPropertySet('RootInTES'):
                    log.info("Set RootInTES=%s for %s" % (root, s.getName()))
                    s.RootInTES = root
            #
            if not 'Members' in prps: return
            #
            for a in s.Members:
                _set_root_in_tes_(a, root)

        _set_root_in_tes_(ms, rit)
예제 #2
0
"""
# =============================================================================
__author__ = "Vanya BELYAEV [email protected]"
__date__ = "2013-09-01"
__version__ = "$Revision:$"
# =============================================================================
from GaudiKernel.SystemOfUnits import MeV, GeV
# =============================================================================
# logging
# =============================================================================
try:
    from AnalysisPython.Logger import getLogger
    _name = __name__
    if 0 == _name.find('__'):
        _name = 'C&Y'
    logger = getLogger(_name)
except:
    from Gaudi.Configuration import log as logger
# =============================================================================


# =============================================================================
# 0. get upsilons from DIMUON.DST
# =============================================================================

ups_name = 'FullDSTDiMuonDiMuonHighMass'

from PhysSelPython.Wrappers import AutomaticData
ups = AutomaticData('/Event/Dimuon/Phys/%sLine/Particles' % ups_name)

# =============================================================================
예제 #3
0
# =============================================================================
__version__ = "$Revision:"
__author__ = "Vanya BELYAEV [email protected]"
__date__ = "2014-06-08"
__all__ = ()  ## nothing to be imported
# =============================================================================
import ROOT, os
import Ostap.PyRoUts
from Ostap.Data import Data, DataAndLumi
from Ostap.Utils import timing
# =============================================================================
# logging
# =============================================================================
from AnalysisPython.Logger import getLogger
if '__main__' == __name__ or '__builtin__' == __name__:
    logger = getLogger('Ostap.TestKisa')
else:
    logger = getLogger(__name__)
# =============================================================================
logger.info('Test  Data')
# =============================================================================
# data patterns:
ganga = '/afs/cern.ch/work/i/ibelyaev/public/GANGA/workspace/ibelyaev/LocalXML'
if os.path.exists('/mnt/shared/VMDATA/LocalXML'):
    ganga = '/mnt/shared/VMDATA/LocalXML'
# =============================================================================
patterns = [
    ganga + '/358/*/output/CY.root',  ## 2k+11,down
    ganga + '/359/*/output/CY.root',  ## 2k+11,up
    ganga + '/356/*/output/CY.root',  ## 2k+12,down
    ganga + '/357/*/output/CY.root',  ## 2k+12,up
예제 #4
0
import ROOT
from AnalysisPython.PyRoUts import *
# ========================================================================
from AnalysisPython.Logger import getLogger
logger = getLogger(__name__)


# Trigger
cuts_trg = "((psi_l0tos & 2) == 2)"
cuts_trg += "&& ((psi_l1tos & 2) == 2)"
cuts_trg += "&& ((psi_l2tos & 2) == 2)"

# Cuts
cuts_ = " DTFchi2ndof > 0"
cuts_ += "&& DTFchi2ndof < 5"
cuts_ += "&& DTFctau > 0.25"
cuts_ += "&& vchi2_b < 20"
cuts_ += "&& pt_pion[0] > 0.3 && pt_pion[1] > 0.3"
cuts_ += "&& pt_kaon > 0.6"
cuts_ += "&& m_jpsi    > 3.020 && m_jpsi    < 3.135"
cuts_ += "&& minann_K  > 0.3 && minann_pi > 0.3"
cuts_ += "&& MIPCHI2DV_k > 12. && MIPCHI2DV_pi1 > 12. && MIPCHI2DV_pi2 > 12."

mctrue = " && mcTrueB && mcTruePsi && mcTruePi1 && mcTruePi2 && mcTrueK && mcTrueMu1 && mcTrueMu2"

cuts_Bu = cuts_ + "&& " + cuts_trg
cuts_mc = cuts_Bu + mctrue


def prntCuts(cuts, prefix=""):
    for cut in cuts.split("&&"):
예제 #5
0
"""
# =============================================================================
__version__ = "$Revision:"
__author__ = "Vanya BELYAEV [email protected]"
__date__ = "2014-05-10"
__all__ = ()  ## nothing to be imported
# =============================================================================
import ROOT
from Ostap.PyRoUts import *
from Ostap.Utils import rooSilent
# =============================================================================
# logging
# =============================================================================
from AnalysisPython.Logger import getLogger
if '__main__' == __name__ or '__builtin__' == __name__:
    logger = getLogger('Ostap.TestOther')
else:
    logger = getLogger(__name__)
# =============================================================================
logger.info('Test for signal it models from Analysis/Ostap')
# =============================================================================
## make simple test
mass2 = ROOT.RooRealVar('test_mass2', 'Some test mass', 0, 10)
x = mass2

## book very simple data set
varset2 = ROOT.RooArgSet(mass2)

import Ostap.FitModels as Models

events = 5000
예제 #6
0
"""
# =============================================================================
__version__ = "$Revision:"
__author__ = "Vanya BELYAEV [email protected]"
__date__ = "2014-05-10"
__all__ = ()  ## nothing to be imported
# =============================================================================
import ROOT, random
from Ostap.PyRoUts import *
from Ostap.Utils import rooSilent
# =============================================================================
# logging
# =============================================================================
from AnalysisPython.Logger import getLogger
if '__main__' == __name__ or '__builtin__' == __name__:
    logger = getLogger('Ostap.TestModels')
else:
    logger = getLogger(__name__)
# =============================================================================
logger.info('Test for signal it models from Analysis/Ostap')
# =============================================================================
## make simple test mass
mass = ROOT.RooRealVar('test_mass', 'Some test mass', 3.0, 3.2)

## book very simple data set
varset0 = ROOT.RooArgSet(mass)
dataset0 = ROOT.RooDataSet(dsID(), 'Test Data set-0', varset0)

mmin = mass.getMin()
mmax = mass.getMin()
예제 #7
0
#
#  tests for weighted fits and model with convolution
#
#  @author Vanya BELYAEV [email protected]
#  @date 2014-05-11
#
#                    $Revision$
#  Last modification $Date$
#                 by $Author$
# =============================================================================
import ROOT
from Ostap.PyRoUts import *
from Ostap.Utils import rooSilent
# =============================================================================
from AnalysisPython.Logger import getLogger
if '__main__' == __name__: logger = getLogger('Ostap.TestWeighted')
else: logger = getLogger(__name__)
# =============================================================================
logger.info('Test for weighted fits and model with convolution')
# ============================================================================
RAD = ROOT.RooAbsData
if RAD.Tree != RAD.getDefaultStorageType():
    logger.info('DEFINE default storage type to be TTree! ')
    RAD.setDefaultStorageType(RAD.Tree)

# ============================================================================
# The variables
# ============================================================================
m_b = ROOT.RooRealVar('mB', 'm(B)', 5.2, 5.4)
m_phi = ROOT.RooRealVar('mPhi', 'm(Phi)', 1.0, 1.050)
h_phi = m_phi.histo(50)
예제 #8
0
"""
__version__ = "$Id: Configuration.py,v 1.125 2010-09-10 11:31:19 jpalac Exp $"
__author__ = "Juan Palacios <*****@*****.**>"

from LHCbKernel.Configuration import *
from Configurables import GaudiSequencer
from Configurables import (LHCbConfigurableUser, LHCbApp, PhysConf,
                           AnalysisConf, DstConf, L0Conf, LumiAlgsConf)
from LumiAlgs.LumiIntegratorConf import LumiIntegratorConf
import GaudiKernel.ProcessJobOptions

#
##
#
from AnalysisPython.Logger import getLogger
log = getLogger('DaVinci')


class DaVinci(LHCbConfigurableUser):

    __slots__ = {
        # Application Configuration : sent to LHCbApp and Gaudi
        "EvtMax":
        -1  # Number of events to analyse
        ,
        "SkipEvents":
        0  # Number of events to skip at beginning for file
        ,
        "PrintFreq":
        1000  # The frequency at which to print event numbers
        ,
예제 #9
0
Tests for various background fit models  
"""
# =============================================================================
__version__ = "$Revision:"
__author__  = "Vanya BELYAEV [email protected]"
__date__    = "2014-05-10"
__all__     = ()  ## nothing to be imported 
# =============================================================================
import ROOT, random
from   Ostap.PyRoUts import *
# =============================================================================
# logging 
# =============================================================================
from AnalysisPython.Logger import getLogger
if '__main__' == __name__  or '__builtin__'  == __name__ : 
    logger = getLogger ( 'Ostap.TestCmp' )
else : 
    logger = getLogger ( __name__ )
# =============================================================================
logger.info ( 'Test for specific historgam comparisons')
# =============================================================================


#
## histos for gaussian distributions
# 

h1g   = ROOT.TH1D ( hID() , '' ,  40 , -5 , 5 ) ; h1g.Sumw2() 
h2g   = ROOT.TH1D ( hID() , '' ,  40 , -5 , 5 ) ; h2g.Sumw2() 
h3g   = ROOT.TH1D ( hID() , '' ,  20 , -5 , 5 ) ; h3g.Sumw2() 
예제 #10
0
                    $Revision$
  Last modification $Date$
                 by $Author$  
                 """
# =============================================================================
__author__  = 'Vanya BELYAEV [email protected]'
__date__    = "2012-03-16"
__version__ = '$Revision$'
__all__     = (
    'dumpToFile' ,
    'readFile'   , 
    )
# =============================================================================
import ROOT, os
from   AnalysisPython.Logger import getLogger
if __name__ in ( '__main__' , '__builtin__' ) : logger = getLogger ('DumpRootObjects')
else : logger = getLogger ( __name__ )
# ============================================================================

def dumpToFile ( objects , fbase  = 'ROOT_Objects_%d_%s.root' ) :
    
    fname = fbase % ( ROOT.gROOT.GetVersionInt() ,
                      os.environ['CMTCONFIG']    )
    
    f = ROOT.TFile( fname , 'RECREATE' )
    
    for o in objects : o.Write()

    f.ls    ()
    f.Close ()
    
예제 #11
0
#  by                $Author$
# =============================================================================
"""
Test for ROOT6 problem with copy-constructor and cast-operators 

see https://sft.its.cern.ch/jira/browse/ROOT-6627

"""
# =============================================================================
__version__ = "$Revision$"
__author__ = "Vanya BELYAEV [email protected]"
__date__ = "2011-06-07"
# =============================================================================
import ROOT
from AnalysisPython.Logger import getLogger
logger = getLogger('TestVE')

VE = ROOT.Gaudi.Math.ValueWithError
a = VE(1, 1)

logger.info('a = %s +- %s ' % (a.value(), a.error()))

b = VE(a)
logger.info('b = %s +- %s ' % (b.value(), b.error()))

jira = 'https://sft.its.cern.ch/jira/browse/ROOT-6627'
if a.error() != b.error():
    logger.error('Wrong result, the problem %s is not solved yet ' % jira)
    logger.error('ROOT Version %s' % ROOT.gROOT.GetVersion())
    raise TypeError('Values are not equal: %s != %s' % (a.error(), b.error()))
예제 #12
0
#
# @author Vanya BELYAEV [email protected]
# @date 2014-05-11
#
#                    $Revision$
#  Last modification $Date$
#                 by $Author$
# =============================================================================
"""
Tests for various background fit models  
"""
import ROOT
from Ostap.PyRoUts import *
# ==========================================================================================
from AnalysisPython.Logger import getLogger
if '__main__' == __name__: logger = getLogger('Ostap.TestFlatte')
else: logger = getLogger(__name__)
# ==========================================================================================
logger.info('Compare Breit and Flatte')
# ==========================================================================================
import Ostap.FitModels as Models
from Ostap.Utils import rootWarning
m_X = 3.87156
g_X = 0.001
m_Jpsi = 3.0960
m_pipi = 0.4000

mass = ROOT.RooRealVar('m', 'mass(J/psi pipi)', 3.868, 3.88)

bw = cpp.Gaudi.Math.BreitWigner(m_X, g_X, m_Jpsi, m_pipi, 0)
breit = Models.BreitWigner_pdf('BW', bw, mass=mass, mean=m_X, gamma=g_X)
예제 #13
0
"""
# =============================================================================
__version__ = "$Revision:"
__author__  = "Vanya BELYAEV [email protected]"
__date__    = "2014-06-21"
__all__     = ()  ## nothing to be imported 
# =============================================================================
import ROOT, random 
from   Ostap.PyRoUts import *
from   Ostap.Utils   import rooSilent, timing 
# =============================================================================
# logging 
# =============================================================================
from AnalysisPython.Logger import getLogger
if '__main__' == __name__ or '__builtin__' == __name__ : 
    logger = getLogger( 'Ostap.TestDBs' )
else : 
    logger = getLogger( __name__ )
# =============================================================================
import os,tempfile
#
db_sql_name  = tempfile.mktemp ( suffix = '.msql' ) 
db_zip_name  = tempfile.mktemp ( suffix = '.zdb'  )
db_root_name = tempfile.mktemp ( suffix = '.root' )
#
# =============================================================================
import Ostap.ZipShelve    as ZipShelve
import Ostap.SQLiteShelve as SQLiteShelve
import Ostap.RootShelve   as RootShelve
#
bins    = 1000
예제 #14
0
"""
# ============================================================================
__version__ = "$Revision:$"
__author__  = "Vanya BELYAEV  [email protected]"
__date__    = "2014-12-10"
__all__     = (  'data' , 'm_psi' )
# ============================================================================
import ROOT, random
from   Ostap.PyRoUts  import *
import Ostap.ZipShelve as     DBASE 
# ============================================================================
# logging
# ============================================================================
from AnalysisPython.Logger import getLogger
if __name__  in ( '__main__' , '__builtin__' ) :
    logger = getLogger( 'OstapTutor.TestData1')
else : logger = getLogger( __name__ )
logger.info ('Create 1D dataset for Ostap Tutorial ')
# ============================================================================

from OstapTutor.TestVars1 import m_psi

#
## create data set
# 
varset = ROOT.RooArgSet  ( m_psi ) 
data   = ROOT.RooDataSet ( dsID()  , 'Data set for Ostap tutorial' , varset  )

#
## fill it!
#
예제 #15
0
"""
# =============================================================================
__version__ = "$Revision:"
__author__ = "Vanya BELYAEV [email protected]"
__date__ = "2015-02-07"
__all__ = ()  ## nothing to be imported
# =============================================================================
import ROOT
from Ostap.PyRoUts import *
from Ostap.Utils import rooSilent
# =============================================================================
# logging
# =============================================================================
from AnalysisPython.Logger import getLogger
if '__main__' == __name__ or '__builtin__' == __name__:
    logger = getLogger('Ostap.TestPoly')
else:
    logger = getLogger(__name__)
# =============================================================================
logger.info('Test for some polynomials models from Analysis/Ostap')
# =============================================================================
## make simple test
mass2 = ROOT.RooRealVar('test_mass3', 'Some test mass', 2, 10)
x = mass2

## book very simple data set
varset2 = ROOT.RooArgSet(mass2)

import Ostap.FitModels as Models

events = 10000
예제 #16
0
"""
# =============================================================================
__version__ = "$Revision:"
__author__ = "Vanya BELYAEV [email protected]"
__date__ = "2014-05-10"
__all__ = ()  ## nothing to be imported
# =============================================================================
import ROOT, random, math, os
from Ostap.PyRoUts import *
import Ostap.ZipShelve as DBASE
# =============================================================================
# logging
# =============================================================================
from AnalysisPython.Logger import getLogger
if '__main__' == __name__ or '__builtin__' == __name__:
    logger = getLogger('Ostap.TestReweight')
else:
    logger = getLogger(__name__)
# =============================================================================
RAD = ROOT.RooAbsData
if RAD.Tree != RAD.getDefaultStorageType():
    logger.info('DEFINE default storage type to be TTree! ')
    RAD.setDefaultStorageType(RAD.Tree)
# =============================================================================
logger.info('Test for Reweighting machinery')
# =============================================================================
testdatadb = 'testdata.db'
if not os.path.exists(testdatadb):
    #
    logger.info('Test RANDOM data will be generated')
    ## prepare"data" histogram: lets use simple exponential and non-equidistance bins
예제 #17
0
"""
# ============================================================================
__version__ = "$Revision:$"
__author__ = "Vanya BELYAEV  [email protected]"
__date__ = "2014-12-10"
__all__ = ('m_psi', 'm_psi1', 'm_phi', 'm_phi1', 'm_D0', 'm_ups')
# ============================================================================
import ROOT, random
from Ostap.PyRoUts import *
import Ostap.ZipShelve as DBASE
# ============================================================================
# logging
# ============================================================================
from AnalysisPython.Logger import getLogger
if __name__ in ('__main__', '__builtin__'):
    logger = getLogger('OstapTutor.TestVars1')
else:
    logger = getLogger(__name__)
logger.info('Create some varibales for Ostyap tutorial')
# ============================================================================

# make simple test variable
m_psi = ROOT.RooRealVar('mPsi', 'mass(mu+mu-)', 3.000, 3.200)
m_psi1 = ROOT.RooRealVar('mPsi1', 'mass(mu+mu-)', 3.000, 3.200)

# make simple test variable
m_phi = ROOT.RooRealVar('mPhi', 'mass(K+K-)', 0.990, 1.050)
m_phi1 = ROOT.RooRealVar('mPhi1', 'mass(K+K-)', 1.000, 1.050)

# make simple test variable
m_D0 = ROOT.RooRealVar('m_D0', 'mass(K^{-}#pi^{+})', 1.82, 1.92)
예제 #18
0
    'logInfo',  ## helper function to control output level
    'logWarning',  ## helper function to control output level
    'logError',  ## helper function to control output level
    'logColor',  ## context manager to switch on  color logging locally  
    'logNoColor',  ## context manager to switch off color logging locally  
    'noColor',  ## context manager to switch off color logging locally
    'colored_string',  ## helper function to colorize the string
)
# =============================================================================
## import actual logger
from AnalysisPython.Logger import (getLogger, setLogging, logLevel, logVerbose,
                                   logDebug, logInfo, logWarning, logError,
                                   logColor, logNoColor, noColor, make_colors,
                                   reset_colors, colored_string)
# =============================================================================
if '__main__' == __name__: logger = getLogger('Bender.Logger')
else: logger = getLogger(__name__)
# =============================================================================
if __name__ == '__main__':

    import logging
    logging.disable(logging.VERBOSE - 1)

    logger.info(80 * '*')
    logger.info(__doc__)
    logger.info(' Author  : %s ' % __author__)
    logger.info(' Version : %s ' % __version__)
    logger.info(' Date    : %s ' % __date__)
    logger.info(' Symbols : %s ' % list(__all__))
    logger.info(80 * '*')
예제 #19
0
"""
# =============================================================================
__version__ = "$Revision:"
__author__ = "Vanya BELYAEV [email protected]"
__date__ = "2014-06-08"
__all__ = ()  ## nothing to be imported
# =============================================================================
import ROOT, random
from Ostap.PyRoUts import *
from Ostap.Utils import rooSilent
# =============================================================================
# logging
# =============================================================================
from AnalysisPython.Logger import getLogger
if '__main__' == __name__ or '__builtin__' == __name__:
    logger = getLogger('Ostap.TestCorr2D')
else:
    logger = getLogger(__name__)
# =============================================================================
logger.info('')
# =============================================================================
## make simple test vars
m_x = ROOT.RooRealVar('x', 'Some test-(X)', -100, 100)
m_y = ROOT.RooRealVar('y', 'Some test-(Y)', -100, 100)
#
m1 = VE(0, 5)
m2 = VE(0, 5)

RAD = ROOT.RooAbsData
if RAD.Tree != RAD.getDefaultStorageType():
    logger.info('DEFINE default storage type to be TTree! ')
예제 #20
0
Example fo simmple fit
"""
# ============================================================================
__version__ = "$Revision:$"
__author__ = "Vanya BELYAEV  [email protected]"
__date__ = "2014-12-10"
__all__ = ('data', 'm_psi')
# ============================================================================
import ROOT, random
from Ostap.PyRoUts import *
# ============================================================================
# logging
# ============================================================================
from AnalysisPython.Logger import getLogger
if __name__ in ('__main__', '__builtin__'):
    logger = getLogger('fit1')
else:
    logger = getLogger(__name__)
logger.info('Simple fit')
# ============================================================================

## 1) import dataset and variable
from OstapTutor.TestData1 import m_psi, data

logger.info('Data: %s' % data)

## 2) create the model: signnal + background

import Ostap.FitModels as Models

## 2a) create the  signal : gaussian  here
예제 #21
0
"""
# =============================================================================
__version__ = "$Revision:"
__author__ = "Vanya BELYAEV [email protected]"
__date__ = "2014-06-08"
__all__ = ()  ## nothing to be imported
# =============================================================================
import ROOT, os
import Ostap.PyRoUts
from Ostap.Data import Data, DataAndLumi
# =============================================================================
# logging
# =============================================================================
from AnalysisPython.Logger import getLogger
if '__main__' == __name__ or '__builtin__' == __name__:
    logger = getLogger('Ostap.TestData')
else:
    logger = getLogger(__name__)
# =============================================================================
logger.info('Test  Data')
# =============================================================================
# data patterns:
ganga = '/afs/cern.ch/work/i/ibelyaev/public/GANGA/workspace/ibelyaev/LocalXML'
if os.path.exists('/mnt/shared/VMDATA/LocalXML'):
    ganga = '/mnt/shared/VMDATA/LocalXML'
# =============================================================================
patterns = [
    ganga + '/358/*/output/CY.root',  ## 2k+11,down
    ganga + '/359/*/output/CY.root',  ## 2k+11,up
    ganga + '/356/*/output/CY.root',  ## 2k+12,down
    ganga + '/357/*/output/CY.root',  ## 2k+12,up
예제 #22
0
#                    $Revision:$
#  Last modification $Date:$
#                 by $Author:$
# =========================================================================================
""" Simple examples how to  get data
- collect files
- build the chain
- get integrated lumi
"""
# =========================================================================================
import ROOT
from   Ostap.PyRoUts         import * 
from   Ostap.Data            import DataAndLumi as Data 
from   AnalysisPython.Logger import getLogger
# ==========================================================================================
if '__main__' == __name__ : logger = getLogger('OstapTutor/data3')
else                      : logger = getLogger( __name__     )
# ==========================================================================================
## define the default storage for data set 
RAD = ROOT.RooAbsData
if RAD.Tree != RAD.getDefaultStorageType() :
    logger.info ( 'DEFINE default storage type to be TTree! ') 
    RAD.setDefaultStorageType ( RAD.Tree )

    
ganga = '/afs/cern.ch/work/i/ibelyaev/public/GANGA/workspace/ibelyaev/LocalXML'
## ganga = '/mnt/shared/VMDATA/LocalXML'


patterns = [
    ganga + '/356/*/output/CY.root' , ## 2k+12,down
예제 #23
0
"""
# ============================================================================
__version__ = "$Revision:$"
__author__ = "Vanya BELYAEV  [email protected]"
__date__ = "2014-12-10"
__all__ = ('data', 'm_psi', 'm_phi')
# ============================================================================
import ROOT, random
from Ostap.PyRoUts import *
import Ostap.ZipShelve as DBASE
# ============================================================================
# logging
# ============================================================================
from AnalysisPython.Logger import getLogger
if __name__ in ('__main__', '__builtin__'):
    logger = getLogger('OstapTutor.TestData5')
else:
    logger = getLogger(__name__)
logger.info('Create 1D dataset for Ostap Tutorial ')
# ============================================================================
RAD = ROOT.RooAbsData
if RAD.Tree != RAD.getDefaultStorageType():
    logger.info('DEFINE default storage type to be TTree! ')
    RAD.setDefaultStorageType(RAD.Tree)
# ============================================================================

x = ROOT.RooRealVar('x', 'x', 0, 10)
varset = ROOT.RooArgSet(x)

import Ostap.FitModels as Models
예제 #24
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# =========================================================================================
import ROOT
from Ostap.PyRoUts import *
# ==========================================================================================
from AnalysisPython.Logger import getLogger
if '__main__' == __name__: logger = getLogger('work_CY/cuts')
else: logger = getLogger(__name__)
# ==========================================================================================
logger.info('Define some basic cuts for Y+charm analysis')
# ==========================================================================================
from OstapTutor.TestVars1 import m_D0, m_Dp, m_Ds, m_Lc, m_Y

hD0 = m_D0.histo(100)
hDp = m_Dp.histo(90)
hDs = m_Ds.histo(140)
hLc = m_Lc.histo(90)
hY = m_Y.histo(400)

pileup = ROOT.RooRealVar('pileup', 'log10(chi2_DTF)', -2, 6)

hD0Y = ROOT.TH2D(hID(), '', 20, 9.0, 11.0, 16, 1.82, 1.90)
hD0Y.Sumw2()
hDpY = ROOT.TH2D(hID(), '', 20, 9.0, 11.0, 16, 1.82, 1.90)
hDpY.Sumw2()
hDsY = ROOT.TH2D(hID(), '', 20, 9.0, 11.0, 16, 1.92, 2.00)
hDsY.Sumw2()
hLcY = ROOT.TH2D(hID(), '', 20, 9.0, 11.0, 16, 2.245, 2.325)
hLcY.Sumw2()
예제 #25
0
Example fo simmple fit
"""
# ============================================================================
__version__ = "$Revision:$"
__author__  = "Vanya BELYAEV  [email protected]"
__date__    = "2014-12-10"
__all__     = (  'data' , 'm_psi' )
# ============================================================================
import ROOT, random
from   Ostap.PyRoUts  import *
# ============================================================================
# logging
# ============================================================================
from AnalysisPython.Logger import getLogger
if __name__  in ( '__main__' , '__builtin__' ) :
    logger = getLogger( 'fit1')
else : logger = getLogger( __name__ )
logger.info ('Simple fit')
# ============================================================================

## 1) import dataset and variable 
from OstapTutor.TestData2 import m_psi, data

logger.info ( 'Data: %s' % data ) 


## 2) create the model: signnal + background

import Ostap.FitModels as Models

## 2a) create the  signal : 
예제 #26
0
# @date 2011-04-15
# =============================================================================
"""
A file which starts the full calibration process with the Mass Distribution Fit
Method.

Usage:
> python RunMassDistributionCalibration.py
"""
## General things
import os, re, random, socket

## Printouts
from AnalysisPython.Logger import getLogger

loggerIt = getLogger('Iterator:')
loggerAn = getLogger('Analyser:')

## Kali modules responsible for filling and fitting the histograms
from KaliCalo.MassDistribution.FillTask import fillDatabase
from KaliCalo.MassDistribution.Analyse import analyse

## Kali. Just Kali
import KaliCalo.Kali as Kali

## Modules to treat the output
## (histograms and calibration constants)
import KaliCalo.Kali.LambdaMap as LambdaMap
import KaliCalo.ZipShelve as zs
from KaliCalo.MassDistribution import HistoMap
예제 #27
0
"""
# =============================================================================
__version__ = "$Revision:"
__author__ = "Vanya BELYAEV [email protected]"
__date__ = "2014-05-10"
__all__ = ()  ## nothing to be imported
# =============================================================================
import ROOT, random
from Ostap.PyRoUts import *
from Ostap.Utils import rooSilent
# =============================================================================
# logging
# =============================================================================
from AnalysisPython.Logger import getLogger
if '__main__' == __name__ or '__builtin__' == __name__:
    logger = getLogger('Ostap.Test2DModels2')
else:
    logger = getLogger(__name__)
# =============================================================================
logger.info('Test for 2D nonfactorizable fit models from Analysis/Ostap')
# =============================================================================
## make simple test mass
m_x = ROOT.RooRealVar('mass_x', 'Some test mass(X)', 3, 3.2)
m_y = ROOT.RooRealVar('mass_y', 'Some test mass(Y)', 3, 3.2)

## book very simple data set
varset = ROOT.RooArgSet(m_x, m_y)
dataset = ROOT.RooDataSet(dsID(), 'Test Data set-1', varset)

m = VE(3.100, 0.015**2)
예제 #28
0
## @class TrackRefitting
#  Wrapper to configure tools for the RefitParticleTracks
#  @author Paul Seyfert
#  @data   26/11/2015

__author__ = "Paul Seyfert <*****@*****.**>"

from LHCbKernel.Configuration import *
from Gaudi.Configuration import appendPostConfigAction
from Gaudi.Configuration import *
from Configurables import TrackInitFit, TrackMasterFitter
from TrackFitter.ConfiguredFitters import ConfiguredMasterFitter
from Configurables import TrackMasterFitter, TrackStateInitTool, FastVeloFitLHCbIDs

from AnalysisPython.Logger import getLogger
log = getLogger('TrackRefitting')


def ConfigureFitter(fituser, fitAsIn="2015", EnergyLossFactor=1.0):
    '''
   provide a configured TrackInitFit for a DaVinciAlgorithm (or tool)

   Keyword arguments:
   fituser -- the Tool/Algorithm which uses a TrackInitFit
   fitAsIn -- which reconstruction should be mimiced, possible values ['2015','EM2015','Reco14']
   EnergyLossFactor -- modify dE/dx in the material to assess the momentum uncertainty due to the uncertainty on the material budget
   '''
    fituser.addTool(TrackInitFit, "TrackInitFit")
    fituser.TrackInitFit.addTool(TrackMasterFitter, name="Fit")
    fituser.TrackInitFit.addTool(TrackStateInitTool, name="Init")
    fituser.TrackInitFit.Init.UseFastMomentumEstimate = True
예제 #29
0
"""
# =============================================================================
__version__ = "$Revision:"
__author__  = "Vanya BELYAEV [email protected]"
__date__    = "2015-03-10"
__all__     = ()  ## nothing to be imported 
# =============================================================================
import ROOT,random
from   Ostap.PyRoUts import *
from   Ostap.Utils   import rooSilent 
# =============================================================================
# logging 
# =============================================================================
from AnalysisPython.Logger import getLogger
if '__main__' == __name__  or '__builtin__' == __name__ :
    logger = getLogger ( 'Ostap.TestHFit' )
else                      : logger = getLogger ( __name__ )
# =============================================================================
logger.info ( 'Test for histogtram fits')
# =============================================================================
## make simple test 
mass2    = ROOT.RooRealVar ( 'test_mass2' , 'Some test mass' , 0 , 10 )
x        = mass2 

## book very simple data set
varset2  = ROOT.RooArgSet  ( mass2 )

import Ostap.FitModels as     Models 

events = 50000
예제 #30
0
"""
# =============================================================================
__version__ = "$Revision:"
__author__  = "Vanya BELYAEV [email protected]"
__date__    = "2014-05-10"
__all__     = ()  ## nothing to be imported 
# =============================================================================
import ROOT, random
from   Ostap.PyRoUts import *
from   Ostap.Utils   import timing 
# =============================================================================
# logging 
# =============================================================================
from AnalysisPython.Logger import getLogger
if '__main__' == __name__  or '__builtin__'  == __name__ : 
    logger = getLogger ( 'Ostap.TestHParam' )
else : 
    logger = getLogger ( __name__ )
# =============================================================================
logger.info ( 'Test for various parameterizations of histograms')
# =============================================================================

from Ostap.HParamDeco import legendre_sum, chebyshev_sum

#
## histos for exponential distribution 
#

h1 = ROOT.TH1F( hID() , 'histogram(expo)' , 100, 0 , 1 ) ; h1.Sumw2() 
h2 = ROOT.TH1F( hID() , 'histogram(expo)' , 100, 0 , 1 ) ; h2.Sumw2() 
h3 = ROOT.TH1F( hID() , 'histogram(expo)' , 100, 0 , 1 ) ; h3.Sumw2() 
예제 #31
0
__version__ = "$Revision:"
__author__ = "Vanya BELYAEV [email protected]"
__date__ = "2015-10-26"
__all__ = ()  ## nothing to be imported
# =============================================================================
import ROOT, random, os
from array import array
from Ostap.PyRoUts import *
from Ostap.TFileDeco import ROOTCWD
from Ostap.progress_bar import progress_bar
# =============================================================================
# logging
# =============================================================================
from AnalysisPython.Logger import getLogger
if '__main__' == __name__ or '__builtin__' == __name__:
    logger = getLogger('Ostap.TestTMVA')
else:
    logger = getLogger(__name__)
# =============================================================================
data_file = 'tmva_data.root'
tmva_file = 'TMVA_MLP_weights.xml'

if not os.path.exists(data_file):

    nB = 20000
    nS = 10000
    logger.info('Prepare input ROOT file with data')
    with ROOT.TFile.Open(data_file, 'recreate') as test_file:
        ## test_file.cd()
        treeSignal = ROOT.TTree('S', 'signal     tree')
        treeBkg = ROOT.TTree('B', 'background tree')
예제 #32
0
파일: BandQ.py 프로젝트: MMhaidra/lhcb-1
> gaudirun.py  BandQ.py $BANDQCONFIGROOT/scripts/DataTypoe-2011.py   data.py
> gaudirun.py  BandQ.py $BANDQCONFIGROOT/scripts/DataTypoe-2012.py   data.py
   
"""
# =============================================================================
__author__   = "Vanya BELYAEV [email protected]"
__date__     = "$Date: 2012-12-18 16:28:58 +0100 (Tue, 18 Dec 2012) $"
__version__  = "$Revision: 150278 $"
# =============================================================================
## logging
# =============================================================================
try : 
    from AnalysisPython.Logger import getLogger
    _name = __name__
    if 0 == _name.find ( '__'   ) : _name = 'WG/B&Q'
    logger = getLogger (  _name )
except:
    from Gaudi.Configuration import log as logger
    
# =============================================================================

## the_year = "2012"

# =============================================================================
# 1. construct the proper basic selections 
# =============================================================================
#
## location of dimuon candidates in TES:
#
from GaudiKernel.SystemOfUnits             import GeV, MeV, mm
from PhysSelPython.Wrappers import AutomaticData