Ejemplo n.º 1
0
def stripping_sequence_nopids():
    """Return a list of sequences to run and monitor NoPIDs stripping.

    The list contains three sequences:
      1. StreamCharmFromBSemiNoPIDs StrippingConf, which runs all the
         semileptonic Lambda_c -> X stripping lines, but without PID cuts
      2. Stripping report on the above
      3. Algorithm that reports correlations in the above stripping lines
    Sequences 2 and 3 aren't strictly necessary, but are nice to have.
    The list can be run by DaVinci with
        DaVinci().appendToMainSequence(stripping_sequence_nopids())
    """
    stream = StrippingStream("StreamCharmFromBSemi")
    stream.appendLines(
        CharmFromBSemiAllLinesConf("CharmFromBSemi", confdict).lines()
    )

    # Create stripping configuration from my stream
    conf = StrippingConf(
        Streams=[stream],
        MaxCandidates=2000,
        AcceptBadEvents=True,
        # Stripping reports already exist in the DST,
        # so put these ones somewhere fake
        HDRLocation="NowhereIsNowHere"
    )

    # Extra reporting
    reporting = StrippingReport(Selections=conf.selections())
    correlations = AlgorithmCorrelationsAlg(Algorithms=conf.selections())

    return [conf.sequence(), reporting, correlations]
Ejemplo n.º 2
0
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()]
Ejemplo n.º 3
0
tuple.B0.TupleToolTISTOS.Verbose = True
tuple.B0.TupleToolTISTOS.TriggerList = list
tuple.muplus.ToolList += [ "TupleToolTISTOS" ]
tuple.muplus.addTool( TupleToolTISTOS, name = "TupleToolTISTOS" )
tuple.muplus.TupleToolTISTOS.Verbose = True
tuple.muplus.TupleToolTISTOS.TriggerList = list
tuple.muminus.ToolList += [ "TupleToolTISTOS" ]
tuple.muminus.addTool( TupleToolTISTOS, name = "TupleToolTISTOS" )
tuple.muminus.TupleToolTISTOS.Verbose = True
tuple.muminus.TupleToolTISTOS.TriggerList = list
tuple.Decay = "[B0 -> ^mu+ ^mu-]CC"

from Configurables import DaVinci
DaVinci().TupleFile = "TupleToolSignalMC.root"

DaVinci().EvtMax = -1
DaVinci().DataType = '2012'
DaVinci().Simulation   = True
DaVinci().Lumi = False
#CondDB().UseOracle = True
#DaVinci().DDDBtag  = "dddb-20120831"
#DaVinci().CondDBtag = "sim-20121025-vc-md100"
myseq = GaudiSequencer("myseq")
myseq.Members += [ eventNodeKiller ]
myseq.Members += [ sc.sequence() ] 
myseq.Members += [ seq.sequence() ] 
myseq.Members += [tuple]
##DaVinci().UserAlgorithms = [smear,scaler,_myseq]
DaVinci().UserAlgorithms = [myseq]
DaVinci().MainOptions  = ""
MCTruth.addTool(MCTupleToolReconstructed())
MCTruth.ToolList += ["MCTupleToolHierarchy", "MCTupleToolKinematic", "MCTupleToolReconstructed" ]

#tuple.addTool(TupleToolDecay(), name="B")
#tuple.B.ToolList += ["NeutrinoBuildTupleTool"]

#relAlgos = [ sc.sequence() ]
#relAlgos.append(tuple)

#---------------------------
# Configure DaVinci
#---------------------------

from Configurables import DaVinci
DaVinci().UserAlgorithms += [ eventNodeKiller ]
DaVinci().UserAlgorithms += [ sc.sequence(), tuple ]

DaVinci().InputType = 'DST'
DaVinci().DataType = '2012'
DaVinci().Simulation = True
DaVinci().Lumi = False

DaVinci().PrintFreq = 1000
DaVinci().EvtMax = -1

LHCbApp().DDDBtag = 'Sim08-20130503-1'
DaVinci().CondDBtag = 'Sim08-20130503-1-vc-md100'
#DaVinci().CondDBtag = 'Sim08-20130503-1-vc-mu100'

