def finalize(self): print "INFO: finalize" # dump the histograms to a file self.output['histograms'].dump(opts.histofile) numAlignEvents = self.output['derivatives'].equations().numEvents() print 'INFO: number of events in derivatives: ', self.output[ 'derivatives'].equations().numEvents() if numAlignEvents > 0: # write the derivative file if len(opts.derivativefile) > 0: self.output['derivatives'].equations().writeToFile( derivativefile) from GaudiPython.Bindings import AppMgr appMgr = AppMgr() # we want to reinitialize, but we don't want to initialize all # the reco algorithms, so we add just the alignment sequence: appMgr.setAlgorithms(['GaudiSequencer/AlignSequence']) appMgr.configure() appMgr.initialize() # update the geometry # updatetool = appMgr.toolsvc().create( typ = "Al::AlignUpdateTool", name = "ToolSvc.AlignUpdateTool", interface = "IAlignUpdateTool" ) updatetool = appMgr.toolsvc().create( "Al::AlignUpdateTool", interface="Al::IAlignUpdateTool") updatetool.process(self.output['derivatives'].equations(), opts.iter, 1) # call the xml writer tool writertool = appMgr.toolsvc().create( "WriteMultiAlignmentConditionsTool", interface="IWriteAlignmentConditionsTool") writertool.write() # now call finalize to write the conditions. there must be a better way. det = appMgr.detsvc() if self.output['otmonodata'] and det['OTMonoLayerAlignData']: det['OTMonoLayerAlignData'].add(self.output['otmonodata']) appMgr.finalize() # finally create a database layer import os os.system( "copy_files_to_db.py -c sqlite_file:Alignment.db{0} -s xml". format(condtag))
def _getToolSvc(**kwargs): """ Helper private auxillary utility to get Tool Service """ svc = kwargs.get("toolSvc", None) if not svc: svc = kwargs.get("toolsvc", None) if not svc: svc = kwargs.get("service", None) if not svc: svc = kwargs.get("svc", None) else: return svc ## RETURN gaudi = kwargs.get("gaudi", None) if not gaudi: gaudi = AppMgr() return gaudi.toolsvc() ## RETURN
mainLocation = selSequence.outputLocation() # set up some useful paths of locations on the MicroDST flavTagPath = locationRoot + "/" + mainLocation + "/FlavourTags" lhcbApp = LHCbApp() lhcbApp.DDDBtag = 'default' lhcbApp.CondDBtag = 'default' appMgr = AppMgr(outputlevel=4) appMgr.config(files=['$GAUDIPOOLDBROOT/options/GaudiPoolDbRoot.opts']) appMgr.initialize() appMgr.ExtSvc += ['LHCb::ParticlePropertySvc'] appMgr.HistogramPersistency = "ROOT" evtSvc = appMgr.evtSvc() toolSvc = appMgr.toolsvc() evtSel = appMgr.evtSel() nextEvent = Functors.NextEvent(appMgr) pp = Functors.PartPropSvc(appMgr) ppSvc = pp particleNameFunc = Functors.ParticleName(ppSvc) # open a DST or MicroDST evtSel.open(microDSTFile) histoPath = "MicroDST/Histos/" omegaPlots = {} # flavour tagging plot: plot mistag for each category. for cat in range(0, 6): omegaPlots[cat] = book(histoPath + "FlavourTags/MisTagCat" + str(cat),
conf = dec.setup() from GaudiPython.Bindings import AppMgr appMgr = AppMgr() appMgr.HistogramPersistency = "ROOT" hpSvc = appMgr.service('HistogramPersistencySvc') hpSvc.OutputFile = options.OutputDirectory + '/' + options.runNumber + '/' + options.analysisType + '_' + options.runNumber + '.root' ntSvc = appMgr.ntupleSvc() ntSvc.Output = [ "FILE1 DATAFILE='" + options.OutputDirectory + '/' + options.runNumber + '/' + options.analysisType + '_' + options.runNumber + "Tuple.root' TYP='ROOT' OPT='NEW'" ] eventTimeDecoder = appMgr.toolsvc().create("OdinTimeDecoder", interface="IEventTimeDecoder") appMgr.addAlgorithm('LbAppInit') from Configurables import HCRawBankDecoder if options.TAE > 0: for k in ['Prev', 'Next']: for i in range(options.TAE): location = k + repr(options.TAE - i) decoderName = "HCRawBankDecoder/HCRawBankDecoder" + location appMgr.addAlgorithm(decoderName) appMgr.addAlgorithm("HCRawBankDecoder/HCRawBankDecoder") mainAlgorithm = None