def process(self, eventoffset): from GaudiPython.Bindings import AppMgr appMgr = AppMgr() if eventoffset == 0: from Escher.Utils import printsequence printsequence(appMgr) # ugly: change the algorithm after initialization. otherwise it doesn't work for 'reused' applications. #numeventsPerProc = opts.numevents / opts.numprocs + 1 #numeventsThisProc = numeventsPerProc #if eventoffset is opts.numprocs - 1: # numeventsThisProc -= opts.numprocs * numeventsPerProc - opts.numevents #appMgr.evtSel().FirstEvent = eventoffset * numeventsPerProc #appMgr.evtSel().reinitialize() #appMgr.run(numeventsThisProc) appMgr.algorithm(prescalername).Offset = eventoffset appMgr.algorithm(prescalername).Interval = opts.numprocs appMgr.run(opts.numevents) #evt = appMgr.evtsvc() #while 0 < 1:> # check if there are still valid events # if evt['Rec/Header'] == None : break det = appMgr.detsvc() alignderivatives = det['AlignDerivativeData'] #self.output['derivatives'] = copy.deepcopy(alignderivatives) if alignderivatives: self.output['derivatives'].add(alignderivatives) otmonodata = det['OTMonoLayerAlignData'] if otmonodata: self.output['otmonodata'].add(otmonodata) histsvc = appMgr.histsvc() self.output['histograms'].collect(histsvc)
def run(input_files, output_file): ## Bit of extra configuration from GaudiConf import IOHelper IOHelper().inputFiles(input_files) HistogramPersistencySvc().OutputFile = output_file.replace('.root', '_histos.root') ## GaudiPython import GaudiPython import cppyy cppyy.load_reflection_info('libLinkerEvent') cppyy.load_reflection_info('libLinkerInstancesDict') from GaudiPython.Bindings import AppMgr appMgr = AppMgr(outputlevel = 3) appMgr.config() appMgr.HistogramPersistency = 'ROOT' ntSvc = GaudiPython.iService('NTupleSvc') ntSvc.Output = ["MATCHZERRLUN DATAFILE='{0}' OPT='NEW'".format(output_file)] from Hlt1Muons.MatchAlgo import MatchResidualAlgo match_algo = MatchResidualAlgo("MatchResidualAlgo", MatchVeloMuon = mvm.getFullName()) match_algo.NTupleLUN = 'MATCHZERRLUN' appMgr.addAlgorithm(match_algo) from Hlt1Muons.MatchAlgo import MatchChi2Algo chi2_algo = MatchChi2Algo("MatchChi2Algo", MatchVeloMuon = mvm_chi2.getFullName()) chi2_algo.NTupleLUN = 'MATCHZERRLUN' appMgr.addAlgorithm(chi2_algo) if mvm_old: chi2_algo_old = MatchChi2Algo("MatchChi2AlgoOld", MatchVeloMuon = mvm_old.getFullName()) chi2_algo_old.NTupleLUN = 'MATCHZERRLUN' appMgr.addAlgorithm(chi2_algo_old) appMgr.initialize() appMgr.run(options.nevents) appMgr.stop() appMgr.finalize() appMgr.exit()
Shots=50, # Volume="/dd/Geometry/LHCb/lvLHCb" #Volume = "/dd/Geometry/MagnetRegion/Magnet/Magnet" ) from Configurables import TransportSvc TransportSvc(Recovery=True) from Configurables import ApplicationMgr ApplicationMgr(TopAlg=[check], EvtSel='NONE', EvtMax=1) # ============================================================================= if "__main__" == __name__: print __doc__ print __author__ print __version__ from GaudiPython.Bindings import AppMgr gaudi = AppMgr() gaudi.run(1) # ============================================================================= # The END # =============================================================================
RunEnd = (HLT2Params.RunStartTime+HLT2Params.RunDuration)*1000000000 print args if len(args)>1: lstrun = args[1] if lstrun == 'LastRun': RunEnd = None # from Configurables import XmlParserSvc #RunChangeHandlerSvc(OutputLevel=VERBOSE) #MessageSvc(OutputLevel=1) EventDataSvc(ForceLeaves = True) from GaudiPython.Bindings import AppMgr Gaudi=AppMgr() print "===================== Initializing the XML conversion ========================" stat = Gaudi.initialize() print "===================== Running the XML conversion ========================" stat = Gaudi.run(1) print "============= Status :",stat if stat.isFailure(): sys.exit(44) print "============= Gaudi.ReturnCode :",Gaudi.ReturnCode if Gaudi.ReturnCode != 0: sys.exit(44) print "===================== Stopping the XML conversion ========================" stat = Gaudi.stop() print "============= Status :",stat if stat.isFailure(): sys.exit(44) print "===================== Finalizing the XML conversion ========================" stat = Gaudi.finalize() print "============= Status :",stat if stat.isFailure():
, TopAlg = [ bap ] , EvtMax = 10 ) # ============================================================================= # The actual job excution # ============================================================================= if '__main__' == __name__ : print __doc__ , __author__ from GaudiPython.Bindings import AppMgr gaudi = AppMgr() gaudi.run(5) bap = gaudi.algorithm('BoostArrayProps') bap.PropertiesPrint = True bap.Doubles = [ -1 , -2 , -3 , -4 , -5 ] bap.Strings = [ 'a1' , 'a2' , 'a3' , 'a4' ] bap.PropertiesPrint = True # ============================================================================= # The END # =============================================================================
print "Iteration nr: ", i # rewind if not opts.do_not_rewind: mainSeq.Enable = False evtSel.rewind() mainSeq.Enable = True # steer the monitor sequence depending on the iteration appMgr.algorithm('AlignMonitorSeq').Enable = (i == 0) appMgr.algorithm('Moni').Enable = (i == 0) if opts.numiter > 1: appMgr.algorithm('AlignPostMonitorSeq').Enable = (i == opts.numiter - 1) # event loop appMgr.run(opts.numevents) # fire incident for update from GaudiPython import gbl from Configurables import Escher incSvc = appMgr.service('IncidentSvc', 'IIncidentSvc') updateConstants = gbl.Incident('Alignment', 'UpdateConstants') if Escher().getProp("Incident") == "GlobalMPedeFit": updateConstants = gbl.Incident('Alignment', 'GlobalMPedeFit') printUniformity = gbl.Incident('Alignment', 'PrintUniformTD') updateTrackSelector = gbl.Incident('Alignment', 'ResetUniformity') incSvc.fireIncident(printUniformity) incSvc.fireIncident(updateTrackSelector) incSvc.fireIncident(updateConstants) #exit the appmgr for finalize
def run(self): from Configurables import Brunel ## Brunel parameters Brunel().Detectors = ['Spd', 'Prs', 'Ecal', 'Hcal' ] Brunel().DataType = "2015" Brunel().InputType = "MDF" Brunel().OutputType = "DST" Brunel().EvtMax = self.__nevt Brunel().WriteFSR = False Brunel().Histograms = "Online" Brunel().OnlineMode = True Brunel().PrintFreq = 1000 Brunel().DatasetName = self.__dsname ## use the conditions database ## configuration for online from Configurables import CondDB CondDB().Simulation = False CondDB().UseDBSnapshot = True CondDB().DBSnapshotDirectory = "/group/online/hlt/conditions" CondDB().EnableRunChangeHandler = True CondDB().Tags["ONLINE"] = 'fake' CondDB().setProp("IgnoreHeartBeat", True) CondDB().Online = True try: import AllHlt1 except ImportError: rd = '/group/online/hlt/conditions/RunChangeHandler' sys.path.append(rd) import AllHlt1 import AllHlt1 CondDB().RunChangeHandlerConditions = AllHlt1.ConditionMap Online = importOnline() Brunel().CondDBtag = Online.CondDBTag Brunel().DDDBtag = Online.DDDBTag """ Messages in the online get redirected. Setup here the FMC message service @author M.Frank """ app=Gaudi.ApplicationMgr() #Configs.AuditorSvc().Auditors = [] app.MessageSvcType = 'LHCb::FmcMessageSvc' if Gaudi.allConfigurables.has_key('MessageSvc'): del Gaudi.allConfigurables['MessageSvc'] msg = Configs.LHCb__FmcMessageSvc('MessageSvc') msg.fifoPath = os.environ['LOGFIFO'] msg.LoggerOnly = True msg.doPrintAlways = False msg.OutputLevel = MSG_INFO # Online.OutputLevel from GaudiConf import IOHelper IOHelper('MDF').inputFiles(self.__inputs) from GaudiPython.Bindings import AppMgr gaudi = AppMgr() gaudi.initialize() gaudi.run(self.__nevt) gaudi.stop() gaudi.finalize() gaudi.exit()
#cdb.Tags["LHCBCOND"] = "" #app=Gaudi.ApplicationMgr() #Configs.AuditorSvc().Auditors = [] #app.MessageSvcType = 'LHCb::FmcMessageSvc' #if Gaudi.allConfigurables.has_key('MessageSvc'): # del Gaudi.allConfigurables['MessageSvc'] #msg = Configs.LHCb__FmcMessageSvc('MessageSvc') #msg.fifoPath = os.environ['LOGFIFO'] #msg.LoggerOnly = True #msg.doPrintAlways = False #msg.OutputLevel = MSG_INFO # Online.OutputLevel ## make printout of the own documentations print '*' * 120 print __doc__ print ' Author : %s ' % __author__ print ' Version : %s ' % __version__ print ' Date : %s ' % __date__ print '*' * 120 from GaudiConf import IOHelper IOHelper('ROOT').inputFiles(input_files) from GaudiPython.Bindings import AppMgr gaudi = AppMgr() gaudi.run(-1) ## THE END
, EvtMax = 10 ) # ============================================================================= # The actual job excution # ============================================================================= if '__main__' == __name__ : print __doc__ print __author__ from GaudiPython.Bindings import AppMgr gaudi = AppMgr () gaudi.run(1) ske = gaudi.algorithm('StringKeys') ske.PropertiesPrint = True from GaudiPython.Bindings import gbl as cpp SK = cpp.Gaudi.StringKey key = SK('new Key' ) print 'set new key: ', key ske.Key = key
from ROOT import TCanvas from LHCbAlgs.Configuration import * lhcbApp = LHCbApp(DDDBtag='default', CondDBtag='default', DataType='2010', Simulation=False) from AnalysisPython import Dir, Functors from GaudiPython.Bindings import gbl, AppMgr, Helper appMgr = AppMgr(outputlevel=4) #appMgr.config( files = ['$GAUDIPOOLDBROOT/options/GaudiPoolDbRoot.opts']) appMgr.ExtSvc += ['DataOnDemandSvc'] appMgr.initialize() evt = appMgr.evtsvc() appMgr.run(1) evt.dump() import atexit atexit.register(appMgr.exit)
ntSvc.Output = [ "MYLUN DATAFILE='TupleEx.root' OPT='NEW' TYP='ROOT'" ] gaudi.config() gaudi.DLLs = [ 'GaudiAlg', 'RootHistCnv', ] alg = TupleEx( ## configure the property NTupleLUN = 'MYLUN' ) gaudi.setAlgorithms( [alg] ) return SUCCESS # ============================================================================= ## The actual job excution # @author Vanya BELYAEV [email protected] # @date 2006-11-26 if '__main__' == __name__ : print __doc__ from GaudiPython.Bindings import AppMgr gaudi = AppMgr() configure( gaudi ) gaudi.run(20) # ============================================================================= # The END # =============================================================================
if '__main__' == __name__ : ## make printout of the own documentations print '*'*120 print __doc__ print ' Author : %s ' % __author__ print ' Version : %s ' % __version__ print ' Date : %s ' % __date__ print '*'*120 configure() gaudi = AppMgr() gaudi.run ( 4 ) # add 'late' algorithms myAlg3 = SimpleAlgo ( 'Simple3' ) seq = gaudi.algorithm('MySequencer') seq.Members += [ 'HelloWorld/Hello4'] gaudi.run ( 8 ) seq.Members += [ myAlg3.name() ] gaudi.run ( 3 )
print '*' * 120 print __doc__ print ' Author : %s ' % __author__ print ' Version : %s ' % __version__ print ' Date : %s ' % __date__ print '*' * 120 from GaudiPython.Bindings import AppMgr gaudi = AppMgr() evtSel = gaudi.evtSel() evtSel.open( 'castor:/castor/cern.ch/grid/lhcb/user/a/apuignav/7318/7318685/KaliPi0.fmDST' ) gaudi.run(100000) import KaliCalo.Pi0HistoFit as Fit import GaudiPython.GaudiAlgs pi0 = gaudi.algorithm('KaliPi0') histos = pi0.Histos() if histos: keys = histos.keys() keys.sort() for h in keys: histo = histos[h] if hasattr(histo, 'dump'): print histo.dump(40, 20, True) st = Fit.fitPi0(histo) print 'Fit: ', st, Fit.getPi0Params(histo)
quads = [ 'B00', 'B01', 'B02', 'B03', 'B10', 'B11', 'B12', 'B13', 'B20', 'B21', 'B22', 'B23', 'F10', 'F11', 'F12', 'F13', 'F20', 'F21', 'F22', 'F23' ] mainAlgorithm.ChannelCalib = quads tree = ET.parse(options.OutputDirectory + '/' + options.refRunNumber + '/CommonMode_' + options.refRunNumber + ".xml") commonmode = tree.getroot() Corrections = {'Theta': [], 'x0': [], 'y0': []} for q in quads: for p in ['Odd', 'Even']: Corrections['Theta'].append( float(commonmode.find(q + p).find('theta').text)) Corrections['x0'].append( float(commonmode.find(q + p).find('X0').text)) Corrections['y0'].append( float(commonmode.find(q + p).find('Y0').text)) mainAlgorithm.Thetas = Corrections['Theta'] mainAlgorithm.X0 = Corrections['x0'] mainAlgorithm.Y0 = Corrections['y0'] ''' locations = ["Raw/HC/Digits"] if options.analysisType == 'TAE': for k in ['Prev','Next']: for i in range(options.TAE): location = k + repr(options.TAE - i) locations.append(location+"/Raw/HC/Digits") mainAlgorithm.DigitLocation = locations ''' appMgr.run(options.NumberOfEvents)
# Make sure there is data to run on if len(args) != 1: print "error, no settings specified" sys.exit(2) from Gaudi.Configuration import * from Moore.Configuration import * Moore().ThresholdSettings = args[0] Moore().EvtMax = options.EvtMax #Moore().DataType = options.DataType Moore().DDDBtag = options.DDDBtag Moore().CondDBtag = options.CondDBtag Moore().ForceSingleL0Configuration = (not options.multil0) Moore().EnableTimer = args[0] + ".csv" #take the test data and automatically set with the PRConfig from PRConfig import TestFileDB TestFileDB.test_file_db[options.Data].run(withDB=False, configurable=Moore()) EventSelector().PrintFreq = 100 ## GaudiPython from GaudiPython.Bindings import AppMgr appMgr = AppMgr() appMgr.initialize() appMgr.run(Moore().EvtMax)
from GaudiConf.IOHelper import IOHelper IOHelper().inputFiles( TestFileDB.test_file_db["2012_CaloFemtoDST"].filenames) #evtSel.open ( 'KaliPi0_2k+11.fmdst_test') from GaudiPython.Bindings import AppMgr gaudi = AppMgr() ## === OR with test fmDSTs evtSel = gaudi.evtSel() ## run over events gaudi.run(5000) from KaliCalo.FitUtils import fitPi0, getPi0Params, s2b import GaudiPython.GaudiAlgs pi0 = gaudi.algorithm('KaliPi0') histos = pi0.Histos() if histos: keys = histos.keys() keys.sort() for h in keys: histo = histos[h] if hasattr(histo, 'dump'): print histo.dump(60, 25, True) st = fitPi0(histo) print 'Fit : ', st print 'N(pi0) : ', getPi0Params(histo)[0]
def run(self): if lambdas == 'None': kali = firstPass( ##-- cuts and filters PtGamma=250 * MeV, ## selection cuts ## event multiplicity filter Filter= "(650. > CONTAINS('Raw/Spd/Digits')) & ( CONTAINS('Rec/Vertex/Primary') > 0.) & ( CONTAINS('Rec/Vertex/Primary') < 5.)", ##-- output NTupleProduce=True, # produce NTuples NTuple=self.__dsname + '.root', # NTuple name Histograms=False, # do not produce Histograms FemtoDST=self.__dsname + '.fmDST', # output fmDST name ##-- general (configuring DaVinci) DataType='2015', # data type EvtMax=self.__nevt, # number of events to run OutputLevel=ERROR) else: kali = secondPass( ## DestroyTES=False, ## ``Physics'' PtGamma=250 * MeV, Pi0Cut="PT > 550 * MeV", ## IO NTupleProduce=True, # produce NTuples NTuple=self.__dsname + '.root', # NTuple name Histograms=False, # do not produce Histograms FemtoDST="", ## Calibration KaliDB={ 'name': lambdas, 'ecal': 'ecal' }, ## general DataType='2015', EvtMax=self.__nevt, OutputLevel=ERROR) from Configurables import CondDB CondDB().Simulation = False CondDB().UseDBSnapshot = True CondDB().DBSnapshotDirectory = "/group/online/hlt/conditions" CondDB().EnableRunChangeHandler = True CondDB().Tags["ONLINE"] = 'fake' CondDB().setProp("IgnoreHeartBeat", True) CondDB().Online = True try: import AllHlt1 except ImportError: rd = '/group/online/hlt/conditions/RunChangeHandler' sys.path.append(rd) import AllHlt1 import AllHlt1 CondDB().RunChangeHandlerConditions = AllHlt1.ConditionMap Online = importOnline() ## ======== input data type - 'SDST' ============ from Configurables import DaVinci DaVinci().InputType = 'DST' # use SDSTs as an input DaVinci().CondDBtag = Online.CondDBTag DaVinci().DDDBtag = Online.DDDBTag from GaudiConf import IOHelper IOHelper('ROOT').inputFiles(self.__inputs) from GaudiPython.Bindings import AppMgr gaudi = AppMgr() gaudi.initialize() gaudi.run(self.__nevt) gaudi.stop() gaudi.finalize() gaudi.exit()
from ROOT import TCanvas from LHCbAlgs.Configuration import * lhcbApp = LHCbApp(DDDBtag="default", CondDBtag="default", DataType="2010", Simulation=False) from AnalysisPython import Dir, Functors from GaudiPython.Bindings import gbl, AppMgr, Helper appMgr = AppMgr(outputlevel=4) # appMgr.config( files = ['$GAUDIPOOLDBROOT/options/GaudiPoolDbRoot.opts']) appMgr.ExtSvc += ["DataOnDemandSvc"] appMgr.initialize() evt = appMgr.evtsvc() appMgr.run(1) evt.dump() import atexit atexit.register(appMgr.exit)