def initialise():
    
  # Initialise a few things
  from Configurables import DDDBConf, CondDB, LHCbApp, CondDBAccessSvc
  cDB = CondDB()
  
  #DDDBConf(DataType = "2009")
  #LHCbApp().DDDBtag   = "head-20110303"
  #LHCbApp().CondDBtag = "head-20110524"
  
  #DDDBConf(DataType = "2010")
  #LHCbApp().DDDBtag   = "head-20110721"
  #LHCbApp().CondDBtag = "cond-20140328"

  #DDDBConf(DataType = "2011")
  #LHCbApp().DDDBtag   = "head-20110722" 
  #LHCbApp().CondDBtag = "head-20110722"

  #DDDBConf(DataType = "2012")
  #LHCbApp().DDDBtag   = "dddb-20120831"
  #LHCbApp().CondDBtag = "cond-20121025"

  DDDBConf(DataType = "2015")
  LHCbApp().DDDBtag   = "dddb-20150526"
  LHCbApp().CondDBtag = "cond-20150625"

  # Set message level to info and above only
  msgSvc().setOutputLevel(3)
  
  # Finally, initialize GaudiPython
  GaudiPython.AppMgr().initialize()
Пример #2
0
    def __apply_configuration__(self):

        GaudiKernel.ProcessJobOptions.PrintOff()

        # forward some settings...
        self.setOtherProps(LHCbApp(), ['EvtMax', 'SkipEvents', 'DataType'])
        if hasattr(self, "Persistency"):
            self.setOtherProps(LHCbApp(), ['Persistency'])

        # instantiate the sequencer
        mainSeq = GaudiSequencer("LumiSeq")

        # activate the sequence
        appMgr = ApplicationMgr(
            TopAlg=[],
            HistogramPersistency='NONE',
        )
        ApplicationMgr().TopAlg += [mainSeq]

        # add user algorithms at the end
        if self.getProp("userAlgorithms"):
            for userAlg in self.getProp("userAlgorithms"):
                ApplicationMgr().TopAlg += [userAlg]

        # input
        self._configureInput()

        # configure the main sequence
        self._createReader(mainSeq)
Пример #3
0
def PrUpgradeChecking():
    ### match hits and tracks
    log.warning("Run upgrade checkers.")
    from Configurables import UnpackMCParticle, UnpackMCVertex, PrLHCbID2MCParticle
    # Check if VP is part of the list of detectors.
    from Configurables import LHCbApp, VPClusterLinker
    withVP = False
    if hasattr(LHCbApp(), "Detectors"):
        if LHCbApp().isPropertySet("Detectors"):
            if 'VP' in LHCbApp().upgradeDetectors(): withVP = True
    trackTypes = TrackSys().getProp("TrackTypes")
    if "Truth" in trackTypes:
        truthSeq = GaudiSequencer("RecoTruthSeq")
        truthSeq.Members = [UnpackMCParticle(), UnpackMCVertex()]
        if withVP: truthSeq.Members += [VPClusterLinker()]
        truthSeq.Members += [PrLHCbID2MCParticle()]
    else:
        if withVP:
            GaudiSequencer("MCLinksTrSeq").Members = [
                VPClusterLinker(), PrLHCbID2MCParticle()
            ]
        else:
            GaudiSequencer("MCLinksTrSeq").Members = [PrLHCbID2MCParticle()]

    from Configurables import PrTrackAssociator
    GaudiSequencer("MCLinksTrSeq").Members += [PrTrackAssociator()]

    from Configurables import PrChecker, PrDebugTrackingLosses
    GaudiSequencer("CheckPatSeq").Members += [PrChecker()]
    GaudiSequencer("CheckPatSeq").Members += [PrDebugTrackingLosses()]
Пример #4
0
def initialise():

    if not globals()['initialised']:

        import os

        # Check results dir
        if not os.path.exists("results"): os.mkdir("results")

        from ROOT import gROOT
        # No info messages
        gROOT.ProcessLine("gErrorIgnoreLevel = kWarning;")
        # Batch mode (no TCanvas)
        gROOT.SetBatch(True)

        import GaudiPython

        # Initialise a few things
        from Configurables import DDDBConf, CondDB, LHCbApp, CondDBAccessSvc
        cDB = CondDB()

        #DDDBConf(DataType = "2009")
        #LHCbApp().DDDBtag   = "head-20110303"
        #LHCbApp().CondDBtag = "head-20110524"

        #DDDBConf(DataType = "2010")
        #LHCbApp().DDDBtag   = "head-20110303"
        #LHCbApp().CondDBtag = "head-20110524"

        #DDDBConf(DataType = "2011")
        #LHCbApp().DDDBtag   = "head-20110722"
        #LHCbApp().CondDBtag = "head-20110722"
        #LHCbApp().CondDBtag = "HEAD"

        DDDBConf(DataType="2012")
        LHCbApp().DDDBtag = "head-20120413"
        LHCbApp().CondDBtag = "cond-20120730"
        CondDB().addLayer(
            CondDBAccessSvc(
                "2012Aerogel",
                ConnectionString="sqlite_file:2012Aerogel.db/LHCBCOND",
                DefaultTAG="HEAD"))

        # Set message level to info and above only
        msgSvc().setOutputLevel(3)

        # Finally, initialize GaudiPython
        GaudiPython.AppMgr().initialize()

        # Initialise various DeRich objects
        loadRichDet()

        # flag as done
        globals()['initialised'] = True
Пример #5
0
    def defineMonitors(self):
        # get all defined monitors
        monitors = self.getProp("Monitors") + LHCbApp().getProp("Monitors")
        # Currently no Boole specific monitors, so pass them all to LHCbApp
        LHCbApp().setProp("Monitors", monitors)

        # Use TimingAuditor for timing, suppress printout from SequencerTimerTool
        from Configurables import ApplicationMgr, AuditorSvc, SequencerTimerTool
        ApplicationMgr().ExtSvc += ['AuditorSvc']
        ApplicationMgr().AuditAlgorithms = True
        AuditorSvc().Auditors += ['TimingAuditor']
        SequencerTimerTool().OutputLevel = WARNING
