def _configureInput(self): """ Tune initialisation """ # Input data type inputType = self.getProp("InputType").upper() # Get the event time (for CondDb) from ODIN from Configurables import EventClockSvc EventClockSvc().EventTimeDecoder = "OdinTimeDecoder" # if property set explcicitly - use it! if self.isPropertySet('EnableUnpack'): unPack = self.getProp('EnableUnpack') DstConf(EnableUnpack=unPack) PhysConf(EnableUnpack=unPack) elif inputType != "MDF": defaultUnpacking = ["Reconstruction", "Stripping"] DstConf(EnableUnpack=defaultUnpacking) PhysConf(EnableUnpack=defaultUnpacking) if inputType != "MDST": if self.getProp("Simulation"): DstConf().setProp("SimType", "Full") return inputType
def defineGeometry(self): # DIGI is always simulation, as is usage of MC truth! if self.getProp( "WithMC" ) or self.getProp( "InputType" ).upper() == 'DIGI': self.setProp( "Simulation", True ) # Check that detector list does not contain non-upgrade detectors if in upgrade mode (can crash later) if( self.getProp("DataType") is "Upgrade"): for det in self.getProp("Detectors"): if det in ['Velo', 'TT', 'OT', 'IT']: log.warning("You are running with non-upgrade detector %s in upgrade mode."%det) # Delegate handling to LHCbApp configurable self.setOtherProps(LHCbApp(),["DataType","CondDBtag","DDDBtag","Simulation","Detectors"]) # Set list of detectors in DstConf dstConfDetList = [] simConfDetList = [] for det in self.getProp("Detectors"): if det in ['Rich1', 'Rich2', 'Rich1Pmt', 'Rich2Pmt']: if "Rich" not in dstConfDetList: dstConfDetList.append("Rich") if "Rich" not in simConfDetList: simConfDetList.append("Rich") elif det in ['Prs', 'Spd', 'Ecal', 'Hcal']: simConfDetList.append(det) if "Calo" not in dstConfDetList: dstConfDetList.append("Calo") else: dstConfDetList.append(det) simConfDetList.append(det) DstConf().setProp("Detectors", dstConfDetList) from Configurables import SimConf SimConf().setProp("Detectors", simConfDetList)
def _defineMonitors(self): if self.getProp("KillDAQ"): from Configurables import EventNodeKiller daqKiller = EventNodeKiller("DAQKiller") daqKiller.Nodes += ["DAQ"] ApplicationMgr().TopAlg += [daqKiller] ApplicationMgr().TopAlg += ["PrintHeader"] ApplicationMgr().ExtSvc += ["ToolSvc", "DataOnDemandSvc"] if self.getProp("LoadAll"): from Configurables import StoreExplorerAlg, TESFingerPrint storeExp = StoreExplorerAlg(Load=True, PrintFreq=1, ExploreRelations=1) fingerPrint = TESFingerPrint(HeuristicsLevel="Medium", OutputLevel=1) ApplicationMgr().TopAlg += [storeExp, fingerPrint] if self.getProp("DataContent").upper() == "DST": from Configurables import DumpTracks dumpTracks = DumpTracks(OutputLevel=2) ApplicationMgr().TopAlg += ["DumpTracks"] DstConf().EnableUnpack = ["Reconstruction", "Stripping"] if self.getProp("WithMC"): DigiConf().EnableUnpack = True SimConf().EnableUnpack = True ApplicationMgr().TopAlg += ["DumpMCEventAlg"] if self.getProp("DataContent").upper() == "SIM": ApplicationMgr().TopAlg += ["DumpHepMC"]
def _configureSubPackages(self): """ Define DB and so on """ # Delegate handling to LHCbApp configurable self.setOtherProps(LHCbApp(), [ "DataType", "CondDBtag", "DDDBtag", "DQFLAGStag", "Simulation", "IgnoreDQFlags" ]) self.setOtherProps( PhysConf(), ["DataType", "Simulation", "InputType", "Detectors"]) self.setOtherProps(AnalysisConf(), ["DataType", "Simulation"]) self.setOtherProps(DstConf(), ["DataType"])
def __apply_configuration__(self): GaudiKernel.ProcessJobOptions.PrintOff() GaudiKernel.ProcessJobOptions.PrintOn() log.info("Initializing sequences!") self.setOtherProps( RecSysConf(), ["SpecialData", "Context", "OutputType", "DataType"]) #if self.isPropertySet("RecoSequence") : #self.setOtherProp(RecSysConf(),["RecoSequence"]) RecSysConf().RecoSequence = self.CheckRecoSequence() # there is a bug in setOtherProps, so we cannot use it to set the MoniSequence. if not self.getProp("OnlineMode"): self.setOtherProps(RecMoniConf(), ["Context", "DataType"]) RecMoniConf().MoniSequence = self.getProp("MoniSequence") else: self.setOtherProps(RecMoniConf(), ["Context", "DataType"]) RecMoniConf().MoniSequence = self.getProp("MoniSequence") RecMoniConf().Context = "Offline" RecMoniConf().OutputLevel = FATAL RecMoniConf().Histograms = "OfflineFull" self.defineGeometry() self.defineEvents() self.defineOptions() # database hacking for online. if self.getProp('UseDBSnapshot'): self.configureDBSnapshot() # Use TimingAuditor for timing, suppress printout from SequencerTimerTool from Configurables import (ApplicationMgr, AuditorSvc, SequencerTimerTool) ApplicationMgr().ExtSvc += ['ToolSvc', 'AuditorSvc'] ApplicationMgr().AuditAlgorithms = True AuditorSvc().Auditors += ['TimingAuditor'] SequencerTimerTool().OutputLevel = 4 log.info(self) log.info(LHCbApp()) log.info(RecSysConf()) log.info(TrackSys()) if not self.getProp("OnlineMode"): log.info(RecMoniConf()) log.info(TAlignment()) log.info(DstConf()) GaudiKernel.ProcessJobOptions.PrintOff()
def configureOutput(self, dstType, withMC, handleLumi): """ Set up output stream """ # Merge genFSRs if self.getProp("WriteFSR"): if self.getProp("MergeGenFSR"): GaudiSequencer("OutputDSTSeq").Members += ["GenFSRMerge"] if dstType in [ "XDST", "DST", "LDST", "RDST" ]: writerName = "DstWriter" packType = self.getProp( "PackType" ) # event output dstWriter = OutputStream( writerName ) dstWriter.AcceptAlgs += ["Reco"] # Write only if Rec phase completed if handleLumi and self.getProp( "WriteLumi" ): dstWriter.AcceptAlgs += ["LumiSeq"] # Write also if Lumi sequence completed # set verbosity if self.getProp( "ProductionMode" ): if not dstWriter.isPropertySet( "OutputLevel" ): dstWriter.OutputLevel = INFO if self.getProp("WriteFSR"): FSRWriter = RecordStream( "FSROutputStreamDstWriter") if not FSRWriter.isPropertySet( "OutputLevel" ): FSRWriter.OutputLevel = INFO # Suppress spurious error when reading POOL files without run records if self.getProp("WriteFSR"): if self.getProp( "InputType" ).upper() not in [ "MDF" ]: from Configurables import FileRecordDataSvc FileRecordDataSvc().OutputLevel = FATAL if dstType == "XDST": # Allow multiple files open at once (SIM,DST,DIGI etc.) IODataManager().AgeLimit += 1 if dstType in ["DST","XDST","LDST"] and packType not in ["MDF"]: jseq=GaudiSequencer("RawEventSplitSeq") ################################# # Split the Raw Event for the DST # Use the RawEventJuggler. # Not delegated to DSTConf. # Some information must be shared with DSTConf ################################# juggler=RawEventJuggler() juggler.Sequencer=jseq dstseq=GaudiSequencer("OutputDSTSeq") dstseq.Members.append(jseq) # Set the output version if not already overwritten if juggler.isPropertySet("Output") and juggler.getProp("Output") is not None: #it's already set pass else: juggler.setProp("Output",self.getProp("SplitRawEventOutput")) #set the input version, could come from several places if self.isPropertySet("SplitRawEventInput") and self.getProp("SplitRawEventInput") is not None: #if set, take it from Brunel() juggler.setProp("Input",self.getProp("SplitRawEventInput")) #otherwise use the setting of the juggler if it is set elif juggler.isPropertySet("Input") and juggler.getProp("Input") is not None: pass #else find it from DecodeRawEvent elif DecodeRawEvent().isPropertySet("OverrideInputs") and DecodeRawEvent().getProp("OverrideInputs") is not None: juggler.setProp("Input",DecodeRawEvent().getProp("OverrideInputs")) #else if I'm input with a DST, assume it is a Stripping20 type elif self._isReprocessing(self.getProp("InputType")): juggler.setProp("Input",2.0) else: #or set the default to whatever comes out of Moore by default juggler.setProp("Input","Moore") #share information from the Juggler with DSTConf #always write out to where the Juggler asked! DstConf().setProp("SplitRawEventOutput", juggler.getProp("Output")) #or else the default in the juggler is used, should be 0.0 #TODO, handle the turned off Calo, shouldn't actually be a problem... from RawEventCompat.Configuration import _checkv from Configurables import RawEventFormatConf RawEventFormatConf().loadIfRequired() if juggler.getProp("Input")!=juggler.getProp("Output"): if (juggler.getProp("Input") is None or juggler.getProp("Output")) is None or (_checkv(juggler.getProp("Input")))!=(_checkv(juggler.getProp("Output"))): juggler.KillExtraBanks=True juggler.KillExtraNodes=True #really kill /Event/DAQ to prevent it re-appearing! juggler.KillExtraDirectories=True from Configurables import TrackToDST # Filter Best Track States to be written trackFilter = TrackToDST("FilterBestTrackStates") from Configurables import ProcessPhase ProcessPhase("Output").DetectorList += [ "DST" ] GaudiSequencer("OutputDSTSeq").Members += [ trackFilter ] ### For Run 2, filter the fitted Velo tracks for PV if( self.getProp("DataType") in self.Run2DataTypes ): fittedVeloTracksFilter = TrackToDST("FilterFittedVeloTrackStates", veloStates = ["ClosestToBeam"]) fittedVeloTracksFilter.TracksInContainer = "Rec/Track/FittedHLT1VeloTracks" GaudiSequencer("OutputDSTSeq").Members += [ fittedVeloTracksFilter ] if "Muon" in self.getProp("Detectors"): # Filter Muon Track States muonTrackFilter = TrackToDST("FilterMuonTrackStates") muonTrackFilter.TracksInContainer = "/Event/Rec/Track/Muon" GaudiSequencer("OutputDSTSeq").Members += [ muonTrackFilter ] if packType != "NONE": # Add the sequence to pack the DST containers packSeq = GaudiSequencer("PackDST") DstConf().PackSequencer = packSeq DstConf().AlwaysCreate = True GaudiSequencer("OutputDSTSeq").Members += [ packSeq ] # Run the packers also on Lumi only events to write empty containers if handleLumi and self.getProp( "WriteLumi" ): notPhysSeq = GaudiSequencer("NotPhysicsSeq") notPhysSeq.Members += [ packSeq ] # Define the file content DstConf().Writer = writerName DstConf().DstType = dstType DstConf().PackType = packType #In case we didn't juggle the raw event, #We should write out the same as the input type! if not DstConf().isPropertySet("SplitRawEventOutput"): if self.isPropertySet("SplitRawEventInput") and self.getProp("SplitRawEventInput") is not None: DstConf().setProp("SplitRawEventOutput",self.getProp("SplitRawEventInput")) elif DecodeRawEvent().isPropertySet("OverrideInputs") and DecodeRawEvent().getProp("OverrideInputs") is not None: DstConf().setProp("SplitRawEventOutput",DecodeRawEvent().getProp("SplitRawEventInput")) if withMC: DstConf().SimType = "Full" elif self.getProp("DigiType").capitalize() == "Minimal": from Configurables import PackMCVertex GaudiSequencer("OutputDSTSeq").Members += [PackMCVertex()] DstConf().SimType = "Minimal" DstConf().OutputName = self.outputName() self.setOtherProps(DstConf(),["DataType","WriteFSR"])
def defineOptions(self): # Kept for Dirac backward compatibility if self.getProp( "NoWarnings" ) : log.warning("Brunel().NoWarnings=True property is obsolete and maintained for Dirac compatibility. Please use Brunel().ProductionMode=True instead") self.setProp( "ProductionMode", True ) # Special settings for production if self.getProp( "ProductionMode" ) : if not self.isPropertySet( "OutputLevel" ) : self.setProp("OutputLevel", ERROR) if not LHCbApp().isPropertySet( "TimeStamp" ) : LHCbApp().setProp( "TimeStamp", True ) if not self.isPropertySet( "PrintFreq" ) : self.setProp("PrintFreq", 1000) # HC does not exist in Run 1, so use appropriate split output if self.getProp( "DataType" ) in self.Run1DataTypes : if not self.isPropertySet( "SplitRawEventOutput" ) : self.setProp( "SplitRawEventOutput", 4.0 ) # Online mode if self.getProp( "OnlineMode" ) : if not self.isPropertySet("Histograms") : self.setProp("Histograms","Online") if not CondDB().isPropertySet("Online") : CondDB().setProp("Online", True) inputType = self.getProp( "InputType" ).upper() if inputType not in self.KnownInputTypes: raise TypeError( "Invalid inputType '%s'"%inputType ) outputType = self.getProp( "OutputType" ).upper() histOpt = self.getProp("Histograms") if histOpt not in self.KnownHistograms: raise RuntimeError("Unknown Histograms option '%s'"%histOpt) withMC = self.getProp("WithMC") if withMC: if inputType in [ "MDF" ]: log.warning( "WithMC = True, but InputType = '%s'. Forcing WithMC = False"%inputType ) withMC = False # Force it, MDF never contains MC truth if outputType in [ "RDST" ]: log.warning( "WithMC = True, but OutputType = '%s'. Forcing WithMC = False"%inputType ) withMC = False # Force it, RDST never contains MC truth if self.getProp("WriteFSR") and self.getProp("PackType").upper() in ["MDF"]: if hasattr( self, "WriteFSR" ): log.warning("Don't know how to write FSR to MDF output file") self.setProp("WriteFSR", False) if self.getProp( "MergeGenFSR") and not self.getProp( "Simulation" ): if hasattr( self, "MergeGenFSR" ): log.warning("Cannot MergeGenFSR on real data") self.setProp( "MergeGenFSR", False ) # Do not look for Hlt errors in data without HltDecReports bank if self.getProp( "DataType" ) in [ "2008", "2009" ]: self.setProp( "VetoHltErrorEvents", False ) # For simulation, change the default but allow to override if self.getProp( "Simulation" ) and not hasattr( self, "VetoHltErrorEvents" ): self.setProp( "VetoHltErrorEvents", False ) # Flag to handle or not LumiEvents handleLumi = inputType in ["MDF"] and not withMC and not self.getProp('UseDBSnapshot') # Top level configuration for skipping tracking if self.getProp("SkipTracking"): if inputType in ["MDF", "DIGI" ]: raise RuntimeError( "Cannot skip tracking if tracks not present on the input file" ) if withMC: raise RuntimeError( "SkipTracking not (yet) supported for simulation input" ) if( self.getProp("DataType") is "Upgrade"): raise RuntimeError( "SkipTracking not (yet) supported for Upgrade configurations" ) ApplicationMgr().ExtSvc += [ "DataOnDemandSvc" ] # to decode the tracks from the DST DstConf().setProp("EnableUnpack", ["Tracking"] ) # veto Hlt Error Events vetoHltErrorEvents = self.getProp("VetoHltErrorEvents") self.configureSequences( withMC, handleLumi, vetoHltErrorEvents ) self.configureInit( inputType ) self.configureInput( inputType ) self.configureOutput( outputType, withMC, handleLumi ) if withMC: # Create associators for checking and for DST from Configurables import ProcessPhase ProcessPhase("MCLinks").DetectorList += self.getProp("MCLinksSequence") # Unpack Sim data GaudiSequencer("MCLinksUnpackSeq").Members += [ "UnpackMCParticle"] # particle gun uses MCVertex to fake a reconstructed one # unpacking again would lead to crash if "pGun" not in self.getProp("SpecialData"): GaudiSequencer("MCLinksUnpackSeq").Members += [ "UnpackMCVertex" ] else: # Cannot run trigger on pGun events... L0Conf().EnsureKnownTCK=False GaudiSequencer("MCLinksTrSeq").Members += [ "TrackAssociator" ] GaudiSequencer("MCLinksCaloSeq").Members += [ "CaloDigit2MCLinks2Table", "CaloClusterMCTruth", "CaloHypoMCTruth" ] # activate all configured checking (uses MC truth) self.configureCheck( histOpt == "Expert" ) # data on demand needed to pack RichDigitSummary for DST, when reading unpacked DIGI # Also needed to unpack MCHit containers when expert checking enabled ApplicationMgr().ExtSvc += [ "DataOnDemandSvc" ] # ROOT persistency for histograms ApplicationMgr().HistogramPersistency = "ROOT" from Configurables import RootHistCnv__PersSvc RootHistCnv__PersSvc('RootHistCnv').ForceAlphaIds = True if histOpt == "None" or histOpt == "": # HistogramPersistency still needed to read in CaloPID DLLs. # so do not set ApplicationMgr().HistogramPersistency = "NONE" return # Pass expert checking option to RecSys and RecMoni if histOpt == "Expert": DstConf().EnablePackingChecks = True # Use a default histogram file name if not already set if not HistogramPersistencySvc().isPropertySet( "OutputFile" ): histosName = self.getProp("DatasetName") if histosName == "": histosName = "Brunel" if self.getProp( "RecL0Only" ): histosName += '-L0Yes' if (self.evtMax() > 0): histosName += '-' + str(self.evtMax()) + 'ev' if histOpt == "Expert": histosName += '-expert' histosName += '-histos.root' HistogramPersistencySvc().OutputFile = histosName #reconfigure decoders to point to default location, if required! if DecodeRawEvent().isPropertySet("OverrideInputs") and DecodeRawEvent().getProp("OverrideInputs") is not None: #do nothing, it's been configured by someone else! pass elif self.isPropertySet("SplitRawEventInput") and self.getProp("SplitRawEventInput") is not None: #print "WAAAAH Overriding RawEvent Locations" DecodeRawEvent().setProp("OverrideInputs",self.getProp("SplitRawEventInput")) elif inputType in [ "MDF", "DIGI", "XDIGI" ]: #set to the default of what comes out of Moore DecodeRawEvent().setProp("OverrideInputs","Moore") #remember that the default is a long list of locations, #starting with places which only exist _after_ brunel has run! # Following needed to build RecSummary, even if tracking is skipped. if self.getProp("SkipTracking"): from TrackSys import RecoTracking RecoTracking.DecodeTracking(["FastVelo"])
# Example 2010 collisions options for RichParticleSearch # Syntax is: # gaudirun.py myOptions.py # from GaudiKernel.ProcessJobOptions import importOptions importOptions("$APPCONFIGOPTS/Brunel/DataType-2011.py") from Gaudi.Configuration import * from Configurables import Brunel, LHCbApp, CondDB, CondDBAccessSvc, ApplicationMgr # Run faster over dsts from Configurables import DstConf ApplicationMgr().ExtSvc += ["DataOnDemandSvc"] DstConf().EnableUnpack = ["Reconstruction"] from Configurables import RichRecSysConf rConf = RichRecSysConf("RichOfflineRec") ##faster photon reconstruction rConf.richTools().photonReco().FindUnambiguousPhotons = [False, False, False] # #rConf.richTools().PhotonRecoType = "EstiFromRadius"#use for faster photon reconstruction!! #Brunel options Brunel().DataType = "2011" Brunel().EvtMax = -1 Brunel().PrintFreq = 1 Brunel().OutputType = "None" Brunel().InitSequence = ["Brunel"] Brunel().RecoSequence = ["RICH"]
HltConfigSvc().ApplyTransformation = thisTransform # # Define the swimming algorithm # myswimmer = HltMoveVerticesForSwimming("HltMovePVs4Swimming") myswimmer.SwimmingDistance = 0.0 myswimmer.Bcontainer = offCands if options.select == 'none' else swimCands myswimmer.InputSelection = options.onlinePV myswimmer.OutputSelection = options.outPVSel myswimmer.OutputLevel = 4 #The general setup from Swimming import GeneralSetup from Configurables import DstConf, CaloDstUnPackConf CaloDstUnPackConf(Enable=True) DstConf(EnableUnpack=True) # ApplicationMgr().TopAlg = [deathstar] + ApplicationMgr().TopAlg # New persistency if options.ROOT: from GaudiConf import IOHelper IOHelper("ROOT", "ROOT").postConfigServices() # FileStager if options.filestager: from FileStager.Configuration import configureFileStager configureFileStager() # Disable muons in TisTosTool from Configurables import TriggerTisTos ToolSvc().addTool(TriggerTisTos, 'TriggerTisTos')
def configureReco(self, init): """ Configure Reconstruction to be redone """ ## CaloReco & CaloPIDs on-demand clusters = ['Digits', 'Clusters'] from Configurables import CaloProcessor caloProc = CaloProcessor(EnableOnDemand=True, OutputLevel=self.getProp("OutputLevel")) caloProc.RecList = clusters # --- if self.getProp('DataType') == 'Upgrade': caloProc.NoSpdPrs = True ## General unpacking from Configurables import DstConf if self.isPropertySet('EnableUnpack'): DstConf().setProp('EnableUnpack', self.getProp('EnableUnpack')) ## unpack Calo Hypos ? from Configurables import CaloDstUnPackConf unpack = CaloDstUnPackConf() hypos = ['Photons', 'MergedPi0s', 'SplitPhotons', 'Electrons'] # CaloHypos if self.isPropertySet( 'EnableUnpack') and "Reconstruction" in self.getProp( 'EnableUnpack'): unpack.setProp('Enable', True) else: caloProc.RecList += hypos # enable caloHypos onDemand # Reprocess explicitely the full calo sequence in the init sequence ? inputtype = self.getProp('InputType').upper() if (self.getProp("CaloReProcessing") and inputtype != 'MDST'): caloProc.RecList = clusters + hypos caloSeq = caloProc.sequence( ) # apply the CaloProcessor configuration cSeq = GaudiSequencer('CaloReProcessing') cSeq.Members += [caloSeq] init.Members += [cSeq] unpack.setProp('Enable', False) # update CaloHypo->MC Linker if self.getProp('Simulation'): log.info( "CaloReprocessing : obsolete CaloHypo2MC Links is updated") from Configurables import (TESCheck, EventNodeKiller, CaloHypoMCTruth) caloMCLinks = ["Link/Rec/Calo"] caloMCSeq = GaudiSequencer("cleanCaloMCLinks") checkCaloMCLinks = TESCheck("checkCaloMCLinks") checkCaloMCLinks.Inputs = caloMCLinks checkCaloMCLinks.Stop = False killCaloMCLinks = EventNodeKiller("killCaloMCLinks") killCaloMCLinks.Nodes = caloMCLinks caloMCSeq.Members = [checkCaloMCLinks, killCaloMCLinks] init.Members += [caloMCSeq] update = self.getProp("UpdateCaloMCLinks") if update: redoCaloMCLinks = CaloHypoMCTruth("recreteCaloMCLinks") init.Members += [redoCaloMCLinks] else: caloProc.applyConf() if inputtype != 'MDST': log.info( "CaloReProcessing cannot be processed on reduced (m)DST data" ) # For backwards compatibility with MC09, we need the following to rerun # the Muon Reco on old data. To be removed AS SOON as this backwards compatibility # is no longer needed if (self.getProp("DataType") == 'MC09' and inputtype != 'MDST' and self.getProp("AllowPIDRerunning") and inputtype != 'RDST'): from Configurables import DataObjectVersionFilter, MuonRec, TESCheck from MuonID import ConfiguredMuonIDs rerunPIDSeq = GaudiSequencer("ReRunMuonPID") init.Members += [rerunPIDSeq] # Check data version, to see if this is needed or not rerunPIDSeq.Members += [ DataObjectVersionFilter( "MuonPIDVersionCheck", DataObjectLocation="/Event/Rec/Muon/MuonPID", MaxVersion=0) ] # Check raw event is available rerunPIDSeq.Members += [ TESCheck("TESCheckRawEvent", Inputs=["DAQ/RawEvent"], Stop=False) ] # Run Muon PID cm = ConfiguredMuonIDs.ConfiguredMuonIDs( data=self.getProp("DataType")) rerunPIDSeq.Members += [MuonRec(), cm.getMuonIDSeq()] # If muon PID has rerun, need to re make the Combined DLLS... from Configurables import (ChargedProtoParticleAddMuonInfo, ChargedProtoCombineDLLsAlg) rerunPIDSeq.Members += [ ChargedProtoParticleAddMuonInfo("CProtoPAddNewMuon"), ChargedProtoCombineDLLsAlg("CProtoPCombDLLNewMuon") ] # Compatibility with pre-2011 data, where Rec/Summary and Trigger/RawEvent are missing import PhysConf.CheckMissingTESData as DataCheck DataCheck.checkForMissingData()
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() ] )
if options.data: importOptions(options.data) ## Moore settings app = LHCbApp() app.EvtMax = options.nevents app.CondDBtag = 'sim-20131023-vc-md100' app.DDDBtag = 'dddb-20130929-1' app.DataType = '2015' app.Simulation = True ApplicationMgr().HistogramPersistency = "ROOT" PhysConf(EnableUnpack = ["Reconstruction", "Stripping"]) DstConf(EnableUnpack = ["Reconstruction", "Stripping"]) if app.getProp('Simulation'): from Configurables import SimConf SimConf(EnableUnpack = True, EnablePack = False) EventSelector().PrintFreq = 100 eos_dir = '/eos/lhcb/grid/prod/lhcb/MC/Dev/XDST/00034704/0000' p = subprocess.Popen(['/afs/cern.ch/project/eos/installation/0.3.15/bin/eos.select', 'ls', eos_dir], stdout = subprocess.PIPE, stderr = subprocess.STDOUT) o, e = p.communicate() input_files = sorted(['root://eoslhcb.cern.ch/' + os.path.join(eos_dir, f.strip()) for f in o.split()]) seq = GaudiSequencer( "TopSequence" ) from Configurables import ( DecodeVeloRawBuffer, RawBankToSTLiteClusterAlg,
from Brunel.Configuration import * from Configurables import Brunel, LHCbApp importOptions("CKRefractCalib-FullBrunelReco.py") Brunel().InputType = "DST" from Configurables import DstConf ApplicationMgr().ExtSvc += ["DataOnDemandSvc"] DstConf().EnableUnpack = True from Configurables import RecMoniConf RecMoniConf().MoniSequence = ["RICH"] Brunel().RecoSequence = ["RICH"] Brunel().InitSequence = ["Brunel"] Brunel().MCCheckSequence = ["RICH"]
def configureOutput(self, dstType): """ Set up output stream """ if dstType in ["DST", "RDST"]: if hasattr(self, "Persistency"): if self.getProp("Persistency") is not None: DstConf().Persistency = self.getProp("Persistency") writerName = "DstWriter" packType = self.getProp("PackType") # Do not pack DC06 DSTs, for consistency with existing productions if self.getProp("DataType") == "DC06": packType = "NONE" dstWriter = OutputStream(writerName) dstWriter.RequireAlgs += ["Reco" ] # Write only if Rec phase completed # Set a default output file name if not already defined in the user job options if not hasattr(dstWriter, "Output"): DstConf().OutputName = self.outputName() # Define the file content DstConf().Writer = writerName DstConf().DstType = dstType DstConf().PackType = packType DstConf().setProp("WriteFSR", self.getProp("WriteFSR")) if hasattr(self, "Persistency"): if self.getProp("Persistency") is not None: DstConf().setProp("Persistency", self.getProp("Persistency")) from Configurables import TrackToDST if dstType == "DST": # Sequence for altering DST content ProcessPhase("Output").DetectorList += ["DST"] # Filter Track States to be written trackFilter = TrackToDST() else: # Sequence for altering content of rDST compared to DST ProcessPhase("Output").DetectorList += ["L0", "DST"] # Filter Track States to be written trackFilter = TrackToDST("TrackToRDST") trackFilter.veloStates = ["ClosestToBeam"] trackFilter.longStates = ["ClosestToBeam"] trackFilter.TTrackStates = ["FirstMeasurement"] trackFilter.downstreamStates = ["FirstMeasurement"] trackFilter.upstreamStates = ["ClosestToBeam"] GaudiSequencer("OutputDSTSeq").Members += [trackFilter] if packType != "NONE": # Add the sequence to pack the DST containers packSeq = GaudiSequencer("PackDST") DstConf().PackSequencer = packSeq DstConf().AlwaysCreate = True GaudiSequencer("OutputDSTSeq").Members += [packSeq] # Always write an ETC if ETC input if self.getProp("InputType").upper() == "ETC": raise DeprecationWarning, "ETC are no longer supported by LHCb" etcWriter = TagCollectionSvc("EvtTupleSvc") ApplicationMgr().ExtSvc.append(etcWriter) ApplicationMgr().OutStream.append("GaudiSequencer/SeqTagWriter") importOptions("$ESCHEROPTS/DefineETC.opts") if not hasattr(etcWriter, "Output"): etcWriter.Output = [ "EVTTAGS2 DATAFILE='" + self.getProp("DatasetName") + "-etc.root' TYP='POOL_ROOTTREE' OPT='RECREATE' " ] # Do not print event number at every event (done already by Brunel) EventSelector().PrintFreq = -1 CountingPrescaler("EscherPrescaler").PrintFreq = self.getProp( "PrintFreq") # Modify printout defaults if self.getProp("NoWarnings"): importOptions("$ESCHEROPTS/SuppressWarnings.opts")
def configureSequences(self): # Check for special data options for option in self.getProp('SpecialData'): if option not in self.KnownSpecialData: raise RunTimeError("Unknown SpecialData option '%s'" % option) escherSeq = GaudiSequencer("EscherSequencer") #escherSeq.Context = self.getProp("Context") ApplicationMgr().TopAlg = [escherSeq] mainSeq = self.getProp("MainSequence") if len(mainSeq) == 0: self.MainSequence = self.DefaultSequence mainSeq = self.MainSequence escherSeq.Members += mainSeq ProcessPhase("Init").DetectorList += self.getProp("InitSequence") ProcessPhase("Init").Context = self.getProp("Context") from Configurables import RecInit, TrackSys log.info("Setting up alignment sequence") recInit = RecInit(name="EscherInit", PrintFreq=self.getProp("PrintFreq")) GaudiSequencer("InitEscherSeq").Members += [recInit] # set up the HltFilterSeq from Configurables import HltCompositionMonitor from Configurables import LoKi__HDRFilter as HDRFilter hltFilterSeq = GaudiSequencer("HltFilterSeq") from DAQSys.Decoders import DecoderDB from DAQSys.DecoderClass import decodersForBank from itertools import chain hltdecs = [DecoderDB.get("HltDecReportsDecoder/Hlt1DecReportsDecoder")] if not self.getProp("OnlineMode"): ## HLT2 decreports are only used offline. hltdecs += [ DecoderDB.get("HltDecReportsDecoder/Hlt2DecReportsDecoder") ] hltFilterSeq.Members = [d.setup() for d in hltdecs] ## FIXME: These lines should go back in as soon as an easy to use filter ## FIXME: is available that works for HLT1 and HLT2 decreports at the same time. ## identifies events that are not of type Hlt1ErrorEvent or Hlt2ErrorEvent ## hltErrCode = "HLT_PASS_RE('Hlt1(?!ErrorEvent).*Decision') & HLT_PASS_RE('Hlt2(?!ErrorEvent).*Decision')" ## hltErrorFilter = HDRFilter('HltErrorFilter', Code = hltErrCode ) # the filter ## hltFilterSeq.Members += [ HltCompositionMonitor(), hltErrorFilter ] ## add more hlt filters, if requested ## if hasattr(self,"HltFilterCode") and len(self.getProp("HltFilterCode"))>0: ## hltfilter = HDRFilter ( 'HLTFilter', ## Code = self.getProp("HltFilterCode")) ## hltfilter.Preambulo += [ "from LoKiCore.functions import *" ] ## hltFilterSeq.Members += [ hltfilter ] # in Escher we'll always use the DOD ApplicationMgr().ExtSvc += ["DataOnDemandSvc"] alignSeq = GaudiSequencer("AlignSequence") # if the patter reco is not run, we need the DataOnDemand svc # so that e.g. the track container(s) is unpacked: if not GaudiSequencer("RecoTrSeq").getProp("Enable"): DstConf(EnableUnpack=True) # Setup tracking sequence trackConf = TrackSys() self.setOtherProps(trackConf, [ "SpecialData", "OutputType", "DataType", "Simulation", "GlobalCuts" ]) trackConf.ExpertTracking = self.getProp("ExpertTracking") ta = TAlignment() ta.Upgrade = self.getProp("Upgrade") self.setOtherProps(ta, ["DatasetName", "OnlineMode", "OnlineAligWorkDir"]) ta.Sequencer = alignSeq if self.getProp("Millepede"): log.info("Using Millepede type alignment!") self.setProp("Incident", "GlobalMPedeFit") ta.Method = "Millepede" ta.Sequencer = GaudiSequencer("MpedeAlignSeq")
def __apply_configuration__(self): """ Swimming configuration """ log.info("Applying Swimming configuration") log.info(self) if not self.getProp('SwimStripping') and not self.getProp( 'TransformName'): raise TypeError, "No or invalid HLT transform specified when trying to swim the trigger!" if not self.getProp('SwimStripping') and self.getProp('SwimOffSel'): raise TypeError, "You cannot swim the trigger and offline selection in the same job!" if self.getProp('SelectMethod') not in [ 'random', 'first', 'all', 'none' ]: raise TypeError, 'The selectMethod must be eiter "random", "first", "all" or "none".' if type(self.getProp('OffCands')) != dict: raise TypeError, 'OffCands must be a dict' if type(self.getProp('StripCands')) != dict: raise TypeError, 'StripCands must be a dict' for key, value in self.getProp('StripCands').iteritems(): if type(value) != list or not isinstance(key, basestring): raise TypeError, 'StripCands must be a { string : [ ] } dict' if type(self.getProp('MuDSTCands')) != list: raise TypeError, 'MuDSTCands must be a list' if type(self.getProp('StrippingLines')) != list: raise TypeError, 'StrippingLines must be a list' if type(self.getProp('MicroDSTElements')) != list: raise TypeError, 'MicroDSTElements must be a list' if not self.getProp('OutputType') in ['DST', 'MDST']: raise TypeError, "The only supported output types are DST and MDST." if not self.getProp('SwimStripping') and self.getProp( 'OutputType') == 'MDST': raise TypeError, "You cannot write a MicroDST when swimming the trigger." if type(self.getProp('LifetimeFitter')) != list: raise TypeError, "LifetimeFitter must be a list of strings." for lifetimefitter in self.getProp('LifetimeFitter'): if lifetimefitter not in ['LifetimeFitter', 'DecayTreeFitter']: raise TypeError, "Allowed LifetimeFitters are LifetimeFitter and DecayTreeFitter." if type(self.getProp('DecayTreeFitterConstraints')) != dict: raise TypeError, "DecayTreeFitterConstraints must be a dict" extension = self.getProp("OutputFile").rsplit(os.path.extsep, 1)[-1] if extension.upper() != self.getProp('OutputType'): log.warning( "You have specified a different output file extension " + "than OutputType; this is ignored.") from Configurables import DataOnDemandSvc app = LHCbApp() self.setOtherProps( app, ['EvtMax', 'SkipEvents', 'Simulation', 'DataType', 'Persistency']) # Configure XMLSummarySvc if self.getProp('XMLSummary'): app.XMLSummary = self.getProp('XMLSummary') from Configurables import XMLSummarySvc XMLSummarySvc( 'CounterSummarySvc').EndEventIncident = 'SwimmingEndEvent' DstConf(EnableUnpack=["Reconstruction", "Stripping"]) # TODO check if we need: CaloDstUnPackConf ( Enable = True ) importOptions("$STDOPTS/DecodeRawEvent.py") appConf = ApplicationMgr() appConf.HistogramPersistency = 'ROOT' appConf.ExtSvc += ['DataOnDemandSvc'] EventSelector().PrintFreq = -1 EventSelector().OutputLevel = 6 if not (self.getProp('Input') == []): from GaudiConf import IOHelper IOHelper('ROOT').inputFiles(self.getProp('Input')) # Swimming::Service ApplicationMgr().ExtSvc += ['Swimming::Service'] from Configurables import Swimming__Service as Service Service().RefitPVs = self.getProp('RefitPVs') Service().OfflinePVLocation = self.getProp('OfflinePV') # FileStager if self.getProp('UseFileStager'): from FileStager.Configuration import configureFileStager configureFileStager() IODataManager().UseGFAL = False # Disable muons in TisTosTool from Configurables import TriggerTisTos ToolSvc().addTool(TriggerTisTos, 'TriggerTisTos') ToolSvc().TriggerTisTos.TOSFracMuon = 0. # Disable TT hits also ToolSvc().TriggerTisTos.TOSFracTT = 0.
Escher().DataType = 'Upgrade' Escher().Upgrade = True RecSysConf().Detectors = detectors RecMoniConf().Detectors = detectors Escher().ExpertTracking = ["kalmanSmoother"] TrackSys().TrackExtraInfoAlgorithms = [] TrackSys().DataType = 'Upgrade' TrackSys().Simulation = True TrackSys().WithMC = True #TrackSys().TrackTypes = ["Velo"] TrackSys().TrackPatRecAlgorithms = [ "VP", "Forward", "TsaSeed", "Match", "Downstream" ] DstConf().Detectors = detectors hvpseq = GaudiSequencer("VPSeq") prLHCbID2mc = PrLHCbID2MCParticle() prPixTr = PrPixelTracking() prPixStCl = PrPixelStoreClusters() hvpseq.Members += [prPixStCl, prPixTr, prLHCbID2mc] AlignAlgorithm("Alignment").ForcedInitialTime = 1 elements = Alignables() elements.VPModules("TxTyTzRxRyRz") # elements.VPLeft("TxTy") # elements.VPRight("TxTyRz") # constraints = ["Rz","Ry","Rx","Szx","Szy","SRz"]
def _configureForOnline(self): # DecodeRawEvent().DataOnDemand=False writer=InputCopyStream( self.writerName ) DstConf().setProp("SplitRawEventOutput", self.getProp("RawFormatVersion")) # Use RawEventJuggler to create the Turbo stream raw event format tck = "0x409f0045" # DUMMY TurboBanksSeq=GaudiSequencer("TurboBanksSeq") RawEventJuggler().TCK=tck RawEventJuggler().Input="Moore" RawEventJuggler().Output=self.getProp("RawFormatVersion") RawEventJuggler().Sequencer=TurboBanksSeq RawEventJuggler().WriterOptItemList=writer RawEventJuggler().KillExtraNodes=True RawEventJuggler().KillExtraBanks=True RawEventJuggler().KillExtraDirectories = True self.teslaSeq.Members += [TurboBanksSeq] # Begin Lumi configuration lumiSeq = GaudiSequencer("LumiSeq") # # Add ODIN decoder to LumiSeq *** from DAQSys.Decoders import DecoderDB CreateODIN=DecoderDB["createODIN"].setup() #******************************** # # Main algorithm config lumiCounters = GaudiSequencer("LumiCounters") lumiCounters.Members+=[CreateODIN] lumiSeq.Members += [ lumiCounters ] LumiAlgsConf().LumiSequencer = lumiCounters LumiAlgsConf().OutputLevel = self.getProp('OutputLevel') LumiAlgsConf().InputType = "MDF" # # Filter out Lumi only triggers from further processing, but still write to output # Trigger masks changed in 2016, see LHCBPS-1486 physFilterRequireMask = [] lumiFilterRequireMask = [] if self.getProp( "DataType" ) in ["2012","2015"]: # 2012 needed for nightlies tests. physFilterRequireMask = [ 0x0, 0x4, 0x0 ] lumiFilterRequireMask = [ 0x0, 0x2, 0x0 ] else: physFilterRequireMask = [ 0x0, 0x0, 0x80000000 ] lumiFilterRequireMask = [ 0x0, 0x0, 0x40000000 ] from Configurables import HltRoutingBitsFilter physFilter = HltRoutingBitsFilter( "PhysFilter", RequireMask = physFilterRequireMask ) lumiFilter = HltRoutingBitsFilter( "LumiFilter", RequireMask = lumiFilterRequireMask ) lumiSeq.Members += [ lumiFilter, physFilter ] lumiSeq.ModeOR = True # from Configurables import RecordStream FSRWriter = RecordStream( "FSROutputStreamDstWriter") FSRWriter.OutputLevel = INFO # # Sequence to be executed if physics sequence not called (nano events) notPhysSeq = GaudiSequencer("NotPhysicsSeq") notPhysSeq.ModeOR = True notPhysSeq.Members = [ physFilter ] writer.AcceptAlgs += ["LumiSeq","NotPhysicsSeq"] self.teslaSeq.Members += [lumiSeq, notPhysSeq]
from Gaudi.Configuration import * from LHCbKernel.Configuration import * from Configurables import GaudiSequencer, RawEventJuggler from Configurables import DaVinci from Configurables import DecodeRawEvent from Configurables import DstConf DstConf().Turbo = True DaVinci() DaVinci().EvtMax = -1 DaVinci().DataType = "2015" from GaudiConf import IOHelper IOHelper().inputFiles(["tesla_2015_TCK.dst"], clear=True) import GaudiPython from Gaudi.Configuration import ApplicationMgr from Configurables import LoKiSvc from GaudiKernel import ROOT6WorkAroundEnabled if ROOT6WorkAroundEnabled('ROOT-7492'): # trigger autoloading of LHCbKernel dictionary GaudiPython.gbl.LHCb.LHCbID # trigger autoloading of DigiEvent dictionary GaudiPython.gbl.LHCb.CaloDigit gaudi = GaudiPython.AppMgr() gaudi.initialize() TES = gaudi.evtsvc()
def add_line_tuple_sequence(self, linesettings, toolList = ["TupleToolPropertime", "TupleToolKinematic", "TupleToolGeometry", "TupleToolEventInfo", "TupleToolPrimaries", "TupleToolPid", "TupleToolANNPID", "TupleToolTrackInfo", "TupleToolRecoStats",], mcToolList = ['TupleToolMCTruth', 'TupleToolMCBackgroundInfo', 'MCTupleToolPrompt'], L0List = [], HLT1List = [], HLT2List = [], strippingList = [], aliases = {}, labXAliases = False, substitutions = {}, suffix = '') : if not isinstance(linesettings, dict) : linesettings = self.get_line_settings(*linesettings) isTrigger = is_trigger(linesettings['version']) rootInTES = linesettings['rootInTES'] linename = linesettings['linename'] version = linesettings['version'] decayDescs = linesettings['decayDescs'] inputlocation = linesettings['inputLocation'] if self.getProp('Simulation') and not isTrigger : rootInTES = '/'.join(rootInTES.split('/')[:-1] + ['AllStreams']) if self.getProp('InputType').lower() != 'mdst' : inputlocation = os.path.join(rootInTES, inputlocation) rootInTES = '' self.RootInTES = rootInTES if isTrigger : from Configurables import DstConf dstconf = DstConf() dstconf.Turbo = True self.extraobjs.add(dstconf) lineseq = GaudiSequencer(linename + '-Sequence') if substitutions : subs = {} for i, desc in enumerate(decayDescs) : descsubs, newdesc = desc.get_substitutions(substitutions) subs.update(descsubs) decayDescs[i] = newdesc newinputlocation = inputlocation.split('/') newinputlocation[-2] += '-SubPID' newinputlocation = '/'.join(newinputlocation) subpid = SubstitutePID(linename + '-SubPID', Code = 'ALL', Substitutions = subs, Inputs = [inputlocation], Output = newinputlocation) lineseq.Members += [subpid] inputlocation = newinputlocation for desc in decayDescs : if labXAliases : desc.set_labX_aliases() elif aliases : desc.set_aliases(aliases) desctuple = DecayTreeTuple(desc.get_full_alias() + suffix + 'Tuple', ToolList = []) desctuple.configure_for_line(desc, inputlocation, linename, version, self.getProp('Simulation'), toolList, mcToolList, L0List, HLT1List, HLT2List, strippingList) lineseq.Members.append(desctuple) self.UserAlgorithms.append(lineseq) return linesettings, lineseq