Exemple #1
0
def _file(f):
    if f.lstrip().startswith('DATAFILE'): return f
    from GaudiConf.IOHelper import IOHelper
    if _ext(f).upper() in ["RAW", "MDF"]:

        return IOHelper(Input="MDF").dressFile(f, IO="I")

    return IOHelper().dressFile(f, IO="I")
Exemple #2
0
    def _configureInput(self):
        from GaudiConf.IOHelper import IOHelper
        files = self.getProp('inputFiles')
        if not len(files): return

        persistency = None
        if hasattr(self, "Persistency"):
            persistency = self.getProp("Persistency")

        from GaudiConf import IOHelper

        if _hasMDF(files):
            IOHelper(Input="MDF", Output=persistency).inputFiles(files,
                                                                 clear=True)
        else:
            IOHelper(persistency, persistency).inputFiles(files, clear=True)
def _hasMDF(files):
    from GaudiConf.IOHelper import IOHelper
    for f in files:
        f = IOHelper().undressFile(f)
        if _ext(f).upper() in ["RAW", "MDF"]:
            return True
    return False
Exemple #4
0
 def definePersistency(self):
     '''Use IOHelper to set up the tes and IO services etc.'''
     persistency = None
     if hasattr(self, "Persistency"):
         persistency = self.getProp("Persistency")
     # Set up TES and I/O services
     from GaudiConf.IOHelper import IOHelper
     IOHelper(persistency, persistency).setupServices()
Exemple #5
0
    def _doWrite(self):
        """
        Define the file content and write it out
        """
        if self.getProp("Writer") == "NONE":
            log.info("No Writer defined for DIGI")
            return

        dType = self.getProp("DigiType").capitalize()
        if dType not in self.KnownDigiTypes:
            raise TypeError("Unknown DIGI type '%s'" % dType)

        if self.getProp("EnablePack"):
            if not hasattr(self, "PackSequencer"):
                raise TypeError(
                    "Packing requested but PackSequencer not defined")

        from GaudiConf.IOHelper import IOHelper
        writer = OutputStream(self.getProp("Writer"))
        writer.Preload = False

        # Set a default file name if not already set
        if not writer.isPropertySet("Output"):
            outputFile = self.getProp("OutputName")
            outputFile = "PFN:" + outputFile + '.digi'
        else:
            outputFile = IOHelper().undressFile(writer.getProp("Output"))

        # Add to the ApplicationMgr with correct output persistency
        algs = IOHelper().outputAlgs(outputFile,
                                     "OutputStream/" + self.getProp("Writer"),
                                     self.getProp("WriteFSR"))
        for alg in algs:
            ApplicationMgr().OutStream.insert(0, alg)

        self._defineOutputData(dType, writer)

        self._doWritePOOL(dType, writer)
Exemple #6
0
 def _doWriteROOT(self, items, optItems):
     """
     Write a DST (or XDST) in ROOT format
     """
     writer = OutputStream(self.getProp("Writer"))
     writer.Preload = False
     writer.ItemList += items
     writer.OptItemList += optItems
     log.info("%s.ItemList=%s" % (self.getProp("Writer"), writer.ItemList))
     log.info("%s.OptItemList=%s" %
              (self.getProp("Writer"), writer.OptItemList))
     from GaudiConf.IOHelper import IOHelper
     # Set a default file name if not already set
     if not writer.isPropertySet("Output"):
         outputFile = self.getProp("OutputName")
         outputFile = "PFN:" + outputFile + '.' + self.getProp(
             "DstType").lower()
     else:
         outputFile = IOHelper().undressFile(writer.getProp("Output"))
     # Add to the ApplicationMgr with corresct output persistency
     IOHelper().outStream(outputFile,
                          "OutputStream/" + self.getProp("Writer"),
                          self.getProp("WriteFSR"))
    def _configureOutput(self):
        # first empty the outstream, because it would write all the time
        ApplicationMgr().OutStream = []
        # only configure the writer - use it where applicable
        outputFile = self.getProp('outputFile')
        if not outputFile: return

        from Configurables import OutputStream
        writerName = "DstWriter"
        dstWriter = OutputStream(writerName,
                                 ItemList=["/Event#999"
                                           ])  #,     # miniDST selection: #1

        persistency = None
        if hasattr(self, "Persistency"):
            persistency = self.getProp("Persistency")

        from GaudiConf.IOHelper import IOHelper

        IOHelper(persistency, persistency).outStream(filename=outputFile,
                                                     writer=dstWriter)
Exemple #8
0
from Configurables import RecombineRawEvent, DecodeRawEvent
RecombineRawEvent()
DecodeRawEvent().DataOnDemand = True