DaVinci().TupleFile = '12MCDown_Bc2Norm_B2XMuMu_strip21.root'
Ejemplo n.º 5
0
    
    for stream in streams: 
        for line in stream.lines:
            if line.name() in MyLines:
                MyStream.appendLines( [ line ] )

    # Configure Stripping
    from Configurables import ProcStatusCheck
    filterBadEvents = ProcStatusCheck()
    
    sc = StrippingConf( Streams = [ MyStream ],
                        MaxCandidates = 2000,
                        AcceptBadEvents = False,
                        BadEventSelection = filterBadEvents )

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

    # MC Tuples
    addMCTuple('phi2KsKs', '[phi(1020) -> ^(KS0 -> ^pi+ ^pi-) ^(KS0 -> ^pi+ ^pi-)]CC')
    addMCTuple('phi2KsKl', '[phi(1020) -> ^(KS0 -> ^pi+ ^pi-) ^(KL0 -> ^pi+ ^pi-)]CC')
    addMCTuple('Ds_phi2KsKl', '[D_s+ -> ^(phi(1020) -> ^(KS0 -> ^pi+ ^pi-) ^(KS0 -> ^pi+ ^pi-)) ^pi+]CC')
    if 'minbias' in dataSample.name:
        addMCTuple('phi2KK', '[phi(1020) -> ^K- ^K-]CC')
        # addMCTuple('KsKs', '[(KS0 -> ^pi+ ^pi-)cc && (KS0 -> ^pi+ ^pi-)cc]')
        addMCTuple('Ks', '[KS0 -> ^pi+ ^pi-]CC')

    from Configurables import PrintMCTree, PrintMCDecayTreeTool
    mctree = PrintMCTree("PrintTruePhi")
    mctree.addTool(PrintMCDecayTreeTool, name = "PrintMC")
    mctree.PrintMC.Information = "Name"
    mctree.ParticleNames = [ "phi(1020)", 'KS0' ]
#
from StrippingConf.Configuration import StrippingConf
from StrippingSelections.Streams import allStreams

sc = StrippingConf( Streams = allStreams )
##############################################################################
#
# Hlt
#
# DaVinci().Hlt = True
# DaVinci().HltThresholdSettings = 'Physics_320Vis_300L0_10Hlt1_Jan10'
# DaVinci().L0 = True
# DaVinci().ReplaceL0BanksWithEmulated = True
##############################################################################
#
# DaVinci
#
DaVinci().DataType = "2009"                   # Default is "MC09"
DaVinci().UserAlgorithms = [ sc.sequence() ]
DaVinci().EvtMax = 1000
##############################################################################
#
# Real Data
#
importOptions( "$DAVINCIROOT/options/2009-RealData-Reco07.py" )   # change
##############################################################################

MessageSvc().Format = "% F%60W%S%7W%R%T %0W%M"
#from Configurables import CondDB
#CondDB(UseOracle = True)


tupleB.addTupleTool('TupleToolMCTruth')
tupleB.TupleToolMCTruth.ToolList = ["MCTupleToolKinematic", "MCTupleToolHierarchy"]

# rerun the Calo reconstruction 
importOptions("$APPCONFIGOPTS/DaVinci/DV-RedoCaloPID-Stripping21.py")

#Configure DaVinci


DaVinci().HistogramFile = 'xdummy.root'
DaVinci().EvtMax = -1
DaVinci().PrintFreq = 2000
DaVinci().appendToMainSequence( [ sc.sequence() ] )
DaVinci().appendToMainSequence([tupleB])


DaVinci().DataType  = "2012"
DaVinci().InputType = "DST"
DaVinci().Simulation = True
DaVinci().Lumi = False

DaVinci().TupleFile = "bae-"+str(tuplename)+"-mc.root"

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


DaVinci().DDDBtag   = "dddb-20150522-2"
Ejemplo n.º 8
0
PhysConf().OutputLevel     = appMgr.OutputLevel
#AnalysisConf().OutputLevel = appMgr.OutputLevel

datatype =  "2015"
PhysConf().DataType      = datatype
AnalysisConf().DataType  = datatype
LumiAlgsConf().DataType  = datatype
DDDBConf().DataType      = datatype

inputType = "DST"
LumiAlgsConf().InputType = inputType
PhysConf().InputType     = inputType

unPack = ["Reconstruction"]
PhysConf().EnableUnpack = unPack
DstConf().EnableUnpack  = unPack

lumiSeq = GaudiSequencer("LumiSeq")
LumiAlgsConf().LumiSequencer = lumiSeq

appMgr.TopAlg += [ PhysConf().initSequence(),
                   AnalysisConf().initSequence(),
                   sc.sequence(), lumiSeq ]

