예제 #1
0
def patchBrunel(true_online_version):
    """
        Instantiate the options to run Brunel with raw data

        @author M.Frank
  """
    import Brunel.Configuration
    import OnlineEnv

    brunel = Brunel.Configuration.Brunel()
    brunel.OnlineMode = True
    try:
        brunel.DDDBtag = OnlineEnv.DDDBTag
    except:
        print "DDDBTag not found, use default"

    try:
        brunel.CondDBtag = OnlineEnv.CondDBTag
    except:
        print "CondDBTag not found, use default"

    conddb = CondDB()
    conddb.IgnoreHeartBeat = True
    #
    # Adjust to pickup the proper online conditions
    #
    import Online as RunChange_All
    conddb.setProp('RunChangeHandlerConditions', RunChange_All.ConditionMap)
    conddb.setProp('EnableRunChangeHandler', True)
    #
    # Brunel output configuration
    #
    brunel.WriteFSR = False  # This crashes Jaap's stuff
    brunel.DataType = "2013"
    brunel.OutputType = ''

    EventLoopMgr().OutputLevel = MSG_DEBUG  #ERROR
    EventLoopMgr().Warnings = False

    from Configurables import EventClockSvc
    EventClockSvc().InitialTime = 1322701200000000000

    brunel.UseDBSnapshot = True  # try it
    #  brunel.PartitionName = "FEST"
    # Hack by Chris
    print "# Warning using CKThetaQuartzRefractCorrections = [ 0,-0.0001,0 ]"
    from Configurables import RichRecSysConf
    rConf = RichRecSysConf("RichOfflineRec")
    rConf.richTools().photonReco().CKThetaQuartzRefractCorrections = [
        0, -0.001, 0
    ]
    brunel.OutputLevel = MSG_WARNING
    brunel.PrintFreq = -1
    HistogramPersistencySvc().OutputFile = ""
    HistogramPersistencySvc().OutputLevel = MSG_ERROR

    #print brunel
    return brunel
예제 #2
0
    def _configureDBSnapshot(self):
        from Configurables import CondDB
        conddb = CondDB()
        conddb.EnableRunStampCheck = False
        conddb.Tags["ONLINE"] = 'fake'
        conddb.setProp('IgnoreHeartBeat', self.getProp('IgnoreDBHeartBeat'))
        self.setOtherProps(conddb, [
            'UseDBSnapshot', 'DBSnapshotDirectory', 'EnableRunChangeHandler',
            'RunChangeHandlerConditions'
        ])

        # https://savannah.cern.ch/bugs/?94454#comment12
        from Configurables import MagneticFieldSvc
        MagneticFieldSvc().UseSetCurrent = True
예제 #3
0
        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
예제 #4
0
    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