Exemple #1
0
def insertDump(seq, entry, outputname):
    dumpAlgs = []
    from Configurables import EventNodeKiller
    dumpAlgs += [EventNodeKiller("killForDump")]
    EventNodeKiller("killForDump").Nodes = Gaudi.Excise['killAtLeast']
    from Configurables import OutputStream, InputCopyStream
    dump = OutputStream("DumpEverything")
    dump.ItemList = Gaudi.Excise['copyNodes']
    from GaudiConf import IOHelper
    dumpAlgs += IOHelper().outputAlgs(outputname, dump, writeFSR=True)
    return insertSomething(seq, entry, dumpAlgs)
    def _defineMonitors(self):
        if self.getProp("KillDAQ"):
            from Configurables import EventNodeKiller
            daqKiller = EventNodeKiller("DAQKiller")
            daqKiller.Nodes += ["DAQ"]
            ApplicationMgr().TopAlg += [daqKiller]
        ApplicationMgr().TopAlg += ["PrintHeader"]
        ApplicationMgr().ExtSvc += ["ToolSvc", "DataOnDemandSvc"]

        if self.getProp("LoadAll"):
            from Configurables import StoreExplorerAlg, TESFingerPrint
            storeExp = StoreExplorerAlg(Load=True,
                                        PrintFreq=1,
                                        ExploreRelations=1)
            fingerPrint = TESFingerPrint(HeuristicsLevel="Medium",
                                         OutputLevel=1)
            ApplicationMgr().TopAlg += [storeExp, fingerPrint]

        if self.getProp("DataContent").upper() == "DST":
            from Configurables import DumpTracks
            dumpTracks = DumpTracks(OutputLevel=2)
            ApplicationMgr().TopAlg += ["DumpTracks"]
            DstConf().EnableUnpack = ["Reconstruction", "Stripping"]

        if self.getProp("WithMC"):
            DigiConf().EnableUnpack = True
            SimConf().EnableUnpack = True
            ApplicationMgr().TopAlg += ["DumpMCEventAlg"]

        if self.getProp("DataContent").upper() == "SIM":
            ApplicationMgr().TopAlg += ["DumpHepMC"]
Exemple #3
0
    def _doWritePOOL(self, dType, writer):
        """
        Write a file in POOL format
        """
        log.info("%s.ItemList    = %s" %
                 (self.getProp("Writer"), writer.ItemList))
        log.info("%s.OptItemList = %s" %
                 (self.getProp("Writer"), writer.OptItemList))

        # In Minimal case, need to kill some nodes
        if dType == "Minimal":
            from Configurables import EventNodeKiller
            nodeKiller = EventNodeKiller("POOLNodeKiller")
            ApplicationMgr().OutStream.insert(0, nodeKiller)
            nodeKiller.Nodes += ["Link"]
            simDir = "MC"
            if self.getProp("EnablePack"): simDir = "pSim"
            nodeKiller.Nodes += [simDir + "/MCParticles"]
            nodeKiller.Nodes += [
                simDir + "/Velo", simDir + "/PuVeto", simDir + "/TT",
                simDir + "/IT", simDir + "/OT", simDir + "/Rich",
                simDir + "/Prs", simDir + "/Spd", simDir + "/Ecal",
                simDir + "/Hcal", simDir + "/Muon", simDir + "VP",
                simDir + "UT", simDir + "FT"
            ]
            nodeKiller.Nodes += self.KnownSpillPaths
Exemple #4
0
    def configureInput(self, inputType):
        """
        Tune initialisation according to input type
        """

        # 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

        if self._isReprocessing(inputType):
            # Kill knowledge of any previous Brunel processing
            from Configurables import ( TESCheck, EventNodeKiller )
            InitReprocSeq = GaudiSequencer( "InitReprocSeq" )
            if ( self.getProp("WithMC") and inputType in ["XDST","DST"] ):
                # Load linkers, to kill them (avoid appending to them later)
                InitReprocSeq.Members.append( "TESCheck" )
                TESCheck().Inputs = ["Link/Rec/Track/Best"]
            killer = EventNodeKiller()
            killer.Nodes += [ "Raw", "Link/Rec" ]
            if self.getProp("SkipTracking"):
                killer.Nodes += [ "pRec/Rich", "pRec/Muon", "pRec/Calo", "pRec/Track/Muon", "pRec/ProtoP" ]
            else:
                killer.Nodes += [ "pRec", "Rec" ]
            InitReprocSeq.Members.append( killer )
            ### see configureOutput to see how the remainder of the juggler is configured
            
        # Get the event time (for CondDb) from ODIN
        from Configurables import EventClockSvc
        EventClockSvc().EventTimeDecoder = "OdinTimeDecoder";
Exemple #5
0
    def patSeq(self, outputLevel=INFO):
        if not allConfigurables.get("PatSeq"):
            if outputLevel == VERBOSE:
                print "VERBOSE: Pat Sequencer not defined! Defining!"

            patSequencer = GaudiSequencer("PatSeq")
            patSequencer.MeasureTime = True

            from Configurables import (TESCheck, EventNodeKiller)

            patSequencer.Members.append(
                TESCheck(Inputs=["Link/Rec/Track/Best"], Stop=False))
            patSequencer.Members.append(
                EventNodeKiller(Nodes=["Rec", "Raw", "Link/Rec"]))

            patSequencer.Members.append(
                GaudiSequencer("RecoVELOSeq", MeasureTime=True))
            patSequencer.Members.append(
                GaudiSequencer("RecoTTSeq", MeasureTime=True))
            patSequencer.Members.append(
                GaudiSequencer("RecoITSeq", MeasureTime=True))
            patSequencer.Members.append(
                GaudiSequencer("RecoOTSeq", MeasureTime=True))
            patSequencer.Members.append(
                GaudiSequencer("RecoTrSeq", MeasureTime=True))
            patSequencer.Members.append(
                GaudiSequencer("RecoVertexSeq", MeasureTime=True))

            #importOptions("$TRACKSYSROOT/options/RecoTracking.py")
            #importOptions("$TALIGNMENTROOT/options/PatRecognition.opts")

            from Configurables import TrackRemoveDoubleHits
            if allConfigurables.get("TrackForwardPatSeq"):
                trackFwdPatSeq = GaudiSequencer("TrackForwardPatSeq")
                trackRemoveDoubleHitsFwd = TrackRemoveDoubleHits(
                    "FwdRemoveDoubleHits")
                trackRemoveDoubleHitsFwd.TracksLocation = "Rec/Track/Forward"
                trackFwdPatSeq.Members.append(trackRemoveDoubleHitsFwd)

            if allConfigurables.get("TrackMatchPatSeq"):
                trackMatchPatSeq = GaudiSequencer("TrackMatchPatSeq")
                trackRemoveDoubleHitsMatch = TrackRemoveDoubleHits(
                    "MatchRemoveDoubleHits")
                trackRemoveDoubleHitsMatch.TracksLocation = "Rec/Track/Match"
                trackMatchPatSeq.Members.append(trackRemoveDoubleHitsMatch)

            from Configurables import (PatPVOffline)
            allConfigurables["RecoVertexSeq"].Members.append(PatPVOffline())

            return patSequencer
        else:
            if outputLevel == VERBOSE:
                print "VERBOSE: Pat Sequencer already defined!"
            return allConfigurables.get("PatSeq")
def ReStrip(mylines, stripping="stripping21r0p1", streamname=None):

    from Configurables import EventNodeKiller, ProcStatusCheck
    from StrippingArchive.Utils import buildStreams
    from StrippingArchive import strippingArchive
    from StrippingConf.Configuration import StrippingStream
    from StrippingConf.Configuration import StrippingConf
    from StrippingSettings.Utils import strippingConfiguration

    NodeKiller = EventNodeKiller("StripKiller")
    NodeKiller.Nodes = ["/Event/AllStreams", "/Event/Strip"]

    from StrippingSelections import buildersConf
    from StrippingSelections.Utils import lineBuilder, buildStreamsFromBuilder

    config = strippingConfiguration(stripping)
    archive = strippingArchive(stripping)
    streams = buildStreams(stripping=config, archive=archive)

    #confs = buildersConf()

    mystream = StrippingStream("MyStream")
    #for name in confnames:
    #    streams = buildStreamsFromBuilder(confs,name)
    for stream in streams:
        #if streamname not in stream : continue
        for line in stream.lines:
            print line
            if line.name() in mylines:
                print "Adding ", line.name(), "for restripping"
                mystream.appendLines([line])

    restrip = StrippingConf(Streams=[mystream],
                            MaxCandidates=2000,
                            AcceptBadEvents=False,
                            BadEventSelection=ProcStatusCheck(),
                            TESPrefix='Strip',
                            ActiveMDSTStream=True)
    #Verbose = True,
    #MicroDSTStreams = streams )
    return restrip, [NodeKiller, restrip.sequence()]
 def redoMCLinks(self,init):
     """
     Redo MC links.
     """
     
     if ( self.getProp("Simulation") ):
         redo = self.getProp("RedoMCLinks")
         if ( redo ):
             from Configurables import (GaudiSequencer,TESCheck,EventNodeKiller,TrackAssociator)
             mcKillSeq = GaudiSequencer("KillMCLinks") # The sequence killing the node of it exists
             tescheck = TESCheck("DaVinciEvtCheck")    # Check for presence of node ...
             tescheck.Inputs = ["Link/Rec/Track/Best"] # 
             tescheck.Stop = False                     # But don't stop
             tescheck.OutputLevel = 5                  # don't print warnings
             evtnodekiller = EventNodeKiller("DaVinciEvtNodeKiller") # kill nodes
             evtnodekiller.Nodes = ["Link/Rec/Track"]        # Kill that
             mcKillSeq.Members = [ tescheck, evtnodekiller, TrackAssociator() ]                  
             mcLinkSeq = GaudiSequencer("RedoMCLinks") # The sequence redoing the links
             mcLinkSeq.IgnoreFilterPassed = True       # Run it always
             mcLinkSeq.Members = [ mcKillSeq, TrackAssociator() ]  
             init.Members += [ mcLinkSeq ]
Exemple #8
0
    def configureInput(self, inputType):
        """
        Tune initialisation according to input type
        """

        # POOL Persistency, now in LHCbApp
        #importOptions("$GAUDIPOOLDBROOT/options/GaudiPoolDbRoot.opts")

        # By default, Escher 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

        if inputType in ["XDST", "DST", "RDST", "ETC"]:
            # Kill knowledge of any previous Brunel processing
            from Configurables import (TESCheck, EventNodeKiller)
            InitReprocSeq = GaudiSequencer("InitReprocSeq")
            if (self.getProp("WithMC") and inputType in ["XDST", "DST"]):
                # Load linkers, to kill them (avoid appending to them later)
                InitReprocSeq.Members.append("TESCheck")
                TESCheck().Inputs = ["Link/Rec/Track/Best"]
            InitReprocSeq.Members.append("EventNodeKiller")
            EventNodeKiller().Nodes = ["pRec", "Rec", "Raw", "Link/Rec"]

        if inputType == "ETC":
            raise DeprecationWarning, "ETC are no longer supported by LHCb software"
            from Configurables import TagCollectionSvc
            ApplicationMgr().ExtSvc += [TagCollectionSvc("EvtTupleSvc")]
            # Read ETC selection results into TES for writing to DST
            IODataManager().AgeLimit += 1

        #if inputType in [ "MDF", "RDST", "ETC" ]:
        #    # In case raw data resides in MDF file
        #    EventPersistencySvc().CnvServices.append("LHCb::RawDataCnvSvc")
        DecodeRawEvent()

        if self.getProp("UseFileStager"):
            import os, getpass
            from FileStager.Configuration import configureFileStager
            from Configurables import FileStagerSvc
            configureFileStager(keep=True)
            targetdir = '/tmp/' + getpass.getuser() + '/stagedfiles'
            if os.path.isdir('/pool/spool/'):
                targetdir = '/pool/spool/' + getpass.getuser() + '/stagedfiles'
            if not os.path.isdir(targetdir):
                os.makedirs(targetdir)
            FileStagerSvc().Tempdir = targetdir
Exemple #9
0
    def addMCDigitSummaries(self, writer):
        simDir = "MC"
        if ((self.getProp("EnablePack"))
                and ("Rich" in self.getProp("Detectors"))):
            simDir = "pSim"
            packDigi = self.getProp("PackSequencer")
            from Configurables import DataPacking__Pack_LHCb__MCRichDigitSummaryPacker_
            RichSumPack = DataPacking__Pack_LHCb__MCRichDigitSummaryPacker_(
                "MCRichDigitSummaryPacker")
            packDigi.Members += [RichSumPack]
            # Kill the unpacked Rich node
            from Configurables import EventNodeKiller
            nodeKiller = EventNodeKiller("MCRichNodeKiller")
            nodeKiller.Nodes += ["MC/Rich"]
            packDigi.Members += [nodeKiller]

        # Digitization summaries
        if "Rich" in self.getProp("Detectors"):
            writer.ItemList += ["/Event/" + simDir + "/Rich/DigitSummaries#1"]
        if "Muon" in self.getProp("Detectors"):
            writer.ItemList += ["/Event/MC/Muon/DigitsInfo#1"]
Exemple #10
0
def killDAQ(nodes=['/Event/DAQ', '/Event/pRec'], logger=None):
    """
    Configure node killing agents for uDST processing
    """
    #
    if not logger: logger = log
    #
    from Configurables import EventNodeKiller
    killer = EventNodeKiller("KillDAQ")

    for node in nodes:
        if node in killer.Nodes: continue
        killer.Nodes.append(node)

    try:
        from Gaudi.Configuration import getConfigurable
        conf = getConfigurable('DaVinciEventInitSeq')
        conf.Members.insert(0, killer)
        logger.info("Add           killer agent for: %s" % killer.Nodes)
    except:
        logger.error("Failed to add killer agent for: %s" % killer.Nodes)
#
#  an options file to read data and create an ntuple.
#
########################################################################

from Gaudi.Configuration import *
from Configurables import DecayTreeTuple, TupleToolTrigger, TupleToolDecay, SubstitutePID
from Configurables import LoKi__Hybrid__TupleTool, TupleToolDecayTreeFitter, TupleToolTISTOS
from Configurables import LoKi__Hybrid__EvtTupleTool, TupleToolEventInfo, TupleToolTrackIsolation
from Configurables import TupleToolMCTruth, TupleToolTrackInfo, TupleToolRICHPid, TupleToolMuonPid, TupleToolPid, TupleToolGeometry
from Configurables import DaVinci
from Configurables import PrintDecayTree
from DecayTreeTuple.Configuration import *

from Configurables import EventNodeKiller
NodeKiller = EventNodeKiller('NodeKiller')
NodeKiller.Nodes = ['DAQ', 'pRec']

#teslocation = "/Event/AllStreams/" #change to this for MC

teslocation = "/Event/Bhadron/"  #change to this for Data

#
#Momentum scale correction
#

from Configurables import TrackScaleState