Пример #6
0
def execute(polarity):
    option_files = "$APPCONFIGOPTS/Brunel/DataType-2015.py;$APPCONFIGOPTS/Brunel/MC-WithTruth.py;$APPCONFIGOPTS/Persistency/Compression-ZLIB-1.py"
    option_files = option_files.split(";")
    for option in option_files:
        importOptions(option)

    importOptions("$APPCONFIGOPTS/Brunel/xdst.py")

    LHCbApp().Simulation = True
    LHCbApp().DDDBtag = "dddb-20140729"
    LHCbApp().CondDBtag = "sim-20140730-vc-m%s100" % polarity

    Brunel().DatasetName = "EarlyEvents-Extended-L0-Turbo-Moore-Brunel"
    HistogramPersistencySvc().OutputFile = 'EarlyEvents-BrunelHistos.root'
Пример #7
0
def execute():
    option_files = "$APPCONFIGOPTS/Boole/Default.py;$APPCONFIGOPTS/Boole/DataType-2012.py;$APPCONFIGOPTS/Boole/Boole-SiG4EnergyDeposit.py;$APPCONFIGOPTS/Persistency/Compression-ZLIB-1.py"
    option_files = option_files.split(";")
    for option in option_files:
        importOptions(option)

    importOptions("$APPCONFIGOPTS/Boole/xdigi.py")

    LHCbApp().Simulation = True
    LHCbApp().DDDBtag = "dddb-20140729"
    LHCbApp().CondDBtag = "sim-20140730-vc-mu100"

    Boole().DatasetName = "EarlyEvents"
    HistogramPersistencySvc().OutputFile = "EarlyEvents-BooleHistos.root"
    FileCatalog().Catalogs = ["xmlcatalog_file:EarlyEvents-BooleCatalog.xml"]
Пример #8
0
def configMonitor():
    import os
    from Gaudi.Configuration import EventPersistencySvc, HistogramPersistencySvc
    from Configurables import (LHCbApp,
                               LHCb__RawDataCnvSvc,
                               GaudiSequencer,
                               UpdateAndReset,
                               createODIN,
                               ApplicationMgr )

    app = LHCbApp()
    app.DataType = '2015'
    app.EvtMax = -1

    EventPersistencySvc().CnvServices.append( LHCb__RawDataCnvSvc('RawDataCnvSvc') )
    HistogramPersistencySvc().OutputFile = ''
    HistogramPersistencySvc().Warnings = False

    UpdateAndReset().saveHistograms = 1
    #UpdateAndReset().saverCycle     = 3600

    from Configurables import EventClockSvc
    EventClockSvc().EventTimeDecoder = 'OdinTimeDecoder'

    appMgr = ApplicationMgr()

    # Decoder
    from Configurables import HCRawBankDecoder
    decoder = HCRawBankDecoder()
    decoder.Monitoring = True

    # Monitor
    from Configurables import HCDigitMonitor
    monitor = HCDigitMonitor()
    monitor.CrateB = 0
    monitor.CrateF = 1
    monitor.ChannelsB0 = [47, 46, 45, 44]
    monitor.ChannelsB1 = [23, 22, 21, 20]
    monitor.ChannelsB2 = [11, 10,  9,  8]
    monitor.ChannelsF1 = [23, 22, 21, 46]
    monitor.ChannelsF2 = [11, 10,  9,  8]

    # Top level sequence
    topSeq = GaudiSequencer("TopSequence")
    topSeq.Members = [createODIN(), decoder, monitor]

    appMgr.TopAlg = [topSeq]
    return app, monitor
Пример #9
0
    def defineDB(self):
        if self.getProp("DataType") == "DC06":
            raise RuntimeError(
                "DC06 data type no longer supported. Please use an earlier Boole version"
            )
        if self.getProp("DataType") == "MC09":
            raise RuntimeError(
                "MC09 data type no longer supported. Please use an earlier Boole version"
            )

        # Delegate handling to LHCbApp configurable
        self.setOtherProps(LHCbApp(), ["CondDBtag", "DDDBtag", "DataType"])
        LHCbApp().Simulation = True
        if hasattr(self, "Persistency"):
            self.setOtherProps(LHCbApp(), ["Persistency"])
            self.setOtherProps(DigiConf(), ["Persistency"])
Пример #10
0
def execute(evt_type=13104021, stereo=5):
    importOptions(
        "$APPCONFIGOPTS/Gauss/Beam7000GeV-md100-nu7.6-HorExtAngle.py")

    importOptions("$LBPYTHIA8ROOT/options/Pythia8.py")
    importOptions("$APPCONFIGOPTS/Gauss/G4PL_FTFP_BERT_EmNoCuts.py")
    importOptions("$APPCONFIGOPTS/Conditions/Upgrade.py")
    importOptions("$APPCONFIGOPTS/Persistency/Compression-ZLIB-1.py")
    importOptions("$APPCONFIGOPTS/Gauss/Gauss-Upgrade-Baseline-20131029.py")

    outpath = "%s_%s" % ("Stereo", evt_type)
    Gauss().DataType = "Upgrade"

    set_tags(stereo)

    importOptions("$DECFILESROOT/options/%s.py" % (evt_type))

    GaussGen = GenInit("GaussGen")
    GaussGen.FirstEventNumber = 1
    GaussGen.RunNumber = 1082

    LHCbApp().EvtMax = 10

    HistogramPersistencySvc().OutputFile = outpath + '-GaussHistos.root'

    OutputStream(
        "GaussTape"
    ).Output = "DATAFILE='PFN:%s.sim' TYP='POOL_ROOTTREE' OPT='RECREATE'" % outpath