## Tell HltANNSvc the ID of your line
# NEEDED WHEN NOT RUNNING FROM A TCK
# YOU CAN FIND THE ID IN THE PYTHON IMPLEMENTATION
# IN Hlt/Hlt2Lines
from Configurables import HltANNSvc
Hlt2ID = HltANNSvc().Hlt2SelectionID
if "Hlt2Global" not in Hlt2ID: Hlt2ID.update({"Hlt2Global": 2})
HltANNSvc().Hlt1SelectionID = {'PV3D': 10103, 'ProtoPV3D': 10117}
Hlt2ID.update({
    'Hlt2IncPhiDecision': 50000,
    'Hlt2IncPhiSidebandsDecision': 50003,
    'Hlt2IncPhiTrackFitDecision': 50002
})
#from Configurables import ConfigTarFileAccessSvc
#ConfigTarFileAccessSvc().File='/afs/cern.ch/user/s/sbenson/cmtuser/Moore_v23r2/TCKData/config.tar'

Tesla().TriggerLines = ["Hlt2IncPhi"]  # Enter your trigger line here
Tesla().EvtMax = -1
Tesla().OutputLevel = DEBUG

from GaudiConf.IOHelper import IOHelper
ioh = IOHelper()
ioh.setupServices()
ioh.inputFiles(["/PATH/TO/INPUT"])
Tesla().outputFile = "OUTPUT"
Exemple #9
0
from Configurables import Tesla
from Gaudi.Configuration import *

from Configurables import RecombineRawEvent, DecodeRawEvent
RecombineRawEvent()
DecodeRawEvent().DataOnDemand = True

from Configurables import ConfigTarFileAccessSvc
ConfigTarFileAccessSvc(
).File = '/afs/cern.ch/work/s/sbenson/public/forTeslaExtendedReps/config.tar'

Tesla().TriggerLine = "Hlt2DiMuonJPsi"
Tesla().ReportVersion = 2
Tesla().EvtMax = -1

from GaudiConf.IOHelper import IOHelper
ioh = IOHelper()
ioh.setupServices()
ioh.inputFiles(["/tmp/ikomarov/With_new_HLT.dst"])
Tesla().outputFile = "/tmp/ikomarov/Turbo.dst"
# Test to copy a POOL dst file to a ROOT dst file
from Configurables import IOTest
from GaudiConf.IOHelper import IOHelper
from PRConfig import TestFileDB

IOTest(EvtMax=5, LoadAll=True, DataType='MC09')

ioh = IOHelper()
ioh.setupServices()
ioh.outStream('PFN:ROOT.dst', "InputCopyStream")

TestFileDB.test_file_db["MC09-pool-dst"].run()
Exemple #11
0
from Configurables import IOTest
from GaudiConf.IOHelper import IOHelper

from Configurables import ApplicationMgr, createODIN
odin = createODIN()
ApplicationMgr().TopAlg += [odin]

IOTest(EvtMax=5, LoadAll=True)

ioh = IOHelper('ROOT')
ioh.setupServices()
ioh.inputFiles(['PFN:Reco14-Stripping20.dst'])
from Configurables import Tesla
from Gaudi.Configuration import *

from Configurables import RecombineRawEvent, DecodeRawEvent
RecombineRawEvent()
DecodeRawEvent().DataOnDemand = True

# Path to private TCK
from Configurables import ConfigTarFileAccessSvc
ConfigTarFileAccessSvc(
).File = '/afs/cern.ch/user/s/sbenson/cmtuser/Moore_v23r2/TCKData/config.tar'

Tesla().TriggerLines = ["Hlt2IncPhi"]  # Enter your trigger line here
Tesla().EvtMax = -1

from GaudiConf.IOHelper import IOHelper
ioh = IOHelper()
ioh.setupServices()
ioh.inputFiles(["PATH/TO/HLT/PROCESSED/DATA"])
Tesla().outputFile = "PATH/TO/OUTPUT"
Exemple #13
0
# Pathological events from 2012 that caused huge processing times in Stripping21.
from Gaudi.Configuration import FileCatalog
from Configurables import Brunel

#-- File catalogs. First one is read-write
FileCatalog().Catalogs = [ "xmlcatalog_file:MyCatalog.xml" ]

#-- Use latest 2012 database tags for real data
Brunel().DataType = "2012"
Brunel().InputType = "DST"

#-- Twelve events with huge processing times in Reco14/Stripping21 draft.
from GaudiConf.IOHelper import IOHelper
IOHelper().inputFiles( [
  "DATAFILE='$QMTESTFILESROOT/data/12Events_Stripping21Reco14_SlowEvents.dst'" ] )
Exemple #14
0
from Configurables import Tesla 
from Gaudi.Configuration import *

from Configurables import RecombineRawEvent, DecodeRawEvent
RecombineRawEvent()
DecodeRawEvent().DataOnDemand = True