scaler = TrackScaleState('Scaler', RootInTES=teslocation)
#    ScaleSlope = 1 - 1.0e-3 ,
#    DeltaSlope = 0.9e-3 ,
Exemple #12
0
    def __apply_configuration__(self):
        #make sure the dictionaries are there... Hack! %TODO -> Remove this!
        RawEventFormatConf().loadIfRequired()
        #then get them ...
        locs, rec = _getDict()
        added_locations = []

        if not self.isPropertySet("Output") or not self.isPropertySet("Input"):
            raise AttributeError(
                "You must set both the input and the output version, this can be a version number (float, int) or a name, see: "
                + rec.__str__())

        #swap logical for numeric, and check it exists
        ov = _checkv(self.getProp("Output"), locs, rec)
        iv = _checkv(self.getProp("Input"), locs, rec)

        output_locations = ReverseDict(ov, locs, rec)
        input_locations = ReverseDict(iv, locs, rec)
        #check if a Trigger TCK is needed

        if len([
                loc for loc in input_locations
                if self.getProp("TCKReplacePattern") in loc
        ]) or len([
                loc for loc in output_locations
                if self.getProp("TCKReplacePattern") in loc
        ]):
            if (not self.isPropertySet("TCK")) and (
                    not RawEventFormatConf().isPropertySet("TCK")):
                raise AttributeError(
                    "The raw event version you specified requires a TCK to be given. Set RawEventJuggler().TCK"
                )
        for prop in ["TCK", "GenericReplacePatterns", "TCKReplacePattern"]:
            self.__safeset__(RawEventFormatConf(), prop)

        killBefore = []
        loc_to_alg_dict = {}
        killAfter = []

        ######################################
        # Stage 1: KillBefore if requested
        ######################################
        if self.isPropertySet("KillInputBanksBefore"):
            from Configurables import bankKiller
            #if KillBanks or KillNodes... has been requested, I can't use DoD, it's unsafe. I don't know what's "before" and "after"
            if self.getProp("DataOnDemand"):
                raise AttributeError(
                    "You have asked for some killing of banks, and asked for DoD, which is not a safe way to run. Either cope with the extra banks, or use a sequencer instead of DoD"
                )
            import re
            for loc in input_locations:
                #see if this location has banks to kill
                killBanks = [
                    abank for abank in input_locations[loc]
                    if re.match(self.getProp("KillInputBanksBefore"), abank)
                ]
                if not len(killBanks):
                    continue
                loc = _replaceWrap(loc)
                bk = bankKiller(
                    ("kill_" + loc.replace("/", "_") + "_Before").replace(
                        "__", "_"))
                killBefore.append(bk)
                bk.RawEventLocations = [loc]
                bk.BankTypes = killBanks

        ##################################
        # The part which does the juggling
        ##################################
        if iv != ov:
            ######################################
            # Stage 2: Check options
            ######################################
            #if a bank is needed to be added to an existing location, I can't do that.
            for loc in input_locations:
                if loc in output_locations:
                    for abank in output_locations[loc]:
                        if abank not in input_locations[loc]:
                            print "# WARNING, don't know how to add new bank " + abank + " to existing location " + loc + " ...skipping..."
                            output_locations[loc].remove(abank)
            #if banks need to be juggled, tell me how to do it, sequencer or DoD
            if not (self.getProp("DataOnDemand")
                    or self.isPropertySet("Sequencer")):
                raise AttributeError(
                    "You have asked for some juggling, but not told me where to put the algorithms. Set either DataOnDemand or pass a Sequencer"
                )
            #if banks need to be juggled, tell me how to do it, sequencer or DoD
            if self.getProp("DataOnDemand") and self.isPropertySet(
                    "Sequencer"):
                raise AttributeError(
                    "You asked for DoD and also gave a sequencer, I can't do both at the same time"
                )

            #if KillBanks or KillNodes... has been requested, I can't use DoD, it's unsafe. I don't know what's "before" and "after"
            if self.getProp("DataOnDemand") and (
                    self.getProp("KillExtraNodes")
                    or self.isPropertySet("KillInputBanksBefore")
                    or self.isPropertySet("KillInputBanksAfter")
                    or self.getProp("KillExtraBanks")):
                raise AttributeError(
                    "You have asked for some killing of banks, and asked for DoD, which is not a safe way to run. Either cope with the extra banks, or use a sequencer instead of DoD"
                )
            if self.getProp("KillExtraDirectories"
                            ) and not self.getProp("KillExtraNodes"):
                raise AttributeError(
                    "In order to kill extra directories, you must also be killing the extra nodes (raw events)"
                )
            #raise import error if you don't have the correct requirements
            from Configurables import RawEventMapCombiner, EventNodeKiller, bankKiller

            ###############################################
            # Stage 3: Recombine banks from given locations
            ###############################################

            #for each new location, add a RawEventMapCombiner to the DoD or to the sequencer
            loc_to_alg_dict = {}
            for loc in output_locations:
                if loc not in input_locations:
                    #if none of the banks are available, skip
                    if len([
                            abank for abank in output_locations[loc]
                            if abank in locs[iv]
                    ]) == 0:
                        print "#WARNING, nowhere to copy any banks for " + loc + " from, skipping"
                        continue
                    wloc = _replaceWrap(loc)
                    loc_to_alg_dict[wloc] = RawEventMapCombiner(
                        ("create_" + wloc.replace("/", "_")).replace(
                            "__", "_").rstrip("_"))
                    loc_to_alg_dict[wloc].OutputRawEventLocation = wloc
                    loc_to_alg_dict[wloc].RawBanksToCopy = {}

                    added_locations.append(wloc)

                    for abank in output_locations[loc]:
                        if abank not in locs[iv]:
                            print "#WARNING, nowhere to copy " + abank + " from, skipping"
                            continue
                        loc_to_alg_dict[wloc].RawBanksToCopy[
                            abank] = WhereBest(abank, iv, locs, rec)

            ###############################################
            # Stage 4: Clean up, kill after if requested
            ###############################################

            killAfter = []
            if self.isPropertySet("KillInputBanksAfter") or self.getProp(
                    "KillExtraBanks"):
                import re
                for loc in input_locations:
                    #see if this location has banks to kill
                    killBanks = []
                    if self.isPropertySet("KillInputBanksAfter"):
                        killBanks += [
                            abank
                            for abank in input_locations[loc] if re.match(
                                self.getProp("KillInputBanksAfter"), abank)
                        ]
                    if self.getProp("KillExtraBanks"):
                        killBanks += [
                            abank for abank in input_locations[loc]
                            if (loc in output_locations
                                and abank not in output_locations[loc])
                        ]
                    if not len(killBanks):
                        continue
                    loc = _replaceWrap(loc)
                    bk = bankKiller(
                        ("kill_" + loc.replace("/", "_") + "_After").replace(
                            "__", "_"))
                    killAfter.append(bk)
                    bk.RawEventLocations = [loc]
                    bk.BankTypes = killBanks

            #for each missing location, kill that location?
            if self.getProp("KillExtraNodes"):
                if len([
                        loc for loc in input_locations
                        if loc not in output_locations
                ]) > 0:
                    enk = EventNodeKiller("KillRawEventNodes")
                    enk.Nodes = []
                    killAfter.append(enk)
                    for loc in input_locations:
                        if loc not in output_locations:
                            enk.Nodes.append(_replaceWrap(loc))
                            if self.getProp("KillExtraDirectories"):
                                dloc = loc.replace("/RawEvent", "")
                                flags = [
                                    o.startswith(dloc)
                                    for o in output_locations
                                ]
                                if (True not in flags) and (dloc
                                                            not in enk.Nodes):
                                    enk.Nodes.append(_replaceWrap(dloc))

        elif self.isPropertySet("KillInputBanksAfter") or self.getProp(
                "KillExtraNodes") or self.isPropertySet("KillExtraBanks"):
            raise AttributeError(
                "You've asked to kill something from the input *after* copying, but you aren't actually doing any copying. Please kill them yourself without this configurable, or use KillInputBanksBefore!"
            )

        ###############################################
        # Stage 5: Add to sequence or DoD
        ###############################################
        if self.getProp("DataOnDemand"):
            if len(loc_to_alg_dict):
                from Configurables import DataOnDemandSvc
                ApplicationMgr().ExtSvc = ["DataOnDemandSvc"] + [
                    svc for svc in ApplicationMgr().ExtSvc
                    if svc is not "DataOnDemandSvc"
                ]
                for loc in loc_to_alg_dict:
                    DataOnDemandSvc().AlgMap[loc] = loc_to_alg_dict[loc]
        else:
            for alg in killBefore:
                self.getProp("Sequencer").Members.append(alg)
            for loc in loc_to_alg_dict:
                self.getProp("Sequencer").Members.append(loc_to_alg_dict[loc])
            for alg in killAfter:
                self.getProp("Sequencer").Members.append(alg)

        ###############################################
        # Stage 6: now handle the writers if appended
        ###############################################
        if self.isPropertySet("WriterOptItemList"):
            self.getProp("WriterOptItemList").OptItemList += self.__opWrap__(
                output_locations.keys())
        if self.isPropertySet("WriterItemList"):
            self.getProp("WriterItemList").ItemList += self.__opWrap__(
                output_locations.keys())
def execute_option_file(path):
    # ================= BEGIN EDIT AREA =======================
    tuplename = "Bu2LLK_meLine"
    simulation_inputstring = "/Event/AllStreams/Phys/Bu2LLK_meLine/Particles"
    data_inputstring = "/Event/Leptonic/Phys/Bu2LLK_meLine/Particles"

    decaydescriptor = "[B+ -> ^[J/psi(1S) -> ^mu+ ^e-]CC ^K+]CC"
    branches = {    # Dictionary for the branches to write in the tuple
        "B"         : "[B+ -> [J/psi(1S) -> mu+ e-]CC K+]CC",
        "Psi"       : "[B+ -> ^[J/psi(1S) -> mu+ e-]CC K+]CC",
        "muplus"    : "[B+ -> [J/psi(1S) -> ^mu+ e-]CC K+]CC",
        "eminus"    : "[B+ -> [J/psi(1S) -> mu+ ^e-]CC K+]CC",
        "Kplus"     : "[B+ -> [J/psi(1S) -> mu+ mu-]CC ^K+]CC"
    }

    toollist = [
                "TupleToolBremInfo"       #Bremsstrahlung information
                , "TupleToolGeometry"       #geometry of vertex locations (ENDVERTEX, OWNPV, IP_OWNPV, FD_OWNPV, DIRA_OWNPV)
                , "TupleToolKinematic"      #kinematic variables (inv. mass MM, kin. mass M/sqrt(E^2-p^2), P, PX/Y/Z/E, PT)
                , "TupleToolEventInfo"      #Event information such as run number, polarity, GPS time etc.
                , "TupleToolPropertime"     #proper lifetime of reconstructed particles
                , "TupleToolAngles"        #decay angles of charged tracks
                , "TupleToolTrigger"
                , "TupleToolTrackInfo"      #GhostProb of track and track type (TYPE) - 0 = unknown, 1 = velo track...
                , "TupleToolPrimaries"      #Number and coordinates of all primary vertices
                , "TupleToolDira"
                , "TupleToolTrackPosition"  #Plot the X/Y position at a given Z (default: 2500 = TTstation)
                , "TupleToolRecoStats"
                , "TupleToolBremInfo"       #Bremsstrahlung information
                , "TupleToolIsolationTwoBody"  #degree of isolation of two particles with common mother from Bsmumu
                , "TupleToolANNPID"         #V2,V3,... ProbNN variables
                #, "TupleToolCaloHypo"
                #, "TupleToolL0Calo"
                ]
    # ================= END EDIT AREA =======================




    # ================= BEGIN DO NOT EDIT HERE =======================
    from Configurables import GaudiSequencer
    MySequencer = GaudiSequencer('Sequence')



    #Check whether it is a DST or MDST file
    import os.path
    extension = os.path.splitext(path)[1]
    print extension
    if extension.lower() == ".dst":
        DaVinci().InputType = 'DST'
    elif extension.lower() == ".mdst":
        DaVinci().InputType = 'MDST'
    else:
        raise Exception("Extension {extension} of {path} does not match .mdst or .dst".format(extension, path))

    #Kill some nodes if micro dst-file
    if DaVinci().InputType == 'MDST':
        from Configurables import EventNodeKiller
        eventNodeKiller = EventNodeKiller('DAQkiller')
        eventNodeKiller.Nodes = ['/Event/DAQ','/Event/pRec']
        MySequencer.Members+=[eventNodeKiller]



    #DecayTreeTuple -> Fills information about particles, vertices and daughters
    ntuple = DecayTreeTuple(tuplename)



    if DaVinci().Simulation is True: # for MC
        ntuple.Inputs = [simulation_inputstring]
    elif DaVinci().Simulation is False: # for Tuple
        ntuple.Inputs = [data_inputstring]
    else:
        raise Exception(" `DaVinci().Simulation` not set.")

    ntuple.Decay = decaydescriptor
    ntuple.addBranches(branches)

    ntuple.TupleName = "DecayTree"


    #Tools added to the ToolList can not be modified i.e. no other options than the defaults can be used
    ntuple.ToolList = toollist

    MySequencer.Members.append(ntuple)





    # ================= BEGIN EDIT TUPLETOOLS WITH OPTIONS ==================

    # LOKI TupleTool
    LoKi = ntuple.addTupleTool("LoKi::Hybrid::TupleTool")
    LoKi.Variables =  {
        "ETA" : "ETA",
        "PHI" : "PHI"       #Azimuthal angle
    }


    #Isolation tool from Alex
    weightsfolder = ""
    if(True):
        from Configurables import TupleToolApplyIsolation
        ntuple.B.addTupleTool(TupleToolApplyIsolation, name="TupleToolApplyIsolationHard")
        ntuple.B.TupleToolApplyIsolationHard.OutputSuffix="_Hard"
        ntuple.B.TupleToolApplyIsolationHard.WeightsFile= weightsfolder+"weightsHard.xml"
        ntuple.B.addTupleTool(TupleToolApplyIsolation, name="TupleToolApplyIsolationSoft")
        ntuple.B.TupleToolApplyIsolationSoft.OutputSuffix="_Soft"
        ntuple.B.TupleToolApplyIsolationSoft.WeightsFile= weightsfolder+"weightsSoft.xml"
        ntuple.B.addTupleTool("TupleToolVtxIsoln")
        #ntuple.B.TupleToolApplyIsolationHard.OutputLevel = 3
        #ntuple.B.TupleToolApplyIsolationSoft.OutputLevel = 3




    ################################
    ###   DaVinci configuration ####
    ################################

    DaVinci().UserAlgorithms = [MySequencer]
    DaVinci().MoniSequence += [ntuple]
    DaVinci().EvtMax     = 200
    DaVinci().SkipEvents = 0
    DaVinci().Lumi       = True
Exemple #14
0
 sc = StrippingConf(Streams=[stream],
                    MaxCandidates=2000,
                    AcceptBadEvents=False,
                    BadEventSelection=filterBadEvents)
 #Define the node killer, and make sure to kill everything corresponding to
 #the stream which we want to swim
 outputs = []
 for l in lines:
     for f in l.filterMembers():
         if not hasattr(f, 'Output'):
             continue
         # Remove the last item so we get everything (Particle, relations,
         # decayVertices, etc...
         o = '/'.join(f.Output.split('/')[:-1])
         outputs.append(o)
 mykiller = EventNodeKiller("killStripping")
 #Some default nodes which we will want to kill in all cases
 nodestokill = outputs + ['Strip', '/Event/Rec/Vertex/Primary']
 mykiller.Nodes = nodestokill
 deathstar = GaudiSequencer("killStrippingSeq")
 deathstar.Members = [mykiller]
 # Configure DaVinci
 DaVinci().InputType = 'DST'
 DaVinci().DataType = options.datatype
 DaVinci().Simulation = options.forMC
 DaVinci().DDDBtag = options.dddb
 DaVinci().CondDBtag = options.conddb
 # The sequence for the swimming has to be configured
 # by hand inserting the node killer before it
 DaVinci().appendToMainSequence([deathstar])
 DaVinci().appendToMainSequence([sc.sequence()])
    def configureInit(self, tae, initDets):
        """
        Set up the initialization sequence
        """
        # Start the DataOnDemandSvc ahead of ToolSvc
        ApplicationMgr().ExtSvc += ["DataOnDemandSvc"]
        ApplicationMgr().ExtSvc += ["ToolSvc"]

        ProcessPhase("Init").DetectorList.insert(
            0, "Boole")  # Always run Boole initialisation first!
        initBoole = GaudiSequencer("InitBooleSeq")
        initBoole.Members += ["BooleInit"]

        # Kept for Dirac backward compatibility
        if self.getProp("NoWarnings"):
            log.warning(
                "Boole().NoWarnings=True property is obsolete and maintained for Dirac compatibility. Please use Boole().ProductionMode=True instead"
            )
            self.setProp("ProductionMode", True)

        # Special settings for production
        if self.getProp("ProductionMode"):
            self.setProp("OutputLevel", ERROR)
            if not LHCbApp().isPropertySet("TimeStamp"):
                LHCbApp().setProp("TimeStamp", True)

        # OutputLevel
        self.setOtherProp(LHCbApp(), "OutputLevel")
        if self.isPropertySet("OutputLevel"):
            level = self.getProp("OutputLevel")
            if level == ERROR or level == WARNING:
                # Suppress known warnings
                importOptions("$BOOLEOPTS/SuppressWarnings.opts")
                # Additional information to be kept
                getConfigurable("BooleInit").OutputLevel = INFO

        # Do not print event number at every event (done already by BooleInit)
        EventSelector().PrintFreq = -1

        # Load the spillover branches, then kill those not required to prevent further access
        spillPaths = self.getProp("SpilloverPaths")
        killPaths = []
        if len(spillPaths) == 0:
            spillPaths = self.KnownSpillPaths
            self.setProp("SpilloverPaths", spillPaths)

        if self.getProp("UseSpillover"):
            if tae:
                killPaths = self.KnownSpillPaths
            else:
                self.setOtherProp(SimConf(), "SpilloverPaths")
                # Kill any spillover paths not required
                for spill in self.KnownSpillPaths:
                    if spill not in spillPaths:
                        killPaths.append(spill)
        else:
            # Kill all spillover paths
            killPaths = self.KnownSpillPaths

        from Configurables import EventNodeKiller, TESCheck
        spillLoader = TESCheck("SpilloverLoader")
        spillLoader.Inputs = spillPaths
        spillLoader.Stop = False  # In case no spillover on input file
        spillLoader.OutputLevel = ERROR
        spillKiller = EventNodeKiller("SpilloverKiller")
        spillKiller.Nodes = killPaths
        spillHandler = GaudiSequencer("SpilloverHandler")
        spillHandler.Members += [spillLoader, spillKiller]
        spillHandler.IgnoreFilterPassed = True  # In case no spillover on input file
        initBoole.Members += [spillHandler]

        if "Muon" in initDets:
            # Muon Background
            from Configurables import MuonBackground
            GaudiSequencer("InitMuonSeq").Members += [
                MuonBackground("MuonLowEnergy")
            ]
            importOptions("$MUONBACKGROUNDROOT/options/MuonLowEnergy-G4.opts")
            if not tae:
                flatSpillover = MuonBackground("MuonFlatSpillover")
                GaudiSequencer("InitMuonSeq").Members += [flatSpillover]
                if self.getProp("DataType") == "2010":
                    flatSpillover.NBXFullFull = 344
                if self.getProp("DataType") == "2009":
                    flatSpillover.NBXFullFull = 4
                importOptions(
                    "$MUONBACKGROUNDROOT/options/MuonFlatSpillover-G4.opts")
Exemple #16
0
stripTESPrefix = 'Strip'
from Configurables import ProcStatusCheck
sc = StrippingConf(Streams=[MyStream],
                   MaxCandidates=20000,
                   AcceptBadEvents=False,
                   BadEventSelection=ProcStatusCheck(),
                   TESPrefix=stripTESPrefix,
                   Verbose=True,
                   DSTStreams=dstStreams)

# So that we do not get all events written out
MyStream.sequence().IgnoreFilterPassed = False

#This deletes stripping objects from previous stripping versions in the DST file
from Configurables import EventNodeKiller
eventNodeKiller = EventNodeKiller('Stripkiller')
eventNodeKiller.Nodes = ['/Event/AllStreams', '/Event/Strip']

DaVinci().appendToMainSequence([eventNodeKiller, sc.sequence()])

##############################################################################################
##### HLT1 Emulation
##############################################################################################

relinfoutput = MyStream.outputLocations()[0].replace("Particles",
                                                     "HLT1Emulation")