Пример #11
0
    def __apply_configuration__(self):
        '''
    create sequence
    '''
        sequence = self.getProp("LumiSequencer")
        if hasattr(self, "Persistency"):
            self.setOtherProps(LHCbApp(), ['Persistency'])
        if sequence == None:
            raise RuntimeError("ERROR : Lumi Sequencer not set")
        seqMembers = []
        # Input data type - should not be a raw type
        if self.getProp("InputType") in ["MDF", "RAW"]: return
        # event accounting
        seqMembers.append(EventAccounting('EventAccount', OutputLevel=INFO))
        # merge FSRs
        seqMembers.append(LumiMergeFSR('MergeFSR'))
        seqMembers.append(FSRCleaner())  #clean empty FSR directories
        sequence.Members = seqMembers
        sequence.MeasureTime = True
        sequence.ModeOR = False
        sequence.ShortCircuit = True
        sequence.IgnoreFilterPassed = False

        # output
        self._configureOutput()
Пример #12
0
    def defineGeometry(self):
        # DIGI is always simulation, as is usage of MC truth!
        if self.getProp( "WithMC" ) or self.getProp( "InputType" ).upper() == 'DIGI':
            self.setProp( "Simulation", True )

        # Check that detector list does not contain non-upgrade detectors if in upgrade mode (can crash later)
        if( self.getProp("DataType") is "Upgrade"):
            for det in self.getProp("Detectors"):
                if det in ['Velo', 'TT', 'OT', 'IT']:
                    log.warning("You are running with non-upgrade detector %s in upgrade mode."%det)
                    

        # Delegate handling to LHCbApp configurable
        self.setOtherProps(LHCbApp(),["DataType","CondDBtag","DDDBtag","Simulation","Detectors"])

        # Set list of detectors in DstConf
        dstConfDetList = []
        simConfDetList = []
        for det in self.getProp("Detectors"):
            if det in ['Rich1', 'Rich2', 'Rich1Pmt', 'Rich2Pmt']:
                if "Rich" not in dstConfDetList:
                    dstConfDetList.append("Rich")
                if "Rich" not in simConfDetList:                    
                    simConfDetList.append("Rich")
            elif det in ['Prs', 'Spd', 'Ecal', 'Hcal']:
                simConfDetList.append(det)
                if "Calo" not in dstConfDetList:
                    dstConfDetList.append("Calo")
            else:
                dstConfDetList.append(det)
                simConfDetList.append(det)
        DstConf().setProp("Detectors", dstConfDetList)
        from Configurables import SimConf
        SimConf().setProp("Detectors", simConfDetList)
Пример #13
0
  def __apply_configuration__(self):

    GaudiKernel.ProcessJobOptions.PrintOff()
    #done by LHCbApp
    #EventPersistencySvc().CnvServices.append( 'LHCb::RawDataCnvSvc' )

    # forward some settings...
    self.setOtherProps( LHCbApp(), ['EvtMax','SkipEvents','DataType'] )

    # instantiate the sequencer
    mainSeq = GaudiSequencer("LumiSeq")

    # activate the sequence
    appMgr=ApplicationMgr(TopAlg=[],
                          HistogramPersistency='NONE',
                          )
    ApplicationMgr().TopAlg += [ mainSeq ]
    
    # add user algorithms at the end
    if self.getProp("userAlgorithms"):
      for userAlg in self.getProp("userAlgorithms"):
        ApplicationMgr().TopAlg += [ userAlg ]
    
    # input
    self._configureInput()
    
    # configure the main sequence
    self._createWriter(mainSeq)
    
    # output
    self._configureOutput()

    # Switch off LoKi banner
    from Configurables import LoKiSvc
    LoKiSvc().Welcome = False
Пример #14
0
    def __apply_configuration__(self):
        #GaudiKernel.ProcessJobOptions.PrintOff()
        
        from GaudiKernel.Configurable import ConfigurableGeneric as RFileCnv
        RFileCnv('RFileCnv').GlobalCompression = "LZMA:6"

        ############## Set other properties ###########
        self._safeSet( LHCbApp(), ['EvtMax','SkipEvents','Simulation', 'DataType' , 'CondDBtag','DDDBtag'] )
        ApplicationMgr().AppName="Tesla, utilising DaVinci"
        #
        if self.getProp('Mode') is "Online":
            self.setProp('WriteFSR',True)
            self._configureForOnline()
        else:
            DecodeRawEvent().DataOnDemand=True
            RecombineRawEvent()
            if self.getProp('Simulation')==True:
                self._unpackMC()
        #
        self._configureOutput()
        #
        from Configurables import EventSelector
        EventSelector().PrintFreq = 1000

        # Add monitors if they are there
        if len(self.getProp('Monitors'))>0:
            self._configureHistos()

        if self.getProp('KillInputTurbo'):
            enk = EventNodeKiller('KillTurbo')
            enk.Nodes = [ "Turbo" ]
            ApplicationMgr().TopAlg.insert( 0,  enk.getFullName() ) 

        ApplicationMgr().TopAlg+=[self.teslaSeq]
