Пример #1
0
    def __apply_configuration__(self):
        """
        Swimming configuration
        """
        log.info("Applying Swimming configuration")
        log.info(self)

        if not self.getProp('SwimStripping') and not self.getProp(
                'TransformName'):
            raise TypeError, "No or invalid HLT transform specified when trying to swim the trigger!"
        if not self.getProp('SwimStripping') and self.getProp('SwimOffSel'):
            raise TypeError, "You cannot swim the trigger and offline selection in the same job!"

        if self.getProp('SelectMethod') not in [
                'random', 'first', 'all', 'none'
        ]:
            raise TypeError, 'The selectMethod must be eiter "random", "first", "all" or "none".'

        if type(self.getProp('OffCands')) != dict:
            raise TypeError, 'OffCands must be a dict'
        if type(self.getProp('StripCands')) != dict:
            raise TypeError, 'StripCands must be a dict'
        for key, value in self.getProp('StripCands').iteritems():
            if type(value) != list or not isinstance(key, basestring):
                raise TypeError, 'StripCands must be a { string : [ ] } dict'
        if type(self.getProp('MuDSTCands')) != list:
            raise TypeError, 'MuDSTCands must be a list'
        if type(self.getProp('StrippingLines')) != list:
            raise TypeError, 'StrippingLines must be a list'
        if type(self.getProp('MicroDSTElements')) != list:
            raise TypeError, 'MicroDSTElements must be a list'

        if not self.getProp('OutputType') in ['DST', 'MDST']:
            raise TypeError, "The only supported output types are DST and MDST."
        if not self.getProp('SwimStripping') and self.getProp(
                'OutputType') == 'MDST':
            raise TypeError, "You cannot write a MicroDST when swimming the trigger."

        if type(self.getProp('LifetimeFitter')) != list:
            raise TypeError, "LifetimeFitter must be a list of strings."
        for lifetimefitter in self.getProp('LifetimeFitter'):
            if lifetimefitter not in ['LifetimeFitter', 'DecayTreeFitter']:
                raise TypeError, "Allowed LifetimeFitters are LifetimeFitter and DecayTreeFitter."

        if type(self.getProp('DecayTreeFitterConstraints')) != dict:
            raise TypeError, "DecayTreeFitterConstraints must be a dict"

        extension = self.getProp("OutputFile").rsplit(os.path.extsep, 1)[-1]
        if extension.upper() != self.getProp('OutputType'):
            log.warning(
                "You have specified a different output file extension " +
                "than OutputType; this is ignored.")

        from Configurables import DataOnDemandSvc

        app = LHCbApp()
        self.setOtherProps(
            app,
            ['EvtMax', 'SkipEvents', 'Simulation', 'DataType', 'Persistency'])

        # Configure XMLSummarySvc
        if self.getProp('XMLSummary'):
            app.XMLSummary = self.getProp('XMLSummary')
            from Configurables import XMLSummarySvc
            XMLSummarySvc(
                'CounterSummarySvc').EndEventIncident = 'SwimmingEndEvent'

        DstConf(EnableUnpack=["Reconstruction", "Stripping"])

        # TODO check if we need: CaloDstUnPackConf ( Enable = True )

        importOptions("$STDOPTS/DecodeRawEvent.py")
        appConf = ApplicationMgr()
        appConf.HistogramPersistency = 'ROOT'
        appConf.ExtSvc += ['DataOnDemandSvc']
        EventSelector().PrintFreq = -1
        EventSelector().OutputLevel = 6
        if not (self.getProp('Input') == []):
            from GaudiConf import IOHelper
            IOHelper('ROOT').inputFiles(self.getProp('Input'))

        # Swimming::Service
        ApplicationMgr().ExtSvc += ['Swimming::Service']
        from Configurables import Swimming__Service as Service
        Service().RefitPVs = self.getProp('RefitPVs')
        Service().OfflinePVLocation = self.getProp('OfflinePV')

        # FileStager
        if self.getProp('UseFileStager'):
            from FileStager.Configuration import configureFileStager
            configureFileStager()
        IODataManager().UseGFAL = False

        # Disable muons in TisTosTool
        from Configurables import TriggerTisTos
        ToolSvc().addTool(TriggerTisTos, 'TriggerTisTos')
        ToolSvc().TriggerTisTos.TOSFracMuon = 0.
        # Disable TT hits also
        ToolSvc().TriggerTisTos.TOSFracTT = 0.