def getVars(i, j):
    combination = str(i) + "_" + str(j)
    Vars = {
def ConfigureMoore():
    config = Swimming()
    from Swimming.HltTransforms import getTransform
    thisTransform = getTransform(
        config.getProp('TransformName'),
        config.getProp('Hlt1Triggers') + config.getProp('Hlt2Triggers'))

    from Configurables import (HltConfigSvc, EventNodeKiller,
                               HltMoveVerticesForSwimming, Moore)

    #Global configuration
    mykiller = EventNodeKiller("killHlt")
    mykiller.Nodes = config.getProp('HltNodesToKill')
    deathstar = GaudiSequencer("killHltSeq")
    deathstar.Members = [mykiller]
    from Swimming import MooreSetup
    #

    dddb = config.getProp('DDDBtag')
    conddb = config.getProp('CondDBtag')
    tck = config.getProp('TCK')
    run = config.getProp('RunNumber')
    if not dddb and not conddb and not tck and run:
        import shelve
        tag_db = os.path.expandvars(config.getProp('TagDatabase'))
        if not os.path.exists(tag_db):
            raise OSError, "Tag database file %s does not exist" % config.getProp(
                'TagDatabase')
        tag_db = shelve.open(tag_db, 'r')
        info = tag_db['info']
        tags = info[run]
        Moore().DDDBtag = tags['DDDBtag']
        Moore().CondDBtag = tags['CondDBtag']
        Moore().InitialTCK = tags['TCK']
        Swimming().TCK = tags['TCK']
    elif dddb and conddb and tck and not run:
        Moore().DDDBtag = dddb
        Moore().CondDBtag = conddb
        Moore().InitialTCK = tck
    else:
        raise TypeError, 'You must specify either the CondDB tag, DDDB tag and TCK and _not_ the run number' + \
              ' or only the run number.'

    Moore().Simulation = config.getProp('Simulation')
    Moore().DataType = config.getProp('DataType')
    Moore().outputFile = config.getProp('OutputFile')
    Moore().WriteFSR = config.getProp('WriteFSR')
    Moore().Persistency = config.getProp('Persistency')
    Moore().WriterRequires = []
    # Add extra locations to writer
    from Configurables import InputCopyStream
    writer = InputCopyStream('Writer')
    writer.ItemList = [config.getProp('SwimmingPrefix') + '/Reports#1']
    writer.OptItemList = list(
        set([
            l + '/P2TPRelations#1'
            for l in config.getProp('OffCands').values()
        ]))

    #
    # Define the TCK transformation
    #
    HltConfigSvc().ApplyTransformation = thisTransform
    from pprint import pprint
    pprint(HltConfigSvc().ApplyTransformation)
    #
    # Define the swimming algorithm
    #
    myswimmer = HltMoveVerticesForSwimming("HltMovePVs4Swimming")
    myswimmer.SwimmingDistance = 0.0
    loc = config.getProp(
        'SwimmingPrefix')  # TODO check differences with trunk more carefully
    myswimmer.Bcontainer = loc
    myswimmer.InputSelection = config.getProp('OnlinePV')
    myswimmer.OutputSelection = config.getProp('OutPVSel')
    myswimmer.OutputLevel = 4

    # Configure an extra TisTos Tool and some decoder algos to debug TisTos issues
    prefix = config.getProp('SwimmingPrefix')
    from Configurables import HltDecReportsDecoder, HltSelReportsDecoder
    decoders = [(HltDecReportsDecoder, [('OutputHltDecReportsLocation',
                                         'Hlt/DecReports')]),
                (HltSelReportsDecoder,
                 [('OutputHltSelReportsLocation', 'Hlt/SelReports'),
                  ('HltDecReportsLocation', 'Hlt/DecReports')])]
    from Configurables import TriggerTisTos
    ToolSvc().addTool(TriggerTisTos, 'SwimmingDebugTisTos')
    ToolSvc().SwimmingDebugTisTos.TOSFracMuon = 0.0
    ToolSvc().SwimmingDebugTisTos.TOSFracTT = 0.0
    for conf, d in decoders:
        configurable = conf('Swimming' + d[0][1].split('/')[-1])
        print configurable
        try:
            configurable.InputRawEventLocation = 'PrevTrig/RawEvent'
        except:
            configurable.RawEventLocations = [
                'PrevTrig/RawEvent'
            ] + configurable.RawEventLocations
        output = None
        for prop, loc in d:
            if not output: output = prefix + '/' + loc
            setattr(configurable, prop, prefix + '/' + loc)
        DataOnDemandSvc().AlgMap[output] = configurable
        prop = d[0][0][6:]
        print prop, output
        setattr(ToolSvc().SwimmingDebugTisTos, prop, output)

    class Deathstar(object):
        def __init__(self, seq):
            self._seq = seq

        def insert(self):
            ApplicationMgr().TopAlg.insert(0, self._seq)

    d = Deathstar(deathstar)
    appendPostConfigAction(d.insert)
Exemple #18
0
from StrippingSelections.StrippingBs2KKhh import BsPhiRhoConf
from DecayTreeTuple.Configuration import *
from PhysSelPython.Wrappers import Selection, SelectionSequence, DataOnDemand, AutomaticData
from Configurables import  LoKi__Hybrid__TupleTool
from Configurables import DaVinci,HltSelReportsDecoder,HltVertexReportsDecoder,HltDecReportsDecoder, BackgroundCategory, TupleToolRecoStats, TupleToolTrackIsolation
from Configurables import GaudiSequencer
from Configurables import EventNodeKiller

myDecayType = 3 
#myDecayType : (1 for Bsphirho, 2 for Bsphif0, 3 for Bsphiphi) 
DataYear = "2012"
IsMC = True
if not IsMC: 
    myDecayType = 0
    MySequencer = GaudiSequencer('Sequence')
    eventNodeKiller = EventNodeKiller('DAQkiller')
    eventNodeKiller.Nodes = ['DAQ','pRec']
    MySequencer.Members+=[eventNodeKiller]

userAlgos = []

from Configurables import TrackScaleState as SCALER
scaler = SCALER('StateScale')
from Configurables import TrackSmearState as SMEAR
smear = SMEAR('StateSmear')

mydataLocation = "/Event/AllStreams/Phys/BsPhiRhoLine/Particles"
_strippingOutput = AutomaticData(Location = mydataLocation)

if myDecayType and IsMC:
  if myDecayType == 1:
    '/Event/pRec/Vertex/V0',
    '/Event/pRec/Vertex'
]

extraLoad = [
    '/Event/Link/MC/Rich/Hits2MCRichOpticalPhotons',
    '/Event/Link/MC/Particles2MCRichTracks'
]

from Configurables import (TESCheck, EventNodeKiller)
initBoole = GaudiSequencer("InitBooleSeq")
xdstLoader = TESCheck("XDSTLoader")
xdstLoader.Inputs = xdstPaths + extraLoad
xdstLoader.Stop = False  # If not MC do not expect all of the entries
xdstLoader.OutputLevel = ERROR
xdstKiller = EventNodeKiller("XDSTKiller")
xdstKiller.Nodes = xdstPaths
xdstHandler = GaudiSequencer("XDSTLoverHandler")
xdstHandler.Members += [xdstLoader, xdstKiller]
xdstHandler.IgnoreFilterPassed = True  # keep going
initBoole.Members += [xdstHandler]

from GaudiConf import IOHelper


def patch():
    OutputStream("DigiWriter").ItemList += ["/Event/Link/MC#1"]


appendPostConfigAction(patch)
Exemple #20
0
    '/Event/Rich',
    '/Event/Other/RawEvent'
]

extraLoad = [
    '/Event/Link/MC/Rich/Hits2MCRichOpticalPhotons',
    '/Event/Link/MC/Particles2MCRichTracks'
]

from Configurables import (TESCheck, EventNodeKiller)
initBoole = GaudiSequencer("InitBooleSeq")
xdigiLoader = TESCheck("XDIGILoader")
xdigiLoader.Inputs = xdigiPaths + extraLoad
xdigiLoader.Stop = False  # If not MC do not expect all of the entries
xdigiLoader.OutputLevel = ERROR
xdigiKiller = EventNodeKiller("XDIGIKiller")
xdigiKiller.Nodes = xdigiPaths
xdigiHandler = GaudiSequencer("XDIGILoverHandler")
xdigiHandler.Members += [xdigiLoader, xdigiKiller]

xdigiHandler.IgnoreFilterPassed = True  # keep going
initBoole.Members += [xdigiHandler]

from GaudiConf import IOHelper


def patch():
    OutputStream("DigiWriter").ItemList += ["/Event/Link/MC#1"]


appendPostConfigAction(patch)
def execute_option_file(path):
    # ================= BEGIN EDIT AREA =======================
    tuplename = "Bu2LLK_meLine"
    simulation_inputstring = "/Event/AllStreams/Phys/Bu2LLK_meLine/Particles"
    data_inputstring = "/Event/Leptonic/Phys/Bu2LLK_meLine/Particles"

    decaydescriptor = "[B+ -> ^[J/psi(1S) -> ^mu+ ^e-]CC ^K+]CC"
    branches = {    # Dictionary for the branches to write in the tuple
        "B"         : "[B+ -> [J/psi(1S) -> mu+ e-]CC K+]CC",
        "Psi"       : "[B+ -> ^[J/psi(1S) -> mu+ e-]CC K+]CC",
        "muplus"    : "[B+ -> [J/psi(1S) -> ^mu+ e-]CC K+]CC",
        "eminus"    : "[B+ -> [J/psi(1S) -> mu+ ^e-]CC K+]CC",
        "Kplus"     : "[B+ -> [J/psi(1S) -> mu+ mu-]CC ^K+]CC"
    }

    #Tools added to the ToolList can not be modified i.e. no other options than the defaults can be used
    #use data.addTupleTool('<tool>') in the corresponding section below if you also want to modify the specific tool
    toollist = [
          "TupleToolGeometry"       #geometry of vertex locations (ENDVERTEX, OWNPV, IP_OWNPV, FD_OWNPV, DIRA_OWNPV)
        , "TupleToolKinematic"      #kinematic variables (inv. mass MM, kin. mass M/sqrt(E^2-p^2), P, PX/Y/Z/E, PT)
        , "TupleToolEventInfo"      #Event information such as run number, polarity, GPS time etc.
        #, "TupleToolPropertime"    #proper lifetime of reconstructed particles
        , "TupleToolAngles"         #decay angles of charged tracks (i.e. angle in mothers frame, name: CosTheta)
        #, "TupleToolTrigger"       #Saves trigger decision (I prefer to use TupleToolTISTOS)
        , "TupleToolTISTOS"         #Trigger on/independent of signal
        , "TupleToolTrackInfo"      #GhostProb of track and track type (TYPE) - 0 = unknown, 1 = velo track...
        , "TupleToolPrimaries"      #Number and coordinates of all primary vertices
        , "TupleToolDira"           #Angle between secondary minus primary vertex and the mother momentum
        #, "TupleToolTrackPosition" #Extrapolate track to given z-position (option .Z, default=2500. which is TT)
        , "TupleToolRecoStats"      #Fills reconstruction information like nTracks, nSPDHits, nMuonTracks from RecSummary
        , "TupleToolBremInfo"       #Bremsstrahlung information
        ]
    # ================= END EDIT AREA =======================









    # ================= BEGIN DO NOT EDIT HERE =======================
    from Configurables import GaudiSequencer
    MySequencer = GaudiSequencer('Sequence')



    #Check whether it is a DST or MDST file
    import os.path
    extension = os.path.splitext(path)[1]
    print extension
    if extension.lower() == ".dst":
        DaVinci().InputType = 'DST'
    elif extension.lower() == ".mdst":
        DaVinci().InputType = 'MDST'
    else:
        raise Exception("Extension {extension} of {path} does not match .mdst or .dst".format(extension, path))

    #Kill some nodes if micro dst-file
    if DaVinci().InputType == 'MDST':
        from Configurables import EventNodeKiller
        eventNodeKiller = EventNodeKiller('DAQkiller')
        eventNodeKiller.Nodes = ['/Event/DAQ','/Event/pRec']
        MySequencer.Members+=[eventNodeKiller]




    #DecayTreeTuple -> Fills information about particles, vertices and daughters
    ntuple = DecayTreeTuple(tuplename)


    ntuple.ToolList = toollist


    if DaVinci().InputType != 'MDST':
        ntuple.ToolList += ["TupleToolTrackIsolation"]
    if DaVinci().Simulation is True:
        ntuple.ToolList +=["TupleToolMCBackgroundInfo"]            #Sets the background category
        MCTruth=ntuple.addTupleTool("TupleToolMCTruth")            #Saves information of MC particle associated to the current particle (you can add tools to it itself!)
        MCTruth.addTupleTool("MCTupleToolHierarchy")               #True IDs of mother and grandmother particles



    if DaVinci().Simulation is True: # for MC
        ntuple.Inputs = [simulation_inputstring]
    elif DaVinci().Simulation is False: # for Tuple
        ntuple.Inputs = [data_inputstring]
    else:
        raise Exception(" `DaVinci().Simulation` not set.")

    ntuple.Decay = decaydescriptor
    ntuple.addBranches(branches)

    ntuple.TupleName = "DecayTree"

    MySequencer.Members.append(ntuple)
    # ================= END DO NOT EDIT HERE =======================













    # ================= BEGIN EDIT TUPLETOOLS WITH OPTIONS ==================

    # LOKI TupleTool
    LoKi = ntuple.addTupleTool("LoKi::Hybrid::TupleTool")
    LoKi.Variables =  {
        "ETA" : "ETA",       #Pseudorapidity
        "PHI" : "PHI"       #Azimuthal angle
    }




    # PID TupleTool
    if(True):
        pid = ntuple.addTupleTool("TupleToolPid")            #PID information for charged particles
        pid.Verbose = True                                 #More information like isMuonLoose etc.



    #TISTOS TupleTool
    if(True):
        from Configurables import TupleToolTISTOS

        L0Triggers = ["L0MuonDecision", "L0DiMuonDecision", "L0HadronDecision", "L0ElectronDecision", "L0PhotonDecision" ]
        ##            ['Muon',               'DiMuon',               '  Hadron',     'Electron',  'Photon','PhotonHi','ElectronHi']

        Hlt1Triggers = [  "Hlt1TrackAllL0Decision", "Hlt1TrackMuonDecision" ,"Hlt1TrackPhotonDecision" ,"Hlt1DiMuonLowMassDecision" ,"Hlt1DiMuonHighMassDecision"]

        Hlt2Triggers = [
            ## muon lines
            "Hlt2SingleMuonDecision", "Hlt2SingleMuonLowPTDecision", "Hlt2SingleMuonHighPTDecision",
            "Hlt2DiMuonDecision",  "Hlt2DiMuonLowMassDecision",
            "Hlt2DiMuonJPsiDecision",  "Hlt2DiMuonJPsiHighPTDecision",  "Hlt2DiMuonPsi2SDecision",
            "Hlt2DiMuonDetachedDecision",  "Hlt2DiMuonDetachedJPsiDecision", "Hlt2DiMuonDetachedHeavyDecision", "Hlt2TriMuonTauDecision",
            ## hadron/Topo lines
            "Hlt2B2HHDecision",
            "Hlt2DiMuonBDecision",  "Hlt2DiMuonZDecision",
            "Hlt2TopoMu2BodyBBDTDecision", "Hlt2TopoMu3BodyBBDTDecision", "Hlt2TopoMu4BodyBBDTDecision",
            "Hlt2TopoE2BodyBBDTDecision", "Hlt2TopoE3BodyBBDTDecision", "Hlt2TopoE4BodyBBDTDecision",
            "Hlt2Topo2BodyBBDTDecision",   "Hlt2Topo3BodyBBDTDecision",   "Hlt2Topo4BodyBBDTDecision",
            ##others
            "Hlt2PassThroughDecision",
            "Hlt2TransparentDecision",
            ## inclusive decisions
            "Hlt2DiMuonDY.*Decision","Hlt2TopoE.*Decision", "Hlt2Topo.*Decision",  "Hlt2Charm.*Decision", "Hlt2DiElectron.*Decision"
            ]

        triggerList = L0Triggers + Hlt1Triggers + Hlt2Triggers

        ntuple.addTool(TupleToolTISTOS)
        ntuple.TupleToolTISTOS.VerboseL0 = True
        ntuple.TupleToolTISTOS.VerboseHlt1 = True
        ntuple.TupleToolTISTOS.VerboseHlt2 = True
        ntuple.TupleToolTISTOS.FillL0 = True
        ntuple.TupleToolTISTOS.FillHlt1 = True
        ntuple.TupleToolTISTOS.FillHlt2 = True
        ntuple.TupleToolTISTOS.OutputLevel = INFO
        ntuple.TupleToolTISTOS.TriggerList = triggerList



    #DecayTreeFitter
    if(False):
        fitter = ntuple.B.addTupleTool("TupleToolDecayTreeFitter/FIX_JPSI")
        fitter.constrainToOriginVertex = False
        fitter.daughtersToConstrain = [ "J/psi(1S)" ]
        fitter.Verbose = True

    #Isolation
    if(True):
        from Configurables import TupleToolApplyIsolation
        ntuple.B.addTupleTool(TupleToolApplyIsolation, name="TupleToolApplyIsolationHard")
        ntuple.B.TupleToolApplyIsolationHard.OutputSuffix="_Hard"
        ntuple.B.TupleToolApplyIsolationHard.WeightsFile="weightsHard.xml"
        #ntuple.B.ToolList+=["TupleToolApplyIsolation/TupleToolApplyIsolationHard"]
        ntuple.B.addTupleTool(TupleToolApplyIsolation, name="TupleToolApplyIsolationSoft")
        ntuple.B.TupleToolApplyIsolationSoft.OutputSuffix="_Soft"
        ntuple.B.TupleToolApplyIsolationSoft.WeightsFile="weightsSoft.xml"
        #ntuple.B.ToolList+=["TupleToolApplyIsolation/TupleToolApplyIsolationSoft"]
        ntuple.B.addTupleTool("TupleToolVtxIsoln")
        #ntuple.B.TupleToolApplyIsolationHard.OutputLevel = 3
        #ntuple.B.TupleToolApplyIsolationSoft.OutputLevel = 3


    #Settings for TupleToolTrackHits (some only are necessary for MDST-files because of other locations of the clusters)
    if(True):   #Change this value if you don't want to use this tool
        from Configurables import TupleToolTrackHits, STOfflinePosition
        trackhits = ntuple.addTupleTool("TupleToolTrackHits")
        trackhits.Verbose = True

        if DaVinci().InputType == 'MDST':
            from Configurables import MeasurementProvider
            ntuple.addTool(MeasurementProvider('MeasProvider'))
            ntuple.MeasProvider.RootInTES = "/Event/Leptonic/"        #Change Leptonic for your stream-name in case of MDST
            trackhits.MeasurementProvider = ntuple.MeasProvider

        itClusterPosition = STOfflinePosition('ToolSvc.ITClusterPosition')      #avoid crashes from missing IT channels
        itClusterPosition.DetType = 'IT'


    # ================= END EDIT TUPLETOOLS WITH OPTIONS ==================
















    #DDDB and CondDB-Tags for DATA (needs to be set for Simulation in runfile.py according to generation->see bookkeeping!)
    #Always use the latest tags for the given datatype from (the newest are currently not in the database yet, therefore take the default ones!)
    """
    if DaVinci().Simulation is False:
        if DaVinci().DataType == '2012':
            DaVinci().CondDBtag = "dddb-20150522-2"
            DaVinci().DDDBtag = "cond-20150409-1"
        elif DaVinci().DataType == '2011':
            DaVinci().CondDBtag = "dddb-20150522-1"
            DaVinci().DDDBtag = "cond-20150409"
    """



    ################################
    ###   DaVinci configuration ####
    ################################

    DaVinci().UserAlgorithms = [MySequencer]
    DaVinci().MoniSequence += [ntuple]
    DaVinci().EvtMax     = -1
    DaVinci().Lumi       = True
