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 __apply_configuration__(self): GaudiKernel.ProcessJobOptions.PrintOff() # database hacking for online if self.getProp('UseDBSnapshot') : self._configureDBSnapshot() self.defineGeometry() self.defineEvents() self.defineOptions() self.defineMonitors() self.setOtherProps(RecSysConf(),["Histograms","SpecialData","Context", "OutputType","DataType","Simulation","OnlineMode","SkipTracking"]) self.setOtherProps(RecMoniConf(),["Histograms","Context","DataType","Simulation","OnlineMode","SkipTracking"]) self.setOtherProps(TrackSys(),["DataType","Simulation"]) if self.isPropertySet("RecoSequence") : self.setOtherProp(RecSysConf(),"RecoSequence") GaudiKernel.ProcessJobOptions.PrintOn() log.info( self ) log.info( RecSysConf() ) log.info( TrackSys() ) log.info( RecMoniConf() ) GaudiKernel.ProcessJobOptions.PrintOff()
# Run list contains dst with at least one track in the OT in good OT runs ############################################################################## from Configurables import (Escher, TrackSys, RecSysConf) Escher().DataType = "2009" Escher().Kalman = True Escher().Millepede = False Escher( ).TrackContainer = "Rec/Track/Best" # Velo, VeloR, Long, Upstream, Downstream, Ttrack, Muon or Calo Escher().EvtMax = -1 TrackSys().ExpertTracking += ["simplifiedGeometry"] TrackSys().TrackExtraInfoAlgorithms = [''] TrackSys().TrackPatRecAlgorithms = ["Velo", "TsaSeed", "Match", "Downstream"] RecSysConf().RecoSequence = ["VELO", "TT", "IT", "OT", "Tr"] ############################################################### from GaudiKernel.SystemOfUnits import GeV, mm from Gaudi.Configuration import * uselocalframe = True chisqconstraints = [] # un numero in corrispondenza di ogni constraint constraints = [] dof = 'TxTy' outputlevel = ERROR #INFO#ERROR# INFO maskNoise = True # to mask Noisy Channels nameCond = 'ResidualsM1'
'ProcessPhase/Reco', GaudiSequencer('MoniITSeq'), GaudiSequencer('MoniSTSeq') ] TrackSys().ExcludedLayers = ["T3X2"] #TrackSys().TrackPatRecAlgorithms = TrackSys().DefaultPatRecAlgorithmsRun2 #VetraRecoConf().Sequence = [ "Decoding" ] + RecSysConf().DefaultTrackingSubdets # = ["Decoding", "VELO","TT","IT","OT","Tr","Vertex"] VetraRecoConf().Sequence = [ "Decoding", "VELO", "TT", "IT", "OT", "TrHLT1", "Vertex", "TrHLT2" ] VetraRecoConf().TrackPatRecAlgorithms = TrackSys().DefaultPatRecAlgorithmsRun2 print '----------------------------------------------------------------------------------------------------\n\n\n\n\n' print TrackSys().DefaultPatRecAlgorithms print RecSysConf().DefaultTrackingSubdets print '----------------------------------------------------------------------------------------------------\n\n\n\n\n' from Configurables import CondDB, CondDBAccessSvc, CondDBTimeSwitchSvc connection = "sqlite_file:$STSQLDDDBROOT/db/STCOND.db/COND" CondDB().addLayer(CondDBAccessSvc("COND", ConnectionString=connection)) CondDB().IgnoreHeartBeat = True CondDB().EnableRunStampCheck = False #importOptions('$HOME/cmtuser/Vetra_v15r0/ST/STVetraAnalysis/options/TTEmulator.py') #importOptions('$STVETRAANALYSISROOT/options/TTEmulator.py') importOptions('$STTELL1ALGORITHMSROOT/options/ITEmulator.py') from Configurables import STNZSResolution, STADCTrackMonitor #ODINChecker = STODINCheck()
CondDB().LoadCALIBDB = 'HLT1' Escher().InputType = "DIGI" Escher().Kalman = True Escher().Millepede = False # Escher().TrackContainer = "Rec/Track/Velo" # Velo, VeloR, Long, Upstream, Downstream, Ttrack, Muon or Calo Escher().EvtMax = -1 Escher().MoniSequence = [] Escher().RecoSequence = [ "Decoding", "VP", "VELOPIX", "Tr", "Vertex", "CALO", "PROTO" ] Escher().WithMC = True Escher().Simulation = True 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")
def configureInit(self, inputType): # Init sequence if not self.isPropertySet("InitSequence"): if self._isReprocessing(inputType): self.setProp( "InitSequence", self.DefaultReproInitSequence ) else: self.setProp( "InitSequence", self.DefaultInitSequence ) from Configurables import ProcessPhase ProcessPhase("Init").DetectorList += self.getProp("InitSequence") from Configurables import RecInit, MemoryTool recInit = RecInit( "BrunelInit", PrintFreq = self.getProp("PrintFreq")) GaudiSequencer("InitBrunelSeq").Members += [ recInit ] recInit.addTool( MemoryTool(), name = "BrunelMemory" ) recInit.BrunelMemory.HistoTopDir = "Brunel/" recInit.BrunelMemory.HistoDir = "MemoryTool" if not recInit.isPropertySet( "MemoryPurgeLimit" ): recInit.MemoryPurgeLimit = 2000 * 1000 # 2GB # count events from Configurables import EventCountHisto evtC = EventCountHisto("BrunelEventCount") evtC.HistoTopDir = "Brunel/" GaudiSequencer("InitBrunelSeq").Members += [ evtC ] # kill some RAW banks banksToKill = [] if self.isPropertySet( "RawBanksToKill" ): banksToKill = self.getProp( "RawBanksToKill" ) if ("2009" == self.getProp("DataType")) and (inputType in ["MDF"]) and not self.getProp("Simulation") : banksToKill += ["VeloFull", "L0PUFull"] if len(banksToKill) > 0 : from Configurables import bankKiller bkKill = bankKiller("BrunelBankKiller") bkKill.BankTypes = banksToKill GaudiSequencer("InitBrunelSeq").Members += [ bkKill ] # Do not print event number at every event (done already by BrunelInit) EventSelector().PrintFreq = -1 # OutputLevel self.setOtherProp(LHCbApp(),"OutputLevel") if self.isPropertySet( "OutputLevel" ) : level = self.getProp("OutputLevel") if level == ERROR or level == WARNING : # Suppress known warnings importOptions( "$BRUNELOPTS/SuppressWarnings.opts" ) if not recInit.isPropertySet( "OutputLevel" ): recInit.OutputLevel = INFO self.setOtherProps(RecSysConf(), ["OutputLevel","Detectors"]) self.setOtherProps(RecMoniConf(),["OutputLevel","Detectors"]) # New NoSPDPRS switches noSPDPRS = False if [det for det in ['Spd', 'Prs'] if det not in self.getProp("Detectors")]: noSPDPRS = True # only set properties if no use RecoSequence is defined or if it contains 'PROTO' # not that 'PROTO' alone is not sufficient to run the Calo reconstruction, but a requirement if ( not self.isPropertySet("RecoSequence") or "PROTO" in self.getProp("RecoSequence") ): CaloProcessor().setProp("NoSpdPrs", noSPDPRS) GlobalRecoConf().setProp("NoSpdPrs", noSPDPRS) # Always print Magnetic Field used from Configurables import MagneticFieldSvc magSvc = MagneticFieldSvc() if not magSvc.isPropertySet("OutputLevel") : magSvc.setProp("OutputLevel", INFO) # Switch off LoKi banner from Configurables import LoKiSvc LoKiSvc().Welcome = False
#================================================================ # Rerun PID Reco + Remake ProtoParticles #================================================================ from Configurables import (DaVinci, RecSysConf, GaudiSequencer, ProcessPhase, PhysConf) from STTools import STOfflineConf STOfflineConf.DefaultConf().configureTools() # Create the top level Conf object and set some general options from DV rConf = RecSysConf("RecSysConf") DaVinci().setOtherProps(rConf, ["Simulation", "DataType"]) # Only run PID + Protoparticles rConf.RecoSequence = ["CALO", "PROTO"] rConf.SkipTracking = True PhysConf().CaloReProcessing = True # list of algs to prepend to DV palgs = [] # Create the Reco process phase reco = ProcessPhase("Reco") palgs += [reco] # Re-pack the new CALO output from Configurables import CaloDstPackConf caloPackSeq = GaudiSequencer("CaloPacking") caloPack = CaloDstPackConf(Enable=True) caloPack.Sequence = caloPackSeq caloPack.AlwaysCreate = True
from Configurables import (Escher, TrackSys, RecSysConf) from Gaudi.Configuration import * from GaudiConf.Configuration import * from GaudiKernel.ProcessJobOptions import importOptions importOptions('$STDOPTS/PreloadUnits.opts') Escher().Kalman = True Escher().Millepede = False Escher().EvtMax = 1000 Escher().UseOracle = False Escher().DatasetName = "Collisions2011" Escher().PrintFreq = 100 TrackSys().ExpertTracking += ["simplifiedGeometry"] TrackSys().TrackExtraInfoAlgorithms = [''] RecSysConf().RecoSequence = [ "Decoding", "VELO", "TT", "IT", "OT", "Tr", "Vertex", "CALO", "MUON" ] Escher().MoniSequence = ["Tr", "OT", "ST"] from Configurables import MagneticFieldSvc MagneticFieldSvc().OutputLevel = 1 from Configurables import TAlignment from TAlignment.Alignables import * from TAlignment.SurveyConstraints import * elements = Alignables() elements.Velo("None") #elements.VeloRight("TxTyTzRxRy")
#importOptions('$STDOPTS/PreloadUnits.opts') #Escher().DataType = "2008" #Escher().DDDBtag = "default" #Escher().CondDBtag = "default" #Escher().Detectors = ["Velo"] Escher().Kalman = True Escher().InputType = "DST" Escher().Millepede = False Escher( ).TrackContainer = "Rec/Track/Best" # Velo, VeloR, Long, Upstream, Downstream, Ttrack, Muon or Calo Escher().EvtMax = 10000 #TrackSys().ExpertTracking += [ "kalmanSmoother" ] #TrackSys().TrackExtraInfoAlgorithms = [''] #RecSysConf().RecoSequence = ["VELO","TT","IT","OT","Tr","Vertex"] RecSysConf().RecoSequence = ["VELO", "Tr", "Vertex"] TrackSys().TrackPatRecAlgorithms = ["Velo"] from Configurables import (ProcessPhase, AlignSensors, VAlign, WriteAlignmentConditions, TrackVertexMonitor, PatPVOffline) from TrackFitter.ConfiguredFitters import * from TrackFitter.ConfiguredFitters import (ConfiguredStraightLineFit) def doMyAlignChanges(): #veloAlign=AlignSensors("AlignSensors") veloAlign = VAlign("VAlign") GaudiSequencer("AlignSequence").Members = [ veloAlign, #WriteAlignmentConditions("WriteDetectors"),
).TrackContainer = "Rec/Track/Best" # Velo, VeloR, Long, Upstream, Downstream, Ttrack, Muon or Calo Escher().EvtMax = 100 Escher().UseOracle = False Escher().SpecialData = ["fieldOff"] #TrackSys().ExpertTracking += [ "noMaterialCorrections"] TrackSys().ExpertTracking += ["simplifiedGeometry"] #TrackSys().ExpertTracking += ["noDrifttimes" ] TrackSys().TrackExtraInfoAlgorithms = [''] #TrackSys().TrackPatRecAlgorithms = ["Velo","Forward","PatSeed","PatMatch","Downstream","VeloTT"] TrackSys().TrackPatRecAlgorithms = ["Velo", "Forward", "PatSeed", "PatMatch"] TrackSys().TrackPatRecAlgorithms = ["Velo", "PatSeed", "PatMatch"] #TrackSys().TrackPatRecAlgorithms = ["Velo","TsaSeed","PatMatch"] TrackSys().TrackPatRecAlgorithms = ["Velo", "TsaSeed", "Match"] #RecSysConf().RecoSequence = ["VELO","TT","IT","OT","Tr","Vertex"] #RecSysConf().RecoSequence = ["VELO","TT","IT","OT","Tr"] RecSysConf().RecoSequence = ["CALO", "VELO", "TT", "IT", "OT", "Tr", "Vertex"] Escher().MoniSequence = ["VELO", "Tr", "OT", "ST"] from Configurables import TAlignment from TAlignment.Alignables import * from TAlignment.SurveyConstraints import SurveyConstraints elements = Alignables() constraints = [] surveyconstraints = SurveyConstraints() elements.Velo("Rx") #elements.Velo("None") elements.VeloRight("Ry") #elements.VeloLeft("RxRy") elements.TT("TxTyTz")
############################################################################## # $Id: DVMonitorWithBrunel.py,v 1.3 2010-05-21 05:35:16 rlambert Exp $ # # syntax: gaudirun.py $DAVINCIMONITORSROOT/options/DVMonitorDst.py # # Author: Patrick Koppenburg <*****@*****.**> # ############################################################################## from DaVinci.Configuration import * from Gaudi.Configuration import * ############################################################################## # # Reconstruction # from RecConf.Configuration import * RecSysConf() ############################################################################## # # the stuff # importOptions( "$DAVINCIMONITORSROOT/options/DaVinciMonitoring.py") ############################################################################## # # Histograms # DaVinci().HistogramFile = "DVMonitors.root" ############################################################################## # # Most of this will be configured from Dirac # ##############################################################################
def ConfiguredTrackMonitorSequence(Name="TrackMonitorSequence", HistoPrint=False): # figure out detectors seq = GaudiSequencer(Name) subDets = None #default, all monitors from Configurables import LHCbApp if hasattr(LHCbApp(), "Detectors"): if LHCbApp().isPropertySet("Detectors"): subDets = LHCbApp().getProp("Detectors") seq.Members.append(TrackMonitor(HistoPrint=HistoPrint)) seq.Members.append(TrackDiMuonMonitor(HistoPrint=HistoPrint)) seq.Members.append(TrackVertexMonitor(HistoPrint=HistoPrint)) seq.Members.append(AlignmentOnlineMonitor(HistoPrint=HistoPrint)) from Configurables import TrackSys if TrackSys().timing(): seq.Members.append(TrackTimingMonitor(HistoPrint=HistoPrint)) if not RecMoniConf().getProp("Histograms") is "Online": seq.Members.append(TrackV0Monitor(HistoPrint=HistoPrint)) seq.Members.append(TrackFitMatchMonitor(HistoPrint=HistoPrint)) seq.Members.append(TrackAlignMonitor(HistoPrint=HistoPrint)) if (subDets is None or "IT" in subDets): seq.Members.append(TrackITOverlapMonitor(HistoPrint=HistoPrint)) if (subDets is None or "Velo" in subDets): seq.Members.append(TrackVeloOverlapMonitor(HistoPrint=HistoPrint)) if (subDets is None or "TT" in subDets): seq.Members.append(TTTrackMonitor(HistoPrint=HistoPrint)) if (subDets is None or "IT" in subDets): seq.Members.append(ITTrackMonitor(HistoPrint=HistoPrint)) seq.Members.append(TrackPV2HalfAlignMonitor(HistoPrint=HistoPrint)) if RecMoniConf().expertHistos(): if [ det for det in ['Velo', 'TT', 'IT', 'OT'] if (subDets is None or det in subDets) ]: seq.Members.append(HitEffPlotter(HistoPrint=HistoPrint)) #else: # log.warning("HitEffPlotter not defined for upgrade") if "CALO" in RecSysConf().RecoSequence: if (subDets is None or "Ecal" in subDets): seq.Members.append( TrackCaloMatchMonitor("TrackEcalMatchMonitor", CaloSystem='Ecal', HistoPrint=HistoPrint)) #if ("Hcal" in subDets): #seq.Members.append(TrackCaloMatchMonitor("TrackHcalMatchMonitor", CaloSystem='Hcal', HistoPrint=HistoPrint)) if (subDets is None or "Spd" in subDets): seq.Members.append( TrackCaloMatchMonitor("TrackSpdMatchMonitor", CaloSystem='Spd', HistoPrint=HistoPrint)) if (subDets is None or "Prs" in subDets): seq.Members.append( TrackCaloMatchMonitor("TrackPrsMatchMonitor", CaloSystem='Prs', HistoPrint=HistoPrint)) if "MUON" in RecSysConf().RecoSequence: if (subDets is None or "Muon" in subDets): seq.Members.append( TrackMuonMatchMonitor("TrackMuonMatchMonitor", HistoPrint=HistoPrint)) return seq
class Escher(LHCbConfigurableUser): ##list of ConfigurableUser classes this one is going to query in the apply_configuration method __queried_configurables__ = [] ##list of ConfigurableUser classes this one is going to modify in the apply_configuration method. __used_configurables__ = [ TrackSys, RecSysConf, RecMoniConf, LHCbApp, DstConf, TAlignment, DecodeRawEvent, CondDB ] ## Default main sequences for real and simulated data DefaultSequence = [ #CountingPrescaler("EscherPrescaler") #, "ProcessPhase/Init", GaudiSequencer("HltFilterSeq"), "ProcessPhase/Reco", "ProcessPhase/Moni", GaudiSequencer("AlignSequence") ] KnownSpecialData = [] DefaultRecoSequences = { 'Run1': ["Decoding"] + RecSysConf().DefaultTrackingSubdets, 'Run2': ["Decoding"] + RecSysConf().DefaultTrackingSubdetsRun2 } # Steering options __slots__ = { "EvtMax": -1 # Maximum number of events to process , "SkipEvents": 0 # events to skip , "PrintFreq": 100 # The frequency at which to print event numbers , "DataType": "2011" # Data type, can be ['DC06','2008'] , "WithMC": False # set to True to use MC truth , "Simulation": False # set to True to use SimCond , "InputType": "DST" # or "DIGI" or "ETC" or "RDST" or "DST" , "OutputType": "NONE" # or "RDST" or "NONE". Also forwarded to RecSys , "GlobalCuts": {} # global event cuts for tracking , "Persistency": None # POOL or ROOT foraward to LHCbApp , "PackType": "TES" # Flag whether or not to use packed containers , "NoWarnings": False # suppress all messages with MSG::WARNING or below , "DatasetName": "" # string used to build file names , "DDDBtag": "" # Tag for DDDB. Default as set in DDDBConf for DataType , "CondDBtag": "" # Tag for CondDB. Default as set in DDDBConf for DataType , "UseOracle": False # if False, use SQLDDDB instead , "MainSequence": [] # The default main sequence, see self.DefaultSequence , "InitSequence": ["Escher"] # default init sequence , "AlignSequence": [], "Kalman": True # run the kalman filter type alignment , "Millepede": False # run the Millepede type alignment , "OutputLevel": 3 # , "Incident": "" # for Millepede style alignment, there are two incident handles: GlobalMPedeFit and Converged # for Kalman style alignment, there is a handle: UpdateConstants. # Following are options forwarded to RecSys # , "RecoSequence" : ["Decoding","VELO","Tr","Vertex"] # The Sub-detector reconstruction sequencing. See RecSys for default , "RecoSequence": [ ] # The Sub-detector reconstruction sequencing. See RecSys for default , "MoniSequence": ["VELO", "Tr", "OT", "ST"], "SpecialData": [ ] # Various special data processing options. See KnownSpecialData for all options , "Context": "Offline" # The context within which to run , "WriteFSR": True #write FSRs to DSTs , "UseFileStager": False, "ExpertTracking": ["simplifiedGeometry"], "HltFilterCode": None # Loki filter on Hlt decision , "OnlineMode": False, "UseDBSnapshot": False, "PartitionName": "LHCb", "DBSnapshotDirectory": "/group/online/hlt/conditions", "OnlineAligWorkDir": "/group/online/AligWork/running", "Upgrade": False } 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) # Delegate handling to LHCbApp configurable self.setOtherProps(LHCbApp(), ["DataType", "CondDBtag", "DDDBtag", "Simulation"]) # specify the use of the oracle database if self.getProp("UseOracle"): from Configurables import CondDB CondDB(UseOracle=True) def defineEvents(self): # Delegate handling to LHCbApp configurable self.setOtherProps(LHCbApp(), ["EvtMax", "SkipEvents"]) def defineOptions(self): log.info("Defining options!") inputType = self.getProp("InputType").upper() if inputType not in ["MDF", "DST", "DIGI", "ETC", "RDST"]: raise TypeError("Invalid inputType '%s'" % inputType) outputType = self.getProp("OutputType").upper() if outputType not in ["NONE", "DST", "RDST"]: raise TypeError("Invalid outputType '%s'" % outputType) self.configureSequences() self.configurePersistency() self.configureInput(inputType) self.configureOutput(outputType) # ROOT persistency for histograms importOptions('$STDOPTS/RootHist.opts') from Configurables import RootHistCnv__PersSvc RootHistCnv__PersSvc('RootHistCnv').ForceAlphaIds = True # Use a default histogram file name if not already set if not hasattr(HistogramPersistencySvc(), "OutputFile"): histosName = self.getProp("DatasetName") if (self.evtMax() > 0): histosName += '-' + str(self.evtMax()) + 'ev' histosName += '-histos.root' HistogramPersistencySvc().OutputFile = histosName 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 configurePersistency(self): if hasattr(self, "Persistency"): if self.getProp("Persistency") is not None: LHCbApp().setProp("Persistency", self.getProp("Persistency")) def configureInput(self, inputType): """ Tune initialisation according to input type """ # POOL Persistency, now in LHCbApp #importOptions("$GAUDIPOOLDBROOT/options/GaudiPoolDbRoot.opts") # By default, Escher only needs to open one input file at a time # Only set to zero if not previously set to something else. if not IODataManager().isPropertySet("AgeLimit"): IODataManager().AgeLimit = 0 if inputType in ["XDST", "DST", "RDST", "ETC"]: # Kill knowledge of any previous Brunel processing from Configurables import (TESCheck, EventNodeKiller) InitReprocSeq = GaudiSequencer("InitReprocSeq") if (self.getProp("WithMC") and inputType in ["XDST", "DST"]): # Load linkers, to kill them (avoid appending to them later) InitReprocSeq.Members.append("TESCheck") TESCheck().Inputs = ["Link/Rec/Track/Best"] InitReprocSeq.Members.append("EventNodeKiller") EventNodeKiller().Nodes = ["pRec", "Rec", "Raw", "Link/Rec"] if inputType == "ETC": raise DeprecationWarning, "ETC are no longer supported by LHCb software" from Configurables import TagCollectionSvc ApplicationMgr().ExtSvc += [TagCollectionSvc("EvtTupleSvc")] # Read ETC selection results into TES for writing to DST IODataManager().AgeLimit += 1 #if inputType in [ "MDF", "RDST", "ETC" ]: # # In case raw data resides in MDF file # EventPersistencySvc().CnvServices.append("LHCb::RawDataCnvSvc") DecodeRawEvent() if self.getProp("UseFileStager"): import os, getpass from FileStager.Configuration import configureFileStager from Configurables import FileStagerSvc configureFileStager(keep=True) targetdir = '/tmp/' + getpass.getuser() + '/stagedfiles' if os.path.isdir('/pool/spool/'): targetdir = '/pool/spool/' + getpass.getuser() + '/stagedfiles' if not os.path.isdir(targetdir): os.makedirs(targetdir) FileStagerSvc().Tempdir = targetdir 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 outputName(self): """ Build a name for the output file, based in input options """ outputName = self.getProp("DatasetName") if (self.evtMax() > 0): outputName += '-' + str(self.evtMax()) + 'ev' outputType = self.getProp("OutputType").lower() return outputName + '.' + outputType def evtMax(self): return LHCbApp().evtMax() def configureDBSnapshot(self): """ Configure the database to use the online snapshot """ tag = { "DDDB": self.getProp('DDDBtag'), "LHCBCOND": self.getProp('CondDBtag'), "SIMCOND": self.getProp('CondDBtag'), "ONLINE": 'fake' } # https://savannah.cern.ch/bugs/?94454#comment12 from Configurables import MagneticFieldSvc MagneticFieldSvc().UseSetCurrent = True from Configurables import CondDB cdb = CondDB() cdb.Tags = tag cdb.setProp('IgnoreHeartBeat', True) self.setOtherProps( cdb, ['UseDBSnapshot', 'DBSnapshotDirectory', 'PartitionName']) # So, here is the problem: we don't want to run the risk that # the CondDB() configurable (which configures /after/ us) # overwrites our conditions. Yet, we don't want to miss the # default conditions (e.g. velo stepper motor, magnetic field) # either. if we add our conditions to its # RunChangeHandlerConditions list, then we a) need to fix the # path and b) don't know what happens for conditions that # appear twice, because we don't control the ordering of the # list. So, the hack is: # - don't set 'EnableRunChangeHandler' # - copy what is hidden behind that flag in CondDB()._configureDBSnapshot # - do the test of the RunChangeHandler configuration ourselves: cdb.setProp('EnableRunChangeHandler', False) from Configurables import RunChangeHandlerSvc rch = RunChangeHandlerSvc() ApplicationMgr().ExtSvc.append(rch) baseloc = self.getProp("DBSnapshotDirectory") rch.Conditions = dict( (c, '/'.join([baseloc, f])) for f, cs in cdb.getProp("RunChangeHandlerConditions").iteritems() for c in cs) #path = self.getProp('DBSnapshotDirectory') + "/.."*4 + "/group/online/AligWork/current/" allconds = { 'Velo': [ 'Conditions/Alignment/Velo/VeloSystem', 'Conditions/Alignment/Velo/VeloRight', 'Conditions/Alignment/Velo/VeloLeft' ] + ['Conditions/Alignment/Velo/Module%02d' % i for i in range(0, 42)] + [ 'Conditions/Alignment/Velo/Detector%02d-%02d' % (i, (1 + i / 2) % 2) for i in range(0, 42) ], 'IT': [] + ['Conditions/Alignment/IT/ITSystem'] + ['Conditions/Alignment/IT/ITT%d' % i for i in range(1, 4)] + [ 'Conditions/Alignment/IT/ITT%d%sBox' % (i, b) for i in range(1, 4) for b in ['Top', 'Bottom', 'ASide', 'CSide'] ] + [ 'Conditions/Alignment/IT/ITT%d%sLayer%s' % (i, b, l) for i in range(1, 4) for b in ['Top', 'Bottom', 'ASide', 'CSide'] for l in ['X1', 'U', 'V', 'X2'] ] + [ 'Conditions/Alignment/IT/ITT%d%sLayer%sLadder%d' % (i, b, l, a) for i in range(1, 4) for b in ['Top', 'Bottom', 'ASide', 'CSide'] for l in ['X1', 'U', 'V', 'X2'] for a in range(1, 8) ], # + [ 'Conditions/Alignment/IT/ITT%d%sLayer%sLadder%dSector' % (i,b,l,a) for i in range(1,4) for b in ['Top','Bottom','ASide','CSide' ] for l in ['X1','U','V','X2' ] for a in range(1,8) ] # + [ 'Conditions/Alignment/IT/ITT%d%sLayer%sLadder%dSector_Sensor1' % (i,b,l,a) for i in range(1,4) for b in ['Top','Bottom','ASide','CSide' ] for l in ['X1','U','V','X2' ] for a in range(1,8) ] # + [ 'Conditions/Alignment/IT/ITT%d%sLayer%sLadder%dSector_Sensor2' % (i,b,l,a) for i in range(1,4) for b in ['ASide','CSide' ] for l in ['X1','U','V','X2' ] for a in range(1,8) ] , 'OT': [] + ['Conditions/Alignment/OT/OTSystem'] + ['Conditions/Alignment/OT/T%d' % i for i in range(1, 4)] + [ 'Conditions/Alignment/OT/T%d%s' % (i, l) for i in range(1, 4) for l in ['X1', 'U', 'V', 'X2'] ] + [ 'Conditions/Alignment/OT/T%d%sQ%d' % (i, l, q) for i in range(1, 4) for l in ['X1', 'U', 'V', 'X2'] for q in range(0, 4) ] + [ 'Conditions/Alignment/OT/T%d%sQ%dM%d' % (i, l, q, m) for i in range(1, 4) for l in ['X1', 'U', 'V', 'X2'] for q in range(0, 4) for m in range(1, 10) ], 'TT': [] + ['Conditions/Alignment/TT/TTSystem'] + ['Conditions/Alignment/TT/TT%s' % i for i in ['a', 'b']] + [ 'Conditions/Alignment/TT/TT%sLayer' % (l) for l in ['aX', 'aU', 'bV', 'bX'] ] + [ 'Conditions/Alignment/TT/TT%sLayerR%dModule%d%s' % (l, r, m, w) for w in ['T', 'B'] for l in ['aX', 'aU', 'bV', 'bX'] for r in range(1, 4) for m in range(1, 4) ] + [ 'Conditions/Alignment/TT/TT%sLayerR%dModule%d%s' % (l, r, m, w) for w in ['T', 'B'] for l in ['bV', 'bX'] for r in range(1, 4) for m in range(4, 6) ] + [ 'Conditions/Alignment/TT/TT%sLayerR%dModule%d%s' % (l, r, m, w) for w in ['T', 'B'] for l in ['aX', 'aU', 'bV', 'bX'] for r in [1, 3] for m in range(6, 7) ] + [ 'Conditions/Alignment/TT/TT%sLayerR%dModule%d%s' % (l, r, m, w) for w in ['T', 'B'] for l in ['aX', 'aU'] for r in [1, 3] for m in range(4, 6) ], 'Muon': [] + ['Conditions/Alignment/Muon/MuonSystem'] + ['Conditions/Alignment/Muon/M%sStation' % i for i in range(1, 6)] + ['Conditions/Alignment/Muon/M%sASide' % i for i in range(1, 6)] + ['Conditions/Alignment/Muon/M%sCSide' % i for i in range(1, 6)] } ## This is a bit dirty, since we're supposed to control TAlignment. We ## know that this is set from top level, so let's give it a try anyway ta = TAlignment() sdToWrite = set(ta.getProp("WriteCondSubDetList")) pat = self.getProp("OnlineAligWorkDir") + "/xml/%s.xml" conditionmap = dict((pat % sd, f) for (sd, f) in allconds.iteritems() if sd in sdToWrite) # add to the existing map rch.Conditions = dict(rch.Conditions.items() + dict( (c, f) for f, cs in conditionmap.iteritems() for c in cs).items()) from Configurables import MagneticFieldSvc MagneticFieldSvc().UseSetCurrent = True ## Check the reconstruction sequence def CheckRecoSequence(self): RecoSeq = self.getProp("RecoSequence") RunType = 'Run2' if self.getProp("DataType") in ['2015'] else 'Run1' # Set default sequence if not specified if RecoSeq == []: RecoSeq = self.DefaultRecoSequences[RunType] return RecoSeq # Inform that the specified sequence contains algorithm which are not in the default one if not set(RecoSeq).issubset(set(self.DefaultRecoSequences[RunType])): print 'Escher.RecoSequence contains algorithms which are not in '+RunType+' sequence:', \ self.DefaultRecoSequences[RunType] return RecoSeq ## Apply the configuration 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()