ecs.InitialTime = RunOption.RunStartTime*1000000000 ecs.addTool(FakeEventTime,"EventTimeDecoder") ecs.EventTimeDecoder.StartTime = ecs.InitialTime ecs.EventTimeDecoder.TimeStep = 10 #xmlCnvSvc = XmlCnvSvc(AllowGenericConversion = True) DDDBConf() #detDataSvc = DetectorDataSvc() #DetectorPersistencySvc( CnvServices = [ xmlCnvSvc ] ) cdb = CondDB() cdb.RunChangeHandlerConditions=CondMap.ConditionMap cdb.EnableRunChangeHandler = True cdb.EnableRunStampCheck=False cdb.UseDBSnapshot = True cdb.Tags = { "DDDB" : RunOption.DDDBTag, "LHCBCOND" : RunOption.CondDbTag, "ONLINE" : 'fake'} cdb.IgnoreHeartBeat = True dbxalg = DBXferAlg() dbxalg.RunNumber = RunOption.RunNumber dbxalg.RunStartTime = RunOption.RunStartTime*1000000000 dbxalg.OnlineXmlDir = RunOption.OutputDirectory wrconf = WriterConf("wconf",dets)#["Velo","IT","TT","OT"]) wrconf.CondFilePrefix = RunOption.OutputDirectory+"/offl/Conditions/Online" from Configurables import WriteMultiAlignmentConditionsTool xmlwriter = WriteMultiAlignmentConditionsTool()#"AlignWriterTool") wrconf.addXmlWriters(xmlwriter) app = ApplicationMgr() app.TopAlg = [ dbxalg ] app.addTool(xmlwriter) #app.ExtSvc += [ detDataSvc]#, rch ]
theApp.DDDBtag = "dddb-20150526" theApp.CondDBtag = "cond-20150601" # Setup CondDB #from Configurables import CondDB from Configurables import (CondDBAccessSvc, CondDB) from Gaudi.Configuration import appendPostConfigAction conddb = CondDB() conddb.IgnoreHeartBeat = True #conddb.UseDBSnapshot = True #conddb.EnableRunChangeHandler = True #conddb.Tags['ONLINE'] = 'fake' conddb.Tags = { "DDDB": theApp.getProp('DDDBtag'), "LHCBCOND": theApp.getProp('CondDBtag'), "SIMCOND": theApp.getProp('CondDBtag'), "ONLINE": 'fake' } def overrideONLINEWithSnapshot(): ONLINE_2015 = CondDBAccessSvc("ONLINE_2015") ONLINE_2015.ConnectionString = "sqlite_file:ONLINE-2015.db/ONLINE" conddb.addLayer(ONLINE_2015) appendPostConfigAction(overrideONLINEWithSnapshot) conddb.addLayer( CondDBAccessSvc( "t0_db",
#actor.Config = [os.path.join(os.getcwd(), "apps/DD4hep/examples/DDDB/data/VPOnly.xml")] example_alg = LbDD4hepExample() ApplicationMgr().TopAlg = [actor, example_alg] # Just instantiate the configurable... theApp = MyTest() ToolSvc.LogLevel=DEBUG cdb = CondDB() tag = { "DDDB": '' , "LHCBCOND": 'default' #, "SIMCOND" : 'upgrade/dd4hep' , "SIMCOND" : '' , "ONLINE" : 'fake' } cdb.Tags = tag cdb.setProp('IgnoreHeartBeat', True) cdb.setProp('EnableRunChangeHandler', True) #cdb.LogFile = "/tmp/cdb.log" cdb.Upgrade = True theApp.setOtherProps( cdb, [ 'UseDBSnapshot', 'DBSnapshotDirectory', 'PartitionName' ]) #-- Use latest database tags for real data #LHCbApp().DDDBtag = "" #LHCbApp().CondDBtag = "default" LHCbApp().EvtMax = 5 LHCbApp().DataType = "Upgrade" LHCbApp().Simulation = True EventSelector().PrintFreq = 1
example_alg = LbDD4hepExample() ApplicationMgr().TopAlg = [actor, example_alg] # noqa: F405 # Just instantiate the configurable... theApp = MyTest() ToolSvc.LogLevel = DEBUG # noqa: F405 cdb = CondDB() tag = { "DDDB": '', "LHCBCOND": 'default', # "SIMCOND" : 'upgrade/dd4hep', "SIMCOND": '', "ONLINE": 'fake' } cdb.Tags = tag cdb.setProp('IgnoreHeartBeat', True) cdb.setProp('EnableRunChangeHandler', True) # cdb.LogFile = "/tmp/cdb.log" cdb.Upgrade = True theApp.setOtherProps(cdb, ['UseDBSnapshot', 'DBSnapshotDirectory', 'PartitionName']) # -- Use latest database tags for real data # LHCbApp().DDDBtag = "" # LHCbApp().CondDBtag = "default" LHCbApp().EvtMax = 5 LHCbApp().DataType = "Upgrade" LHCbApp().Simulation = True EventSelector().PrintFreq = 1
def configureDBSnapshot(self): """ Configure the database to use the online snapshot """ tag = { "DDDB": self.getProp('DDDBtag'), "LHCBCOND": self.getProp('CondDBtag'), "SIMCOND": self.getProp('CondDBtag'), "ONLINE": 'fake' } # https://savannah.cern.ch/bugs/?94454#comment12 from Configurables import MagneticFieldSvc MagneticFieldSvc().UseSetCurrent = True from Configurables import CondDB cdb = CondDB() cdb.Tags = tag cdb.setProp('IgnoreHeartBeat', True) self.setOtherProps( cdb, ['UseDBSnapshot', 'DBSnapshotDirectory', 'PartitionName']) # So, here is the problem: we don't want to run the risk that # the CondDB() configurable (which configures /after/ us) # overwrites our conditions. Yet, we don't want to miss the # default conditions (e.g. velo stepper motor, magnetic field) # either. if we add our conditions to its # RunChangeHandlerConditions list, then we a) need to fix the # path and b) don't know what happens for conditions that # appear twice, because we don't control the ordering of the # list. So, the hack is: # - don't set 'EnableRunChangeHandler' # - copy what is hidden behind that flag in CondDB()._configureDBSnapshot # - do the test of the RunChangeHandler configuration ourselves: cdb.setProp('EnableRunChangeHandler', False) from Configurables import RunChangeHandlerSvc rch = RunChangeHandlerSvc() ApplicationMgr().ExtSvc.append(rch) baseloc = self.getProp("DBSnapshotDirectory") rch.Conditions = dict( (c, '/'.join([baseloc, f])) for f, cs in cdb.getProp("RunChangeHandlerConditions").iteritems() for c in cs) #path = self.getProp('DBSnapshotDirectory') + "/.."*4 + "/group/online/AligWork/current/" allconds = { 'Velo': [ 'Conditions/Alignment/Velo/VeloSystem', 'Conditions/Alignment/Velo/VeloRight', 'Conditions/Alignment/Velo/VeloLeft' ] + ['Conditions/Alignment/Velo/Module%02d' % i for i in range(0, 42)] + [ 'Conditions/Alignment/Velo/Detector%02d-%02d' % (i, (1 + i / 2) % 2) for i in range(0, 42) ], 'IT': [] + ['Conditions/Alignment/IT/ITSystem'] + ['Conditions/Alignment/IT/ITT%d' % i for i in range(1, 4)] + [ 'Conditions/Alignment/IT/ITT%d%sBox' % (i, b) for i in range(1, 4) for b in ['Top', 'Bottom', 'ASide', 'CSide'] ] + [ 'Conditions/Alignment/IT/ITT%d%sLayer%s' % (i, b, l) for i in range(1, 4) for b in ['Top', 'Bottom', 'ASide', 'CSide'] for l in ['X1', 'U', 'V', 'X2'] ] + [ 'Conditions/Alignment/IT/ITT%d%sLayer%sLadder%d' % (i, b, l, a) for i in range(1, 4) for b in ['Top', 'Bottom', 'ASide', 'CSide'] for l in ['X1', 'U', 'V', 'X2'] for a in range(1, 8) ], # + [ 'Conditions/Alignment/IT/ITT%d%sLayer%sLadder%dSector' % (i,b,l,a) for i in range(1,4) for b in ['Top','Bottom','ASide','CSide' ] for l in ['X1','U','V','X2' ] for a in range(1,8) ] # + [ 'Conditions/Alignment/IT/ITT%d%sLayer%sLadder%dSector_Sensor1' % (i,b,l,a) for i in range(1,4) for b in ['Top','Bottom','ASide','CSide' ] for l in ['X1','U','V','X2' ] for a in range(1,8) ] # + [ 'Conditions/Alignment/IT/ITT%d%sLayer%sLadder%dSector_Sensor2' % (i,b,l,a) for i in range(1,4) for b in ['ASide','CSide' ] for l in ['X1','U','V','X2' ] for a in range(1,8) ] , 'OT': [] + ['Conditions/Alignment/OT/OTSystem'] + ['Conditions/Alignment/OT/T%d' % i for i in range(1, 4)] + [ 'Conditions/Alignment/OT/T%d%s' % (i, l) for i in range(1, 4) for l in ['X1', 'U', 'V', 'X2'] ] + [ 'Conditions/Alignment/OT/T%d%sQ%d' % (i, l, q) for i in range(1, 4) for l in ['X1', 'U', 'V', 'X2'] for q in range(0, 4) ] + [ 'Conditions/Alignment/OT/T%d%sQ%dM%d' % (i, l, q, m) for i in range(1, 4) for l in ['X1', 'U', 'V', 'X2'] for q in range(0, 4) for m in range(1, 10) ], 'TT': [] + ['Conditions/Alignment/TT/TTSystem'] + ['Conditions/Alignment/TT/TT%s' % i for i in ['a', 'b']] + [ 'Conditions/Alignment/TT/TT%sLayer' % (l) for l in ['aX', 'aU', 'bV', 'bX'] ] + [ 'Conditions/Alignment/TT/TT%sLayerR%dModule%d%s' % (l, r, m, w) for w in ['T', 'B'] for l in ['aX', 'aU', 'bV', 'bX'] for r in range(1, 4) for m in range(1, 4) ] + [ 'Conditions/Alignment/TT/TT%sLayerR%dModule%d%s' % (l, r, m, w) for w in ['T', 'B'] for l in ['bV', 'bX'] for r in range(1, 4) for m in range(4, 6) ] + [ 'Conditions/Alignment/TT/TT%sLayerR%dModule%d%s' % (l, r, m, w) for w in ['T', 'B'] for l in ['aX', 'aU', 'bV', 'bX'] for r in [1, 3] for m in range(6, 7) ] + [ 'Conditions/Alignment/TT/TT%sLayerR%dModule%d%s' % (l, r, m, w) for w in ['T', 'B'] for l in ['aX', 'aU'] for r in [1, 3] for m in range(4, 6) ], 'Muon': [] + ['Conditions/Alignment/Muon/MuonSystem'] + ['Conditions/Alignment/Muon/M%sStation' % i for i in range(1, 6)] + ['Conditions/Alignment/Muon/M%sASide' % i for i in range(1, 6)] + ['Conditions/Alignment/Muon/M%sCSide' % i for i in range(1, 6)] } ## This is a bit dirty, since we're supposed to control TAlignment. We ## know that this is set from top level, so let's give it a try anyway ta = TAlignment() sdToWrite = set(ta.getProp("WriteCondSubDetList")) pat = self.getProp("OnlineAligWorkDir") + "/xml/%s.xml" conditionmap = dict((pat % sd, f) for (sd, f) in allconds.iteritems() if sd in sdToWrite) # add to the existing map rch.Conditions = dict(rch.Conditions.items() + dict( (c, f) for f, cs in conditionmap.iteritems() for c in cs).items()) from Configurables import MagneticFieldSvc MagneticFieldSvc().UseSetCurrent = True
from Configurables import DumpConditions DumpConditions().RunStartTime = arguments.start[0] DumpConditions().RunNumber = arguments.run[0] DumpConditions().OutFile= arguments.output[0] DumpConditions().Conditions = list_conditions from Configurables import CondDB cdb = CondDB() if arguments.online: import CondMap cdb.RunChangeHandlerConditions = CondMap.ConditionMap cdb.EnableRunChangeHandler = True cdb.UseDBSnapshot = True cdb.Tags = { "DDDB" : HLT2Params.DDDBTag, "LHCBCOND" : HLT2Params.CondDBTag, "ONLINE" : 'fake'} cdb.Online = True else: cdb.EnableRunStampCheck = False useNewFeature = False if useNewFeature: # new feature Liang cdb.UseOracle = True cdb.Online = True else: pass #''' # Marco's workaround from Gaudi.Configuration import appendPostConfigAction