Esempio n. 1
0
    def _config_with_tck(self):
        from Configurables import HltConfigSvc
        from Funcs import _tck
        cfg = HltConfigSvc(
            initialTCK=_tck(self.getProp('InitialTCK')),
            checkOdin=self.getProp('CheckOdin'),
            ConfigAccessSvc=self.getConfigAccessSvc().getFullName())

        ApplicationMgr().ExtSvc.insert(0, cfg.getFullName())
        # configure services...
        from Configurables import VFSSvc
        VFSSvc().FileAccessTools = [
            'FileReadTool', 'CondDBEntityResolver/CondDBEntityResolver'
        ]
        from Configurables import LHCb__ParticlePropertySvc
        LHCb__ParticlePropertySvc(
        ).ParticlePropertiesFile = 'conddb:///param/ParticleTable.txt'
Esempio n. 2
0
    def __apply_configuration__(self):
        """
        Converts the high-level information passed as properties into low-level configuration.
        """
        ##########################################################################
        # Detector Transient Store Configuration
        ##########################################################################
        # Notes:
        #   - DetDbLocation must use '/' because it is a URL (never use '\')
        #   - DetStorageType:
        #     + 7 => XML
        #     + 9 => pure CondDB (remove "conddb:" from URL)
        ##########################################################################
        detDataSvc = DetectorDataSvc( UsePersistency = True,
                                      DetDbRootName = "dd",
                                      DetDbLocation = self.getProp("DbRoot"),
                                      DetStorageType = 7 )

        ##########################################################################
        # XML Conversion Service configuration
        ##########################################################################
        # Notes:
        #   - AllowGenericConversion triggers generic detector element conversion
        #     Useful in the case of visualization or in a case the required user
        #     defined detector element converters are somehow not available.
        ##########################################################################
        xmlCnvSvc = XmlCnvSvc(AllowGenericConversion = True)

        xmlParserSvc = XmlParserSvc(
                                    # Set the maximum number of files to be put in the
                                    # cache of the XmlCnvSvc
                                    MaxDocNbInCache = 10,

                                    # Change the behavior of the cache. A 0 value makes
                                    # it FIFO while a bigger value tends to make it keep
                                    # only reused files.
                                    CacheBehavior = 3,

                                    # Tell to the XmlParserSvc how to resolve entities
                                    # in the CondDB
                                    EntityResolver = CondDBEntityResolver()
                                    )

        ##########################################################################
        # Use the XmlCnvSvc in the persistency service for the detector description
        DetectorPersistencySvc( CnvServices = [ xmlCnvSvc ] )


        ##########################################################################
        # DetetectorDataSvc must be external, to finalize after ToolSvc
        ApplicationMgr().ExtSvc.insert(0, detDataSvc)

        # Propagate the properties to the used Configurables
        self.propagateProperties()

        dataType = self.getProp("DataType")
        if not dataType in self.__data_types_handlers__:
            raise ValueError("Invalid value %r for property DetDesc().DataType."
                             " (allowed: %r)"% (dataType,
                                                self.__data_types_handlers__.keys()))
        if dataType in [ "Upgrade" ]:
            sim = self.getProp("Simulation")
            if not sim:
                log.info("%s data is _always_ simulation", dataType )

        if not self.getProp('AutoTags'):
            # calls the specific configuration function for the requested data type
            self.__data_types_handlers__[dataType](self)
        else:
            log.info("Ariadne driven configuration requested for CondDB")
            datatype = self.getProp("DataType")
            cond_type = 'LHCBCONDTag' if not self.getProp("Simulation") else 'SIMCONDTag'
            question = {'detector_type': datatype, 'DDDBTag': None, cond_type: None, 'DQFLAGSTag': None}
            self.__auto_tags_conf__(question, criterion = 'latest_LHCBCOND_DDDB')

        # Get particle properties table from condDB
        from Configurables import LHCb__ParticlePropertySvc
        LHCb__ParticlePropertySvc( ParticlePropertiesFile = 'conddb:///param/ParticleTable.txt' )
Esempio n. 3
0
# values.
ParticlePropertyFile = open("ParticlePropertySvc_Monopole.txt", 'w')
ParticlePropertyFile.write(
    "\# ParticlePropertySvc file automatically generated by MoEDAL_options.py\n"
)
ParticlePropertyFile.write("PARTICLE")