#from Configurables import DaVinci
#DaVinci().ProductionType = "Stripping"
#DaVinci().DataType   = datatype
#DaVinci().DDDBtag    = LHCbApp().DDDBtag
#DaVinci().CondDBtag  = LHCbApp().CondDBtag
#DaVinci().appendToMainSequence( [ sc.sequence() ] )
Ejemplo n.º 9
0
tupleB.addTool(TupleToolANNPID, name="TupleToolANNPID")
tupleB.TupleToolANNPID.ANNPIDTunes = ['MC12TuneV2', 'MC12TuneV3']

dstWriter = SelDSTWriter('BuKmumuDSTWriter',
                         SelectionSequences=sc.activeStreams(),
                         OutputFileSuffix='Stripped')

from Configurables import DaVinci
DaVinci().TupleFile = "BuKMuMu.root"
DaVinci().EvtMax = -1
DaVinci().DataType = '2012'
DaVinci().Simulation = True
DaVinci().Lumi = not DaVinci().Simulation

_myseq = GaudiSequencer("myseq")
_myseq.Members += [eventNodeKiller, sc.sequence()]  #redo the stripping
_myseq.Members += [SeqB.sequence()]  # make B candidates (muon channel)
#_myseq.Members += [tuple]
_myseq.Members += [tupleB]  # put stuff in a Tuple
DaVinci().UserAlgorithms = [_myseq]  # run the whole thing
DaVinci().MainOptions = ""
"""
#we should put this back later if we want to smear stuff
from Configurables import TrackSmeared
TrackSmeared("TrackSmearing").smearBest = True
TrackSmeared("TrackSmearing").Scale = 0.5
TrackSmearingSeq = GaudiSequencer("TrackSmearingSeq")
TrackSmearingSeq.Members = [ TrackSmeared("TrackSmearing") ]
"""
#try to do it like in the starterkit
"""
Ejemplo n.º 10
0
                   MaxCandidates=2000,
                   AcceptBadEvents=False,
                   BadEventSelection=filterBadEvents)

# The output is placed directly into Phys, so we only need to
# define the stripping line here
line = 'D2hhCompleteEventPromptDst2D2RSLine'

# Create an ntuple to capture D*+ decays from the StrippingLine line
dtt = DecayTreeTuple('TupleDstToD0pi_D0ToKpi')
dtt.Inputs = ['/Event/Phys/{0}/Particles'.format(line)]
dtt.Decay = '[D*(2010)+ -> (D0 -> K- pi+) pi+]CC'

# Configure DaVinci

# Important: The selection sequence needs to be inserted into
# the Gaudi sequence for the stripping to run
DaVinci().appendToMainSequence([event_node_killer, sc.sequence()])
DaVinci().UserAlgorithms += [dtt]
DaVinci().InputType = 'DST'
DaVinci().TupleFile = 'DVntuple.root'
DaVinci().PrintFreq = 1000
DaVinci().DataType = '2012'
DaVinci().Simulation = True
# Only ask for luminosity information when not using simulated data
DaVinci().Lumi = not DaVinci().Simulation
DaVinci().EvtMax = 5000

# Use the local input data
IOHelper().inputFiles(['./00035742_00000002_1.allstreams.dst'], clear=True)
Ejemplo n.º 11
0
Archivo: B2XMuMu.py Proyecto: po10/BAE

tuple.Decay = "B0 -> ^mu+ ^mu-"


dstWriter = SelDSTWriter('BuKmumuDSTWriter',
                   SelectionSequences = sc.activeStreams(),
                   OutputFileSuffix = 'Stripped')

from Configurables import DaVinci
DaVinci().TupleFile = "BuKMuMu.root"

DaVinci().EvtMax = -1
DaVinci().DataType = '2011'
DaVinci().Simulation   = True
DaVinci().Lumi = True
#CondDB().UseOracle = True
DaVinci().DDDBtag = "MC11-20111102"
DaVinci().CondDBtag = "sim-20111111-vc-md100"
_myseq = GaudiSequencer("myseq")
#_myseq.Members += [ DecayTreeFitterB]
_myseq.Members += [ eventNodeKiller ]
#_myseq.Members += [ TrackSmearingSeq ]  
_myseq.Members += [ sc.sequence() ] 
#_myseq.Members += [ dstWriter.sequence() ]
_myseq.Members += [tuple]

DaVinci().UserAlgorithms = [_myseq]

DaVinci().MainOptions  = ""
Ejemplo n.º 12
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() ] )
Ejemplo n.º 13
0
from Gaudi.Configuration import *
from Configurables import DaVinci, SelDSTWriter
from StrippingConf.Configuration import StrippingConf

from StrippingSelections.Streams import StreamDimuon, StreamCalibration
sc = StrippingConf(Streams=[StreamDimuon.stream])

from DSTWriters.__dev__.Configuration import StripDSTWriter

dstWriter = StripDSTWriter(
    "StripDSTWriter",
    SelectionSequences=sc.activeStreams(),
    OutputFileSuffix='TestDiMuon',
)

dv = DaVinci()
dv.DataType = '2010'
dv.InputType = 'SDST'
dv.Simulation = True
dv.EvtMax = 5000
dv.appendToMainSequence([sc.sequence()])
dv.appendToMainSequence([dstWriter.sequence()])
#dv.UserAlgorithms = [dstWriter.sequence()]
importOptions("Reco05-Stripping09_SDSTs.py")
Ejemplo n.º 14
0
                    MyStream.appendLines( [ line ])
                    
	from Configurables import ProcStatusCheck
        filterBadEvents=ProcStatusCheck()
        
        sc=StrippingConf( Streams= [ MyStream ],
                          MaxCandidates = 2000,
                          AcceptBadEvents = False,
                          BadEventSelection = filterBadEvents,
			  HDRLocation       =  "SomeNoExistingLocation" )

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

        StripSequencer = GaudiSequencer('StripSequencer')
        StripSequencer.Members= [sc.sequence(),sr]
        StripSequencer.IgnoreFilterPassed =True
        DaVinci().appendToMainSequence([event_node_killer,StripSequencer])
                                                                                                            

############################################################################################

from PhysSelPython.Wrappers import Selection
from PhysSelPython.Wrappers import SelectionSequence
from PhysSelPython.Wrappers import DataOnDemand, AutomaticData

from Configurables import CombineParticles, FilterDesktop
from StandardParticles import StdLoosePions

#from PhysConf.Filters import LoKi_Filters
#fltrs = LoKi_Filters(
Ejemplo n.º 15
0
                   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 = {
        'chi2':
        "RELINFO('" + relinfoutput + "', 'VERTEX_CHI2_COMB_" + combination +
        "',0)",
Ejemplo n.º 16
0

Lb2JpsiL  = Selection( "Lb2JpsiL",
                      Algorithm          = _Lb2JpsiL ,
                      RequiredSelections = [ Jpsi2MuMu, FilterL ] )

### Gaudi sequence
SeqLb2JpsiL = SelectionSequence("SeqLb2JpsiL", TopSelection = Lb2JpsiL)
seq = SeqLb2JpsiL.sequence()

#--------------------------------------------------------------------------
# Configure DaVinci
#-------------------------------------------------------------------------
from Configurables import DaVinci

DaVinci().appendToMainSequence( [sc.sequence() ] )   # Append the stripping selection sequence to DaVinci

from Configurables import  OfflineVertexFitter

from Configurables import  DecayTreeTuple, MCDecayTreeTuple
importOptions("Xb2JpsiXTreeMC.py")


tuple = DecayTreeTuple( "Lb2JpsiLTree" )
tuple.Inputs = [ SeqLb2JpsiL.outputLocation() ]



from PhysConf.Filters import LoKi_Filters #!
fltrs = LoKi_Filters(STRIP_Code = "(HLT_PASS_RE('StrippingFullDSTDiMuonJpsi2MuMuDetachedLineDecision'))" ) #!
Ejemplo n.º 17
0
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()])
Ejemplo n.º 18
0
dstWriter = SelDSTWriter('BuKmumuDSTWriter',
                   SelectionSequences = sc.activeStreams(),
                   OutputFileSuffix = 'Stripped')




from Configurables import DaVinci
DaVinci().TupleFile = "BuKMuMu.root"
DaVinci().EvtMax = -1
DaVinci().DataType = '2012'
DaVinci().Simulation   = True
DaVinci().Lumi = not DaVinci().Simulation

_myseq = GaudiSequencer("myseq")
_myseq.Members += [ eventNodeKiller, sc.sequence()] #redo the stripping
_myseq.Members += [SeqB.sequence() ] # make B candidates (muon channel)
#_myseq.Members += [tuple]
_myseq.Members +=[ tupleB] # put stuff in a Tuple
DaVinci().UserAlgorithms = [_myseq] # run the whole thing
DaVinci().MainOptions  = ""



"""
#we should put this back later if we want to smear stuff
from Configurables import TrackSmeared
TrackSmeared("TrackSmearing").smearBest = True
TrackSmeared("TrackSmearing").Scale = 0.5
TrackSmearingSeq = GaudiSequencer("TrackSmearingSeq")
TrackSmearingSeq.Members = [ TrackSmeared("TrackSmearing") ]
Ejemplo n.º 19
0
                   BadEventSelection=filterBadEvents)