Пример #15
0
    def __apply_configuration__(self):
        self.defineOptions()
        useUpgrade = False
        from Configurables import LHCbApp
        upgradeDets = []
        #Test if LHCbApp has this method (same revision as property)
        if hasattr(LHCbApp(), "Detectors"):
            if LHCbApp().isPropertySet("Detectors"):
                upgradeDets = LHCbApp().upgradeDetectors()
                useUpgrade = bool(
                    [det for det in upgradeDets if det in ['VP', 'UT', 'FT']])
        if not self.isPropertySet("TrackTypes"):
            self.setProp("TrackTypes", self.DefaultTrackTypes)

        if useUpgrade:
            from TrackSys import RecoUpgradeTracking
            RecoUpgradeTracking.RecoUpgradeTracking()
        else:
            if self.getProp("FilterBeforeFit"):
                if self.getProp("DataType") in self.Run2DataTypes:
                    from TrackSys import RecoTrackingRun2
                    # per default, run simplified geometry and use liteClusters
                    RecoTrackingRun2.RecoTrackingHLT1(
                        simplifiedGeometryFit=not self.fullGeometryHLT1(),
                        liteClustersFit=not self.fullClustersHLT1())
                    RecoTrackingRun2.RecoTrackingHLT2(
                        simplifiedGeometryFit=not self.fullGeometryHLT2(),
                        liteClustersFit=not self.fullClustersHLT2())
                else:
                    from TrackSys import RecoTracking
                    RecoTracking.RecoTracking()

            else:
                raise RuntimeError("'FilterBeforeFit' needs to be set...")
                #RecoTracking.RecoTracking()
            #if self.upgrade():
            #    from RecoUpgrade import RecoTrackingUpgrade
            #    RecoTrackingUpgrade.RecoTrackingUpgrade()

        if self.getProp("WithMC"):
            if useUpgrade:
                from TrackSys import PrUpgradeChecking
                PrUpgradeChecking.PrUpgradeChecking()
            else:
                from TrackSys import PatChecking
                PatChecking.PatChecking()
Пример #16
0
 def defineEvents(self):
     self.setOtherProps(LHCbApp(), ["EvtMax", "SkipEvents"])
     # POOL Persistency
     importOptions("$GAUDIPOOLDBROOT/options/GaudiPoolDbRoot.opts")
     # By default, Brunel only needs to open one input file at a time
     # Only set to zero if not previously set to something else.
     if not IODataManager().isPropertySet("AgeLimit"):
         IODataManager().AgeLimit = 0
Пример #17
0
def execute():
    LHCbApp()
    tck = "0x40b10033"
    MySeq = GaudiSequencer("MoveTCKtoNewLocation")
    MyWriter = InputCopyStream("CopyToFile")
    RawEventJuggler().TCK = tck
    RawEventJuggler().Input = 4.0 #2.0 ?
    RawEventJuggler().Output = 0.0
    RawEventJuggler().Sequencer = MySeq
    RawEventJuggler().WriterOptItemList = MyWriter
    RawEventJuggler().KillInputBanksAfter= " L0*|Hlt*"
    RawEventJuggler().KillExtraNodes = True 
    ApplicationMgr().TopAlg = [MySeq]
    LHCbApp().EvtMax = -1

    from GaudiConf import IOHelper
    IOHelper().outStream("Early2015-Juggled.dst", MyWriter)
Пример #18
0
def startGaudiInspect(aligndb=""):
    global appMgr

    LHCbApp().DDDBtag = ""
    LHCbApp().CondDBtag = ""

    if aligndb:
        from Configurables import (CondDB, CondDBAccessSvc)
        counter = 1
        for db in aligndb:
            alignCond = CondDBAccessSvc('AlignCond' + str(counter))
            alignCond.ConnectionString = 'sqlite_file:' + db + '/LHCBCOND'
            CondDB().addLayer(alignCond)
            counter += 1

    appConf = ApplicationMgr(OutputLevel=INFO, AppName='myBrunel')
    appMgr = GaudiPython.AppMgr()
Пример #19
0
 def defineOptions(self):
     log.info("Setting options")
     from Configurables import MisAlignAlg
     MisAlignAlg().Detectors = self.getProp("Detectors")
     MisAlignAlg().OTMisalignment_file = self.getProp("OT")
     MisAlignAlg().ITMisalignment_file = self.getProp("IT")
     MisAlignAlg().TTMisalignment_file = self.getProp("TT")
     MisAlignAlg().VeLoMisalignment_file = self.getProp("VELO")
     self.setOtherProp(LHCbApp(), "OutputLevel")
def execute(evt_type=13104021, stereo=5):
    importOptions(
        "$APPCONFIGOPTS/Gauss/Beam7000GeV-md100-nu7.6-HorExtAngle.py")

    importOptions("$LBPYTHIA8ROOT/options/Pythia8.py")
    importOptions("$APPCONFIGOPTS/Gauss/G4PL_FTFP_BERT_EmNoCuts.py")
    importOptions("$APPCONFIGOPTS/Conditions/Upgrade.py")
    importOptions("$APPCONFIGOPTS/Persistency/Compression-ZLIB-1.py")
    importOptions("$APPCONFIGOPTS/Gauss/Gauss-Upgrade-Baseline-20131029.py")

    outpath = "%s_%s" % ("Gun", evt_type)
    Gauss().DataType = "Upgrade"

    set_tags(stereo)

    importOptions('$LBPGUNSROOT/options/PGuns.py')
    from Configurables import ParticleGun
    #ParticleGun().EventType = 52210010

    # Set momentum
    from Configurables import MaterialEval
    ParticleGun().addTool(MaterialEval, name="MaterialEval")
    ParticleGun().ParticleGunTool = "MaterialEval"
    x_orig = 480
    y_orig = 500
    ParticleGun().MaterialEval.Xorig = x_orig
    ParticleGun().MaterialEval.Yorig = y_orig
    ParticleGun().MaterialEval.Zorig = 7620
    ParticleGun().MaterialEval.ModP = 150000  #150GeV

    ParticleGun().MaterialEval.ZPlane = 9439
    ParticleGun().MaterialEval.Xmin = x_orig - 20
    ParticleGun().MaterialEval.Xmax = x_orig + 20
    ParticleGun().MaterialEval.Ymin = y_orig - 5
    ParticleGun().MaterialEval.Ymax = y_orig + 5
    ParticleGun().MaterialEval.PdgCode = 211

    # Set min and max number of particles to produce in an event
    from Configurables import FlatNParticles
    ParticleGun().addTool(FlatNParticles, name="FlatNParticles")
    ParticleGun().NumberOfParticlesTool = "FlatNParticles"
    ParticleGun().FlatNParticles.MinNParticles = 2
    ParticleGun().FlatNParticles.MaxNParticles = 2

    GaussGen = GenInit("GaussGen")
    GaussGen.FirstEventNumber = 1
    GaussGen.RunNumber = 1082

    LHCbApp().EvtMax = 10

    HistogramPersistencySvc().OutputFile = outpath + '-GaussHistos.root'

    OutputStream(
        "GaussTape"
    ).Output = "DATAFILE='PFN:%s.sim' TYP='POOL_ROOTTREE' OPT='RECREATE'" % outpath