ParticlePropertyFile.write('\n')
ParticlePropertyFile.write('magnetic_monopole')  # PARTICLE NAME
ParticlePropertyFile.write('\t' + str(monopole_pdg))  # GEANTID
ParticlePropertyFile.write('\t' + str(monopole_pdg))  # PDGID
ParticlePropertyFile.write('\t' + str(monopole_elcharge))  # CHARGE
ParticlePropertyFile.write('\t' + str(monopole_mass))  # MASS(GeV)
ParticlePropertyFile.write('\t-1')  # TLIFE(s)
ParticlePropertyFile.write('\tmagnetic_monopole')  # EVTGENNAME
ParticlePropertyFile.write('\t' + str(monopole_pdg))  # PYTHIAID
ParticlePropertyFile.write('\t0.00000000')  # MAXWIDTH

ParticlePropertyFile.write('\n')
ParticlePropertyFile.write('antimagnetic_monopole')  # PARTICLE NAME
ParticlePropertyFile.write('\t' + str(-monopole_pdg))  # GEANTID
ParticlePropertyFile.write('\t' + str(-monopole_pdg))  # PDGID
ParticlePropertyFile.write('\t' + str(-monopole_elcharge))  # CHARGE
ParticlePropertyFile.write('\t' + str(monopole_mass))  # MASS(GeV)
ParticlePropertyFile.write('\t-1')  # TLIFE(s)
ParticlePropertyFile.write('\tantimagnetic_monopole')  # EVTGENNAME
ParticlePropertyFile.write('\t' + str(-monopole_pdg))  # PYTHIAID
ParticlePropertyFile.write('\t0.00000000')  # MAXWIDTH

LHCb__ParticlePropertySvc().OtherFiles = ["ParticlePropertySvc_Monopole.txt"]
from Gaudi.Configuration import *
from Configurables import LHCbApp, LHCb__ParticlePropertySvc

app = LHCbApp()
# Sim08a (MC2012)
#app.DDDBtag = 'Sim08-20130503-1'
#app.CondDBtag = 'Sim08-20130503-vc-md100'
# Sim05 (MC11a)
#app.DDDBtag = 'MC11-20111102'
#app.CondDBtag = 'sim-20111111-vc-md100'
# Sim08e (MC2012)
app.DDDBtag = 'dddb-20130929-1'
app.CondDBtag = 'sim-20130522-1-vc-md100'

ApplicationMgr().ExtSvc += [LHCb__ParticlePropertySvc()]

from GaudiPython.Bindings import AppMgr
import PartProp.Service

appMgr = AppMgr()
appMgr.initialize()

ppSvc = appMgr.ppSvc()
B_s0H = ppSvc.find("B_s0H")
B_s0L = ppSvc.find("B_s0L")

GH = 1./B_s0H.lifetime()/1000
GL = 1./B_s0L.lifetime()/1000

