示例#1
0
def main():
    import sys
    import user

    #    sys.path.append("../i686-slc5-gcc43-opt/")

    # output
    outputFile = "out1.root"
    # input
    inputFiles = sys.argv[1].split(',')

    from GaudiPython import AppMgr
    theApp = AppMgr()
    theApp.EvtMax = 1
    # Verboseness threshold level: 0=NIL,1=VERBOSE, 2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL, 7=ALWAYS
    #    theApp.outputLevel = 4
    #    MessageSvc.OutputLevel = 4
    #    EventSelector.OutputLevel = 4
    theApp.JobOptionsType = "NONE"
    theApp.EvtSel = "NONE"
    theApp.Dlls = ["GaudiAlg", "MiniNtuple"]

    myNtp = theApp.algorithm("TMiniNtuple")
    myNtp.InputFileName = inputFiles
    myNtp.OutputFileName = outputFile
    myNtp.Debug = False
    myNtp.ApplyLeptonSkim = True
    myNtp.MinLeptonPt = 9000.

    theApp.topAlg = ["TMiniNtuple"]

    theApp.config()
    theApp.initialize()
    theApp.run(1)
    theApp.exit()
示例#2
0
def main():
    import sys
    import user
    import glob
    import os

    fpath = '/UserDisk2/othrif/data/MiniNtuple/v44-3/'
    #    folder = sys.argv[1]
    filename = sys.argv[1]

    # output
    #    outputFile = os.path.join(fpath, 'user.othrif.'+filename)
    outputFile = os.path.join(fpath, filename)

    # input
    path = os.path.join('/UserDisk2/othrif/data/Ximo/v44-3/' + filename)
    inputFiles = glob.glob(path)

    #    outputFile = "/tmp/test_out1.root"
    #    inputFiles = glob.glob('/UserDisk2/othrif/susy/mc_method/Ximo.v18/user.jpoveda.t0616_v18.00270816.physics_Main.DAOD_SUSY2.f611_m1463_p2375_output.root/*.root')
    #   inputFiles = glob.glob('/UserDisk2/othrif/susy/test/mc15_13TeV.370602.MGPy8EG_A14N23LO_NUHM2_m12_400_strong.merge.DAOD.e4209_a766_a777_r6282.root')

    #    filename = sys.argv[1]
    # output
    #    outputFile = "/tmp/test_out1.root"
    #    outputFile = '/tmp/',filename,'.root'
    # input
    #    inputFiles = glob.glob('/users/orifki/workarea/susy_ss3l/input/user.jpoveda.5286937._000001.output.root')
    #    inputFiles = glob.glob('/data3/orifki/gtt_above_diag_FULL/validation/mc12_8TeV.156581.Herwigpp_UEEE3_CTEQ6L1_Gtt_G1100_T2500_L200.merge.NTUP_SUSY.e1221_s1469_s1470_r3542_r3549_p1328_tid01151387_00/NTUP_SUSY.01151387._000001.root.1')

    # run over data
    #    inputFiles = glob.glob('/data3/orifki/susy/cutflow/user.jpoveda.t0609_v12.00266904.physics_Main.DAOD_SUSY9.f594_m1435_p2361_output.root.30695488/user.jpoveda.5632900._000001.output.root')
    #    inputFiles = glob.glob('/afs/cern.ch/user/o/othrif/data/user.jpoveda.t0609_v12.00266904.physics_Main.DAOD_SUSY9.f594_m1435_p2361_output.root.30695488/user.jpoveda.5632900._000001.output.root')

    #    inputFiles = glob.glob('/afs/cern.ch/user/o/othrif/data/user.jpoveda.t0609_v12.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.DAOD_SUSY1.s2608_r6633_p2353_output.root.*/*.root')

    #    inputFiles = glob.glob('/UserDisk2/othrif/susy/mc_method/user.jpoveda.t0615_v17.00266904.physics_Main.DAOD_SUSY9.r6847_p2358_p2361_output.root/*.root')

    #    inputFiles = glob.glob('/UserDisk2/othrif/susy/mc_method/user.jpoveda.t0616_v18.410067.MadGraphPythia8EvtGen_A14NNPDF23LO_ttW_Np1.DAOD_SUSY2.s2608_r6793_p2375_output.root/user.jpoveda.6120928._000001.output.root')

    #    inputFiles = glob.glob('/UserDisk2/othrif/susy/mc_method/user.jpoveda.t0615_v17.361106.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zee.DAOD_SUSY2.s2576_r6630_p2375_output.root/*.root')

    from GaudiPython import AppMgr
    theApp = AppMgr()
    theApp.EvtMax = 100
    # Verboseness threshold level: 0=NIL,1=VERBOSE, 2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL, 7=ALWAYS
    #    theApp.outputLevel = 4
    #    MessageSvc.OutputLevel = 4
    #    EventSelector.OutputLevel = 4
    theApp.JobOptionsType = "NONE"
    theApp.EvtSel = "NONE"
    theApp.Dlls = ["GaudiAlg", "MiniNtuple"]

    myNtp = theApp.algorithm("TMiniNtuple")
    myNtp.InputFileName = inputFiles
    myNtp.OutputFileName = outputFile
    myNtp.Debug = False
    myNtp.ApplyLeptonSkim = True
    myNtp.MinLeptonPt = 13000.

    theApp.topAlg = ["TMiniNtuple"]

    theApp.config()
    theApp.initialize()
    theApp.run(1)
    theApp.exit()