Exemple #22
0
    def configureReco(self, init):
        """
        Configure Reconstruction to be redone
        """

        ## CaloReco & CaloPIDs on-demand
        clusters = ['Digits', 'Clusters']
        from Configurables import CaloProcessor
        caloProc = CaloProcessor(EnableOnDemand=True,
                                 OutputLevel=self.getProp("OutputLevel"))
        caloProc.RecList = clusters
        # ---
        if self.getProp('DataType') == 'Upgrade':
            caloProc.NoSpdPrs = True

        ## General unpacking
        from Configurables import DstConf
        if self.isPropertySet('EnableUnpack'):
            DstConf().setProp('EnableUnpack', self.getProp('EnableUnpack'))

        ## unpack Calo Hypos ?
        from Configurables import CaloDstUnPackConf
        unpack = CaloDstUnPackConf()
        hypos = ['Photons', 'MergedPi0s', 'SplitPhotons',
                 'Electrons']  # CaloHypos
        if self.isPropertySet(
                'EnableUnpack') and "Reconstruction" in self.getProp(
                    'EnableUnpack'):
            unpack.setProp('Enable', True)
        else:
            caloProc.RecList += hypos  # enable caloHypos onDemand

        # Reprocess explicitely the full calo sequence in the init sequence ?
        inputtype = self.getProp('InputType').upper()
        if (self.getProp("CaloReProcessing") and inputtype != 'MDST'):
            caloProc.RecList = clusters + hypos
            caloSeq = caloProc.sequence(
            )  # apply the CaloProcessor configuration
            cSeq = GaudiSequencer('CaloReProcessing')
            cSeq.Members += [caloSeq]
            init.Members += [cSeq]
            unpack.setProp('Enable', False)
            # update CaloHypo->MC Linker
            if self.getProp('Simulation'):
                log.info(
                    "CaloReprocessing : obsolete CaloHypo2MC Links is updated")
                from Configurables import (TESCheck, EventNodeKiller,
                                           CaloHypoMCTruth)
                caloMCLinks = ["Link/Rec/Calo"]
                caloMCSeq = GaudiSequencer("cleanCaloMCLinks")
                checkCaloMCLinks = TESCheck("checkCaloMCLinks")
                checkCaloMCLinks.Inputs = caloMCLinks
                checkCaloMCLinks.Stop = False
                killCaloMCLinks = EventNodeKiller("killCaloMCLinks")
                killCaloMCLinks.Nodes = caloMCLinks
                caloMCSeq.Members = [checkCaloMCLinks, killCaloMCLinks]
                init.Members += [caloMCSeq]
                update = self.getProp("UpdateCaloMCLinks")
                if update:
                    redoCaloMCLinks = CaloHypoMCTruth("recreteCaloMCLinks")
                    init.Members += [redoCaloMCLinks]
        else:
            caloProc.applyConf()
            if inputtype != 'MDST':
                log.info(
                    "CaloReProcessing cannot be processed on reduced (m)DST data"
                )

        # For backwards compatibility with MC09, we need the following to rerun
        # the Muon Reco on old data. To be removed AS SOON as this backwards compatibility
        # is no longer needed
        if (self.getProp("DataType") == 'MC09' and inputtype != 'MDST'
                and self.getProp("AllowPIDRerunning") and inputtype != 'RDST'):

            from Configurables import DataObjectVersionFilter, MuonRec, TESCheck
            from MuonID import ConfiguredMuonIDs

            rerunPIDSeq = GaudiSequencer("ReRunMuonPID")
            init.Members += [rerunPIDSeq]

            # Check data version, to see if this is needed or not
            rerunPIDSeq.Members += [
                DataObjectVersionFilter(
                    "MuonPIDVersionCheck",
                    DataObjectLocation="/Event/Rec/Muon/MuonPID",
                    MaxVersion=0)
            ]
            # Check raw event is available
            rerunPIDSeq.Members += [
                TESCheck("TESCheckRawEvent",
                         Inputs=["DAQ/RawEvent"],
                         Stop=False)
            ]
            # Run Muon PID
            cm = ConfiguredMuonIDs.ConfiguredMuonIDs(
                data=self.getProp("DataType"))
            rerunPIDSeq.Members += [MuonRec(), cm.getMuonIDSeq()]

            # If muon PID has rerun, need to re make the Combined DLLS...
            from Configurables import (ChargedProtoParticleAddMuonInfo,
                                       ChargedProtoCombineDLLsAlg)
            rerunPIDSeq.Members += [
                ChargedProtoParticleAddMuonInfo("CProtoPAddNewMuon"),
                ChargedProtoCombineDLLsAlg("CProtoPCombDLLNewMuon")
            ]

        # Compatibility with pre-2011 data, where Rec/Summary and Trigger/RawEvent are missing
        import PhysConf.CheckMissingTESData as DataCheck
        DataCheck.checkForMissingData()