G  = (GL + GH)/2.
DG = (GL - GH)
    decayDesc = parse_decay_descriptor(dtt.Decay)
    decayDesc.set_aliases(aliases)
    xbname = decayDesc.particle.name
    xcname = decayDesc.daughters[0].particle.name

    dtts = {'' : dtt}

    dv.add_TrackScaleState()

    isMC = dv.getProp('Simulation')

    # Update particle masses for accurate mass constraints.
    # May also need to do this for MC if it was generated with a different
    # version of ParticleTable.txt
    if not isMC :
        ppsvc = LHCb__ParticlePropertySvc()
        lcmass = particledb.find_particle('Lambda_c+').mass
        xicmass = lcmass + 181.51
        xicp = particledb.find_particle('Xi_c+')
        xicm = particledb.find_particle('Xi_c~-')
        xicp.mass = xicm.mass = xicmass
        lbmass = particledb.find_particle('Lambda_b0').mass
        xibmass = lbmass + 172.44
        xib0 = particledb.find_particle('Xi_b0')
        xib0bar = particledb.find_particle('Xi_b~0')
        xib0.mass = xib0bar.mass = xibmass
        ppsvc.Particles = [p.table_entry() for p in xicp, xicm, xib0, xib0bar]
        dv.extraobjs.add(ppsvc)
    else :
        dttmcseq = dv.add_mc_unbiased_sequence(decayDesc,
                                               L0List = args.L0List.split(), 
Esempio n. 6
0
    def __apply_configuration__(self):
        """
        Converts the high-level information passed as properties into low-level configuration.
        """
        ##########################################################################
        # Detector Transient Store Configuration
        ##########################################################################
        # Notes:
        #   - DetDbLocation must use '/' because it is a URL (never use '\')
        #   - DetStorageType:
        #     + 7 => XML
        #     + 9 => pure CondDB (remove "conddb:" from URL)
        ##########################################################################
        detDataSvc = DetectorDataSvc(UsePersistency=True,
                                     DetDbRootName="dd",
                                     DetDbLocation=self.getProp("DbRoot"),
                                     DetStorageType=7)

        using_git = self.getProp("DbRoot").startswith('git:')
        ##########################################################################
        # XML Conversion Service configuration
        ##########################################################################
        # Notes:
        #   - AllowGenericConversion triggers generic detector element conversion
        #     Useful in the case of visualization or in a case the required user
        #     defined detector element converters are somehow not available.
        ##########################################################################
        xmlCnvSvc = XmlCnvSvc(AllowGenericConversion=True)

        # fine tune the defaults for heart-beat and run-stamp checks
        ignore_hb = self.getProp("OnlineMode") or self.getProp("Simulation")
        self._properties["IgnoreHeartBeat"].setDefault(ignore_hb)
        self._properties["EnableRunStampCheck"].setDefault(not ignore_hb)

        if self.getProp("Simulation"):
            resolvers = [
                GitEntityResolver('GitDDDB', Ignore="Conditions/.*"),
                GitEntityResolver('GitSIMCOND'),
            ]
        else:
            resolvers = [
                GitEntityResolver('GitDDDB', Ignore="Conditions/.*"),
                GitEntityResolver('GitLHCBCOND',
                                  Ignore="Conditions/(Online|DQ).*"),
                GitEntityResolver(
                    'GitONLINE',
                    Ignore="Conditions/DQ.*",
                    LimitToLastCommitTime=not self.getProp("IgnoreHeartBeat")),
                GitEntityResolver('GitDQFLAGS', Ignore="Conditions/Online.*"),
            ]
        # set PathToRepository if needed and available
        for r in resolvers:
            r.PathToRepository = (r.PathToRepository
                                  if r.isPropertySet('PathToRepository') else
                                  GIT_CONDDBS.get(r.name()[11:], ''))
        # keep only Git resolvers that can be actually used
        resolvers = [r for r in resolvers if r.PathToRepository]

        # Leave the outputLevel at INFO even if global level is different
        for r in resolvers:
            if not r.isPropertySet('OutputLevel'):
                r.setProp('OutputLevel', INFO)

        resolver = EntityResolverDispatcher(EntityResolvers=resolvers,
                                            Mappings=[(r'^conddb:', 'git:')])

        xmlParserSvc = XmlParserSvc(
            # Set the maximum number of files to be put in the
            # cache of the XmlCnvSvc
            MaxDocNbInCache=15,

            # Change the behavior of the cache. A 0 value makes
            # it FIFO while a bigger value tends to make it keep
            # only reused files.
            CacheBehavior=3,

            # Tell to the XmlParserSvc how to resolve entities
            # in the CondDB
            EntityResolver=resolver)

        ##########################################################################
        # Use the XmlCnvSvc in the persistency service for the detector description
        DetectorPersistencySvc(CnvServices=[xmlCnvSvc])

        ##########################################################################
        # DetetectorDataSvc must be external, to finalize after ToolSvc
        ApplicationMgr().ExtSvc.insert(0, detDataSvc)

        # Propagate the properties to the used Configurables
        self.propagateProperties()

        dataType = self.getProp("DataType")
        if dataType not in self.__data_types_handlers__:
            raise ValueError(
                "Invalid value %r for property DetDesc().DataType."
                " (allowed: %r)" %
                (dataType, self.__data_types_handlers__.keys()))
        if dataType in ["Upgrade"]:
            sim = self.getProp("Simulation")
            if not sim:
                log.info("%s data is _always_ simulation", dataType)

        # calls the specific configuration function for the requested data type
        self.__data_types_handlers__[dataType](self)
        # by default, use the latest DQFLAGS tag for the requested data type
        # (unless already set by a data type handler)
        if not self.getProp("Simulation") and dataType not in ("Upgrade"):
            self.__set_tag__(["DQFLAGS"], "<latest:{0}>".format(dataType))

        # Get particle properties table from condDB
        from Configurables import LHCb__ParticlePropertySvc
        LHCb__ParticlePropertySvc(
            ParticlePropertiesFile='git:///param/ParticleTable.txt')