Пример #21
0
def set_tags(stereo=5):
    LHCbApp().Simulation = True
    CondDB().Upgrade = True
    t = {#"DDDB": "dddb-20140606",
         "DDDB": "dddb-20140827", #latest and greatest
         "CondDB": "sim-20140204-vc-md100",
         #"Others": ["VP_UVP_Rotation"],
         #"Others": ["VP_UVP+RICH_2019+UT_UUT",
         #           "FT_StereoAngle5", "Muon_NoM1", "Calo_NoSPDPRS"],
         }
    t = {
        "DDDB": "dddb-20131025",
        "CondDB": "sim-20130830-vc-md100",
        "Others": ["VP_UVP+RICH_2019+UT_UUT",
                   "FT_StereoAngle%s"%stereo,
                   "Muon_NoM1", "Calo_NoSPDPRS"],
        }
    LHCbApp().DDDBtag = t['DDDB']
    LHCbApp().CondDBtag = t['CondDB']
    if 'Others' in t:
      CondDB().AllLocalTagsByDataType = t['Others']
Пример #22
0
def execute(event_type):
    option_files = "$APPCONFIGOPTS/Gauss/Beam6500GeV-mu100-nu1.6.py;$APPCONFIGOPTS/Gauss/DataType-2015.py;$APPCONFIGOPTS/Gauss/RICHRandomHits.py;$DECFILESROOT/options/@{eventType}.py;$LBPYTHIAROOT/options/Pythia.py;$APPCONFIGOPTS/Gauss/G4PL_FTFP_BERT_EmNoCuts.py;$APPCONFIGOPTS/Persistency/Compression-ZLIB-1.py"
    option_files = option_files.replace("@{eventType}", str(event_type))
    option_files = option_files.split(";")
    for option in option_files:
        print option
        importOptions(option)

    LHCbApp().Simulation = True
    LHCbApp().DDDBtag = "dddb-20140729"
    LHCbApp().CondDBtag = "sim-20140730-vc-mu100"
    LHCbApp().EvtMax = 3

    GaussGen = GenInit("GaussGen")
    #GaussGen.FirstEventNumber = 1
    GaussGen.RunNumber = 383589

    #HistogramPersistencySvc().OutputFile = outpath+'-GaussHistos.root'
    OutputStream(
        "GaussTape"
    ).Output = "DATAFILE='PFN:EarlyEvents.sim' TYP='POOL_ROOTTREE' OPT='RECREATE'"
Пример #23
0
def startInspect():
  global appMgr
  
  LHCbApp().DDDBtag   = "head-20100518"
  LHCbApp().CondDBtag = "head-20100518"

  try:
    if alignDB:
      from Configurables import ( CondDB, CondDBAccessSvc )
      counter = 1
      for db in alignDB:
	alignCond = CondDBAccessSvc( 'AlignCond' + str(counter) )
	alignCond.ConnectionString = 'sqlite_file:' + db + '/LHCBCOND'
	CondDB().addLayer( alignCond )
	counter += 1
  except:
    pass

  appConf = ApplicationMgr( OutputLevel = INFO, AppName = 'myBrunel' )
  appMgr = GaudiPython.AppMgr()
  print "/dd/Structure/LHCb/BeforeMagnetRegion/TT"
Пример #24
0
def execute(polarity):
    option_files = "$APPCONFIGOPTS/Moore/MooreSimProductionForSeparateL0AppStep2015.py;$APPCONFIGOPTS/Conditions/TCK-0x40b10033.py;$APPCONFIGOPTS/Moore/DataType-2012.py"
    option_files = option_files.split(";")
    for option in option_files:
        importOptions(option)

    LHCbApp().Simulation = True
    LHCbApp().DDDBtag = "dddb-20140729"
    LHCbApp().CondDBtag = "sim-20140730-vc-m%s100" % polarity

    #inputFiles = ["/tmp/thead/EarlyEvents-Extended-L0.xdst"]
    #IOHelper('ROOT').inputFiles(inputFiles)
    #Moore().EvtMax = 20

    Moore().outputFile = "EarlyEvents-Extended-L0-TurboMoore.xdst"

    # path to private TCK
    ConfigTarFileAccessSvc().File = 'config.tar'
    Moore().TCKData = '.'

    Moore().InitialTCK = "0x40b20033"  # your chosen TCK
    Moore().UseTCK = True
Пример #25
0
    def defineGeometry(self):
        # DIGI is always simulation, as is usage of MC truth!
        if self.getProp("WithMC") or self.getProp(
                "InputType").upper() == 'DIGI':
            self.setProp("Simulation", True)

        # Delegate handling to LHCbApp configurable
        self.setOtherProps(LHCbApp(),
                           ["DataType", "CondDBtag", "DDDBtag", "Simulation"])
        # specify the use of the oracle database
        if self.getProp("UseOracle"):
            from Configurables import CondDB
            CondDB(UseOracle=True)
