Created
March 2, 2018 11:38
-
-
Save VanyaBelyaev/82c6b51790a9a692f04569aa51a879d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# ============================================================================= | |
## @file HelloWorld.py | |
# | |
# The standard 'Hello,world!'-example | |
# | |
# This file is a part of | |
# <a href="http://cern.ch/lhcb-comp/Analysis/Bender/index.html">Bender project</a> | |
# <b>``Python-based Interactive Environment for Smart and Friendly | |
# Physics Analysis''</b> | |
# | |
# The package has been designed with the kind help from | |
# Pere MATO and Andrey TSAREGORODTSEV. | |
# And it is based on the | |
# <a href="http://cern.ch/lhcb-comp/Analysis/LoKi/index.html">LoKi project:</a> | |
# ``C++ ToolKit for Smart and Friendly Physics Analysis'' | |
# | |
# By usage of this code one clearly states the disagreement | |
# with the smear campaign of Dr.O.Callot et al.: | |
# ``No Vanya's lines are allowed in LHCb/Gaudi software.'' | |
# | |
# @author Vanya BELYAEV Ivan.Belyaev@itep.ru | |
# @date 2006-10-12 | |
# | |
# ============================================================================= | |
"""The standard 'Hello,world!'-example | |
oooooooooo. .o8 | |
`888' `Y8b \"888 | |
888 888 .ooooo. ooo. .oo. .oooo888 .ooooo. oooo d8b | |
888oooo888' d88' `88b `888P\"Y88b d88' `888 d88' `88b `888\"\"8P | |
888 `88b 888ooo888 888 888 888 888 888ooo888 888 | |
888 .88P 888 .o 888 888 888 888 888 .o 888 | |
o888bood8P' `Y8bod8P' o888o o888o `Y8bod88P\" `Y8bod8P' d888b | |
This file is a part of BENDER project: | |
``Python-based Interactive Environment for Smart and Friendly Physics Analysis'' | |
The project has been designed with the kind help from | |
Pere MATO and Andrey TSAREGORODTSEV. | |
And it is based on the LoKi project: | |
``C++ ToolKit for Smart and Friendly Physics Analysis'' | |
By usage of this code one clearly states the disagreement | |
with the smear campaign of Dr.O.Callot et al.: | |
``No Vanya's lines are allowed in LHCb/Gaudi software.'' | |
$Revision$ | |
Last modification $Date$ | |
by $Author$ | |
""" | |
# ============================================================================= | |
__author__ = " Vanya BELYAEV Ivan.Belyaev@itep.ru " | |
__date__ = " 2006-10-12 " | |
__version__ = " Version $Revision$ " | |
# ============================================================================= | |
## import everything from bender | |
from Bender.Main import * | |
# ============================================================================= | |
## (optional) logging | |
# ============================================================================= | |
from Bender.Logger import getLogger | |
if '__main__' == __name__ : logger = getLogger ( 'Bender:Hello,World!' ) | |
else : logger = getLogger ( __name__ ) | |
# ============================================================================= | |
## @class HelloWorld | |
# simple Python/Bender class for classical 'Hello,World!' example | |
# @author Vanya BELYAEV Ivan.Belyaev@itep.ru | |
class HelloWorld(Algo): | |
"""The most trivial algorithm to print 'Hello,world!' | |
""" | |
## the main 'analysis' method | |
def analyse( self ) : ## IMPORTANT! | |
"""The main 'analysis' method | |
""" | |
## use the native Python print to stdout: | |
print 'Hello, world! (using native Python)' | |
## use Gaudi-style printout: | |
self.Print( 'Hello, World! (using Gaudi)') | |
## use python logger | |
logger.info ( 'Hello,world! (using logger)') | |
return SUCCESS ## IMPORTANT!!! | |
# ============================================================================= | |
# ============================================================================= | |
## The configuration of the job | |
def configure ( inputdata , ## the list of input files | |
catalogs = [] , ## xml-catalogs (filled by GRID) | |
castor = False , ## use the direct access to castor/EOS ? | |
params = {} ) : | |
## import DaVinci | |
from Configurables import DaVinci | |
## delegate the actual configurtaion to DaVinci | |
dv = DaVinci ( DataType = '2012' , | |
InputType = 'MDST' ) | |
from PhysConf.Selections import AutomaticData, PrintSelection | |
particles = AutomaticData ( 'Phys/SelPsi2KForPsiX/Particles' ) | |
particles = PrintSelection ( particles ) | |
hello = BenderSelection ( 'Hello' , particles ) | |
dv.UserAlgorithms.append ( hell0 ) | |
## define the input data | |
setData ( inputdata , catalogs , castor ) | |
## get/create application manager | |
gaudi = appMgr() | |
## create the algorithm | |
alg = HelloWorld( hellp ) | |
return SUCCESS | |
# ============================================================================= | |
# ============================================================================= | |
## Job steering | |
if __name__ == '__main__' : | |
logger.info ( 80*'*' ) | |
logger.info ( __doc__ ) | |
logger.info ( ' Author : %s ' % __author__ ) | |
logger.info ( ' Version : %s ' % __version__ ) | |
logger.info ( ' Date : %s ' % __date__ ) | |
logger.info ( 80*'*' ) | |
## job configuration | |
## BKQuery ( '/LHCb/Collision12/Beam4000GeV-VeloClosed-MagDown/Real Data/Reco14/Stripping20/WGBandQSelection7/90000000/PSIX.MDST' ) | |
inputdata = [ | |
'/lhcb/LHCb/Collision12/PSIX.MDST/00035290/0000/00035290_00000221_1.psix.mdst', | |
'/lhcb/LHCb/Collision12/PSIX.MDST/00035290/0000/00035290_00000282_1.psix.mdst', | |
'/lhcb/LHCb/Collision12/PSIX.MDST/00035290/0000/00035290_00000238_1.psix.mdst', | |
] | |
configure( inputdata , castor = True ) | |
## event loop | |
run(10) | |
# ============================================================================= | |
# The END | |
# ============================================================================= |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment