def doMyAlignChanges(): #veloAlign=AlignSensors("AlignSensors") veloAlign = VAlign("VAlign") GaudiSequencer("AlignSequence").Members = [ veloAlign, #WriteAlignmentConditions("WriteDetectors"), WriteAlignmentConditions("WriteGlobal"), WriteAlignmentConditions("WriteModules"), TrackVertexMonitor("TrackVertexMonitor") ] importOptions("$VELOALIGNMENTOPTS/VeloAlign.py") veloAlign.OutputLevel = 3 PatPVOffline("PatPVOffline").OutputLevel = 3 VAlign("VAlign").Box_DOF = [1, 1, 1, 1, 1, 1] VAlign("VAlign").Box_EQs = [0, 0, 0, 0, 0, 0] TrackVertexMonitor( "TrackVertexMonitor").TrackContainer = "LHCb::TrackLocation::Velo" ###VAlign("VAlign").TrackContainer= "Rec/Track/Best" eventfitter = TrackEventFitter('FitVelo') eventfitter.Fitter.ZPositions = [] eventfitter.Fitter.ApplyMaterialCorrections = False eventfitter.Fitter.Extrapolator.ApplyMultScattCorr = False eventfitter.Fitter.Extrapolator.ApplyEnergyLossCorr = False eventfitter.Fitter.Extrapolator.ApplyElectronEnergyLossCorr = False eventfitter.Fitter.StateAtBeamLine = False eventfitter.Fitter.MaxNumberOutliers = 0 eventfitter.Fitter.NumberFitIterations = 10 eventfitter.Fitter.UpdateTransport = True
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() #ODINChecker.OutputLevel = generalOutputLevel #ODINChecker.ODINData = "DAQ/ODIN"; #GaudiSequencer('ODINPreChecker').Members = [ODINChecker] ttRes = STNZSResolution("ITResolution") ttRes.OutputLevel = 4 ttRes.DetType = "IT" ttRes.UseNZSdata = True ttRes.InputData = "/Event/Raw/IT/LCMSADCs"
from Configurables import PrPixelTracking, PrPixelStoreClusters, PrLHCbID2MCParticle from Configurables import TAlignment from TAlignment.Alignables import Alignables # * from TAlignment.TrackSelections import * from Configurables import AlignAlgorithm from Configurables import TrackContainerCopy, TrackSelector from Configurables import VPTrackSelector from TrackFitter.ConfiguredFitters import * from Gaudi.Configuration import appendPostConfigAction from TAlignment.SurveyConstraints import SurveyConstraints # * from GaudiConf import IOHelper from Configurables import CaloDigitConf, CaloProcessor, GlobalRecoConf print os.listdir(os.getcwd()) importOptions('$STDOPTS/PreloadUnits.opts') # Load the velo conditions CondDB().addLayer( dbFile="/pc2014-data3/cburr/hybrid-distortions/try_aligning/DDDB.db", dbName="DDDB") CondDB().addLayer( dbFile="/pc2014-data3/cburr/hybrid-distortions/try_aligning/SIMCOND.db", dbName="SIMCOND") alignment_conditions = CondDBAccessSvc("AlignmentConditions") alignment_conditions.ConnectionString = "sqlite_file:/pc2014-data3/cburr/hybrid-distortions/try_aligning/Alignment_SIMCOND.db/SIMCOND" CondDB().addLayer(alignment_conditions) LHCbApp().Simulation = True LHCbApp().DataType = 'Upgrade' CondDB().Upgrade = True
# Special options for 2011 25ns fill, without Hlt2 # Syntax is: # gaudirun.py COLLISION11_25.py # from Gaudi.Configuration import FileCatalog, EventSelector from Configurables import Brunel #-- File catalogs. First one is read-write FileCatalog().Catalogs = ["xmlcatalog_file:MyCatalog.xml"] #-- Use latest 2011 database tags for real data from GaudiKernel.ProcessJobOptions import importOptions importOptions("$APPCONFIGOPTS/Brunel/2011-25ns.py") # Events from run 103053, fill 2186 on 2011-10-07, 25ns bunch spacing from PRConfig import TestFileDB TestFileDB.test_file_db['2011_25ns_raw_default'].run(withDB=False)
# 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"]
from Configurables import ProcessPhase, GaudiSequencer, NTupleSvc, OutputStream from Configurables import GaudiSequencer from Configurables import PatPV3D, PVOfflineTool, LSAdaptPV3DFitter from Configurables import PatPVOffline, LSAdaptPVFitter, PVSeed3DOfflineTool, VertexCompare from Gaudi.Configuration import * from Configurables import LHCbApp from Configurables import Brunel from Configurables import RecSysConf, RecMoniConf from Configurables import L0Conf from Configurables import TrackAssociator from Brunel.Configuration import * import GaudiKernel.SystemOfUnits as Units from GaudiKernel.ProcessJobOptions import importOptions importOptions("$APPCONFIGOPTS/Brunel/MC-WithTruth.py") importOptions("$APPCONFIGOPTS/Brunel/Upgrade-RichPmt.py") importOptions("$APPCONFIGOPTS/Brunel/patchUpgrade1.py") importOptions("$APPCONFIGOPTS/Brunel/xdst.py") from Configurables import Brunel LHCbApp().DDDBtag = "dddb-20140606" LHCbApp().CondDBtag = "sim-20140204-vc-md100" Brunel().DataType = "2012" #Brunel().OnlineMode = True Brunel().WithMC = True Brunel().InputType = "DIGI" Brunel().WriteFSR = False NTupleSvc().Output += ["FILE1 DATAFILE='tuples.root' TYP='ROOT' OPT='NEW'"]
def ConfigureDoD(RValue=0.5): from Configurables import DataOnDemandSvc dod = DataOnDemandSvc() #dod.OutputLevel = VERBOSE #datasets #first MC from JetAccessoriesMC.StdHepMCParticles import StdHepMCParticlesConf ### create the partons import JetAccessoriesMC.PreConfiguredMCSelections StdHepMCPartons = StdHepMCParticlesConf( "StdHepMCPartons", JetAccessoriesMC.PreConfiguredMCSelections.PartonConfAll) ### create all hepMC particles from Z interaction StdHepMCParticlesAll = StdHepMCParticlesConf( "StdHepMCParticlesAll", JetAccessoriesMC.PreConfiguredMCSelections.HepMCAllConfZJets) ### create measurable hepMC particles from Z interaction StdHepMCParticles = StdHepMCParticlesConf( "StdHepMCParticles", JetAccessoriesMC.PreConfiguredMCSelections.HepMCConfVisibleZJets) for alg in [ StdHepMCPartons.Alg, StdHepMCParticlesAll.Alg, StdHepMCParticles.Alg ]: dod.AlgMap['Phys/' + alg.getName() + '/Particles'] = alg.getFullName() #filter input particles MC import JetAccessoriesMC.MCParticles MCPartFilter = JetAccessoriesMC.MCParticles.MCPartFilter #then reco #selected tracks import JetAccessories.RecoParticles SelectedRecoParticles = JetAccessories.RecoParticles.SelectedTracks #Particle Flow # import JetAccessories.ParticleFlow #fixme # SelectedPFParticles = JetAccessories.ParticleFlow.ParticleFlow #jets from JetAccessoriesMC.ConfigurationHelpers import jetMakerConfig ### create partonic jets StdPartonicJets = jetMakerConfig("StdPartonicJets", ["Phys/StdHepMCPartons/Particles"], RValue) ### create hepMC all jets StdHepMCAllJets = jetMakerConfig("StdHepMCAllJets", ["Phys/StdHepMCParticlesAll/Particles"], RValue) ### create hepMC jets StdHepMCJets = jetMakerConfig("StdHepMCJets", ["Phys/FilteredStableParticles/Particles"], RValue) ### create reco jets StdJets = jetMakerConfig( "StdJets", [ #"Phys/FilteredPions/Particles", "Phys/StdNoPIDsDownPions/Particles", "Phys/StdAllNoPIDsPions/Particles", "Phys/StdLoosePhotons/Particles" ], RValue) ### create ParticleFlow jets # StdPFJets = jetMakerConfig("StdPFJets", [ SelectedPFParticles.PFOutputLocation] ,RValue) for alg in [ StdPartonicJets, StdHepMCAllJets, StdHepMCJets, StdJets, #StdPFJets, MCPartFilter, SelectedRecoParticles #,SelectedPFParticles ]: dod.AlgMap['Phys/' + alg.getName() + '/Particles'] = alg.getFullName() #matching tables # more MC matching tables (for LoKi in HepMCJets2Jets) from GaudiKernel.ProcessJobOptions import importOptions importOptions("$LOKIGENMCROOT/python/LoKiGenMC/HepMC2MC_Configuration.py") importOptions( "$LOKIGENMCROOT/python/LoKiGenMC/MC2Collision_Configuration.py") # configure matchers matchers = {} from JetAccessoriesMC.ConfigurationHelpers import jetMatcherConfig for HepMCParticleJet in [ StdHepMCAllJets, StdHepMCJets # ,StdHepMCJetsAcc,StdHepMCAllJetsAcc todo MC jets with acceptance cuts! ]: name = HepMCParticleJet.getName() # parton jets Parton2HepMCParticleJet = jetMatcherConfig( 'Parton2' + name, 'LoKi__PartonicJets2HepMCJets', 'Phys/StdPartonicJets/Particles', 'Phys/' + name + '/Particles', 'Relations/Phys/StdPartonicJetsJets2' + name) Parton2HepMCParticleJet.LoKi__PartonicJets2HepMCJets.StdHepMC2HepMCTable = 'Relations/Phys/StdHepMC2HepMC' Parton2HepMCParticleJet.LoKi__PartonicJets2HepMCJets.PartonInJet = [] Parton2HepMCParticleJet.LoKi__PartonicJets2HepMCJets.HadronInJet = [] Parton2HepMCParticleJet.LoKi__PartonicJets2HepMCJets.AllPartons = True matchers[name + 'Partonic'] = Parton2HepMCParticleJet # reco jets for RecJet in [StdJets]: #,StdPFJets]: weird problem! name2 = RecJet.getName() print name, name2 # use 'MCtrue' energy to calulate overlap HepMC2RecMC = jetMatcherConfig( name + '2' + name2 + 'MC', 'LoKi__HepMCJets2Jets', 'Phys/' + name + '/Particles', 'Phys/' + name2 + '/Particles', 'Relations/Phys/' + name + '2' + name2 + 'MCtrue') if name == 'StdHepMCAllJets': HepMC2RecMC.LoKi__HepMCJets2Jets.StdHepMC2HepMCTable = 'Relations/Phys/StdHepMC2HepMCAllZ' if name == 'StdHepMCJets': HepMC2RecMC.LoKi__HepMCJets2Jets.StdHepMC2HepMCTable = 'Relations/Phys/StdHepMC2HepMCZ' HepMC2RecMC.LoKi__HepMCJets2Jets.MatchingMethod = 'MCtrue' matchers[name + '2' + name2 + "MCtrue"] = HepMC2RecMC #use 'measured' energy to calcluate overlap HepMC2RecM = jetMatcherConfig( name + '2RecM', 'LoKi__HepMCJets2Jets', 'Phys/' + name + '/Particles', 'Phys/' + name2 + '/Particles', 'Relations/Phys/' + name + '2' + name2 + 'Measured') if name == 'StdHepMCAllJets': HepMC2RecM.LoKi__HepMCJets2Jets.StdHepMC2HepMCTable = 'Relations/Phys/StdHepMC2HepMCAllZ' if name == 'StdHepMCJets': HepMC2RecM.LoKi__HepMCJets2Jets.StdHepMC2HepMCTable = 'Relations/Phys/StdHepMC2HepMCZ' HepMC2RecM.LoKi__HepMCJets2Jets.MatchingMethod = 'measured' matchers[name + '2' + name2 + "measured"] = HepMC2RecM #use DeltaR to calculate distance (note: meaning of the weight variable is opposite to the other two cases) HepMC2RecDR = jetMatcherConfig( name + '2RecDeltaR', 'LoKi__HepMCJets2JetsDeltaR', 'Phys/' + name + '/Particles', 'Phys/' + name2 + '/Particles', 'Relations/Phys/' + name + '2' + name2 + 'DeltaR') matchers[name + '2' + name2 + "DeltaR"] = HepMC2RecDR for MatchAlg in matchers.values(): dod.AlgMap[MatchAlg.OutputTable] = MatchAlg.getFullName() return matchers
############################################################################### # File for running Brunel with default options (2008 real data,.mdf in,.dst out) ############################################################################### # Syntax is: # gaudirun.py Brunel-Default.py <someDataFiles>.py ############################################################################### from Configurables import Brunel from Configurables import Brunel, CondDB, DigiConf,DstConf, SimConf,RecMoniConf,RecSysConf from Configurables import CondDBAccessSvc, UpdateManagerSvc from Gaudi.Configuration import * from GaudiKernel.ProcessJobOptions import importOptions from Configurables import ApplicationMgr, NTupleSvc, GaudiSequencer from Configurables import Velo__VeloTrackMonitorNT, VeloClusterPosition,TrackEventFitter, DecodeVeloRawBuffer, Velo__VeloIPResolutionMonitorNT, Velo__VeloIPResolutionMonitor, PVResolution,TrackVertexMonitor importOptions( '$STDOPTS/RootHist.opts' ) from Configurables import RootHistCnv__PersSvc RootHistCnv__PersSvc( 'RootHistCnv' ).ForceAlphaIds = True from Configurables import Brunel, CondDB, DigiConf, RecMoniConf,RecSysConf ############################################################################### # Set here any steering options. # Available steering options and defaults are documented in # $BRUNELROOT/python/Brunel/Configuration.py ############################################################################### # Just instantiate the configurable... app = Brunel() app.CondDBtag = "MC2011-20120727-vc-md100" app.DDDBtag = "MC2011-20120727" CondDB().LocalTags["SIMCOND"] = ["velo-20120515"] CondDB().LocalTags["DDDB"] = ["velo-20120821"]
############################################################################## # File for running Boole with Upgrade configuration, with full Digi output # # Syntax is: # gaudirun.py Boole-Upgrade-WithTruth.py <someDataFiles>.py ############################################################################## from GaudiKernel.ProcessJobOptions import importOptions importOptions("$APPCONFIGROOT/options/Boole/Upgrade-WithTruth.py") ############################################################################## # I/O datasets and database tags are defined in a separate file, ##############################################################################
def __init__(self, outputlevel = -1, joboptions = None, selfoptions = {}, dllname = None, factname = None) : global _gaudi if _gaudi : return # Protection against multiple calls to exit() if the finalization fails self.__dict__['_exit_called'] = False # keep the Gaudi namespace around (so it is still available during atexit shutdown)... self.__dict__['_gaudi_ns'] = Gaudi try: from GaudiKernel.Proxy.Configurable import expandvars except ImportError: # pass-through implementation if expandvars is not defined (AthenaCommon) expandvars = lambda data : data if dllname and factname: self.__dict__['_appmgr'] = gbl.Gaudi.createApplicationMgr(dllname,factname) elif dllname: self.__dict__['_appmgr'] = gbl.Gaudi.createApplicationMgr(dllname) else: self.__dict__['_appmgr'] = gbl.Gaudi.createApplicationMgr() self.__dict__['_svcloc'] = gbl.Gaudi.svcLocator() self.__dict__['_algmgr'] = InterfaceCast(gbl.IAlgManager)(self._appmgr) self.__dict__['_evtpro'] = InterfaceCast(gbl.IEventProcessor)(self._appmgr) self.__dict__['_svcmgr'] = InterfaceCast(gbl.ISvcManager)(self._appmgr) self.__dict__['pyalgorithms'] = [] iService.__init__(self, 'ApplicationMgr', self._appmgr ) #------python specific initialization------------------------------------- if self.FSMState() < Gaudi.StateMachine.CONFIGURED : # Not yet configured self.JobOptionsType = 'NONE' if joboptions : from GaudiKernel.ProcessJobOptions import importOptions importOptions(joboptions) # Ensure that the ConfigurableUser instances have been applied import GaudiKernel.Proxy.Configurable if hasattr(GaudiKernel.Proxy.Configurable, "applyConfigurableUsers"): GaudiKernel.Proxy.Configurable.applyConfigurableUsers() # This is the default and could be overridden with "selfopts" self.OutputLevel = 3 selfprops = Configurable.allConfigurables.get('ApplicationMgr',{}) if selfprops : selfprops = expandvars(selfprops.getValuedProperties()) for p,v in selfprops.items() : setattr(self, p, v) for p,v in selfoptions.items() : setattr(self, p, v) # Override job options if outputlevel != -1 : self.OutputLevel = outputlevel self.configure() #---MessageSvc------------------------------------------------------------ ms = self.service('MessageSvc') if 'MessageSvc' in Configurable.allConfigurables: msprops = Configurable.allConfigurables['MessageSvc'] ms = self.service('MessageSvc') if hasattr(msprops,"getValuedProperties"): msprops = expandvars(msprops.getValuedProperties()) for p,v in msprops.items(): setattr(ms, p, v) if outputlevel != -1 : ms.OutputLevel = outputlevel #---JobOptions------------------------------------------------------------ self.__dict__['_optsvc'] = InterfaceCast(gbl.IJobOptionsSvc)(Helper.service(self._svcloc,'JobOptionsSvc')) #------Configurables initialization (part2)------------------------------- for n in getNeededConfigurables(): c = Configurable.allConfigurables[n] if n in ['ApplicationMgr','MessageSvc'] : continue # These are already done--- for p, v in c.getValuedProperties().items() : v = expandvars(v) # Note: AthenaCommon.Configurable does not have Configurable.PropertyReference if hasattr(Configurable,"PropertyReference") and type(v) == Configurable.PropertyReference: # this is done in "getFullName", but the exception is ignored, # so we do it again to get it v = v.__resolve__() if type(v) == str : v = '"%s"' % v # need double quotes elif type(v) == long: v = '%d' % v # prevent pending 'L' self._optsvc.addPropertyToCatalogue(n, StringProperty(p,str(v))) if hasattr(Configurable,"_configurationLocked"): Configurable._configurationLocked = True # Ensure that the exit method is called when exiting from Python import atexit atexit.register(self.exit) #---Hack to avoid bad interactions with the ROOT exit handler # Look for an exit handler installed by ROOT root_handler_installed = False for h in atexit._exithandlers: func = h[0] if hasattr(func, "__module__") and func.__module__ == "ROOT": root_handler_installed = True break # If the handler is not yet installed, let's install our private version # that detects that the ROOT exit handler is installed and add our own # after it to ensure it is called before. if not root_handler_installed: orig_register = atexit.register def register(func, *targs, **kargs): orig_register(func, *targs, **kargs) if hasattr(func, "__module__") and func.__module__ == "ROOT": orig_register(self.exit) # we do not need to remove out handler from the list because # it can be safely called more than once register.__doc__ = (orig_register.__doc__ + "\nNote: version hacked by GaudiPython to work " + "around a problem with the ROOT exit handler") atexit.register = register
# Example 2009 Beam gas options for Brunel # Syntax is: # gaudirun.py 2009-BeamGas.py # from GaudiKernel.ProcessJobOptions import importOptions importOptions("$APPCONFIGOPTS/Brunel/moff.py") importOptions("$APPCONFIGOPTS/Brunel/veloOpen.py") importOptions("$APPCONFIGOPTS/Brunel/beamGas.py") from Gaudi.Configuration import FileCatalog, EventSelector from Configurables import Brunel #-- File catalogs. First one is read-write FileCatalog().Catalogs = ["xmlcatalog_file:MyCatalog.xml"] #-- Use latest 2009 database tags for real data Brunel().DataType = "2009" datasetName = "062509_0000000001" EventSelector().Input = [ "DATAFILE='PFN:root:/castor/cern.ch/grid/lhcb/data/2009/RAW/FULL/LHCb/BEAM1/62509/" + datasetName + ".raw' SVC='LHCb::MDFSelector'" ] # Default output files names are set up using value Brunel().DatasetName property Brunel().DatasetName = datasetName
from Gaudi.Configuration import * from Configurables import ( Escher, TrackSys ) from Configurables import (VAlign,WriteAlignmentConditions) from Configurables import Millepede from GaudiKernel.ProcessJobOptions import importOptions ######################### # # JobOptions file for Velo Alignment algorithm # ######################## # Option file for monitoring (control sample, constants,...) importOptions( '$VELOALIGNMENTOPTS/VeloAlignmentMonitor.py' ) # # Then we set the alignment job properties # # #\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ # The main alignment switchboard #\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\ # ########################## # # 1. Internal alignment with tracks # ##########################
# Example 2010 collisions options for Brunel # Syntax is: # gaudirun.py COLLISION10-Beam3500GeV-VeloClosed-MagOff.py # from GaudiKernel.ProcessJobOptions import importOptions importOptions("$APPCONFIGOPTS/Brunel/moff.py") from Gaudi.Configuration import FileCatalog, EventSelector from Configurables import Brunel #-- File catalogs. First one is read-write FileCatalog().Catalogs = ["xmlcatalog_file:MyCatalog.xml"] #-- Use latest 2010 database tags for real data Brunel().DataType = "2010" from PRConfig import TestFileDB TestFileDB.test_file_db['2010_MagOff_raw_default'].run(withDB=False)
# Example 2009 collisions options for Brunel # Syntax is: # gaudirun.py 2009-Collisions.py # from GaudiKernel.ProcessJobOptions import importOptions importOptions("$APPCONFIGOPTS/Brunel/veloOpen.py") from Gaudi.Configuration import FileCatalog, EventSelector from Configurables import Brunel #-- File catalogs. First one is read-write FileCatalog().Catalogs = ["xmlcatalog_file:MyCatalog.xml"] #-- Use latest 2009 database tags for real data Brunel().DataType = "2009" # First collisions with magnet off #importOptions("$APPCONFIGOPTS/Brunel/moff.py") #EventSelector().Input = [ # "DATAFILE='root:/castor/cern.ch/grid/lhcb/data/2009/RAW/FULL/LHCb/BEAM1/62558/062558_0000000001.raw' SVC='LHCb::MDFSelector'" # ] # Collisions on 6th December with magnet on and all detectors in readout EventSelector().Input = [ "DATAFILE='mdf:root://castorlhcb.cern.ch//castor/cern.ch/grid/lhcb/data/2009/RAW/FULL/LHCb/COLLISION09/63497/063497_0000000001.raw?svcClass=lhcbtape' SVC='LHCb::MDFSelector'" ]