Пример #26
0
 def _configureSubPackages(self):
     """
     Define DB and so on
     """
     # Delegate handling to LHCbApp configurable
     self.setOtherProps(LHCbApp(), [
         "DataType", "CondDBtag", "DDDBtag", "DQFLAGStag", "Simulation",
         "IgnoreDQFlags"
     ])
     self.setOtherProps(
         PhysConf(), ["DataType", "Simulation", "InputType", "Detectors"])
     self.setOtherProps(AnalysisConf(), ["DataType", "Simulation"])
     self.setOtherProps(DstConf(), ["DataType"])
Пример #27
0
def configure ( datafiles        ,
                catalogs = []    ,
                castor   = False ,
                params   = {}    ) :
    """
    Configure the job
    """
    
    ##
    ## 1. Static configuration using "Configurables"
    ##

    the_year = '2012'
    from Configurables import DaVinci
    dv = DaVinci (
        DataType = the_year ,
        ) 
    
    alg_name = 'MyAlg'
    davinci.UserAlgorithms += [ alg_name ]
   
    from Configurables import CondDB
    CondDB ( LatestGlobalTagByDataType = the_year )
    
    from Configurables import LHCbApp
    LHCbApp().XMLSummary = 'summary.xml'
    
    from BenderTools.Utils import silence
    silence()
    
    ## define/set the input data 
    setData ( datafiles , catalogs )
    

    
    ##
    ## jump into the wonderful world of the actual Gaudi components!
    ## 
    
    ## get the actual application manager (create if needed)
    gaudi = appMgr() 
    
    ## create local algorithm:
    
    alg = Template(
        alg_name          ## algorithm instance name 
        )

    
    return SUCCESS
Пример #28
0
    def __apply_configuration__(self):

        GaudiKernel.ProcessJobOptions.PrintOff()
        GaudiKernel.ProcessJobOptions.PrintOn()
        log.info("Initializing sequences!")
        self.setOtherProps(
            RecSysConf(), ["SpecialData", "Context", "OutputType", "DataType"])

        #if self.isPropertySet("RecoSequence") :
        #self.setOtherProp(RecSysConf(),["RecoSequence"])
        RecSysConf().RecoSequence = self.CheckRecoSequence()

        # there is a bug in setOtherProps, so we cannot use it to set the MoniSequence.
        if not self.getProp("OnlineMode"):
            self.setOtherProps(RecMoniConf(), ["Context", "DataType"])
            RecMoniConf().MoniSequence = self.getProp("MoniSequence")
        else:
            self.setOtherProps(RecMoniConf(), ["Context", "DataType"])
            RecMoniConf().MoniSequence = self.getProp("MoniSequence")
            RecMoniConf().Context = "Offline"
            RecMoniConf().OutputLevel = FATAL
            RecMoniConf().Histograms = "OfflineFull"

        self.defineGeometry()
        self.defineEvents()
        self.defineOptions()

        # database hacking for online.
        if self.getProp('UseDBSnapshot'): self.configureDBSnapshot()

        # Use TimingAuditor for timing, suppress printout from SequencerTimerTool
        from Configurables import (ApplicationMgr, AuditorSvc,
                                   SequencerTimerTool)
        ApplicationMgr().ExtSvc += ['ToolSvc', 'AuditorSvc']
        ApplicationMgr().AuditAlgorithms = True
        AuditorSvc().Auditors += ['TimingAuditor']
        SequencerTimerTool().OutputLevel = 4

        log.info(self)
        log.info(LHCbApp())
        log.info(RecSysConf())
        log.info(TrackSys())
        if not self.getProp("OnlineMode"):
            log.info(RecMoniConf())
        log.info(TAlignment())
        log.info(DstConf())
        GaudiKernel.ProcessJobOptions.PrintOff()
Пример #29
0
    def __apply_configuration__(self):

        #print "WAAAAAAAAAAAAAHHHHHHHHHHHHHHHH"

        ############## Set other properties ###########
        self._safeSet(LHCbApp(), [
            'EvtMax', 'SkipEvents', 'Simulation', 'DataType', 'CondDBtag',
            'DDDBtag'
        ])

        ApplicationMgr().AppName = "L0App within Moore"

        ############## The raw event ##################

        from Configurables import DataOnDemandSvc
        dod = DataOnDemandSvc()
        if dod not in ApplicationMgr().ExtSvc:
            ApplicationMgr().ExtSvc.append(dod)

        DecodeRawEvent().DataOnDemand = True

        importOptions("$L0TCK/L0DUConfig.opts")

        self._setRawEventLocations()

        ############## The L0 Part  ###################

        from DAQSys.Decoders import DecoderDB
        l0du = DecoderDB["L0DUFromRawTool"]
        l0du.Properties["StatusOnTES"] = False

        #configure L0 Sequence
        l0seq = GaudiSequencer("L0")
        ApplicationMgr().TopAlg += [l0seq]
        L0TCK = '0x%s' % self.getProp('TCK')[-4:]

        L0Conf().setProp("TCK", L0TCK)
        L0Conf().setProp("L0Sequencer", l0seq)
        self.setOtherProps(L0Conf(), ["DataType"])

        if (self.getProp("ReplaceL0Banks")):
            L0Conf().setProp("ReplaceL0BanksWithEmulated", True)
        else:
            L0Conf().setProp("SimulateL0", True)

        #done, that was quite easy, now for the output files
        self._configureOutput()
Пример #30
0
def initialise(dddbtag = '', datatype = '') :
    global pps
    if pps :
        return
    import PartProp.PartPropAlg
    import PartProp.Service
    from   GaudiPython.Bindings import AppMgr
    import sys
    from Configurables import LHCbApp

    if dddbtag :
        LHCbApp().DDDBtag = dddbtag
    elif datatype:
        from Configurables import CondDB
        CondDB().LatestGlobalTagByDataType = datatype
    gaudi = AppMgr()

    # Annoyingly have to initialise the AppMgr to initialise the ppSvc
    gaudi.initialize()

    pps   = gaudi.ppSvc()
