def buildStream(stripping, streamName=''): """ Create a StrippingStream from the lineBuilder database Usage: >>> streamDimuon = strippingStream('Stripping13','Dimuon') or: >>> conf = strippingConfiguration('Stripping13') >>> streamDimuon = strippingStream(conf,'Dimuon') """ from StrippingConf.StrippingStream import StrippingStream from StrippingSettings.Utils import strippingConfiguration from StrippingSelections import lineBuilders stream = StrippingStream(streamName) if isinstance(stripping, basestring): _db = strippingConfiguration(stripping) else: _db = stripping for key in _db.keys(): _conf = _db[key] if stream.name() in _conf['STREAMS']: _lb = lineBuilders()[_conf['BUILDERTYPE']](key, _conf['CONFIG']) stream.appendLines(_lb.lines()) return stream
def cloneStream(stream, newStreamName='Full', linePrefix='Full', prescale=1.0): """ Clone the stream """ from StrippingConf.StrippingStream import StrippingStream lines = cloneLinesFromStream(stream, linePrefix, prescale) stream = StrippingStream(newStreamName) stream.appendLines(lines) return stream
def cloneStream( stream, newStreamName = 'Full', linePrefix = 'Full', prescale = 1.0 ): """ Clone an entire stream, with a new prefix and a different prescale """ from StrippingConf.StrippingStream import StrippingStream lines = cloneLinesFromStream( stream, linePrefix, prescale ) stream = StrippingStream( newStreamName ) stream.appendLines( lines ) return stream
def buildStreams(stripping, WGs=None): """ Build and return a set of StrippingStreams for a given stripping configuration. Usage: >>> streams = buildStreams('Stripping13') >>> for s in streams : ... print s.name(), s.lines It is also possible to use a configuration dictionary directly: >>> conf = strippingConfiguration('Stripping13') >>> streams = buildStreams(conf) To select only streams belonging to the RD or the Gamma from trees WGs: >>> streams = buildStreams('stripping13', WGs = ['RD','GammaFromTrees'] ) >>> """ from StrippingConf.StrippingStream import StrippingStream from StrippingSettings.Utils import strippingConfiguration from StrippingSelections import lineBuilders streams = {} if isinstance(stripping, basestring): scdb = strippingConfiguration(stripping) else: scdb = stripping for k, v in scdb.iteritems(): if 'STREAMS' in v.keys() and not WGs or 'WGs' in v.keys(): if not WGs or any(WG for WG in v['WGs'] if WG in WGs): lb = lineBuilders()[v['BUILDERTYPE']](k, v['CONFIG']) addBuilderToStreamGrouping(streams, v, lb) else: raise Exception('Config', k, 'missing either STREAM or WG data data.') strippingStreams = [] for stream in streams: lines = [line for line in streams[stream]] print('Creating ' + stream + ' stream with ' + str(len(lines)) + ' lines') strippingStreams.append(StrippingStream(stream, Lines=lines)) return strippingStreams
def buildStream(stripping, streamName='', WGs=None): """ Create a StrippingStream from the lineBuilder database Usage: >>> streamDimuon = strippingStream('Stripping13','Dimuon') or: >>> conf = strippingConfiguration('Stripping13') >>> streamDimuon = strippingStream(conf,'Dimuon') """ from StrippingConf.StrippingStream import StrippingStream from StrippingSettings.Utils import strippingConfiguration from StrippingSelections import lineBuilders from StrippingUtils.Utils import lineFromName stream = StrippingStream(streamName) if isinstance(stripping, basestring): _db = strippingConfiguration(stripping) else: _db = stripping for key in _db.keys(): _conf = _db[key] if stream.name() in _conf['STREAMS']: if WGs and not any(WG for WG in _conf['WGs'] if WG in WGs): continue _lb = lineBuilders()[_conf['BUILDERTYPE']](key, _conf['CONFIG']) if isinstance(_conf['STREAMS'], dict): for linename in _conf['STREAMS'][stream.name()]: line = lineFromName(_lb, linename) if line: stream.appendLines([line]) else: raise Exception( 'The line you have requested does not exist ' + linename) elif isinstance(_conf['STREAMS'], list): stream.appendLines(_lb.lines()) else: raise Exception('Unsupported type, expected list ' + 'or dict for line-to-STREAM mapping') return stream
def buildStreams(stripping): """ Build and return a set of StrippingStreams for a given stripping configuration. Usage: >>> streams = buildStreams('Stripping13') >>> for s in streams : ... print s.name(), s.lines It is also possible to use a configuration dictionary directly: >>> conf = strippingConfiguration('Stripping13') >>> streams = buildStreams(conf) """ from StrippingConf.StrippingStream import StrippingStream streams = {} if isinstance(stripping, basestring): scdb = strippingConfiguration(stripping) else: scdb = stripping for k, v in scdb.iteritems(): if 'STREAMS' in v.keys(): for stream in v['STREAMS']: if stream in streams.keys(): streams[stream] += [k] else: streams[stream] = [k] else: print 'ERROR: config', k, 'had no STREAMS data. Ignore!!!' builderMap = {} for builder in scdb.keys(): builderMap[builder] = lineBuilder(scdb, builder) strippingStreams = [] for stream, builderNames in streams.iteritems(): lines = [] for b in builderNames: lines += [line for line in builderMap[b].lines()] print 'Creating steam', stream, 'with lines', lines strippingStreams.append(StrippingStream(stream, Lines=lines)) return strippingStreams
def buildStreams(stripping,archive=None, WGs = None) : """ Build and return a set of StrippingStreams for a given stripping configuration. Usage: >>> streams = buildStreams('Stripping13') >>> for s in streams : ... print s.name(), s.lines It is also possible to use a configuration dictionary directly: >>> conf = strippingConfiguration('Stripping13') >>> archive = strippingArchive('Stripping13') >>> streams = buildStreams(conf,archive) """ from StrippingConf.StrippingStream import StrippingStream streams = {} if isinstance(stripping, basestring) : scdb = _sConf(stripping) from StrippingArchive import strippingArchive archive=strippingArchive(stripping) else : scdb = stripping for k, v in scdb.iteritems() : if 'STREAMS' in v.keys() and not WGs or 'WGs' in v.keys(): if not WGs or any( WG for WG in v['WGs'] if WG in WGs ): lb = archive.lineBuilders()[v['BUILDERTYPE']](k,v['CONFIG']) addBuilderToStreamGrouping( streams, v, lb ) else: raise Exception('Config',k,'missing either STREAM or WG data data.') strippingStreams=[] for stream in streams: lines = [ line for line in streams[stream] ] print ( 'Creating ' + stream + ' stream with ' + str( len(lines) ) + ' lines' ) strippingStreams.append( StrippingStream( stream, Lines = lines ) ) return strippingStreams
from StrippingSelections.StrippingSL import StrippingB2DMuForTauMu #import actual selections from StrippingSettings.Stripping28.LineConfigDictionaries_Semileptonic import B2DMuForTauMu #************************************************************************** # MODIFY STRIPPING CUTS for PIDs. #---> PID is not applied to MC because badly modeled. #---> Corrections with data are applied to MC PID variables #---> Substitute the tauonic line PID cuts. B2DMuForTauMu['CONFIG']['PIDmu'] = -99999 B2DMuForTauMu['CONFIG']['KaonPIDK'] = -99999 B2DMuForTauMu['CONFIG']['ProtonPIDp'] = -99999 B2DMuForTauMu['CONFIG']['PionPIDKTight'] = 99999 B2DMuForTauMu['CONFIG']['Hlt2Line'] = "" MyStream = StrippingStream("B2DMuNuXANDTAU") #create a line builder instance of type 'B2DMuForTauMu' and configure it with the 'CONFIG' dictionary. confB2DMuForTauMu = StrippingB2DMuForTauMu.B2DMuForTauMuconf( "B2DMuForTauMu", B2DMuForTauMu['CONFIG']) #Replace Mu/Pi/K/p Selections with NoPID particles replaceDictFilterDesktop = { 'MuforB2DMuForTauMu': 'Phys/StdAllNoPIDsMuons/Particles', 'PiforB2DMuForTauMu': 'Phys/StdAllNoPIDsPions/Particles', 'KforB2DMuForTauMu': 'Phys/StdAllNoPIDsKaons/Particles', 'PforB2DMuForTauMu': 'Phys/StdAllNoPIDsProtons/Particles' } replaceDictVoidFilter = { 'SelFilterPhys_StdAllLooseMuons_Particles': "\n 0<CONTAINS('Phys/StdAllNoPIDsMuons/Particles',True)\n ", 'SelFilterPhys_StdLooseKaons_Particles':
from StrippingArchive.Stripping21.StrippingB2XMuMu import B2XMuMuConf from StrippingSettings.Stripping21.LineConfigDictionaries_RD import B2XMuMu from PhysSelPython.Wrappers import AutomaticData, Selection, SelectionSequence B2XMuMu['CONFIG']['HLT_FILTER'] = "" B2XMuMuConf = B2XMuMuConf("B2XMuMu", B2XMuMu['CONFIG']) B2XMuMuLines = B2XMuMuConf.lines() for line in B2XMuMuLines: print "CL DEBUG", line print "CL DEBUG", line.name() stripline = B2XMuMuLines[0] sc = StrippingConf( HDRLocation = "DecReports" ) sstream = StrippingStream("TestStream") sstream.appendLines([ stripline ] ) sstream.OutputLevel = 2 sc.appendStream( sstream ) Strip_Location1 = stripline.outputLocation() print Strip_Location1 StripSel1 = AutomaticData(Location = Strip_Location1) print StripSel1 print "ALL OK" rootintes = "/Event/AllStreams" #--------------------------- # Run fixing XmumuLine #---------------------------
if options.strippingFile != 'none': strippingFile = options.strippingFile else: strippingFile = options.strippingLine myconfig = lineBuilderConfiguration(options.strippingVersion, options.strippingLine) import StrippingSelections mylineconf = getattr( __import__('StrippingSelections.Stripping' + strippingFile, globals(), locals(), [myconfig["BUILDERTYPE"]], -1), myconfig["BUILDERTYPE"]) mylinedict = myconfig["CONFIG"] print mylineconf print mylinedict from StrippingConf.StrippingStream import StrippingStream stream = StrippingStream(options.strippingStream + "Swimming") allLines = mylineconf(options.strippingLine, mylinedict).lines() lines = [] for l in allLines: lineName = options.stripcands.split('/')[-1] if l.outputLocation().find(lineName) != -1: lines.append(l) 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
stripLines = { "kkpi":0, "kpipi":1, "pipipi":2, "kppos":3, "kkk":4, "kkpos":5, "hhh":6, } lineNumber = stripLines["pipipi"] # Now build the stream from StrippingConf.StrippingStream import StrippingStream ss = StrippingStream("ByTom") 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 from StrippingSelections import StrippingD2hhh_conf D2HHHConf = StrippingD2hhh_conf.D2hhhConf('D2hhh',default_config) D2hhhLines = D2HHHConf.lines() for line in D2hhhLines : print line.name(), line.outputLocation()
'eeVCHI2PDOF' : 9. , 'eeMinMass' : 2200. , # MeV 'eeMaxMass' : 4200. , # MeV 'JpsiLineCut' : "(PT>2.*GeV) & (BPVDLS>50) ", 'Bu2JpsieeKLine_Prescale' : 1, 'Bu2JpsieeKLine_HltFilter' : None, 'Bu2JpsieeKLine_KaonCut' : "(TRCHI2DOF<4) & (PT>1.0*GeV) & (PIDK >0) & (BPVIPCHI2()>9)", 'Bu2JpsieeKLine_JpsiCut' : "(BPVDLS>5)", 'Bu2JpsieeKLine_BuComCut' : "in_range(4.1*GeV,AM,6.1*GeV)", 'Bu2JpsieeKLine_BuMomCut' : "in_range(4.2*GeV,M, 6.0*GeV) & (VFASPF(VCHI2PDOF)<9)" } from StrippingConf.StrippingStream import StrippingStream ss = StrippingStream("ByTom") from StrippingSelections import StrippingElectronID line = StrippingElectronID.ElectronIDConf("Jpsi2eeForElectronID",eid_config_default) ss.appendLines( [line.lines()[lineNumber]] ) stripOutputLoc = line.outputLocations()[lineNumber] ############################ ### Configure the ntuple ### ############################ myNTUPLE = DecayTreeTuple('myNTUPLE') myNTUPLE.ReFitPVs = True # re-fit the PVs myNTUPLE.ToolList += [ "TupleToolGeometry" , "TupleToolKinematic"
if not WGs or any( WG for WG in v['WGs'] if WG in WGs ): try: lb = lineBuilders()[v['BUILDERTYPE']](k,v['CONFIG']) except Exception, x: log.error("Unable to configure %s because of %s" %(v['BUILDERTYPE'],str(x))) else: addBuilderToStreamGrouping( streams, v, lb ) else: raise Exception('Config',k,'missing either STREAM or WG data data.') strippingStreams=[] for stream in streams: lines = [ line for line in streams[stream] ] print ( 'Creating ' + stream + ' stream with ' + str( len(lines) ) + ' lines' ) strippingStreams.append( StrippingStream( stream, Lines = lines ) ) return strippingStreams def buildStreamsFromBuilder(conf, names ): """ Build and return a set of StrippingStreams for a given line builder configuration Usage: >>> streams = buildStreamsFromBuilder(somelinebuilder, 'B2ppipiSigmacmm_Lcpi') """ from StrippingConf.StrippingStream import StrippingStream from StrippingSettings.Utils import strippingConfiguration from StrippingSelections import lineBuilders streams = {}
"StdNoPIDsKaons", "StdNoPIDsPions", "Sel_Bd2KstarMuMu_DiMuon", "Sel_Bd2KstarMuMu_Kstar", "StrippingBd2KstarMuMu_BdToKstarMuMuLine" ] ### # DaVinci ### ## Preselection from StrippingConf.Configuration import StrippingConf from StrippingConf.StrippingStream import StrippingStream from StrippingArchive.Utils import lineBuilder lineBuilder = lineBuilder('Stripping17', 'Bd2KstarMuMu') stream = StrippingStream("BKstarMuMuTest", Lines = lineBuilder.lines()) sc = StrippingConf() sc.appendStream( stream ) from Configurables import DaVinci DaVinci().UserAlgorithms = [ trueSeq ] DaVinci().MoniSequence = [ TestCorrelations ] DaVinci().appendToMainSequence( [ sc.sequence() ] ) ######################################################################## #-- GAUDI jobOptions generated on Tue Jan 18 17:40:43 2011 #-- Contains event types : #-- 11114004 - 1 files - 10000 events - 2.78 GBytes # MC_2010_428935_2010-Sim08Reco06-withTruth_11114004 # from Gaudi.Configuration import *
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() ] )
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()])
#kill the previous stripping just in case (it is not the case) your file was already stripped. from Configurables import EventNodeKiller killer = EventNodeKiller('Stripkiller') killer.Nodes = ['/Event/AllStreams', '/Event/Strip'] stripping='stripping20r0p2' config = strippingConfiguration(stripping) archive = strippingArchive(stripping) streams = buildStreams(stripping=config, archive=archive) # Select my line MyStream = StrippingStream("MyStream") MyLines = ['StrippingBetaSQ2B3piSelectionLine'] 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,
from Gaudi.Configuration import * from GaudiKernel.SystemOfUnits import * MessageSvc().Format = "% F%30W%S%7W%R%T %0W%M" ####################################################################### # # Selection # from StrippingConf.Configuration import StrippingConf from StrippingConf.StrippingStream import StrippingStream from StrippingArchive.Utils import lineBuilder lineBuilder = lineBuilder('Stripping17', 'BetaS') line = lineBuilder.lineFromName('StrippingBetaSBd2JpsiKsDetachedLine') stream = StrippingStream("B2JpsiXTest", Lines=[line]) sc = StrippingConf() sc.appendStream(stream) ######################################################################## # # The Decay Tuple # from Configurables import DecayTreeTuple tuple = DecayTreeTuple("Tuple") tuple.ToolList += [ "TupleToolMCTruth", "TupleToolMCBackgroundInfo", "TupleToolGeometry", "TupleToolKinematic", "TupleToolPropertime", "TupleToolPrimaries", "TupleToolEventInfo", "TupleToolTrackInfo" # , "TupleToolTISTOS"