示例#3
0
# "execute" the configuration script generated (if any)
from Gaudi.Configuration import logging
if options:
    g = {}
    l = {}
    exec "from Gaudi.Configuration import *" in g, l
    for o in options:
        logging.debug(o)
        exec o in g, l

## Instantiate application manager
from GaudiPython.Bindings import AppMgr
appMgr = AppMgr()
evtSel = appMgr.evtSel()
evtSel.OutputLevel = 1
mainSeq = appMgr.algorithm("EscherSequencer")
print evtSel.Input

for i in range(opts.numiter):
    print "Iteration nr: ", i
    mainSeq.Enable = False
    evtSel.rewind()
    mainSeq.Enable = True
    # steer the monitor sequence depending on the iteration
    appMgr.algorithm('AlignMonitorSeq').Enable = (i == 0)
    appMgr.algorithm('Moni').Enable = (i == 0)
    if opts.numiter > 1:
        appMgr.algorithm('AlignPostMonitorSeq').Enable = (i == opts.numiter -
                                                          1)

    resetHistos("AlignSensors")
示例#4
0
class EventWriter(Task):
    def __init__(self, name, queues, condition):
        Task.__init__(self, name)
        self._inQueue = queues[0]
        self._outQueue = queues[1]
        self._condition = condition
        self._config = dict()

    def configure(self, configuration):
        # Configure the writing process
        from Configurables import LHCbApp
        for (attr, value) in configuration.items():
            if hasattr(LHCbApp, attr):
                setattr(LHCbApp, attr, value)
            self._config[attr] = value

        if not 'Output' in self._config:
            print "An output filename must be specified."
            raise Exception

        if not 'Input' in self._config:
            print "Input must be specified."
            raise Exception

        EventDataSvc().RootCLID = 1
        from Configurables import LHCb__RawDataCnvSvc as RawDataCnvSvc
        EventPersistencySvc().CnvServices.append(
            RawDataCnvSvc('RawDataCnvSvc'))

        EventSelector().Input = self._config['Input']
        EventSelector().PrintFreq = 100
        FileCatalog().Catalogs = self._config['Catalogs']

        from Configurables import LHCb__MDFWriter as MDFWriter
        writer = MDFWriter('MDFWriter',
                           Compress=0,
                           ChecksumType=1,
                           GenerateMD5=True,
                           Connection=self._config['Output'])
        writer.OutputLevel = INFO
        ApplicationMgr().OutStream = [writer]

    def initialize(self):
        # Initialize the application manager
        self._appMgr = AppMgr()
        self._appMgr.initialize()
        # Disable the execution of the MDFWriter
        algo = self._appMgr.algorithm('MDFWriter')
        self._appMgr.algorithm('MDFWriter').Enable = False

    def run(self):
        # Run the required number of events
        nEvents = self._config['EvtMax']
        event = 0

        nWait = self._config['NPrevious']
        wait = 0

        while True:
            write = self._inQueue.get()
            if type(write) == type(""):
                if write == "DONE":
                    # self.notify()
                    break
            if write == True:
                self._appMgr.algorithm('MDFWriter').Enable = True
                # Write the events
                sc = self._appMgr.run(wait + 1)
                if sc == FAILURE:
                    # No more events in input
                    break
                wait = 0
                self._appMgr.algorithm('MDFWriter').Enable = False
                # print "Writing event " + str( event )
                # self._appMgr.algorithm('MDFWriter').execute()
            else:
                if wait < nWait:
                    wait += 1
                else:
                    sc = self._appMgr.run(1)
                    if sc == FAILURE:
                        # No more events in input
                        break

            # Notify the main program
            self.notify()
            event += 1

    def finalize(self):
        self._appMgr.exit()

    def notify(self):
        self._condition.acquire()
        self._condition.notify()
        self._condition.release()