Exemple #23
0
def execute(stripRun, stripConf, stripLine, dataType, hltReport, tupleDecay, evtMax, mag, outputType="ntuple", strippingStream = "Charm"):

  #0 "pi" "pi"
  #1 "mu" "mu"
  #2 "K"  "pi"
  #3 "e"  "mu"
  #4 "K"  "mu"
  stripLines = {
    "kkpi":0,
    "kpipi":1,
    "pipipi":2,
    "kpipios":3,
    "kkk":4,
    "kkpios":5,
    "hhh":6,
    }

  lineNumber = stripLines[stripLine]

  # Now build the stream
  from StrippingConf.StrippingStream import StrippingStream
  ss = StrippingStream("ByTom")

  from StrippingSelections import StrippingD2hhh_conf
  line = False
  if stripConf == "default" or stripConf == "def":

    from StrippingArchive import Utils
    D2HHHConf, default_config = Utils.lineBuilderAndConf("stripping20","D2hhh")

    def_str_no_pre = default_config
    for key, val in def_str_no_pre.iteritems():
      if "Prescale" in key:
        def_str_no_pre[key] = 1.0

    D2HHHConf = StrippingD2hhh_conf.D2hhhConf('D2hhh',def_str_no_pre)
    D2hhhLines = D2HHHConf.lines()
    for line in D2hhhLines :
      print line.name(), line.outputLocation()

    ss.appendLines( [D2hhhLines[lineNumber]] )
    stripOutputLoc = D2hhhLines[lineNumber].outputLocation()
  else:
    raise ValueError("Unknown value of stripConf: %s"%stripConf)

  from StrippingConf.Configuration import StrippingConf
  conf = StrippingConf( Streams = [ ss ] )

  from Configurables import StrippingReport
  sr = StrippingReport(Selections = conf.selections())


  MessageSvc().Format = "% F%60W%S%7W%R%T %0W%M"

  from Configurables import DaVinci
  from Configurables import LoKi__HDRFilter as StripFilter

  strfilter = StripFilter( 'StripPassFilter', Code="HLT_PASS('"+D2hhhLines[lineNumber].name()+"Decision')", Location="/Event/Strip/Phys/DecReports" )
  #strfilter = StripFilter( 'StripPassFilter', Code="HLT_PASS('StrippingD2hhh_PPPLineDecision')", Location="/Event/Strip/Phys/DecReports" )
  DaVinci().EventPreFilters += [strfilter]

  DaVinci().PrintFreq = 500
  DaVinci().HistogramFile = 'DV_histos.root'
  DaVinci().TupleFile = "DPiPiPi_NTuple.root"
  DaVinci().EvtMax = evtMax

  storeExp = StoreExplorerAlg()
  storeExp.Load = 1
  storeExp.PrintFreq = 10.0

  #DaVinci().appendToMainSequence( [ storeExp ] )
  if stripRun:
    #from Configurables import bankKiller
    #bk = bankKiller( "KillHltBanks", BankTypes = [ "Evt/Strip/Phys/DecReports", "Evt/AllStreams" ] )
    #DaVinci().appendToMainSequence( [ bk ] )
    from Configurables import EventNodeKiller
    enk = EventNodeKiller()
    enk.Nodes=[
      "Event/Strip/Phys/DecReports",
      "Event/AllStreams"]
    DaVinci().appendToMainSequence( [ enk ] )
    #DaVinci().appendToMainSequence( [ storeExp ] )

    DaVinci().appendToMainSequence( [ conf.sequence() ] )
    DaVinci().appendToMainSequence( [ sr ] )
  if hltReport:
    from Configurables import ReadHltReport
    DaVinci().appendToMainSequence( [ ReadHltReport() ] )

  DaVinci().InputType = 'MDST'
  DaVinci().RootInTES = "/Event/Charm"

  a = "->"

  if dataType == "MC10":
    DaVinci().DataType = "2010"
    DaVinci().Simulation = True
    DaVinci().DDDBtag = "head-20101206"
    if mag == "up":
      DaVinci().CondDBtag = "sim-20101210-vc-mu100"
    elif mag == "down":
      DaVinci().CondDBtag = "sim-20101210-vc-md100"
    DaVinci().Lumi = False
  elif dataType == "MC11":
    DaVinci().DataType = "2011"
    DaVinci().Simulation = True
    DaVinci().DDDBtag = "MC11-20111102"
    if mag == "up":
      DaVinci().CondDBtag = "sim-20111111-vc-mu100"
    elif mag == "down":
      DaVinci().CondDBtag = "sim-20111111-vc-md100"
    DaVinci().Lumi = False
  elif dataType == "MC11a":
    DaVinci().DataType = "2011"
    DaVinci().Simulation = True
    DaVinci().DDDBtag = "MC11-20111102"
    if mag == "up":
      DaVinci().CondDBtag = "sim-20111111-vc-mu100"
    elif mag == "down":
      DaVinci().CondDBtag = "sim-20111111-vc-md100"
    DaVinci().Lumi = False
  elif dataType == "MC2012":
    DaVinci().DataType = "2012"
    DaVinci().Simulation = True
    DaVinci().DDDBtag = "Sim08-20130503-1"
    if mag == "up":
      DaVinci().CondDBtag = "Sim08-20130503-1-vc-mu100"
    elif mag == "down":
      DaVinci().CondDBtag = "Sim08-20130503-1-vc-md100"
    DaVinci().Lumi = False
  elif dataType == "MC2011":
    DaVinci().DataType = "2011"
    DaVinci().Simulation = True
    DaVinci().DDDBtag = "Sim08-20130503"
    if mag == "up":
      DaVinci().CondDBtag = "Sim08-20130503-vc-mu100"
    elif mag == "down":
      DaVinci().CondDBtag = "Sim08-20130503-vc-md100"
    DaVinci().Lumi = False
  elif dataType == "data2012":
    a = "->"
    DaVinci().DataType = "2012"
    DaVinci().Simulation = False
    #DaVinci().DDDBtag = "dddb-20130111"
    #if mag == "up":
      #DaVinci().CondDBtag = "cond-20130114"
    #elif mag == "down":
      #DaVinci().CondDBtag = "cond-20130114"
    DaVinci().Lumi = True
  elif dataType == "data2011":
    a = "->"
    DaVinci().DataType = "2011"
    DaVinci().Simulation = False
    #DaVinci().DDDBtag = "dddb-20130111"
    #if mag == "up":
      #DaVinci().CondDBtag = "cond-20130114"
    #elif mag == "down":
      #DaVinci().CondDBtag = "cond-20130114"
    DaVinci().Lumi = True
  elif dataType == "data":
    sys.exit("correct the dataType to include the year")


  from Configurables import DecayTreeTuple
  from Configurables import TupleToolTISTOS
  from Configurables import TupleToolMassHypo, TupleToolSubMass

  if outputType in ["ntuple", "nt", "tuple", "root"]:

    print "stripOutputLoc:",stripOutputLoc

    dttuple = DecayTreeTuple( "DPiPiPi_NTuple" )

    dttuple.ToolList = ["TupleToolGeometry",
                        "TupleToolEventInfo",
                        "TupleToolKinematic",
                        #"TupleToolPrimaries",
                        "TupleToolPropertime",
                        "TupleToolAngles",
                        "TupleToolPid",
                        #"TupleToolRICHPid",
                        "TupleToolDecay",
                        #"TupleToolTrigger",
                        #"TupleToolTrackPosition",
                        #"TupleToolTrackInfo",
                        #"TupleToolRecoStats",
                        "TupleToolDira",
                        "TupleToolDalitz",
                        "TupleToolSubMass",
                        ]

    dttuple.Inputs = [ stripOutputLoc ]

    print "tuple input :",dttuple.Inputs
    print "number of events:", DaVinci().EvtMax


    #[D+ -> pi- pi+ pi+]CC

    if tupleDecay == "pipipi":
      dttuple.Decay = "[D+ "+a+" ^pi- ^pi+ ^pi+]CC"
      dttuple.addBranches ({
        "D":   "[D+ "+a+" pi- pi+ pi+]CC",
        "x1": "[D+ "+a+" ^pi- pi+ pi+]CC",
        "x2": "[D+ "+a+" pi- ^pi+ pi+]CC",
        "x3": "[D+ "+a+" pi- pi+ ^pi+]CC",
        })
    elif tupleDecay == "kpipios":
      dttuple.Decay = "[D+ "+a+" ^pi- ^pi+ ^K+]CC"
      dttuple.addBranches ({
        "D":   "[D+ "+a+" pi- pi+ K+]CC",
        "x1": "[D+ "+a+" ^pi- pi+ K+]CC",
        "x2": "[D+ "+a+" pi- ^pi+ K+]CC",
        "x3": "[D+ "+a+" pi- pi+ ^K+]CC",
        })
    elif tupleDecay == "ds2phipi":
      dttuple.Decay = "[D+ "+a+" ^mu+ ^mu- ^pi+]CC"
      dttuple.addBranches ({
        "D":   "[D+ "+a+" mu+ mu- pi+]CC",
        "x1": "[D+ "+a+" ^mu+ mu- pi+]CC",
        "x2": "[D+ "+a+" mu+ ^mu- pi+]CC",
        "x3": "[D+ "+a+" mu+ mu- ^pi+]CC",
        })

    #if tupleDecay == "eta":
      #dttuple.Decay = "[(D+ "+a+" ^(eta "+a+" ^pi+ ^pi-) ^pi+),(D- "+a+" ^(eta "+a+" ^pi+ ^pi-) ^pi-)]"
      #dttuple.addBranches ({
        #"D":   "[(D+ "+a+" (eta "+a+" pi+ pi-) pi+),(D- "+a+" (eta "+a+" pi+ pi-) pi-)]",
        #"eta": "[(D+ "+a+" ^(eta "+a+" ^pi+ ^pi-) ^pi+),(D- "+a+" ^(eta "+a+" ^pi+ ^pi-) ^pi-)]",
        #"pip": "[(D+ "+a+" (eta "+a+" ^pi+ pi-) pi+),(D- "+a+" (eta "+a+" ^pi+ pi-) pi-)]",
        #"pim": "[(D+ "+a+" (eta "+a+" pi+ ^pi-) pi+),(D- "+a+" (eta "+a+" pi+ ^pi-) pi-)]",
        #"pi":  "[(D+ "+a+" (eta "+a+" pi+ pi-) ^pi+),(D- "+a+" (eta "+a+" pi+ pi-) ^pi-)]",
        #})

    dttuple.TupleName = "DPiPiPi_NTuple"

    ttmhk = TupleToolMassHypo("KaonHypo")
    ttmhk.PIDReplacements = { "pi+" : "K+"}
    #ttmhk.CC = True
    dttuple.D.addTool(ttmhk)
    dttuple.D.ToolList += ["TupleToolMassHypo/KaonHypo"]

    ttmhm = TupleToolMassHypo("MuonHypo")
    ttmhm.PIDReplacements = { "pi+" : "mu+"}
    #ttmhm.CC = True
    dttuple.D.addTool(ttmhm)
    dttuple.D.ToolList += ["TupleToolMassHypo/MuonHypo"]

    dttuple.addTool(TupleToolTISTOS())
    dttuple.TupleToolTISTOS.VerboseL0 = True
    dttuple.TupleToolTISTOS.VerboseHlt1 = True
    dttuple.TupleToolTISTOS.VerboseHlt2 = True
    dttuple.TupleToolTISTOS.Verbose = True
    dttuple.ToolList += ["TupleToolTISTOS"]

    dttuple.TupleToolTISTOS.TriggerList = [

        "L0CALODecision",
        "L0ElectronDecision",
        "L0PhotonDecision",
        "L0HadronDecision",
        "L0MuonDecision",

        "Hlt1TrackMuonDecision",
        "Hlt1TrackAllL0Decision",

        "Hlt2Topo2BodyBBDTDecision",
        "Hlt2Topo3BodyBBDTDecision",
        "Hlt2Topo4BodyBBDTDecision",

        'Hlt2CharmHadD2HHHDecision',

        ] #+ [ trigger_name+"Decision" for trigger_name in
          #      ["L0CALO","L0ElectronNoSPD","L0PhotonNoSPD","L0HadronNoSPD","L0MuonNoSPD","L0DiMuonNoSPD","L0Electron","L0ElectronHi","L0Photon","L0PhotonHi","L0Hadron","L0Muon","L0DiMuon","L0HighSumETJet","L0B1gas","L0B2gas",]\
          #    + ["Hlt1MBMicroBiasVelo","Hlt1Global","Hlt1DiMuonHighMass","Hlt1DiMuonLowMass","Hlt1SingleMuonNoIP","Hlt1SingleMuonHighPT","Hlt1TrackAllL0","Hlt1TrackMuon","Hlt1TrackPhoton","Hlt1Lumi","Hlt1LumiMidBeamCrossing","Hlt1MBNoBias","Hlt1MBMicroBiasVeloRateLimited","Hlt1MBMicroBiasTStation","Hlt1MBMicroBiasTStationRateLimited","Hlt1L0Any","Hlt1L0AnyRateLimited","Hlt1L0AnyNoSPD","Hlt1L0AnyNoSPDRateLimited","Hlt1NoPVPassThrough","Hlt1DiProton","Hlt1DiProtonLowMult","Hlt1BeamGasNoBeamBeam1","Hlt1BeamGasNoBeamBeam2","Hlt1BeamGasBeam1","Hlt1BeamGasBeam2","Hlt1BeamGasCrossingEnhancedBeam1","Hlt1BeamGasCrossingEnhancedBeam2","Hlt1BeamGasCrossingForcedReco","Hlt1ODINTechnical","Hlt1Tell1Error","Hlt1VeloClosingMicroBias","Hlt1BeamGasCrossingParasitic","Hlt1ErrorEvent","Hlt1SingleElectronNoIP","Hlt1TrackForwardPassThrough","Hlt1TrackForwardPassThroughLoose","Hlt1CharmCalibrationNoBias","Hlt1L0HighSumETJet","Hlt1BeamGasCrossingForcedRecoFullZ","Hlt1BeamGasHighRhoVertices","Hlt1VertexDisplVertex","Hlt1TrackAllL0Tight","Hlt1HighPtJetsSinglePV","Hlt1L0PU","Hlt1L0CALO",]\
          #    + ["Hlt2SingleElectronTFLowPt","Hlt2SingleElectronTFHighPt","Hlt2DiElectronHighMass","Hlt2DiElectronB","Hlt2B2HHLTUnbiased","Hlt2Topo2BodySimple","Hlt2Topo3BodySimple","Hlt2Topo4BodySimple","Hlt2Topo2BodyBBDT","Hlt2Topo3BodyBBDT","Hlt2Topo4BodyBBDT","Hlt2TopoMu2BodyBBDT","Hlt2TopoMu3BodyBBDT","Hlt2TopoMu4BodyBBDT","Hlt2TopoE2BodyBBDT","Hlt2TopoE3BodyBBDT","Hlt2TopoE4BodyBBDT","Hlt2IncPhi","Hlt2IncPhiSidebands","Hlt2CharmHadD02HHKsLL","Hlt2Dst2PiD02PiPi","Hlt2Dst2PiD02MuMu","Hlt2Dst2PiD02KMu","Hlt2Dst2PiD02KPi","Hlt2PassThrough","Hlt2Transparent","Hlt2Forward","Hlt2DebugEvent","Hlt2CharmHadD02HH_D02PiPi","Hlt2CharmHadD02HH_D02PiPiWideMass","Hlt2CharmHadD02HH_D02KK","Hlt2CharmHadD02HH_D02KKWideMass","Hlt2CharmHadD02HH_D02KPi","Hlt2CharmHadD02HH_D02KPiWideMass","Hlt2ExpressJPsi","Hlt2ExpressJPsiTagProbe","Hlt2ExpressLambda","Hlt2ExpressKS","Hlt2ExpressDs2PhiPi","Hlt2ExpressBeamHalo","Hlt2ExpressDStar2D0Pi","Hlt2ExpressHLT1Physics","Hlt2Bs2PhiGamma","Hlt2Bs2PhiGammaWideBMass","Hlt2Bd2KstGamma","Hlt2Bd2KstGammaWideKMass","Hlt2Bd2KstGammaWideBMass","Hlt2CharmHadD2KS0H_D2KS0Pi","Hlt2CharmHadD2KS0H_D2KS0K","Hlt2CharmRareDecayD02MuMu","Hlt2B2HH","Hlt2MuonFromHLT1","Hlt2SingleMuon","Hlt2SingleMuonHighPT","Hlt2SingleMuonLowPT","Hlt2DiProton","Hlt2DiProtonTF","Hlt2DiProtonLowMult","Hlt2DiProtonLowMultTF","Hlt2CharmSemilepD02HMuNu_D02KMuNuWS","Hlt2CharmSemilepD02HMuNu_D02PiMuNuWS","Hlt2CharmSemilepD02HMuNu_D02KMuNu","Hlt2CharmSemilepD02HMuNu_D02PiMuNu","Hlt2TFBc2JpsiMuX","Hlt2TFBc2JpsiMuXSignal","Hlt2DisplVerticesLowMassSingle","Hlt2DisplVerticesHighMassSingle","Hlt2DisplVerticesDouble","Hlt2DisplVerticesSinglePostScaled","Hlt2DisplVerticesHighFDSingle","Hlt2DisplVerticesSingleDown","Hlt2CharmSemilepD2HMuMu","Hlt2CharmSemilepD2HMuMuWideMass","Hlt2B2HHPi0_Merged","Hlt2CharmHadD2HHH","Hlt2CharmHadD2HHHWideMass","Hlt2DiMuon","Hlt2DiMuonLowMass","Hlt2DiMuonJPsi","Hlt2DiMuonJPsiHighPT","Hlt2DiMuonPsi2S","Hlt2DiMuonB","Hlt2DiMuonZ","Hlt2DiMuonDY1","Hlt2DiMuonDY2","Hlt2DiMuonDY3","Hlt2DiMuonDY4","Hlt2DiMuonDetached","Hlt2DiMuonDetachedHeavy","Hlt2DiMuonDetachedJPsi","Hlt2DiMuonNoPV","Hlt2TriMuonDetached","Hlt2TriMuonTau","Hlt2CharmSemilepD02HHMuMu","Hlt2CharmSemilepD02HHMuMuWideMass","Hlt2CharmHadD02HHHH","Hlt2CharmHadD02HHHHWideMass","Hlt2ErrorEvent","Hlt2Global","Hlt2diPhotonDiMuon","Hlt2LowMultMuon","Hlt2LowMultHadron","Hlt2LowMultPhoton","Hlt2LowMultElectron","Hlt2SingleTFElectron","Hlt2SingleTFVHighPtElectron","Hlt2B2HHLTUnbiasedDetached","Hlt2CharmHadLambdaC2KPPi","Hlt2SingleMuonVHighPT","Hlt2CharmSemilepD02HMuNu_D02KMuNuTight","Hlt2CharmHadMinBiasLambdaC2KPPi","Hlt2CharmHadMinBiasD02KPi","Hlt2CharmHadMinBiasD02KK","Hlt2CharmHadMinBiasDplus2hhh","Hlt2CharmHadMinBiasLambdaC2LambdaPi","Hlt2DisplVerticesSingle","Hlt2DisplVerticesDoublePostScaled","Hlt2DisplVerticesSingleHighMassPostScaled","Hlt2DisplVerticesSingleHighFDPostScaled","Hlt2DisplVerticesSingleMVPostScaled","Hlt2RadiativeTopoTrackTOS","Hlt2RadiativeTopoPhotonL0","Hlt2DiMuonPsi2SHighPT","Hlt2DoubleDiMuon","Hlt2DiMuonAndMuon","Hlt2DiMuonAndGamma","Hlt2DiMuonAndD0","Hlt2DiMuonAndDp","Hlt2DiMuonAndDs","Hlt2DiMuonAndLc","Hlt2CharmSemilepD02HHMuMuHardHadronsSoftMuons","Hlt2CharmSemilepD02HHMuMuHardHadronsSoftMuonsWideMass","Hlt2CharmSemilepD02HHMuMuHardHadronsAndMuons","Hlt2CharmSemilepD02HHMuMuHardHadronsAndMuonsWideMass","Hlt2TopoRad2BodyBBDT","Hlt2TopoRad2plus1BodyBBDT","Hlt2Lumi","Hlt2LowMultHadron_nofilter","Hlt2LowMultElectron_nofilter","Hlt2CharmHadD02HHKsDD","Hlt2CharmHadD2KS0KS0","Hlt2CharmHadD2KS0KS0WideMass","Hlt2ExpressD02KPi","Hlt2CharmHadLambdaC2KPPiWideMass","Hlt2CharmHadLambdaC2KPK","Hlt2CharmHadLambdaC2KPKWideMass","Hlt2CharmHadLambdaC2PiPPi","Hlt2CharmHadLambdaC2PiPPiWideMass","Hlt2CharmHadLambdaC2PiPK","Hlt2CharmHadLambdaC2PiPKWideMass","Hlt2CharmHadD2KS0H_D2KS0DDPi","Hlt2CharmHadD2KS0H_D2KS0DDK","Hlt2DiPhi","Hlt2CharmHadD02HHHHDstNoHltOne_4pi","Hlt2CharmHadD02HHHHDstNoHltOne_4piWideMass","Hlt2CharmHadD02HHHHDstNoHltOne_K3pi","Hlt2CharmHadD02HHHHDstNoHltOne_K3piWideMass","Hlt2CharmHadD02HHHHDstNoHltOne_KKpipi","Hlt2CharmHadD02HHHHDstNoHltOne_KKpipiWideMass","Hlt2CharmHadD02HHHHDstNoHltOne_2K2pi","Hlt2CharmHadD02HHHHDstNoHltOne_2K2piWideMass","Hlt2CharmHadD02HHHHDstNoHltOne_3Kpi","Hlt2CharmHadD02HHHHDstNoHltOne_3KpiWideMass","Hlt2CharmHadD02HHHHDstNoHltOne_Ch2","Hlt2CharmHadD02HHHHDstNoHltOne_Ch2WideMass","Hlt2CharmSemilep3bodyD2PiMuMu","Hlt2CharmSemilep3bodyD2PiMuMuSS","Hlt2CharmSemilep3bodyD2KMuMu","Hlt2CharmSemilep3bodyD2KMuMuSS","Hlt2CharmSemilep3bodyLambdac2PMuMu","Hlt2CharmSemilep3bodyLambdac2PMuMuSS","Hlt2LambdaC_LambdaC2Lambda0LLPi","Hlt2LambdaC_LambdaC2Lambda0LLK","Hlt2LambdaC_LambdaC2Lambda0DDPi","Hlt2LambdaC_LambdaC2Lambda0DDK","Hlt2RadiativeTopoTrack","Hlt2RadiativeTopoPhoton","Hlt2CharmHadD02HHHHDst_4pi","Hlt2CharmHadD02HHHHDst_4piWideMass","Hlt2CharmHadD02HHHHDst_K3pi","Hlt2CharmHadD02HHHHDst_K3piWideMass","Hlt2CharmHadD02HHHHDst_KKpipi","Hlt2CharmHadD02HHHHDst_KKpipiWideMass","Hlt2CharmHadD02HHHHDst_2K2pi","Hlt2CharmHadD02HHHHDst_2K2piWideMass","Hlt2CharmHadD02HHHHDst_3Kpi","Hlt2CharmHadD02HHHHDst_3KpiWideMass","Hlt2CharmHadD02HHHHDst_Ch2","Hlt2CharmHadD02HHHHDst_Ch2WideMass","Hlt2CharmSemilepD02PiPiMuMu","Hlt2CharmSemilepD02KKMuMu","Hlt2CharmSemilepD02KPiMuMu","Hlt2CharmHadD02HHHH_4pi","Hlt2CharmHadD02HHHH_4piWideMass","Hlt2CharmHadD02HHHH_K3pi","Hlt2CharmHadD02HHHH_K3piWideMass","Hlt2CharmHadD02HHHH_KKpipi","Hlt2CharmHadD02HHHH_KKpipiWideMass","Hlt2CharmHadD02HHHH_2K2pi","Hlt2CharmHadD02HHHH_2K2piWideMass","Hlt2CharmHadD02HHHH_3Kpi","Hlt2CharmHadD02HHHH_3KpiWideMass","Hlt2CharmHadD02HHHH_Ch2","Hlt2CharmHadD02HHHH_Ch2WideMass","Hlt2DiMuonDetachedPsi2S","Hlt2CharmHadD02HHXDst_hhX","Hlt2CharmHadD02HHXDst_hhXWideMass","Hlt2LowMultD2KPi","Hlt2LowMultD2KPiPi","Hlt2LowMultD2K3Pi","Hlt2LowMultChiC2HH","Hlt2LowMultChiC2HHHH","Hlt2LowMultD2KPiWS","Hlt2LowMultD2KPiPiWS","Hlt2LowMultD2K3PiWS","Hlt2LowMultChiC2HHWS","Hlt2LowMultChiC2HHHHWS","Hlt2LowMultDDInc","Hlt2DisplVerticesSingleLoosePS","Hlt2DisplVerticesSingleHighFD","Hlt2DisplVerticesSingleVeryHighFD","Hlt2DisplVerticesSingleHighMass","Hlt2DisplVerticesSinglePS","Hlt2DisplVerticesDoublePS","Hlt2CharmHadD2HHHKsLL","Hlt2CharmHadD2HHHKsDD","Hlt2KshortToMuMuPiPi","Hlt2LowMultChiC2PP","Hlt2LowMultDDIncCP","Hlt2LowMultDDIncVF","Hlt2LowMultLMR2HH","Hlt2HighPtJets","Hlt2ChargedHyperon_Xi2Lambda0LLPi","Hlt2ChargedHyperon_Xi2Lambda0LLMu","Hlt2ChargedHyperon_Omega2Lambda0LLK","Hlt2ChargedHyperon_Xi2Lambda0DDPi","Hlt2ChargedHyperon_Xi2Lambda0DDMu","Hlt2ChargedHyperon_Omega2Lambda0DDK","Hlt2CharmHadD02HHXDst_BaryonhhX","Hlt2CharmHadD02HHXDst_BaryonhhXWideMass","Hlt2CharmHadD02HHXDst_BaryonhhXWithKSLL","Hlt2CharmHadD02HHXDst_BaryonhhXWithKSLLWideMass","Hlt2CharmHadD02HHXDst_BaryonhhXWithLambda0LL","Hlt2CharmHadD02HHXDst_BaryonhhXWithLambda0LLWideMass","Hlt2CharmHadD02HHXDst_BaryonhhXWithKSDD","Hlt2CharmHadD02HHXDst_BaryonhhXWithKSDDWideMass","Hlt2CharmHadD02HHXDst_BaryonhhXWithLambda0DD","Hlt2CharmHadD02HHXDst_BaryonhhXWithLambda0DDWideMass","Hlt2CharmHadD02HHXDst_LeptonhhX","Hlt2CharmHadD02HHXDst_LeptonhhXWideMass","Hlt2CharmHadD02HHXDst_LeptonhhXWithKSLL","Hlt2CharmHadD02HHXDst_LeptonhhXWithKSLLWideMass","Hlt2CharmHadD02HHXDst_LeptonhhXWithLambda0LL","Hlt2CharmHadD02HHXDst_LeptonhhXWithLambda0LLWideMass","Hlt2CharmHadD02HHXDst_LeptonhhXWithKSDD","Hlt2CharmHadD02HHXDst_LeptonhhXWithKSDDWideMass","Hlt2CharmHadD02HHXDst_LeptonhhXWithLambda0DD","Hlt2CharmHadD02HHXDst_LeptonhhXWithLambda0DDWideMass"]
          #  ]

    from Configurables import LoKi__Hybrid__TupleTool
    LoKi_DTFMASS = LoKi__Hybrid__TupleTool("LoKi_DTFMASS")
    LoKi_DTFMASS.Variables = {
        "DTF_CHI2"   : "DTF_CHI2( True )",
        "DTF_NDOF"   : "DTF_NDOF( True )",

        "DTF_D_M"     : "DTF_FUN ( M ,                      True )",
        "DTF_D_MM"    : "DTF_FUN ( MM ,                     True )",
        "DTF_D_P"     : "DTF_FUN ( P ,                      True )",
        "DTF_D_PT"    : "DTF_FUN ( PT ,                     True )",
        "DTF_D_PE"    : "DTF_FUN ( E ,                      True )",
        "DTF_D_PX"    : "DTF_FUN ( PX ,                     True )",
        "DTF_D_PY"    : "DTF_FUN ( PY ,                     True )",
        "DTF_D_PZ"    : "DTF_FUN ( PZ ,                     True )",

        "DTF_x1_M"   : "DTF_FUN ( CHILD(M,1) ,             True )",
        "DTF_x1_MM"  : "DTF_FUN ( CHILD(MM,1) ,            True )",
        "DTF_x1_P"   : "DTF_FUN ( CHILD(P,1) ,             True )",
        "DTF_x1_PT"  : "DTF_FUN ( CHILD(PT,1) ,            True )",
        "DTF_x1_PE"  : "DTF_FUN ( CHILD(E,1) ,             True )",
        "DTF_x1_PX"  : "DTF_FUN ( CHILD(PX,1) ,            True )",
        "DTF_x1_PY"  : "DTF_FUN ( CHILD(PY,1) ,            True )",
        "DTF_x1_PZ"  : "DTF_FUN ( CHILD(PZ,1) ,            True )",

        "DTF_x2_M"   : "DTF_FUN ( CHILD(M,2) ,             True )",
        "DTF_x2_MM"  : "DTF_FUN ( CHILD(MM,2) ,            True )",
        "DTF_x2_P"   : "DTF_FUN ( CHILD(P,2) ,             True )",
        "DTF_x2_PT"  : "DTF_FUN ( CHILD(PT,2) ,            True )",
        "DTF_x2_PE"  : "DTF_FUN ( CHILD(E,2) ,             True )",
        "DTF_x2_PX"  : "DTF_FUN ( CHILD(PX,2) ,            True )",
        "DTF_x2_PY"  : "DTF_FUN ( CHILD(PY,2) ,            True )",
        "DTF_x2_PZ"  : "DTF_FUN ( CHILD(PZ,2) ,            True )",

        "DTF_x3_M"   : "DTF_FUN ( CHILD(M,3) ,             True )",
        "DTF_x3_MM"  : "DTF_FUN ( CHILD(MM,3) ,            True )",
        "DTF_x3_P"   : "DTF_FUN ( CHILD(P,3) ,             True )",
        "DTF_x3_PT"  : "DTF_FUN ( CHILD(PT,3) ,            True )",
        "DTF_x3_PE"  : "DTF_FUN ( CHILD(E,3) ,             True )",
        "DTF_x3_PX"  : "DTF_FUN ( CHILD(PX,3) ,            True )",
        "DTF_x3_PY"  : "DTF_FUN ( CHILD(PY,3) ,            True )",
        "DTF_x3_PZ"  : "DTF_FUN ( CHILD(PZ,3) ,            True )",

        }
    dttuple.D.ToolList+=["LoKi::Hybrid::TupleTool/LoKi_DTFMASS"]
    dttuple.D.addTool(LoKi_DTFMASS)

    if "MC" in dataType:
      from Configurables import TupleToolMCBackgroundInfo
      dttuple.addTool(TupleToolMCBackgroundInfo, name="TupleToolMCBackgroundInfo")
      dttuple.TupleToolMCBackgroundInfo.Verbose=True
      dttuple.addTool(TupleToolMCTruth, name="truth")
      dttuple.truth.ToolList += ["MCTupleToolHierarchy",
                                "MCTupleToolKinematic"]
      dttuple.ToolList+=["TupleToolMCBackgroundInfo/TupleToolMCBackgroundInfo"]
      dttuple.ToolList+=["TupleToolMCTruth/truth"]

    DaVinci().appendToMainSequence( [ dttuple ] )

  elif outputType == "dst":

    from Configurables import SelDSTWriter
    if stripRun:
      dst_Sel = AutomaticData(Location = stripOutputLoc)
    else:
      dst_Sel = AutomaticData(Location = "/Event/"+strippingStream+"/" + stripOutputLoc)

    dst_Filter = FilterDesktop('dst_Filter', Code = "ALL")

    dst_FilterSel = Selection(name = line.name().replace("Stripping",""),
                              Algorithm = dst_Filter,
                              RequiredSelections = [ dst_Sel ])

    dst_Seq = SelectionSequence('lsdata',
                                TopSelection = dst_FilterSel,
                                )

    dstw = SelDSTWriter("DSTWriter")
    dstw.OutputFileSuffix = "PiPiPi"
    #dstw.CopyProtoParticles = False
    dstw.SelectionSequences = [dst_Seq]
    #dstw.CopyL0DUReport = False
    #dstw.CopyHltDecReports = False
    #dstw.CopyMCTruth = True
    #dstw.CopyBTags = True
    DaVinci().appendToMainSequence( [ dstw.sequence() ] )