from Configurables import ConfigTarFileAccessSvc
ConfigTarFileAccessSvc().File='/afs/cern.ch/work/s/sbenson/public/forTeslaExtendedReps/config.tar'

Tesla().TriggerLine = "Hlt2DiMuonJPsi"
Tesla().ReportVersion=2
Tesla().EvtMax = -1

from GaudiConf.IOHelper import IOHelper
ioh = IOHelper()
ioh.setupServices()
ioh.inputFiles([
    "/tmp/ikomarov/With_new_HLT.dst"
])
Tesla().outputFile = "/tmp/ikomarov/Turbo.dst"
Exemple #15
0
# Test to read a ROOT MC10 dst file
from Configurables import IOTest
from GaudiConf.IOHelper import IOHelper

IOTest(EvtMax=5, WithMC=True, LoadAll=True)

ioh = IOHelper('ROOT')
ioh.setupServices()
ioh.inputFiles(['PFN:ROOT-MC10.dst'])
Exemple #16
0
# Test to read a ROOT sim file
from Configurables import IOTest
from GaudiConf.IOHelper import IOHelper

IOTest(EvtMax=5, DataContent="SIM", WithMC=True, LoadAll=True)

ioh = IOHelper('ROOT')
ioh.setupServices()
ioh.inputFiles(['PFN:ROOT.sim'])
Exemple #17
0
# Test to ensure a Reco12-Stripping17 mdst can be copied
from Configurables import IOTest
from GaudiConf.IOHelper import IOHelper
from PRConfig import TestFileDB

IOTest(EvtMax=5, LoadAll=True, DataContent='MDST', KillDAQ=True)

ioh = IOHelper()
ioh.setupServices()
ioh.outStream('PFN:Reco12-Stripping17.mdst', "InputCopyStream")
ioh.inputFiles([
    'PFN:root://eoslhcb.cern.ch//eos/lhcb/grid/prod/lhcb/swtest/lhcb/LHCb/Collision11/CHARM.MDST/00012547/0000/00012547_00000013_1.charm.mdst'
])

#TestFileDB.test_file_db["R12S17-charm.mdst"].run()
# Test of UnpackTrack on SDST contaning a track with more than 65k LHCbIDs
from PRConfig import TestFileDB
from Gaudi.Configuration import ApplicationMgr
from Configurables import DumpTracks, UnpackTrack
from GaudiConf.IOHelper import IOHelper

upkTr = UnpackTrack()
ApplicationMgr().TopAlg += [ upkTr, DumpTracks() ]

ioh = IOHelper('ROOT')
ioh.setupServices()
ioh.inputFiles(['PFN:root://eoslhcb.cern.ch//eos/lhcb/grid/prod/lhcb/swtest/lhcb/swtest/Reco10-sdst-10events/00011652_00000001_1-evt-18641to18650.sdst'])


#TestFileDB.test_file_db["Reco10-sdst-10events"].run()
Exemple #19
0
from Gaudi.Configuration import EventSelector
from Configurables import Brunel

Brunel().DataType = "2010"
Brunel().DatasetName = "bigEvents-2010"

from GaudiConf.IOHelper import IOHelper
# file of selected large events
IOHelper("MDF").inputFiles([
    "$QMTESTFILESROOT/data/069669_2ev_bug65441.raw",
    "$QMTESTFILESROOT/data/070122_1ev_large.raw",
    "$QMTESTFILESROOT/data/071491_0000000091_evt35027_bug67364.raw"
])
Exemple #20
0
# Pathological events from 2012 that caused Brunel crashes or huge processing times.
from Gaudi.Configuration import FileCatalog
from Configurables import Brunel

#-- File catalogs. First one is read-write
FileCatalog().Catalogs = [ "xmlcatalog_file:MyCatalog.xml" ]

#-- Use latest 2012 database tags for real data
Brunel().DataType = "2012"

# Three events with huge processing times, fixed in Brunel v41r2p2, bug 93550
# One event to test bug 94407, fixed in Brunel v42r3p2
from GaudiConf.IOHelper import IOHelper
IOHelper("MDF").inputFiles( [
  "DATAFILE='$QMTESTFILESROOT/data/111473_0000000110_evt11603_bug93550.raw'"
, "DATAFILE='$QMTESTFILESROOT/data/111702_0000000001_evt110102_bug93550.raw'"
, "DATAFILE='$QMTESTFILESROOT/data/111800_0000000026_evt16533_bug93550.raw'"
, "DATAFILE='$QMTESTFILESROOT/data/114752_0000000076_evt377_bug94407.raw'" ] )
Exemple #21
0
# Test to read a ROOT mdst
from Configurables import IOTest
from GaudiConf.IOHelper import IOHelper

IOTest(EvtMax=5, LoadAll=True, DataContent='MDST')