Пример #31
0
from Configurables import LHCbApp, CondDB, UpdateManagerSvc,DDDBConf
from Gaudi.Configuration import *
import os

#Use Oliver's XML DDDB describing the FT detector
#DDDBConf().DbRoot = "/afs/cern.ch/user/o/ogruenbe/public/FT_upgrade/myDDDB-LHCb-Feb2012/lhcb.xml"
#-- the above is a running target, therefore use the following snaphot:
DDDBConf().DbRoot = "/afs/cern.ch/user/p/phopchev/public/FT/DDDBSlice_FT_v3/lhcb.xml"

CondDB().Tags['DDDB'] = 'HEAD'


lhcbApp = LHCbApp()
lhcbApp.Simulation = True

'''
lhcbApp.DataType = '2011'
lhcbApp.DDDBtag = "head-20110914"
lhcbApp.CondDBtag = "sim-20111020-vc-md100"
#dataDir = os.environ['PANORAMIXDATA']
#EventSelector().Input = ["DATAFILE='PFN:"+dataDir+"/2011_Bs2DsmuX.dst' TYP='POOL_ROOTTREE'"]
'''

lhcbApp.DataType = "2011"
lhcbApp.DDDBtag = "MC11-20111102"
lhcbApp.CondDBtag = "sim-20111111-vc-md100"
EventSelector().Input = ["DATAFILE='/castor/cern.ch/user/o/ogruenbe/Bs_mumu_v3.sim' TYP='POOL_ROOTTREE'"]

### Set fake event time to avoid useless ERROR messages from the EventClockSvc (no DAQ/RawEvent as it is MC)
from Configurables import EventClockSvc
EventClockSvc().EventTimeDecoder = 'FakeEventTime'
Пример #32
0
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)
### end

s = SimConf()
SimConf().Detectors = ['VP', 'UT', 'FT', 'Rich1Pmt', 'Rich2Pmt', 'Ecal', 'Hcal', 'Muon']
SimConf().EnableUnpack = True
SimConf().EnablePack = False

d = DigiConf()
DigiConf().Detectors = ['VP', 'UT', 'FT', 'Rich1Pmt', 'Rich2Pmt', 'Ecal', 'Hcal', 'Muon']
DigiConf().EnableUnpack = True
DigiConf().EnablePack = False

dre = DecodeRawEvent()
dre.DataOnDemand = True

lhcbApp = LHCbApp()
lhcbApp.Simulation = True

IOHelper('ROOT').inputFiles([cfg.file])

# Configuration done, run time!
appMgr = GP.AppMgr()
evt = appMgr.evtsvc()
det = appMgr.detsvc()
hist = appMgr.histSvc()

hist.dump()

#exit()