Exemple #24
0
                              dec = '[D_s+ -> ^(phi(1020) -> ^(KS0 -> ^pi+ ^pi-) ^(KS0 -> ^pi+ ^pi-)) ^pi+]CC',
                              branches = {'Ds' : '[D_s+ -> (phi(1020) -> (KS0 -> pi+ pi-) (KS0 -> pi+ pi-)) pi+]CC',
                                        'phi' : '[D_s+ -> ^(phi(1020) -> (KS0 -> pi+ pi-) (KS0 -> pi+ pi-)) pi+]CC',
                                        'Ks1' : '[D_s+ -> (phi(1020) -> ^(KS0 -> pi+ pi-) (KS0 -> pi+ pi-)) pi+]CC',
                                        'Ks2' : '[D_s+ -> (phi(1020) -> (KS0 -> pi+ pi-) ^(KS0 -> pi+ pi-)) pi+]CC',
                                        'pi1' : '[D_s+ -> (phi(1020) -> (KS0 -> ^pi+ pi-) (KS0 -> pi+ pi-)) pi+]CC',
                                        'pi2' : '[D_s+ -> (phi(1020) -> (KS0 -> pi+ ^pi-) (KS0 -> pi+ pi-)) pi+]CC',
                                        'pi3' : '[D_s+ -> (phi(1020) -> (KS0 -> pi+ pi-) (KS0 -> ^pi+ pi-)) pi+]CC',
                                        'pi4' : '[D_s+ -> (phi(1020) -> (KS0 -> pi+ pi-) (KS0 -> pi+ ^pi-)) pi+]CC',
                                        'pis' : '[D_s+ -> (phi(1020) -> (KS0 -> pi+ pi-) (KS0 -> pi+ pi-)) ^pi+]CC',
                                          })


if dataSample.isMC: # Kill banks with old stripping
    from Configurables import EventNodeKiller
    eventNodeKiller = EventNodeKiller('Stripkiller')
    eventNodeKiller.Nodes = [ '/Event/AllStreams', '/Event/Strip' ]

    #   Rerun the stripping selection if MC


    from StrippingConf.Configuration import StrippingConf, StrippingStream
    from StrippingSettings.Utils import strippingConfiguration
    from StrippingArchive.Utils import buildStreams
    from StrippingArchive import strippingArchive
    
    # Standard stripping21 
    stripping='stripping21'
    config  = strippingConfiguration(stripping)
    archive = strippingArchive(stripping)
    streams = buildStreams(stripping=config, archive=archive)
from StrippingConf.Configuration import StrippingConf, StrippingStream
from StrippingSettings.Utils import strippingConfiguration
from StrippingArchive.Utils import buildStreams
from StrippingArchive import strippingArchive
from Configurables import (
    EventNodeKiller,
    ProcStatusCheck,
    DaVinci,
    DecayTreeTuple
)
from GaudiConf import IOHelper
from DecayTreeTuple.Configuration import *

# Node killer: remove the previous Stripping
event_node_killer = EventNodeKiller('StripKiller')
event_node_killer.Nodes = ['/Event/AllStreams', '/Event/Strip']

# Build a new stream called 'CustomStream' that only
# contains the desired line
strip = 'stripping21'
streams = buildStreams(stripping=strippingConfiguration(strip),
                       archive=strippingArchive(strip))

custom_stream = StrippingStream('CustomStream')
custom_line = 'StrippingD2hhCompleteEventPromptDst2D2RSLine'

for stream in streams:
    for line in stream.lines:
        if line.name() == custom_line:
            custom_stream.appendLines([line])
Exemple #26
0
from Configurables import EventNodeKiller, ApplicationMgr
appConf = ApplicationMgr()
appConf.ExtSvc += ['DataOnDemandSvc']
enk = EventNodeKiller('KillTrigRawEvent')
enk.Nodes = [
    "Hlt", "Hlt1", "Hlt2", "Trig", "Raw", "Trigger/RawEvent", "Trigger"
]
appConf.TopAlg.insert(0, enk.getFullName())

from Configurables import L0App
L0App().TCK = '0x0044'
L0App().ReplaceL0Banks = True
L0App().EvtMax = -1
L0App().DataType = '2012'
L0App().DDDBtag = 'dddb-20130929-1'  ## latest strip20 tags as of Jan2013
L0App().CondDBtag = 'sim-20131023-vc-md100'
L0App().Simulation = True
L0App().outputFile = '/tmp/ikomarov/With_new_L0.dst'
from Configurables import EventSelector
EventSelector().PrintFreq = 3
from Configurables import MessageSvc
MessageSvc().OutputLevel = 3
from GaudiConf import IOHelper
IOHelper().inputFiles(["/tmp/ikomarov/Rewrited.dst"])
from Configurables import RootCnvSvc
RootCnvSvc().OutputLevel = 3
Exemple #27
0
from Configurables import EventNodeKiller, ApplicationMgr
appConf = ApplicationMgr()
appConf.ExtSvc += ['DataOnDemandSvc']
enk = EventNodeKiller('KillTrigRawEvent')
enk.Nodes = [ "Hlt","Hlt1","Hlt2","Trig","Raw", "Trigger/RawEvent", "Trigger" ]
appConf.TopAlg.insert( 0,  enk.getFullName() ) 

from Configurables import L0App
L0App().TCK = '0x0044'
L0App().ReplaceL0Banks = True
L0App().EvtMax = -1
L0App().DataType = '2012'
L0App().DDDBtag   = 'dddb-20130929-1'  ## latest strip20 tags as of Jan2013
L0App().CondDBtag = 'sim-20131023-vc-md100'
L0App().Simulation = True
L0App().outputFile = '/tmp/ikomarov/With_new_L0.dst'
from Configurables import EventSelector
EventSelector().PrintFreq = 3
from Configurables import MessageSvc
MessageSvc().OutputLevel = 3
from GaudiConf import IOHelper
IOHelper().inputFiles( [ "/tmp/ikomarov/Rewrited.dst"] ) 
from Configurables import RootCnvSvc
RootCnvSvc().OutputLevel=3
def execute_option_file(path):

    from Configurables import GaudiSequencer
    MySequencer = GaudiSequencer('Sequence')



    #Check whether it is a DST or MDST file
    import os.path
    extension = os.path.splitext(path)[1]
    print extension
    if extension.lower() == ".dst":
        DaVinci().InputType = 'DST'
    elif extension.lower() == ".mdst":
        DaVinci().InputType = 'MDST'
    else:
        raise Exception("Extension {extension} of {path} does not match .mdst or .dst".format(extension, path))

    #Kill some nodes if micro dst-file
    if DaVinci().InputType == 'MDST':
        from Configurables import EventNodeKiller
        eventNodeKiller = EventNodeKiller('DAQkiller')
        eventNodeKiller.Nodes = ['DAQ','pRec']
        MySequencer.Members+=[eventNodeKiller]




    #DecayTreeTuple
    data = DecayTreeTuple('Bu2LLK_mmLine')

    data.ToolList = [
          "TupleToolGeometry"
        , "TupleToolKinematic"
        , "TupleToolEventInfo"
        , "TupleToolPropertime"
        , "TupleToolTrigger"
        , "TupleToolTISTOS"
        , "TupleToolPid"
        , "TupleToolTrackInfo"
        , "TupleToolPrimaries"
        , "TupleToolDira"
        , "TupleToolTrackPosition"
        , "TupleToolRecoStats"
        ]
    if DaVinci().InputType != 'MDST':
        data.ToolList += ["TupleToolTrackIsolation"]
    if DaVinci().Simulation is True:
        data.ToolList +=[
          "TupleToolMCBackgroundInfo"
        , "TupleToolMCTruth"
        ]


    L0Triggers = ["L0MuonDecision", "L0DiMuonDecision", "L0HadronDecision", "L0ElectronDecision", "L0PhotonDecision" ]
    ##            ['Muon',               'DiMuon',               '  Hadron',     'Electron',  'Photon','PhotonHi','ElectronHi']


    Hlt1Triggers = [  "Hlt1TrackAllL0Decision", "Hlt1TrackMuonDecision" ,"Hlt1TrackPhotonDecision" ,"Hlt1DiMuonLowMassDecision" ,"Hlt1DiMuonHighMassDecision"]

    Hlt2Triggers = [
        ## muon lines
        "Hlt2SingleMuonDecision", "Hlt2SingleMuonLowPTDecision", "Hlt2SingleMuonHighPTDecision",
        "Hlt2DiMuonDecision",  "Hlt2DiMuonLowMassDecision",
        "Hlt2DiMuonJPsiDecision",  "Hlt2DiMuonJPsiHighPTDecision",  "Hlt2DiMuonPsi2SDecision",
        "Hlt2DiMuonDetachedDecision",  "Hlt2DiMuonDetachedJPsiDecision", "Hlt2DiMuonDetachedHeavyDecision", "Hlt2TriMuonTauDecision",
        ## hadron/Topo lines
        "Hlt2B2HHDecision",
        "Hlt2DiMuonBDecision",  "Hlt2DiMuonZDecision",
        "Hlt2TopoMu2BodyBBDTDecision", "Hlt2TopoMu3BodyBBDTDecision", "Hlt2TopoMu4BodyBBDTDecision",
        "Hlt2Topo2BodyBBDTDecision",   "Hlt2Topo3BodyBBDTDecision",   "Hlt2Topo4BodyBBDTDecision",
        ##others
        "Hlt2PassThroughDecision",
        "Hlt2TransparentDecision",
        ## inclusive decisions
        "Hlt2DiMuonDY.*Decision","Hlt2TopoE.*Decision", "Hlt2Topo.*Decision",  "Hlt2Charm.*Decision", "Hlt2DiElectron.*Decision"
        ]

    triggerList = L0Triggers + Hlt1Triggers + Hlt2Triggers


    data.addTool(TupleToolTISTOS)
    data.TupleToolTISTOS.VerboseL0 = True
    data.TupleToolTISTOS.VerboseHlt1 = True
    data.TupleToolTISTOS.VerboseHlt2 = True
    data.TupleToolTISTOS.FillL0 = True
    data.TupleToolTISTOS.FillHlt1 = True
    data.TupleToolTISTOS.FillHlt2 = True
    data.TupleToolTISTOS.OutputLevel = INFO
    data.TupleToolTISTOS.TriggerList = triggerList


    if DaVinci().Simulation is True: # for MC
        data.Inputs = ["/Event/AllStreams/Phys/Bu2LLK_mmLine/Particles"]
    elif DaVinci().Simulation is False: # for Tuple
        data.Inputs = ["/Event/Leptonic/Phys/Bu2LLK_mmLine/Particles"]
    else:
        raise Exception(" `DaVinci().Simulation` not set.")

    data.Decay = "[B+ -> ^(J/psi(1S) -> ^mu+ ^mu-) ^K+]CC"
    data.addBranches({
        "B"         : "[B+ -> (J/psi(1S) -> mu+ mu-) K+]CC",
        "Psi"       : "[B+ -> ^(J/psi(1S) -> mu+ mu-) K+]CC",
        "muplus"    : "[B+ -> (J/psi(1S) -> ^mu+ mu-) K+]CC",
        "muminus"   : "[B+ -> (J/psi(1S) -> mu+ ^mu-) K+]CC",
        "Kplus"     : "[B+ -> (J/psi(1S) -> mu+ mu-) ^K+]CC"
        })

    data.TupleName = "DecayTree"


    #DecayTreeFitter
    fitter = data.B.addTupleTool("TupleToolDecayTreeFitter/FIX_JPSI")
    fitter.constrainToOriginVertex = False
    fitter.daughtersToConstrain = [ "J/psi(1S)" ]
    fitter.Verbose = True



    #Isolation
    data.B.addTool(TupleToolApplyIsolation, name="TupleToolApplyIsolationHard")
    data.B.TupleToolApplyIsolationHard.OutputSuffix="_Hard"
    data.B.TupleToolApplyIsolationHard.WeightsFile="weightsHard.xml"
    data.B.ToolList+=["TupleToolApplyIsolation/TupleToolApplyIsolationHard"]
    data.B.addTool(TupleToolApplyIsolation, name="TupleToolApplyIsolationSoft")
    data.B.TupleToolApplyIsolationSoft.OutputSuffix="_Soft"
    data.B.TupleToolApplyIsolationSoft.WeightsFile="weightsSoft.xml"
    data.B.ToolList+=["TupleToolApplyIsolation/TupleToolApplyIsolationSoft"]
    vtxiso = data.B.addTupleTool("TupleToolVtxIsoln")
    #data.B.TupleToolApplyIsolationHard.OutputLevel = 3
    #data.B.TupleToolApplyIsolationSoft.OutputLevel = 3


    MySequencer.Members.append(data)





    #EventTuple for simulation
    """
    if DaVinci().Simulation is True:
        etuple = EventTuple()
        etuple.ToolList=["TupleToolEventInfo"]

        MySequencer.Members.append(etuple)
    """



    #DDDB and CondDB-Tags for DATA (needs to be set for Simulation in runfile.py according to generation->see bookkeeping!)
    #Always use the latest tags for the given datatype from (the newest are currently not in the database yet, therefore take the default ones!)
    """
    if DaVinci().Simulation is False:
        if DaVinci().DataType == '2012':
            DaVinci().CondDBtag = "dddb-20150522-2"
            DaVinci().DDDBtag = "cond-20150409-1"
        elif DaVinci().DataType == '2011':
            DaVinci().CondDBtag = "dddb-20150522-1"
            DaVinci().DDDBtag = "cond-20150409"
    """



    ################################
    ###   DaVinci configuration ####
    ################################

    DaVinci().UserAlgorithms = [MySequencer]
    DaVinci().MoniSequence += [data]
    DaVinci().EvtMax     = -1
    DaVinci().Lumi       = True
    def defineOutput(self):
        """
        Set up output stream according to output data type
        """

        knownOptions = ["MDF", "DIGI"]
        outputs = []
        for option in self.getProp("Outputs"):
            if option not in knownOptions:
                raise RuntimeError("Unknown Boole().Outputs value '%s'" %
                                   option)
            outputs.append(option)

        if "DIGI" in outputs:
            seq = GaudiSequencer("PrepareDIGI")
            ApplicationMgr().TopAlg += [seq]

            # In Minimal case, filter the MCVertices before writing
            if self.getProp("DigiType").capitalize() == "Minimal":
                seq.Members = ["FilterMCPrimaryVtx"]

            # In packed case, run the packing algorithms
            if self.getProp("EnablePack"):
                DigiConf().PackSequencer = seq

            writerName = "DigiWriter"
            digiWriter = OutputStream(writerName, Preload=False)
            digiWriter.RequireAlgs.append("Filter")
            if self.getProp("NoWarnings"
                            ) and not digiWriter.isPropertySet("OutputLevel"):
                digiWriter.OutputLevel = INFO

            # Set up the Digi content
            DigiConf().Writer = writerName
            DigiConf().OutputName = self.outputName()
            self.setOtherProps(DigiConf(), [
                "DigiType",
                "TAEPrev",
                "TAENext",
                "UseSpillover",
                "DataType",
            ])
            if self.getProp("UseSpillover"):
                self.setOtherProps(DigiConf(), ["SpilloverPaths"])

        if "MDF" in outputs:
            # Make sure that file will have no knowledge of other nodes
            from Configurables import EventNodeKiller
            nodeKiller = EventNodeKiller("MDFKiller")
            nodeKiller.Nodes = [
                "Rec", "Trig", "MC", "Raw", "Gen", "Link", "pSim"
            ]
            taePrev = self.getProp("TAEPrev")
            while taePrev > 0:
                nodeKiller.Nodes += ["Prev%" % taePrev]
                taePrev -= 1
            taeNext = self.getProp("TAENext")
            while taeNext > 0:
                nodeKiller.Nodes += ["Next%s" % taeNext]
                taeNext -= 1

            MyWriter = OutputStream("RawWriter",
                                    Preload=False,
                                    ItemList=["/Event/DAQ/RawEvent#1"])
            if not MyWriter.isPropertySet("Output"):
                MyWriter.Output = "DATAFILE='PFN:" + self.outputName(
                ) + ".mdf' SVC='LHCb::RawDataCnvSvc' OPT='REC'"
            MyWriter.RequireAlgs.append("Filter")
            if self.getProp("NoWarnings"
                            ) and not MyWriter.isPropertySet("OutputLevel"):
                MyWriter.OutputLevel = INFO
            ApplicationMgr().OutStream += [nodeKiller, MyWriter]
