def PrUpgradeChecking(): ### match hits and tracks log.warning("Run upgrade checkers.") from Configurables import UnpackMCParticle, UnpackMCVertex, PrLHCbID2MCParticle # Check if VP is part of the list of detectors. from Configurables import LHCbApp, VPClusterLinker withVP = False if hasattr(LHCbApp(), "Detectors"): if LHCbApp().isPropertySet("Detectors"): if 'VP' in LHCbApp().upgradeDetectors(): withVP = True trackTypes = TrackSys().getProp("TrackTypes") if "Truth" in trackTypes: truthSeq = GaudiSequencer("RecoTruthSeq") truthSeq.Members = [UnpackMCParticle(), UnpackMCVertex()] if withVP: truthSeq.Members += [VPClusterLinker()] truthSeq.Members += [PrLHCbID2MCParticle()] else: if withVP: GaudiSequencer("MCLinksTrSeq").Members = [ VPClusterLinker(), PrLHCbID2MCParticle() ] else: GaudiSequencer("MCLinksTrSeq").Members = [PrLHCbID2MCParticle()] from Configurables import PrTrackAssociator GaudiSequencer("MCLinksTrSeq").Members += [PrTrackAssociator()] from Configurables import PrChecker, PrDebugTrackingLosses GaudiSequencer("CheckPatSeq").Members += [PrChecker()] GaudiSequencer("CheckPatSeq").Members += [PrDebugTrackingLosses()]
def sequence(self): if self.seq == None: if self.eventSelectionLine == None: # We don't care of BadEvents, thus not insert bad event line in the stream sequence self.seq = GaudiSequencer( "StrippingSequenceStream" + self.name(), ModeOR=True, ShortCircuit=False, OutputLevel=WARNING, Members=self.algs + [self.streamLine.configurable()]) else: if self.AcceptBadEvents != False: # Need to think a bit more on this log.error( "NOT POSSIBLE TO ACCEPT BAD EVENTS WITH THE CURRENT CONFIGURATION OF STRIPPINGCONF!!!" ) return None else: # since we care of bad events we have to protect the execution of lines and stream-line # inserting them in a sequence with ModeOR = True and ShortCircuit = False. lineSeq = GaudiSequencer( "StrippingProtectedSequence" + self.name(), ModeOR=True, ShortCircuit=False, OutputLevel=WARNING, Members=self.algs + [self.streamLine.configurable()]) # We need a badEventSeq with IgnoreFilterPassed = True in order to always run the protected sequence with # lines and stream-lines badEventSeq = GaudiSequencer( "StrippingBadEventSequence" + self.name(), Members=[self.eventSelectionLine.configurable()], OutputLevel=WARNING, IgnoreFilterPassed=True) # The final sequence is an AND sequence of the badEventSeq and the lines + stream-lines # algorithms (protected sequence) self.seq = GaudiSequencer("StrippingSequenceStream" + self.name(), OutputLevel=WARNING, Members=[badEventSeq, lineSeq]) return self.seq
def myAction(): from Gaudi.Configuration import GaudiSequencer from Configurables import (PrTrackAssociator, TrackResChecker, TrackOccupChecker, PrChecker, TrackSelector, MCReconstructible, MCParticleSelector, PrLHCbID2MCParticle, UnpackMCParticle, UnpackMCVertex, DebugTrackingLosses) from HltTracking.HltTrackNames import HltSharedTrackLoc, HltSharedTrackRoot from DAQSys.Decoders import DecoderDB from DAQSys.DecoderClass import decodersForBank decs = [] decs = decs + decodersForBank(DecoderDB, "TT", "IT") DecSeq = GaudiSequencer("MyDecodingSeq") DecSeq.Members += [d.setup() for d in decs] PatCheck = GaudiSequencer("CheckPatSeq") PatCheck.Members += [ UnpackMCParticle(), UnpackMCVertex(), PrLHCbID2MCParticle("PrLHCbID2MCParticle") ] PrChecker("PrChecker").TriggerNumbers = True PrChecker("PrChecker").Eta25Cut = True PrChecker("PrChecker").WriteForwardHistos = 1 PrChecker("PrChecker").WriteUpHistos = 0 PrChecker("PrChecker").WriteVeloHistos = 1 #(N.B.: container base for velo tracks was renamed to Hlt1) # Figure out which HLT is run from HltConf PrChecker("PrChecker").VeloTracks = HltSharedTrackLoc["Velo"] PrChecker("PrChecker").ForwardTracks = HltSharedTrackLoc[ "ForwardHPT"] #HltSharedForwardLocation PrChecker("PrChecker").UpTracks = HltSharedTrackLoc["VeloTTHPT"] PrChecker("PrChecker").HistoPrint = True #PrChecker("PrChecker").OutputLevel = 1 PrTrackAssociator("AssocAll").RootOfContainers = HltSharedTrackRoot #PrTrackAssociator("AssocAll").OutputLevel = 2 #PrTrackAssociator("AssocAll").SingleContainer = HltSharedTrackLoc["ForwardHPT"] PatCheck.Members += [PrTrackAssociator("AssocAll")] PatCheck.Members += [PrChecker("PrChecker")] EndMembers = GaudiSequencer("HltEndSequence").Members EndMembers.insert(0, DecSeq) EndMembers.insert(1, PatCheck)
def myActionHlt2(): from Gaudi.Configuration import GaudiSequencer from Configurables import (PrTrackAssociator, TrackResChecker, TrackOccupChecker, PrChecker2, TrackSelector, MCReconstructible, MCParticleSelector, PrLHCbID2MCParticle, UnpackMCParticle, UnpackMCVertex, DebugTrackingLosses) from HltTracking.HltTrackNames import HltSharedTrackLoc, HltSharedTrackRoot, Hlt2TrackRoot, Hlt2TrackLoc, HltDefaultFitSuffix PatCheck = GaudiSequencer("CheckPatSeq") PrChecker2("PrCheckerHlt2").TriggerNumbers = True PrChecker2("PrCheckerHlt2").Eta25Cut = True PrChecker2("PrCheckerHlt2").WriteForwardHistos = 1 PrChecker2("PrCheckerHlt2Forward").TriggerNumbers = True PrChecker2("PrCheckerHlt2Forward").Eta25Cut = True PrChecker2("PrCheckerHlt2Forward").WriteForwardHistos = 1 PrChecker2("PrCheckerHlt2Forward" ).ForwardTracks = Hlt2TrackLoc["ComplementForward"] #(N.B.: container base for velo tracks was renamed to Hlt1) # Figure out which HLT is run from HltConf PrChecker2("PrCheckerHlt2").SeedTracks = Hlt2TrackLoc["Seeding"] PrChecker2("PrCheckerHlt2").MatchTracks = Hlt2TrackLoc["Match"] PrChecker2("PrCheckerHlt2").DownTracks = Hlt2TrackLoc["Downstream"] PrChecker2("PrCheckerHlt2").ForwardTracks = Hlt2TrackLoc["Forward"] from HltTracking.Hlt2TrackingConfigurations import Hlt2BiKalmanFittedForwardTracking from HltTracking.Hlt2TrackingConfigurations import Hlt2BiKalmanFittedDownstreamTracking tracks = Hlt2BiKalmanFittedForwardTracking().hlt2PrepareTracks() tracksDown = Hlt2BiKalmanFittedDownstreamTracking().hlt2PrepareTracks() PrChecker2("PrCheckerHlt2").BestTracks = tracks.outputSelection() PrChecker2("PrCheckerHlt2Down").BestTracks = tracksDown.outputSelection() #PrChecker2("PrCheckerHlt2").DownTracks = tracksDown.outputSelection() PrTrackAssociator("AssocAllHlt2").RootOfContainers = Hlt2TrackRoot PrTrackAssociator("AssocFittedHlt2" ).RootOfContainers = Hlt2TrackRoot + HltDefaultFitSuffix print tracks.outputSelection() print Hlt2TrackRoot + HltDefaultFitSuffix print tracks.outputSelection() print Hlt2TrackRoot + HltDefaultFitSuffix print tracks.outputSelection() print Hlt2TrackRoot + HltDefaultFitSuffix PatCheck.Members += [ PrTrackAssociator("AssocAllHlt2"), PrTrackAssociator("AssocFittedHlt2") ] PatCheck.Members += [PrChecker2("PrCheckerHlt2Forward")] PatCheck.Members += [PrChecker2("PrCheckerHlt2")] PatCheck.Members += [PrChecker2("PrCheckerHlt2Down")]
def filterMembers(self): _members = GaudiSequencer(filterName(self.subname(), 'Stripping')).Members while True: _foundSequencer = False _flattenedMembers = [] for i in _members: if GaudiSequencer is type(i): _flattenedMembers += i.Members _foundSequencer = True else: _flattenedMembers += [i] _members = _flattenedMembers if not _foundSequencer: break log.debug("FilterMembers for line %s : " % self.name()) log.debug(_members) return _members
def associateSequence(prefix,debug): from Gaudi.Configuration import GaudiSequencer from Configurables import TrackAssociator, ChargedPP2MC base = "/Event/Turbo/" protos = prefix + "Protos" tracks = prefix + "Tracks" protocont = base + protos trackcont = base + tracks relloc = "Relations/Turbo/" + protos assoctr = TrackAssociator(prefix+"AssocTr") assoctr.TracksInContainer = trackcont assocpp=ChargedPP2MC(prefix+"ProtoAssocPP") assocpp.RootInTES=base assocpp.TrackLocations = [ trackcont ] assocpp.InputData = [ protocont ] assocpp.OutputTable = relloc if debug == True: assocpp.OutputLevel = 2 assoctr.OutputLevel = 2 # Add it to a selection sequence seq = GaudiSequencer(prefix+'SeqP2MC') seq.Members += [assoctr,assocpp] return seq
def PatChecking(): GaudiSequencer("CheckPatSeq").Members += [ PatLHCbID2MCParticle("PatLHCbID2MCParticle") ] ## Define the associators and track efficiency checkers according to the Pattern algorithms trackAlgs = TrackSys().getProp("TrackPatRecAlgorithms") if "Truth" in trackAlgs: GaudiSequencer("RecoTruthSeq").Members += [ UnpackMCParticle(), UnpackMCVertex(), PatLHCbID2MCParticle() ] if not TrackSys().veloOpen() and "FastVelo" not in trackAlgs: GaudiSequencer("CheckPatSeq").Members += [ TrackAssociator("AssocVeloRZ") ] GaudiSequencer("CheckPatSeq").Members += [TrackEffChecker("VeloRZ")] TrackAssociator("AssocVeloRZ").TracksInContainer = "Rec/Track/RZVelo" TrackEffChecker( "VeloRZ").GhostClassification = "VeloRGhostClassification" if "Velo" in trackAlgs or "FastVelo" in trackAlgs: GaudiSequencer("CheckPatSeq").Members += [TrackAssociator("AssocVelo")] GaudiSequencer("CheckPatSeq").Members += [TrackEffChecker("Velo")] TrackAssociator("AssocVelo").TracksInContainer = "Rec/Track/Velo" TrackEffChecker("Velo").GhostClassification = "VeloGhostClassification" if "VeloTT" in trackAlgs: GaudiSequencer("CheckPatSeq").Members += [ TrackAssociator("AssocVeloTT") ] GaudiSequencer("CheckPatSeq").Members += [TrackEffChecker("VeloTT")] TrackAssociator("AssocVeloTT").TracksInContainer = "Rec/Track/VeloTT" TrackEffChecker( "Velo").GhostClassification = "UpstreamGhostClassification" if "Forward" in trackAlgs or "ForwardHLT2" in trackAlgs: GaudiSequencer("CheckPatSeq").Members += [ TrackAssociator("AssocForward") ] GaudiSequencer("CheckPatSeq").Members += [TrackEffChecker("Forward")] TrackAssociator("AssocForward").TracksInContainer = "Rec/Track/Forward" TrackEffChecker( "Forward").GhostClassification = "LongGhostClassification" if "TsaSeed" in trackAlgs or "PatSeed" in trackAlgs: GaudiSequencer("CheckPatSeq").Members += [ TrackAssociator("AssocTTrack") ] GaudiSequencer("CheckPatSeq").Members += [TrackEffChecker("TTrack")] TrackAssociator("AssocTTrack").TracksInContainer = "Rec/Track/Seed" TrackEffChecker( "TTrack").GhostClassification = "TTrackGhostClassification" if "Match" in trackAlgs or "PatMatch" in trackAlgs: GaudiSequencer("CheckPatSeq").Members += [ TrackAssociator("AssocMatch") ] GaudiSequencer("CheckPatSeq").Members += [TrackEffChecker("Match")] TrackAssociator("AssocMatch").TracksInContainer = "Rec/Track/Match" TrackEffChecker( "Match").GhostClassification = "LongGhostClassification" if "Downstream" in trackAlgs or "PatLongLivedTracking" in trackAlgs: GaudiSequencer("CheckPatSeq").Members += [ TrackAssociator("AssocDownstream") ] GaudiSequencer("CheckPatSeq").Members += [ TrackEffChecker("Downstream") ] TrackAssociator( "AssocDownstream").TracksInContainer = "Rec/Track/Downstream" TrackEffChecker( "Downstream").GhostClassification = "DownstreamGhostClassification" GaudiSequencer("CheckPatSeq").Members += [TrackAssociator("AssocBest")] GaudiSequencer("CheckPatSeq").Members += [TrackEffChecker("BestTracks")] TrackAssociator("AssocBest").TracksInContainer = "Rec/Track/Best" TrackEffChecker( "BestTracks").GhostClassification = "AllTrackGhostClassification" GaudiSequencer("CheckPatSeq").Members += [DebugTrackingLosses()] GaudiSequencer("CheckPatSeq").Members += [ TrackResChecker("TrackResChecker") ] TrackResChecker("TrackResChecker").SplitByType = True ConfigureEffCheckTools(TrackResChecker("TrackResChecker")) TrackEffChecker("BestTracks").TracksInContainer = "Rec/Track/Best" TrackEffChecker("BestTracks").SelectionCriteria = "ChargedLong" TrackEffChecker("BestTracks").RequireLongTrack = True ConfigureEffCheckTools(TrackEffChecker("BestTracks")) TrackEffChecker("VeloRZ").TracksInContainer = "Rec/Track/RZVelo" TrackEffChecker("VeloRZ").SelectionCriteria = "ChargedLong" ConfigureEffCheckTools(TrackEffChecker("VeloRZ")) TrackEffChecker("Velo").TracksInContainer = "Rec/Track/Velo" TrackEffChecker("Velo").SelectionCriteria = "ChargedLong" ConfigureEffCheckTools(TrackEffChecker("Velo")) TrackEffChecker("VeloTT").TracksInContainer = "Rec/Track/VeloTT" TrackEffChecker("VeloTT").SelectionCriteria = "ChargedLong" ConfigureEffCheckTools(TrackEffChecker("VeloTT")) TrackEffChecker("Forward").TracksInContainer = "Rec/Track/Forward" TrackEffChecker("Forward").SelectionCriteria = "ChargedLong" ConfigureEffCheckTools(TrackEffChecker("Forward")) TrackEffChecker("TTrack").TracksInContainer = "Rec/Track/Seed" TrackEffChecker("TTrack").SelectionCriteria = "ChargedLong" ConfigureEffCheckTools(TrackEffChecker("TTrack")) TrackEffChecker("Match").TracksInContainer = "Rec/Track/Match" TrackEffChecker("Match").SelectionCriteria = "ChargedLong" ConfigureEffCheckTools(TrackEffChecker("Match")) TrackEffChecker("Downstream").TracksInContainer = "Rec/Track/Downstream" TrackEffChecker("Downstream").SelectionCriteria = "ChargedDownstream" ConfigureEffCheckTools(TrackEffChecker("Downstream")) GaudiSequencer("CheckPatSeq").Members += [ TrackOccupChecker("OccupancyCheck") ]
from Configurables import L0Conf from Configurables import NTupleSvc from Configurables import PrChecker2 from Configurables import LoKi__Hybrid__MCTool from Gaudi.Configuration import GaudiSequencer # As we haven't ran Moore L0Conf().EnsureKnownTCK = False # Required to avoid Loki issues when running PrChecker2 myFactory = LoKi__Hybrid__MCTool("MCHybridFactory") myFactory.Modules = ["LoKiMC.decorators"] PrChecker2("PrChecker2").addTool(myFactory) GaudiSequencer("CheckPatSeq").Members = [ "PrChecker", "PrChecker2", "TrackIPResolutionChecker", "TrackIPResolutionCheckerNT", "VPClusterMonitor" ] NTupleSvc().Output += ["FILE1 DATAFILE='Brunel-tuples.root' TYP='ROOT' OPT='NEW'"]
def createConfigurable(self, TESPrefix="Strip", HDRLocation='Phys/DecReports'): if self._configurable != None: log.info("Configurables already created for line %s, skipping" % self.subname()) return self._configurable if self._HDRLocation == None: self.fullHDRLocation = TESPrefix + "/" + HDRLocation else: self.fullHDRLocation = self._HDRLocation # check for forbidden attributes args = self._args mdict = {} for key in args: if key in _protected_: raise AttributeError, "The attribute'%s' is protected for %s" % ( key, self.type()) mdict[key] = args[key] line = self.subname() # create the line configurable # NOTE: even if pre/postscale = 1, we want the scaler, as we may want to clone configurations # and change them -- and not having the scaler would be problem in that case... mdict.update({ 'Prescale': Scaler(prescalerName(line, 'Stripping'), AcceptFraction=self._prescale), 'Postscale': Scaler(postscalerName(line, 'Stripping'), AcceptFraction=self._postscale) }) if self._ODIN: if isinstance(self._ODIN, str): mdict.update( {'ODIN': ODINFilter(odinentryName(line), Code=self._ODIN)}) elif isinstance(self._ODIN, (tuple, list)) and 2 == len(self._ODIN): mdict.update({ 'ODIN': ODINFilter(odinentryName(line), Code=self._ODIN[0], Preambulo=self._ODIN[1]) }) elif isinstance(self._ODIN, dict): mdict.update( {'ODIN': ODINFilter(odinentryName(line), **self._ODIN)}) else: raise TypeError, "Wrong ODIN attribute: %s " % self._ODIN if self._L0DU: if isinstance(self._L0DU, str): mdict.update( {'L0DU': L0Filter(l0entryName(line), Code=self._L0DU)}) if isinstance(self._L0DU, (tuple, list)) and 2 == len(self._L0DU): mdict.update({ 'L0DU': L0Filter(l0entryName(line), Code=self._L0DU[0], Preambulo=self._L0DU[1]) }) if isinstance(self._L0DU, dict): mdict.update( {'L0DU': L0Filter(l0entryName(line), **self._L0DU)}) from DAQSys.Decoders import DecoderDB Hlt1DecReportsDecoder = DecoderDB[ "HltDecReportsDecoder/Hlt1DecReportsDecoder"].setup() Hlt2DecReportsDecoder = DecoderDB[ "HltDecReportsDecoder/Hlt2DecReportsDecoder"].setup() if self._HLT: log.warning( self.name() + " : The usage of unique HLT is deprecated and will not work on data taken from 2015 onward. Please move to use HLT1 and HLT2." ) if isinstance(self._HLT, str): mdict.update( {'HLT': HDRFilter(hltentryName(line), Code=self._HLT)}) if isinstance(self._HLT, (tuple, list)) and 2 == len(self._HLT): mdict.update({ 'HLT': HDRFilter(hltentryName(line), Code=self._HLT[0], Preambulo=self._HLT[1]) }) if isinstance(self._HLT, dict): mdict.update( {'HLT': HDRFilter(hltentryName(line), **self._HLT)}) if self._HLT1: if isinstance(self._HLT1, str): mdict.update({ 'HLT1': HDRFilter(hlt1entryName(line), Code=self._HLT1, Location=Hlt1DecReportsDecoder. OutputHltDecReportsLocation) }) if isinstance(self._HLT1, (tuple, list)) and 2 == len(self._HLT1): mdict.update({ 'HLT1': HDRFilter(hlt1entryName(line), Code=self._HLT1[0], Location=Hlt1DecReportsDecoder. OutputHltDecReportsLocation, Preambulo=self._HLT1[1]) }) if isinstance(self._HLT1, dict): mdict.update( {'HLT1': HDRFilter(hlt1entryName(line), **self._HLT1)}) if self._HLT2: if isinstance(self._HLT2, str): mdict.update({ 'HLT2': HDRFilter(hlt2entryName(line), Code=self._HLT2, Location=Hlt2DecReportsDecoder. OutputHltDecReportsLocation) }) if isinstance(self._HLT2, (tuple, list)) and 2 == len(self._HLT2): mdict.update({ 'HLT2': HDRFilter(hlt2entryName(line), Code=self._HLT2[0], Location=Hlt2DecReportsDecoder. OutputHltDecReportsLocation, Preambulo=self._HLT2[1]) }) if isinstance(self._HLT2, dict): mdict.update( {'HLT2': HDRFilter(hlt2entryName(line), **self._HLT2)}) # Add extra info tools if needed if self.ExtraInfoTools: from Configurables import AddExtraInfo extraInfoAlg = AddExtraInfo('ExtraInfo_' + self.name()) if self.ExtraInfoSelections: extraInfoAlg.Inputs = self.selectionsToLocations( self.ExtraInfoSelections) else: extraInfoAlg.Inputs = [self.outputLocation()] if self.ExtraInfoDaughters: extraInfoAlg.MaxLevel = self.ExtraInfoRecursionLevel extraInfoAlg.DaughterLocations = self.selectionsToLocations( self.ExtraInfoDaughters) else: extraInfoAlg.MaxLevel = 0 toolNames = [] toolNum = 0 for itool in self.ExtraInfoTools: toolNum += 1 toolType = itool["Type"] toolName = "Tool%d" % toolNum module = __import__("Configurables", globals(), locals(), [toolType]) toolClass = getattr(module, toolType) extraInfoAlg.addTool(toolClass, toolName) toolInstance = getattr(extraInfoAlg, toolName) for property, value in itool.iteritems(): if property == "Type": continue setattr(toolInstance, property, value) toolNames += [toolType + '/' + toolName] extraInfoAlg.Tools = toolNames self._members.append(extraInfoAlg) if self.RelatedInfoTools != None: self.addRelatedInfo() if self.RelatedInfoFilter: if hasattr(type(self.RelatedInfoFilter), "CloneFilteredParticles"): log.debug( "Setting CloneFilteredParticles = True for RelatedInfoFilter %s " % self.RelatedInfoFilter.name()) self.RelatedInfoFilter.CloneFilteredParticles = True self._members.append(self.RelatedInfoFilter) oldOutput = self.outputLocation() self._outputloc = "Phys/" + self.RelatedInfoFilter.name( ) + "/Particles" log.debug('Redefined OutputLocation for line ' + self.name() + ' from ' + oldOutput + ' to ' + self._outputloc) self.addRelatedInfo() # Add flavour tagging tool to the end of line sequence if needed if self._EnableFlavourTagging: if not self.outputLocation() or self.outputLocation() == "": raise AttributeError, "Line %s does not have output, cannot do flavour tagging" % self.name( ) from Configurables import BTagging btag = BTagging("BTag_" + self.name(), Inputs=[self.outputLocation()]) self._members.append(btag) if self._members: filterSeq = GaudiSequencer(filterName(line, 'Stripping'), Members=self._members, OutputLevel=WARNING) mdict.update({'Filter1': filterSeq}) #print self._members mdict.update({'HltDecReportsLocation': self.fullHDRLocation}) if (self.outputLocation()): mdict.update({'OutputLocation': self.outputLocation()}) __mdict = deepcopy(mdict) from Configurables import StrippingAlg self._configurable = StrippingAlg(self.name(), **__mdict) # put upper limit on combinatorics if self.MaxCandidates == "Override": self.MaxCandidates = None if self.MaxCombinations == "Override": self.MaxCombinations = None limitCombinatorics(self._configurable, MaxCandidates=self.MaxCandidates, MaxCombinations=self.MaxCombinations) log.debug(' created StrippingAlg configurable for' + self._name) log.debug(self._configurable) return self._configurable
## finally: define the symbol StdNoPIDsDownMuons = algorithm ## MCTRUTH MATCHING myprotos = ChargedProtoParticleMaker("MyProtoParticles", Inputs = ["Rec/Track/Best"], Output = "Rec/ProtoP/MyProtoParticles") protop_locations = [myprotos.Output] charged = ChargedPP2MC("myprotos") charged.InputData = protop_locations #ChargedPP2MC().InputData = protop_locations myseq = GaudiSequencer("myseq") #myseq.Members +=[myprotos,ChargedPP2MC()] myseq.Members +=[myprotos,charged] DaVinci().UserAlgorithms+=[myseq] ## def get_mcpar(proto): LinkRef = GaudiPython.gbl.LHCb.LinkReference() linker = TES["Link/Rec/ProtoP/MyProtoParticles/PP2MC"] ok = linker.firstReference(proto.key(), None ,LinkRef) if not ok: return 0 return TES["MC/Particles"][LinkRef.objectKey()] ## DOWN DOWN KS0 MyMuonsDown = DataOnDemand(Location = 'Phys/StdNoPIDsDownMuons')
def createConfigurables(self): from Configurables import StrippingCheck # Create configurables if self.TESPrefix == None: self.TESPrefix = self._name from StrippingLine import StrippingLine # If the BadEventsSelection was not given neither in StrippingConf nor in StrippingStream if self.BadEventSelection == "Override": self.BadEventSelection = None # Make the line to mark bad events (those satisfying BadEventSelection) if self.BadEventSelection != None: # create the line that select bad events self.eventSelectionLine = StrippingLine( "Stream" + self.name() + "BadEvent", checkPV=False, algos=[self.BadEventSelection]) self.eventSelectionLine.createConfigurable(self.TESPrefix, self.HDRLocation) self.eventSelectionLine.declareAppended() if self.AcceptBadEvents != False: # Need to think a bit more on this log.error( "NOT POSSIBLE TO ACCEPT BAD EVENTS WITH THE CURRENT CONFIGURATION OF STRIPPINGCONF!!!" ) return else: # Create a filter that negates the bad events (select good events). # This filter will be inserted at the beginning of the filters run by all the lines. from Configurables import LoKi__VoidFilter as Filter self.goodEventFilter = Filter( "StrippingGoodEventCondition" + self.name(), Code=" ALG_EXECUTED('%s') & ~ALG_PASSED('%s') " % (self.eventSelectionLine.name(), self.eventSelectionLine.name()), Preambulo=["from LoKiHlt.algorithms import *"]) for line in self.lines: if line.MaxCandidates == "Override": line.MaxCandidates = self.MaxCandidates if line.MaxCombinations == "Override": line.MaxCombinations = self.MaxCombinations if self.BadEventSelection != None: if not self.AcceptBadEvents != False: # inserting filter for good events inside the lines if not "StrippingGoodEventCondition" in line._members[ 0].name(): line._members.insert(0, self.goodEventFilter) if line.prescale() > 0.: line.createConfigurable(self.TESPrefix, self.HDRLocation) log.debug("ADDING configurable " + line.configurable().name() + "to stream " + self.name()) self.algs.append(line.configurable()) else: line.RequiredRawEvents = None #forcing None rawevents to avoid (harmless) errors from the DSTWriter log.warning("Line " + line.name() + " has zero prescale, skipping") # Make the line for stream decision (OR of all stream lines) linesSeq = GaudiSequencer( "StrippingStreamSeq" + self.name(), ModeOR=True, #ShortCircuit = False, OutputLevel=WARNING, Members=self.algs) self.streamLine = StrippingLine("Stream" + self.name(), checkPV=False, algos=[linesSeq]) ## I think it is redundant, otherwise if it comes out it is needed ## uncomment the following lines #if self.BadEventSelection != None : # if not self.AcceptBadEvents != False : # if not "StrippingGoodEventCondition" in self.streamLine._members[0].name() : # self.streamLine._members.insert(0,self.goodEventFilter) self.streamLine.createConfigurable(self.TESPrefix, self.HDRLocation) self.streamLine.declareAppended()