ioh = IOHelper('ROOT')
ioh.setupServices()
ioh.inputFiles(['PFN:ROOT-Reco08.mdst'])
# Test to ensure a Reco14-Stripping20 mdst can be copied
from Configurables import IOTest
from GaudiConf.IOHelper import IOHelper
from PRConfig import TestFileDB

IOTest(EvtMax=5, LoadAll=True, DataContent='MDST', KillDAQ=True)

ioh = IOHelper()
ioh.setupServices()
ioh.outStream('PFN:Reco14-Stripping20.mdst', "InputCopyStream")
ioh.inputFiles([
    'PFN:root://eoslhcb.cern.ch//eos/lhcb/grid/prod/lhcb/swtest/lhcb/LHCb/Collision12/BHADRON.MDST/00020198/0000/00020198_00000758_1.bhadron.mdst'
])

#TestFileDB.test_file_db["R14S20-bhadron.mdst"].run()
Exemple #23
0
    print '*' * 120

    #### === run with test SDSTs as an input
    ##from Configurables import DaVinci
    ##DaVinci().InputType = 'SDST'                            # use SDSTs as an input
    #### SDSTs for Stripping tests, 2010 data, mu = 2.7
    ##importOptions('$STRIPPINGSELECTIONSROOT/tests/data/RUN_81430_RealData+Reco08-Stripping12_90000000_SDST.py')

    #eos      = 'root://eoslhcb.cern.ch//eos/lhcb/grid/prod'
    #pattern  = '/lhcb/LHCb/Collision11/FMDST/00011385/0000/00011385_00000%03d_1.fmdst'
    #pattern  = '/lhcb/LHCb/Collision12/FMDST/00021391/0000/00021391_00000%03d_1.fmdst'

    from PRConfig import TestFileDB
    from GaudiConf.IOHelper import IOHelper

    IOHelper().inputFiles(
        TestFileDB.test_file_db["2012_CaloFemtoDST"].filenames)

    #evtSel.open ( 'KaliPi0_2k+11.fmdst_test')

    from GaudiPython.Bindings import AppMgr
    gaudi = AppMgr()

    ## === OR with test fmDSTs

    evtSel = gaudi.evtSel()

    ## run over events
    gaudi.run(5000)

    from KaliCalo.FitUtils import fitPi0, getPi0Params, s2b
    import GaudiPython.GaudiAlgs
# Test to ensure a Reco12-Stripping17 dst can be copied
from Configurables import IOTest
from GaudiConf.IOHelper import IOHelper
from PRConfig import TestFileDB

IOTest(EvtMax=5, LoadAll=True)

ioh = IOHelper()
ioh.setupServices()
ioh.outStream('PFN:Reco12-Stripping17.dst', "InputCopyStream")

TestFileDB.test_file_db["R12S17-bhadron.dst"].run()
Exemple #25
0
# Pathological events from 2011 that caused Brunel crashes.
from Gaudi.Configuration import FileCatalog
from Configurables import Brunel

#-- File catalogs. First one is read-write
FileCatalog().Catalogs = ["xmlcatalog_file:MyCatalog.xml"]

#-- Use latest 2011 database tags for real data
Brunel().DataType = "2011"

# Two Reco12 crashes, bug #89269, fixed in Brunel v41r1p1 and >v41r2
# One crash, bug #93382, introduced in Brunel v42r2, fixed in v42r2p1
from GaudiConf.IOHelper import IOHelper
IOHelper("MDF").inputFiles([
    "DATAFILE='$QMTESTFILESROOT/data/102896_0000000146_evt12267_bug89269.raw'",
    "DATAFILE='$QMTESTFILESROOT/data/102897_0000000127_evt35859_bug89269.raw'",
    "DATAFILE='$QMTESTFILESROOT/data/103127_0000000001_evt2277_bug93382.raw'"
])
Exemple #26
0
# SAMPLE FOR TUTORIAL: RunningTesla
# FOR LATEST SCRIPT SEE Turbo_NewLine.py

from Configurables import Tesla 
from Gaudi.Configuration import *

from Configurables import RecombineRawEvent, DecodeRawEvent
RecombineRawEvent()
DecodeRawEvent().DataOnDemand = True

from Configurables import ConfigTarFileAccessSvc
ConfigTarFileAccessSvc().File='/afs/cern.ch/work/s/sbenson/public/forTeslaExtendedReps/config.tar'

Tesla().TriggerLine = "Hlt2IncPhi"
Tesla().EvtMax = -1

from GaudiConf.IOHelper import IOHelper
ioh = IOHelper()
ioh.setupServices()
ioh.inputFiles([
    "root://eoslhcb.cern.ch//eos/lhcb/user/s/sbenson/DSTs/TeslaChain/RemadeSel_phiphi_1k_Tutorial_0044.dst"
])
Tesla().outputFile = "Turbo.dst"