Exemple #30
0
    HistoPrint = True,
    ## N-tuple LUN 
    NTupleLUN  = "DTT",
    ## input particles from selection:
    Inputs = [ '/Event/SwimStrippingD2hhMDST_v14r8/CharmToBeSwum/Phys/D2hhPromptD2KPiLine/Particles' ],
    ## Primary vertices from mDST
    P2PVInputLocations = [ '/Event/SwimStrippingD2hhMDST_v14r8/CharmToBeSwum/Phys/D2hhPromptD2KPiLine/Particle2VertexRelations'],
    UseP2PVRelations = True,
    WriteP2PVRelations = False,
    Decay = "[[D0]cc -> ^K- ^pi+]cc"
    )

from DecayTreeTuple.Configuration import *
## Add appropriate tools
from Configurables import EventNodeKiller
killer=EventNodeKiller( Nodes = ["/Event/DAQ","/Event/pRec"] ) 

dtt.addBranches({
    "D" : "[D0]cc : [[D0]cc -> K- pi+]cc"
})

dtt.D.addTupleTool('TupleToolPropertime')
ttsi = dtt.D.addTupleTool('TupleToolSwimmingInfo/TriggerInfo')
ttsis = dtt.D.addTupleTool('TupleToolSwimmingInfo/StrippingInfo')
ttsi.ReportsLocation = '/Event/SwimStrippingD2hhMDST_v14r8/CharmToBeSwum/Phys/D2hhPromptD2KPiLine/P2TPRelations'
ttsis.ReportsLocation = '/Event/SwimStrippingD2hhMDST_v14r8/CharmToBeSwum/Phys/D2hhPromptD2KPiLine/P2TPRelations'
ttsis.ReportStage = "Stripping"

tttt = dtt.D.addTupleTool('TupleToolTISTOS')
tttt.TriggerList = ['Hlt1TrackAllL0Decision', 'Hlt2CharmHadD02HH_D02KPiDecision']
tttt.VerboseHlt1 = True
    rawEventLoc = rootInTES + "DAQ/RawEvent"
    from Configurables import RawEventSelectiveCopy
    rawCopy = RawEventSelectiveCopy("CopyRawEvent")
    rawCopy.InputRawEventLocation = "/Event/Trigger/RawEvent"
    rawCopy.OutputRawEventLocation = rawEventLoc
    rawCopy.RawBanksToCopy = ["ODIN",
                              "HltSelReports" ,
                              "HltDecReports",
                              "L0Calo",
                              "L0CaloFull",
                              "L0DU",
                              "L0Muon",
                              "L0MuonProcCand",
                              "L0PU",
                              "HltRoutingBits"]
    from Configurables import CopyODIN
    CopyODIN().OutputPrefix = stream 
    from Configurables import (OdinTimeDecoder,ODINDecodeTool)
    OdinTimeDecoder().addTool( ODINDecodeTool, 'ODINDecodeTool' )
    #removed 2014.11.03 as does not have that property
    #OdinTimeDecoder().ODINDecodeTool.RawEventLocation = "/Event/Trigger/RawEvent"
    from Configurables import EventNodeKiller
    eventNodeKiller = EventNodeKiller('DAQkiller')
    eventNodeKiller.Nodes = ['DAQ']
    JpsiSelectionSeq.Members += [eventNodeKiller, CopyODIN(), rawCopy] 

#from Configurables import StoreExplorerAlg
#DaVinci().appendToMainSequence( [ StoreExplorerAlg(PrintEvt=1, ExploreRelations=
#True, Load=True) ] )

from Configurables import ChargedProtoParticleMaker, CombinedParticleMaker, NoPIDsParticleMaker, BestPIDParticleMaker, DataOnDemandSvc, UnpackTrack, DelegatingTrackSelector, TrackSelector, GaudiSequencer, TrackToDST, ChargedPP2MC, TrackAssociator, EventNodeKiller, DaVinci, TrackSmeared
from Configurables import ChargedProtoParticleAddMuonInfo, MuonIDAlg, ChargedProtoParticleAddRichInfo
from MuonID import ConfiguredMuonIDs
from Configurables import ProtoParticleMUONFilter, ChargedProtoCombineDLLsAlg, ProtoParticleCALOFilter

# kill all links
initseq = GaudiSequencer("AnalysisInitSeq")
evtnodekiller = EventNodeKiller("KillLinks")
evtnodekiller.Nodes = ["Link/Rec"]
initseq.Members += [evtnodekiller]
#TrackSmeared().OutputLevel = 0
#ChargedProtoParticleMaker().OutputLevel = 0
#NoPIDsParticleMaker().OutputLevel = 0

#MyOptions = [ "MC" ]
print "OPTIONS OF MAKEMYPARTICLES"
#print MyOptions


def makeMyProtoP(trackcont):
    unpacker = UnpackTrack(trackcont + "UnpackTrack")
    unpacker.InputName = "pRec/Track/" + trackcont
    unpacker.OutputName = "Rec/Track/" + trackcont
    refitter = TrackSmeared(trackcont + "TrackSmeared")
    refitter.InputLocation = "Rec/Track/" + trackcont
    refitter.OutputLocation = "Refit"
    refitter.smear = 1
    #refitter.makePlots = 1
    #refitter.OutputLevel = 2
    #idalg = MuonIDAlg("BestIDalg")
    #idalg.OutputLevel = 0
Exemple #33
0
Moore().CondDBtag = 'cond-20120831'
#from RunDB
Moore().EnableTimer = "timerdefault.csv"

########### L0-related things #######################

from Configurables import L0Conf
L0Conf().EnsureKnownTCK = False
Moore().ForceSingleL0Configuration = False

############# prepend a "killHltSeq" ############

#copied from Swimming/Configuration.py line 214
from Configurables import Swimming, GaudiSequencer, EventNodeKiller
nodes = Swimming.__slots__["HltNodesToKill"]
mykiller = EventNodeKiller("killHlt")
mykiller.Nodes = nodes
deathstar = GaudiSequencer("killHltSeq")
deathstar.Members = [mykiller]


class Deathstar(object):
    def __init__(self, seq):
        self._seq = seq

    def witnessTheFirepowerOfThisFullyArmedAndOperationalBattleStation(self):
        ApplicationMgr().TopAlg.insert(0, self._seq)


d = Deathstar(deathstar)
appendPostConfigAction(
def ConfigureDaVinci():
    config = Swimming()
    from Configurables import DaVinci
    from StrippingConf.Configuration import StrippingConf
    from Configurables import ProcStatusCheck
    from Configurables import EventNodeKiller, GaudiSequencer
    from PhysSelPython.Wrappers import (AutomaticData, SelectionSequence,
                                        MultiSelectionSequence)

    # Get the stripping line
    from StrippingSettings.Utils import lineBuilderConfiguration
    strippingFile = None
    if config.getProp('StrippingFile') != 'none':
        strippingFile = config.getProp('StrippingFile')
    else:
        strippingFile = config.getProp('StrippingLineGroup')
    myconfig = lineBuilderConfiguration(config.getProp('StrippingVersion'),
                                        config.getProp('StrippingLineGroup'))
    import StrippingArchive
    mylineconf = getattr(
        __import__(
            'StrippingArchive.' +
            config.getProp('StrippingVersion') + '.Stripping' + strippingFile,
            globals(), locals(), [myconfig["BUILDERTYPE"]], -1),
        myconfig["BUILDERTYPE"])
    mylinedict = myconfig["CONFIG"]
    substitutions = config.getProp('StrippingConfigSubstitutions')
    print "mylinedict before substitutions:", mylinedict
    print "stripping config substitutions:", substitutions
    mylinedict.update(substitutions)
    print "mylineconf:", mylineconf
    print "mylinedict after substitutions:", mylinedict

    from StrippingConf.StrippingStream import StrippingStream
    stream = StrippingStream(config.getProp('StrippingStream') + "Swimming")
    allLines = mylineconf(config.getProp('StrippingLineGroup'),
                          mylinedict).lines()
    lines = []
    #lineNames = [l.split('/')[-1] for l in config.getProp('StripCands').keys()]
    lineNames = config.getProp('StrippingLines')
    print "lineNames:", lineNames
    for l in allLines:
        for lineName in lineNames:
            if l.outputLocation().find(lineName) != -1:
                lines.append(l)
                print l.outputLocation()
    stream.appendLines(lines)

    # Define the stream
    filterBadEvents = ProcStatusCheck()
    sc = StrippingConf(Streams=[stream],
                       MaxCandidates=2000,
                       AcceptBadEvents=False,
                       BadEventSelection=filterBadEvents)

    # Define the node killer, and make sure to kill everything corresponding to
    # the stream which we want to swim
    outputs = []
    from Configurables import Swimming__PVReFitter as ReFitter
    for l in lines:
        for f in l.filterMembers():
            if hasattr(f, 'ReFitPVs') and f.ReFitPVs:
                if not config.getProp('RefitPVs'):
                    log.warning('RefitPVs is not set, but stripping line applies refitting. Refitted ' + \
                                'PVs will be used for turning-point lifetime calculations.')
                    config.setProp('RefitPVs', True)
                t = f.PVReFitters['']
                f.PVReFitters = {'': 'Swimming::PVReFitter/PVReFitter'}
                f.addTool(ReFitter, 'PVReFitter')
                f.PVReFitter.PVReFitter = t
            elif not hasattr(f, 'Output'):
                continue
            # Remove the last item so we get everything (Particle, relations,
            # decayVertices, etc...
            o = '/'.join(f.Output.split('/')[:-1])
            outputs.append(o)
    print "Outputs are", outputs
    mykiller = EventNodeKiller("killStripping")
    # Some default nodes which we will want to kill in all cases
    nodestokill = outputs + ['Strip', '/Event/Rec/Vertex/Primary']
    mykiller.Nodes = nodestokill
    deathstar = GaudiSequencer("killStrippingSeq")
    deathstar.Members = [mykiller]

    # Configure DaVinci
    DaVinci().InputType = config.getProp('InputType')
    DaVinci().DataType = config.getProp('DataType')
    DaVinci().Simulation = config.getProp('Simulation')
    DaVinci().DDDBtag = config.getProp('DDDBtag')
    DaVinci().CondDBtag = config.getProp('CondDBtag')
    try:
        DaVinci().Persistency = config.getProp('Persistency')
    except AttributeError:
        print "DaVinci doesn't have a Persistency attribute to set"

    # The sequence for the swimming has to be configured
    # by hand inserting the node killer before it
    DaVinci().appendToMainSequence([deathstar])
    DaVinci().appendToMainSequence([sc.sequence()])

    # Since the name of the output file is configured in two places in DaVinci,
    # do some splitting.
    splitName = config.getProp('OutputFile').split(os.path.extsep)
    seqName = ''
    prefix = ''
    if len(splitName) <= 2:
        seqName = splitName[0]
        print "Warning, an output filename in three parts was specified. This does not work well, " + \
              " so 'Swimming.' will be prefixed."
        prefix = 'Swimming'
    else:
        prefix = splitName[0]
        seqName = os.path.extsep.join(splitName[1:-1])

    dstWriter = None
    print config.getProp('OutputType')

    # Offline candidate selection sequences
    sequences = []
    offCands = config.getProp('OffCands').keys()
    for i, cands in enumerate(offCands):
        data = AutomaticData(Location=cands + "/Particles")
        offSeq = SelectionSequence("OfflineCandidates_%d" % i,
                                   TopSelection=data)
        sequences.append(offSeq)

    # selection sequence for offline candidates
    muCands = config.getProp('MuDSTCands')
    for i, cands in enumerate(muCands):
        # Add extra selections for additional MuDSTCands
        data = AutomaticData(Location=cands + "/Particles")
        seq = SelectionSequence("MuDSTCands_%d" % i, TopSelection=data)
        sequences.append(seq)

    selectionSeq = MultiSelectionSequence(seqName, Sequences=sequences)

    if config.getProp('OutputType') == 'MDST':
        pack = False
        isMC = config.getProp("Simulation")
        SwimmingConf = config.getProp('MicroDSTStreamConf')
        SwimmingElements = config.getProp('MicroDSTElements')
        if SwimmingConf == False:
            from DSTWriters.Configuration import stripMicroDSTStreamConf
            SwimmingConf = stripMicroDSTStreamConf(pack=pack, isMC=isMC)
        if len(SwimmingElements) == 0:
            from DSTWriters.Configuration import stripMicroDSTElements
            from DSTWriters.microdstelements import CloneSwimmingReports, CloneParticleTrees, CloneTPRelations
            mdstElements = stripMicroDSTElements(pack=pack, isMC=isMC)
            SwimmingElements = [CloneSwimmingReports()]
            for element in mdstElements:
                SwimmingElements += [element]
                if type(element) == CloneParticleTrees:
                    SwimmingElements += [CloneTPRelations("P2TPRelations")]

        streamConf = {'default': SwimmingConf}
        elementsConf = {'default': SwimmingElements}
        try:
            from DSTWriters.__dev__.Configuration import MicroDSTWriter
        except:
            from DSTWriters.Configuration import MicroDSTWriter
        dstWriter = MicroDSTWriter('MicroDST',
                                   StreamConf=streamConf,
                                   MicroDSTElements=elementsConf,
                                   WriteFSR=config.getProp('WriteFSR'),
                                   OutputFileSuffix=prefix,
                                   SelectionSequences=[selectionSeq])
    elif config.getProp('OutputType') == 'DST':
        try:
            from DSTWriters.__dev__.streamconf import OutputStreamConf
            from DSTWriters.__dev__.Configuration import SelDSTWriter
        except ImportError:
            from DSTWriters.streamconf import OutputStreamConf
            from DSTWriters.Configuration import SelDSTWriter

        streamConf = OutputStreamConf(streamType = InputCopyStream,
                                      fileExtension = '.dst',
                                      extraItems = [config.getProp('SwimmingPrefix') + '/Reports#1'] +\
                                      list(set([l + '/P2TPRelations#1' for l in config.getProp('OffCands').values()])))
        SelDSTWriterElements = {'default': []}
        SelDSTWriterConf = {'default': streamConf}
        dstWriter = SelDSTWriter('FullDST',
                                 StreamConf=SelDSTWriterConf,
                                 MicroDSTElements=SelDSTWriterElements,
                                 WriteFSR=config.getProp('WriteFSR'),
                                 OutputFileSuffix=prefix,
                                 SelectionSequences=[selectionSeq])

    DaVinci().appendToMainSequence([dstWriter.sequence()])
Exemple #35
0
    branches={
        "phi": "[phi(1020) -> (KS0 -> pi+ pi-) (KS0 -> pi+ pi-)]CC",
        "Ks1": "[phi(1020) -> ^(KS0 -> pi+ pi-) (KS0 -> pi+ pi-)]CC",
        "Ks2": "[phi(1020) -> (KS0 -> pi+ pi-) ^(KS0 -> pi+ pi-)]CC",
        "pi1": "[phi(1020) -> (KS0 -> ^pi+ pi-) (KS0 -> pi+ pi-)]CC",
        "pi2": "[phi(1020) -> (KS0 -> pi+ ^pi-) (KS0 -> pi+ pi-)]CC",
        "pi3": "[phi(1020) -> (KS0 -> pi+ pi-) (KS0 -> ^pi+ pi-)]CC",
        "pi4": "[phi(1020) -> (KS0 -> pi+ pi-) (KS0 -> pi+ ^pi-)]CC",
    },
)


if dataSample.isMC:  # Kill banks with old stripping
    from Configurables import EventNodeKiller

    eventNodeKiller = EventNodeKiller("Stripkiller")
    eventNodeKiller.Nodes = ["/Event/AllStreams", "/Event/Strip"]

    #   Rerun the stripping selection if MC

    from StrippingConf.Configuration import StrippingConf, StrippingStream
    from StrippingSettings.Utils import strippingConfiguration
    from StrippingArchive.Utils import buildStreams
    from StrippingArchive import strippingArchive

    # Standard stripping21
    stripping = "stripping21"
    config = strippingConfiguration(stripping)
    archive = strippingArchive(stripping)
    streams = buildStreams(stripping=config, archive=archive)
