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))
AlignAlgorithm('Alignment').InputDataFiles = derivativefiles AlignAlgorithm('Alignment').OutputDataFile = '' # set the database layer if opts.aligndb: counter = 1 for db in opts.aligndb: from Configurables import (CondDB, CondDBAccessSvc) alignCond = CondDBAccessSvc('AlignCond' + str(counter)) alignCond.ConnectionString = 'sqlite_file:' + db + '/LHCBCOND' CondDB().addLayer(alignCond) counter += 1 print 'added databases: ', opts.aligndb 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(['AlignAlgorithm/Alignment']) 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) # now call finalize to write the conditions. there must be a better way. appMgr.finalize() # finally create a database layer import os os.system("copy_files_to_db.py -c sqlite_file:Alignment.db/LHCBCOND -s xml")