# The output is placed directly into Phys, so we only need to
# define the stripping line here
line = 'D2hhCompleteEventPromptDst2D2RSLine'

# Create an ntuple to capture D*+ decays from the StrippingLine line
dtt = DecayTreeTuple('TupleDstToD0pi_D0ToKpi')
dtt.Inputs = ['/Event/Phys/{0}/Particles'.format(line)]
dtt.Decay = '[D*(2010)+ -> (D0 -> K- pi+) pi+]CC'

# Configure DaVinci

# Important: The selection sequence needs to be inserted into
# the Gaudi sequence for the stripping to run
DaVinci().appendToMainSequence([event_node_killer, sc.sequence()])
DaVinci().UserAlgorithms += [dtt]
DaVinci().InputType = 'DST'
DaVinci().TupleFile = 'DVntuple.root'
DaVinci().PrintFreq = 1000
DaVinci().DataType = '2012'
DaVinci().Simulation = True
# Only ask for luminosity information when not using simulated data
DaVinci().Lumi = not DaVinci().Simulation
DaVinci().EvtMax = 5000

# Use the local input data
IOHelper().inputFiles([
    './00035742_00000002_1.allstreams.dst'
], clear=True)
Ejemplo n.º 20
0
sc = StrippingConf(
    Streams=[MyStream],
    MaxCandidates=2000,
    AcceptBadEvents=False,
    BadEventSelection=filterBadEvents,
    HDRLocation='NonexistingPlaceholder',
)