def execute_option_file(path):
    # ================= BEGIN EDIT AREA =======================
    tuplename = "Bu2LLK_meLine"
    simulation_inputstring = "/Event/AllStreams/Phys/Bu2LLK_meLine/Particles"
    data_inputstring = "/Event/Leptonic/Phys/Bu2LLK_meLine/Particles"

    decaydescriptor = "[B+ -> ^[J/psi(1S) -> ^mu+ ^e-]CC ^K+]CC"
    branches = {    # Dictionary for the branches to write in the tuple
        "B"         : "[B+ -> [J/psi(1S) -> mu+ e-]CC K+]CC",
        "Psi"       : "[B+ -> ^[J/psi(1S) -> mu+ e-]CC K+]CC",
        "muplus"    : "[B+ -> [J/psi(1S) -> ^mu+ e-]CC K+]CC",
        "eminus"    : "[B+ -> [J/psi(1S) -> mu+ ^e-]CC K+]CC",
        "Kplus"     : "[B+ -> [J/psi(1S) -> mu+ mu-]CC ^K+]CC"
    }

    toollist = [  "TupleToolBremInfo"       #Bremsstrahlung information
                #, "TupleToolGeometry"       #geometry of vertex locations (ENDVERTEX, OWNPV, IP_OWNPV, FD_OWNPV, DIRA_OWNPV)
                , "TupleToolKinematic"      #kinematic variables (inv. mass MM, kin. mass M/sqrt(E^2-p^2), P, PX/Y/Z/E, PT)
                #, "TupleToolEventInfo"      #Event information such as run number, polarity, GPS time etc.
                #, "TupleToolPropertime"     #proper lifetime of reconstructed particles
                #, "TupleToolAngles"        #decay angles of charged tracks
                #, "TupleToolTrigger"
                #, "TupleToolTrackInfo"      #GhostProb of track and track type (TYPE) - 0 = unknown, 1 = velo track...
                #, "TupleToolPrimaries"      #Number and coordinates of all primary vertices
                #, "TupleToolDira"
                #, "TupleToolTrackPosition"  #Plot the X/Y position at a given Z (default: 2500 = TTstation)
                #, "TupleToolRecoStats"
                #, "TupleToolIsolationTwoBody"  #degree of isolation of two particles with common mother from Bsmumu
                #, "TupleToolANNPID"         #V2,V3,... ProbNN variables
                #, "TupleToolCaloHypo"
                #, "TupleToolL0Calo"
                ]
    # ================= END EDIT AREA =======================




    # ================= BEGIN DO NOT EDIT HERE =======================
    from Configurables import GaudiSequencer
    MySequencer = GaudiSequencer('Sequence')



    #Check whether it is a DST or MDST file
    import os.path
    extension = os.path.splitext(path)[1]
    print extension
    if extension.lower() == ".dst":
        DaVinci().InputType = 'DST'
    elif extension.lower() == ".mdst":
        DaVinci().InputType = 'MDST'
    else:
        raise Exception("Extension {extension} of {path} does not match .mdst or .dst".format(extension, path))

    #Kill some nodes if micro dst-file
    if DaVinci().InputType == 'MDST':
        from Configurables import EventNodeKiller
        eventNodeKiller = EventNodeKiller('DAQkiller')
        eventNodeKiller.Nodes = ['/Event/DAQ','/Event/pRec']
        MySequencer.Members+=[eventNodeKiller]



    #DecayTreeTuple -> Fills information about particles, vertices and daughters
    ntuple = DecayTreeTuple(tuplename)



    if DaVinci().Simulation is True: # for MC
        ntuple.Inputs = [simulation_inputstring]
    elif DaVinci().Simulation is False: # for Tuple
        ntuple.Inputs = [data_inputstring]
    else:
        raise Exception(" `DaVinci().Simulation` not set.")

    ntuple.Decay = decaydescriptor
    ntuple.addBranches(branches)

    ntuple.TupleName = "DecayTree"


    #Tools added to the ToolList can not be modified i.e. no other options than the defaults can be used
    ntuple.ToolList = toollist

    MySequencer.Members.append(ntuple)






    # ================= END DO NOT EDIT HERE =======================




    if DaVinci().Simulation is True:
        from Configurables import BackgroundCategory
        backgroundinfo = ntuple.addTupleTool("TupleToolMCBackgroundInfo")           #Fills the background category
        backgroundinfo.addTool(BackgroundCategory('BackgroundCategory'))
        backgroundinfo.BackgroundCategory.SoftPhotonCut = 100000000000.                    #Ignores all photons
        MCTruth=ntuple.addTupleTool("TupleToolMCTruth")            #Saves information of MC particle associated to the current particle (you can add tools to it itself!)
        MCTruth.addTupleTool("MCTupleToolHierarchy")               #True IDs of mother and grandmother particles




    # ================= BEGIN EDIT TUPLETOOLS WITH OPTIONS ==================

    # LOKI TupleTool
    LoKi = ntuple.addTupleTool("LoKi::Hybrid::TupleTool")
    LoKi.Variables =  {
        "ETA" : "ETA",
        "PHI" : "PHI"       #Azimuthal angle
    }


    #Track isolation
    if(False):
        if DaVinci().InputType != 'MDST':
            ntuple.ToolList += ["TupleToolTrackIsolation"]


    # PID TupleTool
    if(True):
        pid = ntuple.addTupleTool("TupleToolPid")            #PID information for charged particles
        pid.Verbose = True                                   #More information like isMuonLoose etc.



    #TISTOS TupleTool
    if(False):
        from Configurables import TupleToolTISTOS

        L0Triggers = ["L0MuonDecision", "L0DiMuonDecision", "L0HadronDecision", "L0ElectronDecision", "L0PhotonDecision" ]
        ##            ['Muon',               'DiMuon',               '  Hadron',     'Electron',  'Photon','PhotonHi','ElectronHi']

        Hlt1Triggers = [  "Hlt1TrackAllL0Decision", "Hlt1TrackMuonDecision" ,"Hlt1TrackPhotonDecision" ,"Hlt1DiMuonLowMassDecision" ,"Hlt1DiMuonHighMassDecision"]

        Hlt2Triggers = [
            ## muon lines
            "Hlt2SingleMuonDecision", "Hlt2SingleMuonLowPTDecision", "Hlt2SingleMuonHighPTDecision",
            "Hlt2DiMuonDecision",  "Hlt2DiMuonLowMassDecision",
            "Hlt2DiMuonJPsiDecision",  "Hlt2DiMuonJPsiHighPTDecision",  "Hlt2DiMuonPsi2SDecision",
            "Hlt2DiMuonDetachedDecision",  "Hlt2DiMuonDetachedJPsiDecision", "Hlt2DiMuonDetachedHeavyDecision", "Hlt2TriMuonTauDecision",
            ## hadron/Topo lines
            "Hlt2B2HHDecision",
            "Hlt2DiMuonBDecision",  "Hlt2DiMuonZDecision",
            "Hlt2TopoMu2BodyBBDTDecision", "Hlt2TopoMu3BodyBBDTDecision", "Hlt2TopoMu4BodyBBDTDecision",
            "Hlt2TopoE2BodyBBDTDecision", "Hlt2TopoE3BodyBBDTDecision", "Hlt2TopoE4BodyBBDTDecision",
            "Hlt2Topo2BodyBBDTDecision",   "Hlt2Topo3BodyBBDTDecision",   "Hlt2Topo4BodyBBDTDecision",
            ##others
            "Hlt2PassThroughDecision",
            "Hlt2TransparentDecision",
            ## inclusive decisions
            "Hlt2DiMuonDY.*Decision","Hlt2TopoE.*Decision", "Hlt2Topo.*Decision",  "Hlt2Charm.*Decision", "Hlt2DiElectron.*Decision"
            ]

        triggerList = L0Triggers + Hlt1Triggers + Hlt2Triggers

        ntuple.addTupleTool("TupleToolTISTOS")
        ntuple.TupleToolTISTOS.VerboseL0 = True
        ntuple.TupleToolTISTOS.VerboseHlt1 = True
        ntuple.TupleToolTISTOS.VerboseHlt2 = True
        ntuple.TupleToolTISTOS.FillL0 = True
        ntuple.TupleToolTISTOS.FillHlt1 = True
        ntuple.TupleToolTISTOS.FillHlt2 = True
        ntuple.TupleToolTISTOS.OutputLevel = INFO
        ntuple.TupleToolTISTOS.TriggerList = triggerList



    #DecayTreeFitter
    if(False):
        fitter = ntuple.B.addTupleTool("TupleToolDecayTreeFitter/FIX_JPSI")
        fitter.constrainToOriginVertex = False
        fitter.daughtersToConstrain = [ "J/psi(1S)" ]
        fitter.Verbose = True





    #Isolation tool from Alex
    weightsfolder = "./"
    if(False):
        from Configurables import TupleToolApplyIsolation
        ntuple.B.addTupleTool(TupleToolApplyIsolation, name="TupleToolApplyIsolationHard")
        ntuple.B.TupleToolApplyIsolationHard.OutputSuffix="_Hard"
        ntuple.B.TupleToolApplyIsolationHard.WeightsFile= weightsfolder+"weightsHard.xml"
        ntuple.B.addTupleTool(TupleToolApplyIsolation, name="TupleToolApplyIsolationSoft")
        ntuple.B.TupleToolApplyIsolationSoft.OutputSuffix="_Soft"
        ntuple.B.TupleToolApplyIsolationSoft.WeightsFile= weightsfolder+"weightsSoft.xml"
        ntuple.B.addTupleTool("TupleToolVtxIsoln")
        #ntuple.B.TupleToolApplyIsolationHard.OutputLevel = 3
        #ntuple.B.TupleToolApplyIsolationSoft.OutputLevel = 3

    #Tool from B2ee
    if(False):
        from Configurables import TupleToolMuonVariables
        ntuple.addTupleTool("TupleToolMuonVariables")
        if DaVinci().InputType == 'MDST':
            ntuple.TupleToolMuonVariables.TrackContainer = "/Event/Leptonic/Rec/Track/Best"         #Change in case of MDST!
        ntuple.TupleToolMuonVariables.BDTSRootFile = weightsfolder+"HflatBDTS_7Dec.root"
        ntuple.TupleToolMuonVariables.BDTSXMLFile  = weightsfolder+"TMVA_7Dec.weights.xml"





    #Settings for TupleToolTrackHits (some only are necessary for MDST-files because of other locations of the clusters)
    if(True):   #Change this value if you don't want to use this tool
        from Configurables import TupleToolTrackHits, STOfflinePosition
        trackhits = ntuple.addTupleTool("TupleToolTrackHits")
        trackhits.Verbose = True

        if DaVinci().InputType == 'MDST':
            from Configurables import MeasurementProvider
            ntuple.addTool(MeasurementProvider('MeasProvider'))
            ntuple.MeasProvider.RootInTES = "/Event/Leptonic/"        #Change Leptonic for your stream-name in case of MDST
            trackhits.MeasurementProvider = ntuple.MeasProvider

        itClusterPosition = STOfflinePosition('ToolSvc.ITClusterPosition')      #avoid crashes from missing IT channels
        itClusterPosition.DetType = 'IT'


    #Settings for TupleToolAllPhotons (only works for fullDST files)
    #Should be always added to only one branch
    if(DaVinci().InputType == 'DST'):
        if(True):
            from Configurables import TupleToolAllPhotons, STOfflinePosition
            allphotons = ntuple.eminus.addTupleTool("TupleToolAllPhotons")
            allphotons.MCTruth = True
            allphotons.PhotonsLocation = "/Event/Phys/StdVeryLooseAllPhotons/Particles"

            itClusterPosition = STOfflinePosition('ToolSvc.ITClusterPosition')      #avoid crashes from missing IT channels
            itClusterPosition.DetType = 'IT'
            #allphotons.PhotonsLocation = "/Event/Phys/StdLooseAllPhotons/Particles"



    #Settings for TupleToolBremRemover
    #Should be always added to specific branches
    if(True):
        from Configurables import TupleToolBremRemover
        bremremover = ntuple.eminus.addTupleTool("TupleToolBremRemover")
        if DaVinci().Simulation is True:
            bremremover.TRUEP = True


    #TupleToolTrackKink: Refits the track and outputs kink as point with highest Chi2 variation (should be run last because of the refit)
    if(False):
        ntuple.eminus.addTupleTool("TupleToolTrackKink")

    # ================= END EDIT TUPLETOOLS WITH OPTIONS ==================




    ################################
    ###   DaVinci configuration ####
    ################################

    DaVinci().UserAlgorithms = [MySequencer]
    DaVinci().MoniSequence += [ntuple]
    DaVinci().EvtMax     = -1
    DaVinci().SkipEvents = 0
    DaVinci().Lumi       = True
def execute_option_file(path):

    from Configurables import GaudiSequencer
    MySequencer = GaudiSequencer('Sequence')


    #Check whether it is a DST or MDST file
    import os.path
    extension = os.path.splitext(path)[1]
    print extension
    if extension.lower() == ".dst":
        DaVinci().InputType = 'DST'
    elif extension.lower() == ".mdst":
        DaVinci().InputType = 'MDST'
    else:
        raise Exception("Extension {extension} of {path} does not match .mdst or .dst".format(extension, path))

    #Kill some nodes if micro dst-file
    if DaVinci().InputType == 'MDST':
        from Configurables import EventNodeKiller
        eventNodeKiller = EventNodeKiller('DAQkiller')
        eventNodeKiller.Nodes = ['/Event/DAQ','/Event/pRec']
        MySequencer.Members+=[eventNodeKiller]




    #Create DecayTreeTuple -> Fills information about particles, vertices and daughters
    data = DecayTreeTuple('Bu2LLK_meLine')

    #Set root "folder" for MDST - better don't do this as it most likely causes a crash
    #Instead set RootInTES for the particular Tool (e.g. TupleToolTrackHits that needs it)
    #if DaVinci().InputType == 'MDST':
    #    data.RootInTES = "/Event/Leptonic"


    if DaVinci().Simulation is True: # for MC
        data.Inputs = ["/Event/AllStreams/Phys/Bu2LLK_meLine/Particles"]
    elif DaVinci().Simulation is False: # for Tuple
        data.Inputs = ["/Event/Leptonic/Phys/Bu2LLK_meLine/Particles"]
    else:
        raise Exception(" `DaVinci().Simulation` not set.")

    data.Decay = "[B+ -> ^[J/psi(1S) -> ^mu+ ^e-]CC ^K+]CC"
    data.addBranches({
        "B"         : "[B+ -> [J/psi(1S) -> mu+ e-]CC K+]CC",
        "Psi"       : "[B+ -> ^[J/psi(1S) -> mu+ e-]CC K+]CC",
        "muplus"    : "[B+ -> [J/psi(1S) -> ^mu+ e-]CC K+]CC",
        "eminus"   : "[B+ -> [J/psi(1S) -> mu+ ^e-]CC K+]CC",
        "Kplus"     : "[B+ -> [J/psi(1S) -> mu+ mu-]CC ^K+]CC"
        })

    data.TupleName = "DecayTree"


    #TupleTools

    #Tools added to the ToolList can not be modified i.e. no other options than the defaults can be used
    data.ToolList = [

        ]


    #Settings for TupleToolTrackHits (some only are necessary for MDST-files because of other locations of the clusters)
    if(True):   #Change this value if you don't want to use this tool
        from Configurables import TupleToolTrackHits, STOfflinePosition
        trackhits = data.addTupleTool("TupleToolTrackHits")

        if DaVinci().InputType == 'MDST':
            from Configurables import MeasurementProvider
            data.addTool(MeasurementProvider('MeasProvider'))
            data.MeasProvider.RootInTES = "/Event/Leptonic/"        #Change Leptonic for your stream-name in case of MDST
            trackhits.MeasurementProvider = data.MeasProvider

        itClusterPosition = STOfflinePosition('ToolSvc.ITClusterPosition')      #avoid crashes from missing IT channels
        itClusterPosition.DetType = 'IT'






    MySequencer.Members.append(data)






    ################################
    ###   DaVinci configuration ####
    ################################

    DaVinci().UserAlgorithms = [MySequencer]
    DaVinci().MoniSequence += [data]
    DaVinci().EvtMax     = 5000
    DaVinci().Lumi       = True
    DaVinci().SkipEvents = 0
    l = "e"
    tuplename = "electron"

print LeptonType 
print l 


from Gaudi.Configuration import *
from Configurables import DaVinci
from StrippingConf.Configuration import StrippingConf


from Configurables import EventNodeKiller, ProcStatusCheck 

# first kill the nodes 
event_node_killer = EventNodeKiller("StripKiller")
event_node_killer.Nodes = ["/Event/allStreams", "/Event/Strip","/Event/Leptonic" ]



# Specify the name of your configuration
confname='B2KLLXInclusive' #FOR USERS    

from StrippingSelections import buildersConf
confs = buildersConf()

#print confs
from StrippingSelections.Utils import lineBuilder, buildStreamsFromBuilder
streams = buildStreamsFromBuilder(confs,confname)

#clone lines for CommonParticles overhead-free timing
Exemple #39
0
L0Conf().EnableL0DecodingOnDemand = True
L0Conf().FastL0DUDecoding = True
L0Conf().DecodeL0DU = True
L0Conf().TCK = '0x0045'

#from Configurables import Hlt2Conf
#Hlt2Conf().Hlt1TrackOption = "Rerun"

import GaudiPython
from Gaudi.Configuration import ApplicationMgr
from Configurables import LoKiSvc

appMgr = ApplicationMgr()
#
from Configurables import EventNodeKiller
enk = EventNodeKiller('KillTrigRawEvent')
enk.Nodes = [ "Hlt","Hlt1","Hlt2" ]
appMgr.TopAlg.insert( 0,  enk.getFullName() ) 
#
appMgr.ExtSvc += ['DataOnDemandSvc'] #breaks for real data
appMgr.ExtSvc += ['ToolSvc', 'DataOnDemandSvc', LoKiSvc()]
#appMgr.TopAlg += [ seq ]
gaudi = GaudiPython.AppMgr(outputlevel=4)
gaudi.initialize()

gaudi.algorithm('Hlt').Enable = False
gaudi.algorithm('KillTrigRawEvent').Enable = False
triggerTisTosTool = gaudi.toolsvc().create('TriggerTisTos', interface='ITriggerTisTos')
triggerTisTosTool1 = gaudi.toolsvc().create('Hlt1TriggerTisTos', interface='ITriggerTisTos')
triggerTisTosTool2 = gaudi.toolsvc().create('Hlt2TriggerTisTos', interface='ITriggerTisTos')
tes = gaudi.evtsvc()