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]
def get_stripping_conf(streams, lineName, acceptBadEvents = True, maxCandidates = None) : lineName = line_name(lineName) lineStream = StrippingStream(lineName + 'Stream') line, stream = get_line(streams, lineName) lineStream.appendLines([line]) filterBadEvents = ProcStatusCheck() sc = StrippingConf( Streams = [ lineStream ], MaxCandidates = maxCandidates, AcceptBadEvents = acceptBadEvents, BadEventSelection = filterBadEvents ) return line, stream, sc
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()]
#LIST OF FILTERED LINES MyLines = [ 'StrippingX2LcPiPiSSLc2PKPiBeauty2CharmLine', 'StrippingX2LcKPiSSLc2PKPiBeauty2CharmLine', 'StrippingX2LcKKSSLc2PKPiBeauty2CharmLine', 'StrippingB2DHHOSD2HHHCFPIDBeauty2CharmLine' ] for stream in streams: if 'Bhadron' in stream.name(): for line in stream.lines: line._prescale = 1.0 if line.name() in MyLines: linesToAdd.append(line) AllStreams.appendLines(linesToAdd) ################################# for stream in streams: if 'MiniBias' not in stream.name(): for line in stream.lines: dup = False for line2 in AllStreams.lines: if line2.name() == line.name(): dup = True break if not dup: line._prescale = 1.0 AllStreams.appendLines([line])
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]) line = 'D2hhCompleteEventPromptDst2D2RSLine' # Create the actual Stripping configurable filterBadEvents = ProcStatusCheck() sc = StrippingConf(Streams=[custom_stream], 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'
# Build the streams and stripping object # from StrippingArchive.Stripping21.StrippingB2XMuMuInclusive \ import B2XMuMuInclusiveConf as builder from StrippingArchive.Stripping21.StrippingB2XMuMuInclusive \ import defaultConfig as config from StrippingConf.Configuration import StrippingConf, StrippingStream stripping='stripping20' lb = builder('B2XMuMuIncl',config) print config AllStreams = StrippingStream("MyStream") for line in lb.lines(): if line.name() == 'StrippingB2XMuMuIncl_InclDiMuLowQ2Line': AllStreams.appendLines([line]) sc = StrippingConf( Streams = [ AllStreams ], MaxCandidates = 2000 ) stripsel = AutomaticData(Location = "Phys/B2XMuMuIncl_InclDiMuLowQ2Line/Particles") stripfilter = FilterDesktop("stripfilter", Preambulo = ["from LoKiPhysMC.decorators import *", "from LoKiPhysMC.functions import mcMatch"], Code = "ALL") inclmumu = Selection ("Sel"+name, Algorithm = stripfilter,
from Configurables import PhysConf PhysConf().CaloReProcessing=True stripping="stripping21" config=strippingConfiguration(stripping) archive=strippingArchive(stripping) streams=buildStreams(stripping=config,archive=archive) MyStream= StrippingStream("MyStream") MyLines= ["StrippingB2XEtaLb2pKeta3piLine"] for stream in streams: for line in stream.lines: if line.name() in MyLines: MyStream.appendLines( [ line ]) from Configurables import ProcStatusCheck filterBadEvents=ProcStatusCheck() sc=StrippingConf( Streams= [ MyStream ], MaxCandidates = 2000, AcceptBadEvents = False, BadEventSelection = filterBadEvents) DaVinci().appendToMainSequence([event_node_killer,sc.sequence()]) ##################Creating NTuples##################################### from Configurables import DecayTreeTuple
myLine = 'StrippingBetaSBu2JpsiKDetachedLine' stripping = 'Stripping29r2' config = strippingConfiguration(stripping) archive = strippingArchive(stripping) streams = buildStreams(stripping=config, archive=archive) # Select my line MyStream = StrippingStream('MyStream') for stream in streams: for line in stream.lines: if line.name() == myLine: MyStream.appendLines([line]) # Configure Stripping from Configurables import ProcStatusCheck filterBadEvents = ProcStatusCheck() sc = StrippingConf( Streams=[MyStream], MaxCandidates=2000, AcceptBadEvents=False, BadEventSelection=filterBadEvents, HDRLocation='NonexistingPlaceholder', ) # # Configuration of SelDSTWriter
'StrippingBc2DstDst0Dst2DPI0D2KSHHHDst02D0PI0D02KSHHBeauty2CharmLine', 'StrippingBc2DstDst0Dst2DPI0D2KSHHHDst02D0GammaD02HHBeauty2CharmLine', 'StrippingBc2DstDst0Dst2DPI0D2KSHDst02D0GammaD02KSHHBeauty2CharmLine', 'StrippingBc2DstDst0Dst2DPI0D2KSHDst02D0GammaD02KHHHBeauty2CharmLine', 'StrippingBc2DstDst0Dst2DPI0D2KSHDst02D0PI0D02HHBeauty2CharmLine', 'StrippingBc2DstDst0Dst2DPI0D2KSHDst02D0PI0D02KHHHBeauty2CharmLine', 'StrippingBc2DstDst0Dst2DPI0D2KSHDst02D0PI0D02KSHHBeauty2CharmLine', 'StrippingBc2DstDst0Dst2DPI0D2KSHDst02D0GammaD02HHBeauty2CharmLine' ] ## Use these lines to only run the lines listed above streamsel = StrippingStream("Bhadron") for stream in streamall: for line in stream.lines: if line.name() in MyLines: streamsel.appendLines([line]) streams = [streamsel] ## Use this instead to run everything in the B2OC module #streams = streamall leptonicMicroDSTname = 'Leptonic' charmMicroDSTname = 'Charm' pidMicroDSTname = 'PID' bhadronMicroDSTname = 'Bhadron' mdstStreams = [ leptonicMicroDSTname, charmMicroDSTname, pidMicroDSTname, bhadronMicroDSTname ] dstStreams = [ "BhadronCompleteEvent", "CharmCompleteEvent", "Dimuon", "EW",
stripping = 'stripping21' #get the configuration dictionary from the database #config = strippingConfiguration(stripping) #config['HLT_FILTER_HMuNu']="" lb = builder('B2XMuMuInclusive',config['CONFIG']) print config #get the line builders from the archive# # Merge into one stream and run in flag mode # AllStreams = StrippingStream("Dimuon") for line in lb.lines(): print line.name() if line.name() == 'StrippingB2XMuMuInclusive_InclDiMuHighQ2Line': AllStreams.appendLines([line]) if line.name() == 'StrippingB2XMuMuInclusive_InclDiMuLowQ2Line': AllStreams.appendLines([line]) sc = StrippingConf( Streams = [ AllStreams ], MaxCandidates = 2000 ) # But what we really want is to make a dimuon and a Kaon from StandardParticles import StdLooseKaons as kaons
#Use Stripping21r0p1 on MC for Run I #--------------------------------------------------------------- from StrippingArchive.Stripping21r0p1.StrippingRD.StrippingB2Lambda0MuLines import B2Lambda0MuLines from StrippingSettings.Stripping21r0p1.LineConfigDictionaries_RD import B2Lambda0Mu #from StrippingArchive.Stripping23.StrippingRD.StrippingB2Lambda0MuLines import B2Lambda0MuLines #from StrippingSettings.Stripping23r1.LineConfigDictionaries_RD import B2Lambda0Mu B2Lambda0MuConf = B2Lambda0MuLines('B2Lambda0MuLines', B2Lambda0Mu['CONFIG']) B2Lambda0MuLines = B2Lambda0MuConf.lines() sc = StrippingConf(HDRLocation="DecReports") sstream = StrippingStream("TestStream") sstream.appendLines(B2Lambda0MuLines) sstream.OutputLevel = 2 sc.appendStream(sstream) #--------------------------------------------------------------- #Use specific Stripping23r1 on MC for Run II #--------------------------------------------------------------- ## from StrippingArchive.Stripping23.StrippingRD.StrippingB2Lambda0MuLines import B2Lambda0MuLines ## from StrippingSettings.Stripping23r1.LineConfigDictionaries_RD import B2Lambda0Mu ## B2Lambda0MuConf = B2Lambda0MuLines('B2Lambda0MuLines', B2Lambda0Mu['CONFIG']) ## B2Lambda0MuLines = B2Lambda0MuConf.lines() ## ## stripline = B2Lambda0MuLines[0] ## sc = StrippingConf( HDRLocation = "DecReports" )
from StrippingConf.Configuration import StrippingConf, StrippingStream from StrippingSettings.Utils import strippingConfiguration from StrippingSettings.Stripping21.LineConfigDictionaries_RD import B2XMuMu from StrippingArchive.Utils import buildStreams from StrippingArchive import strippingArchive from StrippingArchive.Stripping21.StrippingB2XuMuNu import B2XuMuNuBuilder from StrippingSettings.Stripping21.LineConfigDictionaries_Semileptonic import B2XuMuNu B2XuMuNuConf = B2XuMuNuBuilder('B2XuMuNuBuilder', B2XuMuNu['CONFIG']) B2XuMuNuLines = B2XuMuNuConf.lines() sc = StrippingConf(HDRLocation="DecReports") sstream = StrippingStream("TestStream") sstream.appendLines(B2XuMuNuLines) sstream.OutputLevel = 2 sc.appendStream(sstream) #--------------------------- # Run fixing XmumuLine #--------------------------- from Configurables import NeutrinoBuildTupleTool, PromptNeutrinoTupleTool tuple = DecayTreeTuple('PromptNeutrinoTupleTool') tuple.OutputLevel = INFO stream = 'AllStreams' stripping_line = 'B2XMuMu_Line' tuple.Inputs = tuple.Inputs = [