#
# Configuration of SelDSTWriter
#
SelDSTWriterElements = {
    'default': stripDSTElements(),
}

SelDSTWriterConf = {
    'default': stripDSTStreamConf(),
}

dstWriter = SelDSTWriter("MyDSTWriter",
                         StreamConf=SelDSTWriterConf,
                         OutputFileSuffix='TAGGING',
                         SelectionSequences=sc.activeStreams())

# DaVinci Config
DaVinci().appendToMainSequence([
    sc.sequence(),
    dstWriter.sequence(),
])
Ejemplo n.º 21
0
from Configurables import AuditorSvc, ChronoAuditor

AuditorSvc().Auditors.append(ChronoAuditor("Chrono"))

from Configurables import StrippingReport

sr = StrippingReport(Selections=sc.selections())

from Configurables import AlgorithmCorrelationsAlg

ac = AlgorithmCorrelationsAlg(Algorithms=list(set(sc.selections())))

DaVinci().HistogramFile = 'DV_stripping_histos_sels.root'
DaVinci().EvtMax = 100000
DaVinci().PrintFreq = 1000
DaVinci().appendToMainSequence([sc.sequence()])
DaVinci().appendToMainSequence([sr])
#DaVinci().appendToMainSequence( [ ac ] )
DaVinci().appendToMainSequence([dstWriter.sequence()])
DaVinci().ProductionType = "Stripping"
DaVinci().DataType = "2015"
DaVinci().InputType = "RDST"

# change the column size of timing table
from Configurables import TimingAuditor, SequencerTimerTool

TimingAuditor().addTool(SequencerTimerTool, name="TIMER")
TimingAuditor().TIMER.NameSize = 60

MessageSvc().Format = "% F%60W%S%7W%R%T %0W%M"
Ejemplo n.º 22
0
## (6) build the final selection sequence
from PhysConf.Selections import SelectionSequence

## (7) configure DaVinci
from Configurables import DaVinci
dv = DaVinci(
    DataType=the_year,
    InputType='MDST',  ## ATTENTION! 
    RootInTES=rootInTES,  ## ATTENTION! 
    ##
    #EventPreFilters = fltrs.filters('FILTER') ,
    Lumi=False,
    Simulation=True,
    ##
    TupleFile='test.root',
    #Turbo      = True
)

## (8) insert our sequence into DaVinci
dv.UserAlgorithms = [eventNodeKiller, sc.sequence(), tuple]

## (9) number of event and input data

dv.EvtMax = 2000

## Local test ##
DaVinci().Input = [
    '/afs/cern.ch/user/m/mboubdir/scratch1/tools/Analysisfiles/DST_files/00057864_00000016_3.AllStreams.mdst'
]