#quarter 0 - 3
Пример #34
0
def execute(simulation=True,
            turbo=True,
            decay_descriptor="J/psi(1S) -> mu- mu+"):
    # Configure all the unpacking, algorithms, tags and input files
    appConf = ApplicationMgr()
    appConf.ExtSvc+= ['ToolSvc', 'DataOnDemandSvc', LoKiSvc()]

    ConfigTarFileAccessSvc().File = 'config.tar'
    
    dv = DaVinci()
    dv.DataType = "2012"

    lhcbApp = LHCbApp()
    lhcbApp.Simulation = simulation
    CondDB().Upgrade = False
    
    dtt = DecayTreeTuple("Early2015")
    if turbo:
        tesla_prefix = "Hlt2DiMuonJPsi"
        dtt.Inputs = ["/Event/"+tesla_prefix+"/Particles"]
        dtt.InputPrimaryVertices = "/Event/"+tesla_prefix+"/Primary"
        dtt.WriteP2PVRelations = False

    else:
        LHCbApp().DDDBtag = "dddb-20140729"
        polarity = "u"
        LHCbApp().CondDBtag = "sim-20140730-vc-m%s100"%polarity
        muons = AutomaticData(Location="Phys/StdAllLooseMuons/Particles")

        jpsi = CombineParticles('MyJPsi')
        jpsi.DecayDescriptors = [decay_descriptor]
        jpsi.CombinationCut = "(AM < 7100.0 *GeV)"
        jpsi.DaughtersCuts = {"": "ALL", "mu+": "ALL", "mu-": "ALL"}
        jpsi.MotherCut = "(VFASPF(VCHI2/VDOF) < 999999.0)"
        
        code = """
('J/psi(1S)' == ID) &
in_range(2.990*GeV, M, 3.210*GeV) &
DECTREE('%s') &
CHILDCUT(1, HASMUON & ISMUON) &
CHILDCUT(2, HASMUON & ISMUON) &
(MINTREE('mu+' == ABSID, PT) > 700*MeV) &
(MAXTREE(ISBASIC & HASTRACK, TRCHI2DOF) < 5) &
(MINTREE(ISBASIC & HASTRACK, CLONEDIST) > 5000) &
(VFASPF(VPCHI2) > 0.5/100) &
(abs(BPV(VZ)) <  0.5*meter) &
(BPV(vrho2) < (10*mm)**2)
"""%(decay_descriptor)
        # similar to the HLT2 line
        code = """
(ADMASS('J/psi(1S)')< 120*MeV) &
DECTREE('%s') &
(PT>0*MeV) &
(MAXTREE('mu-'==ABSID,TRCHI2DOF) < 4) &
(MINTREE('mu-'==ABSID,PT)> 0*MeV) &
(VFASPF(VCHI2PDOF)< 25)
"""%(decay_descriptor)
        filter_jpsi = FilterDesktop("MyFilterJPsi",
                                    Code=code,
                                    Preambulo=["vrho2 = VX**2 + VY**2"],
                                    ReFitPVs=True,
                                    #IgnoreP2PVFromInputLocations=True,
                                    #WriteP2PVRelations=True
                                    )
        
        jpsi_sel = Selection("SelMyJPsi", Algorithm=jpsi, RequiredSelections=[muons])
        filter_jpsi_sel = Selection("SelFilterMyJPsi",
                                    Algorithm=filter_jpsi,
                                    RequiredSelections=[jpsi_sel])
        jpsi_seq = SelectionSequence("SeqMyJPsi", TopSelection=filter_jpsi_sel)
        dtt.Inputs = [jpsi_seq.outputLocation()]
    
    # Overwriting default list of TupleTools
    dtt.ToolList = ["TupleToolKinematic",
                    "TupleToolPid",
                    "TupleToolEventInfo",
                    "TupleToolMCBackgroundInfo",
                    "TupleToolMCTruth",
                    #"MCTupleToolHierarchy",
                    #"MCTupleToolPID",
                    "TupleToolGeometry",
                    "TupleToolTISTOS",
                    # with turbo this crashes
                    #"TupleToolTrackInfo",
                    "TupleToolTrigger",
                    ]
    tlist = ["L0HadronDecision", "L0MuonDecision",
             "L0DiMuonDecision", "L0ElectronDecision",
             "L0PhotonDecision",
             "Hlt1DiMuonHighMassDecision", "Hlt1DiMuonLowMassDecision",
             "Hlt1TrackMuonDecision", "Hlt1TrackAllL0Decision",
             "Hlt2DiMuonJPsiDecision", "Hlt2SingleMuonDecision",
             ]
    
    dtt.addTool(TupleToolTrigger, name="TupleToolTrigger")
    dtt.addTool(TupleToolTISTOS, name="TupleToolTISTOS")
    # Get trigger info
    dtt.TupleToolTrigger.Verbose = True
    dtt.TupleToolTrigger.TriggerList = tlist
    dtt.TupleToolTISTOS.Verbose = True
    dtt.TupleToolTISTOS.TriggerList = tlist

    from Configurables import TupleToolMCTruth, MCTupleToolHierarchy
    dtt.addTool(TupleToolMCBackgroundInfo,
                name="TupleToolMCBackgroundInfo")
    dtt.TupleToolMCBackgroundInfo.Verbose = True
    dtt.addTool(MCTupleToolHierarchy,
                name="MCTupleToolHierarchy")
    dtt.MCTupleToolHierarchy.Verbose = True
    dtt.addTool(TupleToolMCTruth,
                name="TupleToolMCTruth")
    dtt.TupleToolMCTruth.Verbose = True

    if turbo:
        assoc_seq = TeslaTruthUtils.associateSequence(tesla_prefix, False)
        ChargedPP2MC(tesla_prefix+"ProtoAssocPP").OutputLevel = 1
        
        assoc_seq.Members.insert(0, PatLHCbID2MCParticle())

        from Configurables import MuonCoord2MCParticleLink
        muon_coords = MuonCoord2MCParticleLink("TeslaMuonCoordLinker")
        assoc_seq.Members.insert(1, muon_coords)
    
        TrackAssociator("TeslaAssocTr").DecideUsingMuons = True
        
        relations = TeslaTruthUtils.getRelLoc(tesla_prefix)

    else:
        relations = "Relations/Rec/ProtoP/Charged"


    TeslaTruthUtils.makeTruth(dtt,
                              relations,
                              ["MCTupleToolKinematic",
                               "MCTupleToolHierarchy",
                               "MCTupleToolPID",
                               ]
                              )
    
    
    dtt.Decay = mark(2, mark(3, decay_descriptor)) #"J/psi(1S) -> ^mu- ^mu+"
    
    dtt.addBranches({"X": "^(%s)"%(decay_descriptor),
                     "muplus": mark(3, decay_descriptor),#"J/psi(1S) -> mu- ^mu+",
                     "muminus": mark(2, decay_descriptor),#"J/psi(1S) -> ^mu- mu+",
                     })
    
    x_preamble = ["DZ = VFASPF(VZ) - BPV(VZ)",
                  ]
    x_vars = {"ETA": "ETA",
              "Y": "Y",
              "PHI": "PHI",
              "VPCHI2": "VFASPF(VPCHI2)",
              "DELTAZ": "DZ",
              # DZ * M / PZ / c with c in units of mm/s
              # XXX should this be the PDG mass or measured mass?
              #"TZ": "DZ*M / PZ / 299792458000.0", #seconds
              "TZ": "DZ*3096.916 / PZ/299792458000.0*(10**12)", #ps
              "minpt": "MINTREE('mu+' == ABSID, PT)",
              "minclonedist": "MINTREE(ISBASIC & HASTRACK, CLONEDIST)",
              "maxtrchi2dof": "MAXTREE(ISBASIC & HASTRACK, TRCHI2DOF)",
              }
    muon_vars = {"ETA": "ETA",
                 "Y": "Y",
                 "PHI": "PHI",
                 "CHARGE": "Q",
                 "CLONEDIST": "CLONEDIST",
                 "TRCHI2DOF": "TRCHI2DOF",
                 }
    
    loki_X = dtt.X.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_X")
    loki_X.Variables = x_vars
    loki_X.Preambulo = x_preamble
    
    loki_mup = dtt.muplus.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_MuPlus")
    loki_mup.Variables = muon_vars
    #dtt.muplus.addTupleTool("TupleToolGeometry")
    
    loki_mum = dtt.muminus.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_MuMinus")
    loki_mum.Variables = muon_vars
    #dtt.muminus.addTupleTool("TupleToolGeometry")
    
    dv.TupleFile = "DVNtuples.root"
    if turbo:
        dv.UserAlgorithms = [assoc_seq, dtt]

    else:
        assocpp = ChargedPP2MC("TimsChargedPP2MC")
        assocpp.OutputLevel = 1
        dv.UserAlgorithms = [jpsi_seq.sequence(), assocpp, dtt]