def configure(self): "This method will be called when object is initialized" mlog = logging.getLogger( 'CaloRingerMetaDataBuilder::configure:%s:' \ % self.__class__.__name__.replace( ".", '_' ) ) mlog.info('entering') # Instantiate the MetaDataWriter: try: MetaDataWriter = AlgFactory( CaloRingerAlgsConf.Ringer__xAODRingSetConfWriter, name="xAODRingSetConfWriter", postInit=[ self._setCaloRingsBuilderTools, self._setCaloRingerConfOutputs ]) self._confWriter = MetaDataWriter() # Check for existing output: self.checkExistingOutput() if not self.ignoreExistingDataObject() and self._overwriting: raise RuntimeError(( "Already existing input will be overwriten and not set flag to" "ignoreExistingDataObject.")) except Exception: removeFromTopSequence(self._confWriter) mlog.error(("Could not get handle to xAODRingSetConfWriter." " Reason:\n %s"), traceback.format_exc()) treatException(("Couldn't set xAODRingSetConfWriter." " Reason:\n%s") % traceback.format_exc()) return False return True
def setupFwdSeededEgamma(): try: from egammaRec.egammaForwardGetter import egammaForwardGetter egammaForwardGetter(ignoreExistingDataObject=True) except Exception: treatException("Could not set up egammaForwardGetter. Switch it off !") jobproperties.egammaRecFlags.doEgammaForwardSeeded = False egammaForwardGetter(disable=True)
def setupTopoSeededEgamma(): try: from egammaRec.topoEgammaGetter import topoEgammaGetter topoEgammaGetter(ignoreExistingDataObject=True) except Exception: treatException("Could not set up topoEgammaGetter. Switch it off !") # If we wanted Topo based cluster seeded egamma it just failed jobproperties.egammaRecFlags.doEgammaCaloSeeded = False topoEgammaGetter(disable=True)
def setupVertices(): # Conversion vertex builder can not run in the default mode without GSF try: from egammaAlgs.EMVertexBuilder import EMVertexBuilder EMVertexBuilder(doPrint=False) except Exception: treatException("Could not set up the conversion vertex building." "Switch vertex building off !") jobproperties.egammaRecFlags.doVertexBuilding = False
def setupTruthAssociation(): try: from egammaRec.egammaTruthAssociationAlg import ( egammaTruthAssociationGetter) egammaTruthAssociationGetter(ignoreExistingDataObject=True) except Exception: treatException( "Could not set up egammaTruthAssociationAlg. Switched off !") jobproperties.egammaRecFlags.doEgammaTruthAssociation = False egammaTruthAssociationGetter(disable=True)
def configure(self): "This routine will be called when object is initialized" conflog = logging.getLogger( 'CaloRingerSelectorsBuilders::configure:%s:' \ % self.__class__.__name__.replace( ".", '_' ) ) conflog.info('entering') try: menu = caloRingerFlags.electronMenuToUse() from RingerSelectorTools.ConfiguredAsgElectronRingerSelector \ import ConfiguredAsgElectronRingerSelector from AthenaCommon.AppMgr import ToolSvc #try: self._looseSelector = ConfiguredAsgElectronRingerSelector(Ringer.Loose, menu) # Adding it into ToolSvc makes it a PublicTool: ToolSvc += self._looseSelector self._allSelectors.append(self._looseSelector) #except Exception: # conflog.error(("Could not set up Ringer Loose electron " # "selector. Reason:\n%s"),traceback.format_exc()) #try: self._mediumSelector = ConfiguredAsgElectronRingerSelector(Ringer.Medium, menu) ToolSvc += self._mediumSelector self._allSelectors.append(self._mediumSelector) #except Exception: # traceback.print_exc() # conflog.error(("Could not set up Ringer Medium electron " # "selector. Reason:\n%s"),traceback.format_exc()) #try: self._tightSelector = ConfiguredAsgElectronRingerSelector(Ringer.Tight, menu) ToolSvc += self._tightSelector self._allSelectors.append(self._tightSelector) #except Exception: # traceback.print_exc() # conflog.error(("Could not set up Ringer Tight electron " # "selector. Reason:\n%s"),traceback.format_exc()) mlog.info (self._allSelectors) except Exception: for selector in self._allSelectors: removeFromToolSvc(selector) caloRingerFlags.doElectronIdentification = False treatException(("An unexpected error occurred. Due to it, all " "Ringer electron selectors won't be executed.")) traceback.print_exc() return False return True
def __call__(self, name = '', **kw ): """Call preInit functions, instantiate tool (alg), call postInit functions and add to ToolSvc (TopSequence)""" params = dict(self.defaults, **kw) params['name'] = name or params.get('name', self.iclass.__name__) del name, kw # to avoid silly mistakes # Get special parameters (or default values) and remove them from dictionary preInit = params.pop('preInit', []) postInit = params.pop('postInit', []) doAdd = params.pop('doAdd', True) doPrint = params.pop('doPrint', False) # Call preInit functions for fcn in preInit: try: fcn() except: treatException('calling preInit function %s on %s instantiation\n' % (fcn.__name__, params['name'])) raise # Call FcnWrapper or ToolFactory parameters # (or if they are inside a list, for ToolHandleArray) classes = (FcnWrapper, ToolFactory) for paramName, value in params.items(): if isinstance(value, classes) or \ (isinstance(value, list) and any(isinstance(v, classes) for v in value) ): try: params[paramName] = value() if not isinstance(value, list) else \ [v() if isinstance(v, classes) else v for v in value] except: treatException('setting property %s :: %s\n' % (params['name'], paramName)) raise # Instantiate tool / alg try: obj = self.iclass(**params) except Exception: treatException( 'instantiating %s, args: %s\n' % (self.iclass.__name__, params)) raise # Call postInit methods for fcn in postInit: try: fcn(obj) except: treatException('calling postInit function %s on %s instantiation\n' % (fcn.__name__, params['name'])) raise # Add to ToolSvc or TopSequence if doAdd: self.add(obj) if doPrint: print obj return obj
def setupMuonCalib(): global topSequence, ToolSvc if not rec.doMuon() or not DetFlags.Muon_on(): logMuon.warning( "Not setting up requested Muon Calibration because Muons are off") return logMuon.info("Setting up Muon Calibration") try: from MuonCnvExample.MuonCalibFlags import muonCalibFlags muonCalibFlags.setDefaults() configs = getCalibConfigs() # # MuonSegmentToCalibSegment # calibConfig = muonRec.allConfigs()[0].getCalibConfig( ) #muonRec.getConfig(muonCalibFlags.EventTag()).getCalibConfig() MuonSegmentToCalibSegment = getMuonSegmentToCalibSegment() # # MuonCalibAlg # MuonCalibAlg = getMuonCalibAlg(muonCalibFlags.EventTag()) from MdtCalibTools.MdtCalibToolsConf import MuonCalib__MdtCalibTool MuonCalibTool = MuonCalib__MdtCalibTool() calibMode = muonCalibFlags.Mode() if calibMode == 'regionNtuple': from MdtCalibTools.MdtCalibToolsConf import MuonCalib__MdtCalibNtupleMakerTool MdtCalibTool = MuonCalib__MdtCalibNtupleMakerTool() else: raise RuntimeError("Unknown Muon Calibration Mode: %r" % calibMode) ToolSvc += MdtCalibTool MuonCalibTool.MdtCalibTool = MdtCalibTool ToolSvc += MuonCalibTool MuonCalibAlg.MuonCalibTool = MuonCalibTool except: from AthenaCommon.Resilience import treatException treatException( "Problem in MuonCalib - Muon Calibration configuration probably incomplete" )
def getCaloRingerInputReaderTools(): """ Returns a list with the CaloRinger tools to get the input objects to be decorated and pass them to their CaloRingerTools""" inputReaders = [] try: if checkBuildElectronCaloRings() or checkDoElectronIdentification(): from CaloRingerTools.CaloRingerInputReaderFactories \ import CaloRingerElectronsReaderTool inputReaders.append(CaloRingerElectronsReaderTool()) mlog.verbose("Added Ringer Electrons reader successfully.") except Exception: if caloRingerFlags.buildElectronCaloRings(): mlog.error(("It won't be possible to build ElectronCaloRings!" " Switching it off!")) caloRingerFlags.buildElectronCaloRings = False if caloRingerFlags.doElectronIdentification(): mlog.error(("It won't be possible to do Electron identification!" " Switching it off!")) caloRingerFlags.doElectronIdentification = False treatException("Could not set up Ringer Electrons reader!") try: if checkBuildPhotonCaloRings() or checkDoPhotonIdentification(): from CaloRingerTools.CaloRingerInputReaderFactories \ import CaloRingerPhotonsReaderTool inputReaders.append(CaloRingerPhotonsReaderTool()) mlog.verbose("Added Ringer Photon reader successfully.") except Exception: if caloRingerFlags.buildPhotonCaloRings(): mlog.error(("It won't be possible to build PhotonCaloRings!" " Switching it off!")) caloRingerFlags.buildPhotonCaloRings = False if caloRingerFlags.doPhotonIdentification(): mlog.error( ("It won't be possible to build do Photon identification!" " Switching it off!")) caloRingerFlags.doPhotonIdentification = False treatException("Could not set up CaloRingerAlgorithm for Photons!") return inputReaders
def transformGaudiTo(inputList, typeList): """Transform GaudiHandle into a list of configurable tools of the desired type. if input is not a Gaudi type return input. """ outputList = [] if isinstance(inputList, (GaudiHandle, GaudiHandleArray)): if not isinstance(inputList, list): inputList = [inputList] for input_ in inputList: inputType = input_.getType() for desiredType in typeList: if inputType == desiredType: cls = getattr(CfgMgr, inputType.replace(':', '_')) try: conf = cls.configurables[input_.getName()] except KeyError: conf = cls.allConfigurables[input_.getName()] outputList.append(conf) break else: treatException( "Unknown input type is %s and does not match searched type list %r.", inputType, typeList) return outputList
def setupGSF(): try: from egammaAlgs.egammaSelectedTrackCopy import (egammaSelectedTrackCopy ) egammaSelectedTrackCopy(doPrint=False) except Exception: treatException("Could not set up the egamma track Selection for GSF." "Switch Brem Building off !") jobproperties.egammaRecFlags.doBremFinding = False try: from egammaAlgs.EMBremCollectionBuilder import (EMBremCollectionBuilder ) EMBremCollectionBuilder(doPrint=False) except Exception: treatException("Could not set up EMBremCollectionBuilder." "Switch Brem Building off !") jobproperties.egammaRecFlags.doBremFinding = False try: from egammaAlgs.EMGSFCaloExtensionBuilder import ( EMGSFCaloExtensionBuilder) EMGSFCaloExtensionBuilder(doPrint=False) except Exception: treatException("Could not set up EMGSFCaloExtensionBuilder.")
if ((DetFlags.haveRIO.Muon_on() and (JetRecFlagsOK and jobproperties.JetRecFlags.Enabled()) and recAlgs.doMuonSpShower()) or rec.readESD()): protectedInclude("MuonSpShowerBuilderAlgs/CBNTAA_MuonSpShower.py") # # Jet # if rec.readAOD() or rec.readESD() or (JetRecFlagsOK and jobproperties.JetRecFlags.Enabled()): try: from JetRec.CBNTJets import schedule_standard_CBNTJets schedule_standard_CBNTJets() except Exception: treatException("Could not load CBNT_Jet. Switched off !") #temporary ## if rec.readAOD() : ## try: ## from JetRec.CBNTJets import schedule_CBNTJets_fromInputFile ## schedule_CBNTJets_fromInputFile(excludeList=["JetTruthParticles","JetTruthPileupParticles"],JetDetailedCBNT = None) ## except Exception: ## treatException("Could not load CBNT_Jet. Switched off !" ) #if rec.readESD() or (tauRecFlagsOK and jobproperties.tauRecFlags.doTauRec() ):# # # # # # ----- CBNT_tau algorithm # # # protectedInclude( "tauRec/tauMerged_CBNT_jobOptions.py")
# pdr.flag_domain('egamma') if rec.doEgamma(): protectedInclude("egammaRec/egammaRec_jobOptions.py") AODFix_postEgammaRec() # # functionality : Muon combined reconstruction # pdr.flag_domain('muoncomb') if rec.doMuonCombined() and DetFlags.Muon_on() and DetFlags.ID_on(): try: include("MuonCombinedRecExample/MuonCombinedRec_config.py") except Exception: treatException( "Could not set up combined muon reconstruction. Switched off !") rec.doMuonCombined = False # # functionality : add cells crossed by high pt ID tracks # if rec.doESD() and recAlgs.doTrackParticleCellAssociation() and DetFlags.ID_on( ): from AthenaCommon.CfgGetter import getPublicTool getPublicTool("MuonCombinedInDetDetailedTrackSelectorTool") topSequence += CfgMgr.TrackParticleCellAssociationAlg( "TrackParticleCellAssociationAlg") # # functionality : energy flow #
def setupMuonCalibNtuple(): global topSequence, muonRecFlags, beamFlags, ToolSvc, rec, DetFlags if not rec.doMuon() or not DetFlags.Muon_on(): logMuon.warning( "Not setting up requested Muon Calibration Ntuple because Muons are off" ) return logMuon.info("Setting up Muon Calibration Ntuple") try: configs = getCalibConfigs() # MuonSegmentToCalibSegment is only needed if we want segments if muonRecFlags.calibNtupleSegments and muonRecFlags.calibMuonStandalone: MuonSegmentToCalibSegment = getMuonSegmentToCalibSegment() # MuonCalibAlg is always needed eventTag = "UNKNOWN" if (muonRecFlags.calibNtupleSegments or muonRecFlags.calibNtupleTracks ) and muonRecFlags.calibMuonStandalone: if len(configs) >= 1: eventTag = configs[0]["eventTag"] elif muonRecFlags.calibNtupleTrigger: eventTag = "TRIG" else: eventTag = "HITS" MuonCalibAlg = getMuonCalibAlg(eventTag) # configure for writing ntuple from MuonCalibTools.MuonCalibToolsConf import MuonCalib__PatternNtupleMaker MuonCalibTool = MuonCalib__PatternNtupleMaker( "MuonCalibPatternNtupleMaker") MuonCalibTool.FillTruth = rec.doTruth() MuonCalibTool.DoRawTGC = (muonRecFlags.doTGCs() and muonRecFlags.calibNtupleRawTGC()) ToolSvc += MuonCalibTool MuonCalibAlg.MuonCalibTool = MuonCalibTool # MuonCalibExtraTree only if we want to write tracks if muonRecFlags.calibNtupleTracks: MuonCalibTool.DelayFinish = True from MuonCalibExtraTreeAlg.MuonCalibExtraTreeAlgConf import MuonCalib__MuonCalibExtraTreeAlg MuonCalibExtraTreeAlg = MuonCalib__MuonCalibExtraTreeAlg( "MuonCalibExtraTreeAlg", NtupleName="PatternNtupleMaker", ) segmentOnTrackSelector = None if hasattr(topSequence, "MuonSegmentToCalibSegment"): from MuonCalibExtraTreeAlg.MuonCalibExtraTreeAlgConf import MuonCalib__SegmentOnTrackSelector segmentOnTrackSelector = MuonCalib__SegmentOnTrackSelector() segmentOnTrackSelector.PattternLocation = "PatternsForCalibration" ToolSvc += segmentOnTrackSelector MuonCalibExtraTreeAlg.SegmentOnTrackSelector = segmentOnTrackSelector if not rec.doMuonCombined(): tool_nr = 0 from MuonCalibExtraTreeAlg.MuonCalibExtraTreeAlgConf import MuonCalib__ExtraTreeTrackFillerTool resPullCalc = getPublicTool("ResidualPullCalculator") for config in configs: trackDumpTool = MuonCalib__ExtraTreeTrackFillerTool( "ExtraTreeTrackFillerTool" + str(tool_nr)) trackDumpTool.TrackCollectionKey = config['tracksKey'] trackDumpTool.SegmentAuthors = [config['segmentAuthor']] trackDumpTool.TrackAuthor = config['trackAuthor'] trackDumpTool.PullCalculator = resPullCalc ToolSvc += trackDumpTool MuonCalibExtraTreeAlg.TrackFillerTools.append( trackDumpTool) tool_nr += 1 # configure needed tools # add to topSequence topSequence += MuonCalibExtraTreeAlg # MuonCalibExtraTreeTriggerAlg only if trigger is available if muonRecFlags.calibNtupleTrigger: # and DetFlags.detdescr.LVL1_on() and DetFlags.haveRDO.LVL1_on(): # protect against running without AtlasTrigger project doMuCTPI = True if doMuCTPI: try: from TrigT1RPCRecRoiSvc import TrigT1RPCRecRoiConfig from TrigT1TGCRecRoiSvc import TrigT1TGCRecRoiConfig except ImportError: logMuon.warning( "MuonCalibExtraTreeTriggerAlg.doMuCTPI = False because AtlasTrigger is not available" ) doMuCTPI = False # delay writing of MuonCalibAlg MuonCalibTool.DelayFinish = True # also delay MuonCalibExtraTreeAlg if it is running try: topSequence.MuonCalibExtraTreeAlg.DelayFinish = True except AttributeError: pass from MuonCalibExtraTreeAlg.MuonCalibExtraTreeAlgConf import MuonCalib__MuonCalibExtraTreeTriggerAlg topSequence += MuonCalib__MuonCalibExtraTreeTriggerAlg( 'MuonCalibExtraTreeTriggerAlg', doMuCTPI=doMuCTPI, doLVL1Calo=rec.doTile() or rec.doLArg() or DetFlags.haveRDO.Calo_on(), doMBTS=rec.doTile() or DetFlags.haveRDO.Tile_on()) except: from AthenaCommon.Resilience import treatException treatException( "Problem in MuonCalib - Muon Calibration Ntuple configuration probably incomplete" )
allowWildCard=True) # DetectorStatus #obsolete fullESDList += [ "DetStatusMap#DetectorStatus" ] # RawInfoSummaryForTag try: fullItemList = [] protectedInclude( "EventTagAthenaPOOL/EventTagAthenaPOOLItemList_joboptions.py") fullESDList += CfgItemList("EventTagAthenaPOOL", items=fullItemList, allowWildCard=True) except Exception: treatException( "Could not include EventTagAthenaPOOL/EventTagAthenaPOOLItemList_joboptions.py" ) # MC Event Collection. Should be moved to a separate jobO if rec.doTruth(): fullESDList += CfgItemList( "McTruthEsd", items=[ "McEventCollection#TruthEvent", "xAOD::TruthEventContainer#TruthEvents", "xAOD::TruthEventAuxContainer#TruthEventsAux.", "xAOD::TruthParticleContainer#TruthParticles", "xAOD::TruthParticleAuxContainer#TruthParticlesAux.-caloExtension", "xAOD::TruthVertexContainer#TruthVertices", "xAOD::TruthVertexAuxContainer#TruthVerticesAux.", "xAOD::TruthPileupEventContainer#TruthPileupEvents",
def setup(self): if hasattr(self, '_autocfg_check_already_executed'): return # hack to only execute this once... setattr(self, '_autocfg_check_already_executed', True) from AthenaCommon.AppMgr import ServiceMgr from AthenaCommon.JobProperties import jobproperties as jp from RecExConfig.RecFlags import jobproperties as jp if jp.Rec.AutoConfiguration() == []: self.msg.info("no AutoConfiguration requested. Leave.") return else: self.msg.info( "Now checking AutoConfiguration see https://twiki.cern.ch/twiki/bin/view/Atlas/RecExCommonAutoConfiguration. Mainly checking that list of input file are identical on C++ and python side." ) if jp.AthenaCommonFlags.isOnline(): self.msg.info( "AthenaCommonFlags.isOnLine is True : autoconfiguration checking would be tricky. Leave." ) return fi = jp.AthenaCommonFlags.FilesInput() from AthenaCommon.Resilience import treatException # try: # check which EventSelector,get collection accordingly esName = ServiceMgr.EventSelector.getFullName().partition("/")[0] if esName == "EventSelectorAthenaPool": ic = ServiceMgr.EventSelector.InputCollections elif esName == "EventSelectorByteStream": ic = ServiceMgr.ByteStreamInputSvc.FullFileName else: self.msg.warning( "Unknown EventSelector instance.Cannot check AutoCOnfig.") return # print fi # print ic lfi = len(fi) lic = len(ic) if lfi == 0: self.msg.warning( "AutoConfiguration requested but FilesInput is empty ! This could lead to wrong configuration. Proceed at your own risk" ) return if lic == 0: self.msg.warning( "AutoConfiguration requested but ServiceMgr.EventSelector.InputCollections empty ! Does not make sense. Proceed at your own risk." ) return samelist = (fi == ic) samefirstfile = (fi[0] == ic[0]) if samelist: self.msg.info( "AutoConfiguration requested, athena input file list and AthenaCommonFlags.FilesInput are identical. All Ok!" ) return else: self.msg.warning( "AutoConfiguration requested, athena input file list and AthenaCommonFlags.FilesInput() are different, %s vs %s " % (ic, fi)) if samefirstfile: self.msg.warning( "At least the first files are the same, but still this is dangerous.! Proceed at your own risk." ) else: self.msg.warning( "Even the first files are different ( %s vs %s ) This could lead to wrong configuration. Proceed at your own risk" % (ic[0], fi[0])) except Exception: treatException( "Could not check autoconfiguration. Could be very wrong! Please report." ) return
#if AODFlags.SpclMC: # protectedInclude( "McParticleAlgs/TruthParticleBuilder_jobOptions.py" ) # Fast Simulation AOD if AODFlags.FastSimulation: try: include("ParticleBuilderOptions/runFastSim.py") from AtlfastAlgs.GlobalEventDataGetter import Atlfast__GlobalEventDataGetter GlobalEventDataMaker = Atlfast__GlobalEventDataGetter().AlgHandle() GlobalEventDataMaker.McLocation = AODFlags.McEventKeyStr() include("AtlfastConversionAlgs/AtlfastConversion_jobOptions.py") if AODFlags.MissingEtTruth or AODFlags.FastTrackParticle: protectedInclude("RecAthenaPool/RecAthenaPool_joboptions.py") if AODFlags.MissingEtTruth: protectedInclude( "ParticleBuilderOptions/MissingEtTruth_jobOptions.py") except Exception: treatException("Could not load FastSim") from FastSimulationConfig.FastSimulationFlags import jobproperties if jobproperties.FastSimulation.doAtlfastICorrection == True: include("AtlfastCorrectionAlgs/AtlfastCDivide.py") # run Fake HLT for streaming if AODFlags.Streaming: protectedInclude("AnalysisTriggerAlgs/FakeHLT_jobOptions.py") from CaloRec.CaloCellFlags import jobproperties if jobproperties.CaloCellFlags.doFastCaloSim.statusOn: protectedInclude("AtlfastAlgs/Atlfast_FastCaloSim_MuonFragment.py")
DetFlags.readRIOPool.TRT_setOn() DetFlags.makeRIO.TRT_setOff() elif globalflags.InputFormat == 'bytestream': DetFlags.readRDOPool.all_setOff() DetFlags.readRDOBS.all_setOn() else: DetFlags.readRDOPool.all_setOff() DetFlags.readRDOBS.all_setOff() if 'readMuonDigit' in dir() and readMuonDigit: # very special case for normal Rome production DetFlags.readRDOPool.Muon_setOff() DetFlags.readRIOPool.Muon_setOn() if not ('doWriteRDO' in dir() and doWriteRDO): DetFlags.makeRIO.Muon_setOn() # switch off lucid stuff for now # DetFlags.Lucid_setOff() # switch off ZDC stuff for now # DetFlags.ZDC_setOff() #DetFlags.ALFA_setOff() #synch muon flags to detflags try: from MuonRecExample.MuonRecFlags import muonRecFlags muonRecFlags.sync_DetFlags() except Exception: treatException("Could not synch DetFlags to muonRecFlags")
from CaloRec.CaloRecFlags import jobproperties # # functionality : CaloExtensionBuilder setup # to be used in tau, pflow, e/gamma # pdr.flag_domain('CaloExtensionBuilder') if (rec.doESD()) and (recAlgs.doEFlow() or rec.doTau() or rec.doEgamma()): # or rec.readESD() try: from TrackToCalo.CaloExtensionBuilderAlgConfig import CaloExtensionBuilder CaloExtensionBuilder( "NoCut", 500.) #Arguments are cutLevel and minPt for track selection except Exception: treatException("Cannot include CaloExtensionBuilder !") # # functionality : electron photon identification # # pdr.flag_domain('egamma') if rec.doEgamma(): protectedInclude("egammaRec/egammaRec_jobOptions.py") AODFix_postEgammaRec() # # functionality : Muon combined reconstruction # pdr.flag_domain('muoncomb') if rec.doMuonCombined() and DetFlags.Muon_on() and DetFlags.ID_on():
#import PerfMonComps.DomainsRegistry as pdr #pdr.flag_domain('admin') # one print every 100 events eventPrintFrequency = vars().get('EVTPRINTFREQ', 100) topSequence += EventCounter(Frequency=eventPrintFrequency) if hasattr(ServiceMgr,"AthenaEventLoopMgr"): ServiceMgr.AthenaEventLoopMgr.EventPrintoutInterval = eventPrintFrequency topSequence.EventCounter.Frequency = ServiceMgr.AthenaEventLoopMgr.EventPrintoutInterval pass try: svcMgr.EventSelector.SkipEvents = athenaCommonFlags.SkipEvents() pass except Exception: treatException("Could not set EventSelector.SkipEvents") pass #-------------------------------------------------------------- # Now specify the list of algorithms to be run # The order of the jobOption specify the order of the algorithms # (don't modify it) #-------------------------------------------------------------- #Temporary: Schedule conversion algorithm for EventInfo object: #FIXME: Subsequent algorithms may alter the event info object (setting Error bits) if not objKeyStore.isInInput( "xAOD::EventInfo"): from xAODEventInfoCnv.xAODEventInfoCreator import xAODMaker__EventInfoCnvAlg topSequence+=xAODMaker__EventInfoCnvAlg()
def configure(self): "This method will be called when object is initialized" mlog = logging.getLogger( 'CaloRingerAlgorithmBuilder::configure:%s:' \ % self.__class__.__name__.replace( ".", '_' ) ) mlog.info('entering') try: # Instantiate the main algorithm: MainCaloRingerAlgorithm = AlgFactory( CaloRingerAlgsConf.Ringer__CaloRingerAlgorithm, name="MainCaloRingerAlgorithm", inputReaderTools=FcnWrapper(getCaloRingerInputReaderTools)) self._caloRingerAlg = MainCaloRingerAlgorithm() if caloRingerFlags.buildCaloRingsOn(): # Egamma locker not being used anymore. #postponeEgammaLock(self._caloRingerAlg) pass # Check if CaloRingerAlgorithm has readers: if not self._caloRingerAlg.inputReaderTools: raise RuntimeError(("Cannot instantiate CaloRingerAlgorithm " "without readers.")) if caloRingerFlags.buildCaloRingsOn(): self._eventOutputs = { outputCaloRingsType() : \ getCaloRingerOutputs(self._caloRingerAlg.inputReaderTools,addRingSetsContainers=False), \ outputRingSetType() : \ getCaloRingerOutputs(self._caloRingerAlg.inputReaderTools,addCaloRingsContainers=False) \ } self._output.update(self._eventOutputs) # Check for existing output: self.checkExistingOutput() if not self.ignoreExistingDataObject() \ and ( ( caloRingerFlags.buildElectronCaloRings() and \ ( inputAvailable(outputCaloRingsType(), outputElectronCaloRingsKey()) or \ inputAvailable(outputCaloRingsType(), outputElectronCaloAsymRingsKey()) ) or \ ( inputAvailable(outputRingSetType(), outputElectronRingSetsKey()) or \ inputAvailable(outputRingSetType(), outputElectronAsymRingSetsKey()) ) ) \ or ( caloRingerFlags.buildPhotonCaloRings() and \ ( inputAvailable(outputCaloRingsType(), outputPhotonCaloRingsKey()) or \ inputAvailable(outputCaloRingsType(), outputPhotonCaloAsymRingsKey()) ) or \ ( inputAvailable(outputRingSetType(), outputPhotonRingSetsKey()) or \ inputAvailable(outputRingSetType(), outputPhotonAsymRingSetsKey()) ) ) ): raise RuntimeError(( "Already existing input will be overwriten and not set Ringer flag " "ignoreExistingDataObject.")) except Exception: removeFromTopSequence(self._caloRingerAlg) caloRingerFlags.Enabled = False self._disabled = True treatException(("Could not get handle to CaloRingerAlgorithm." " Reason:\n%s") % traceback.format_exc()) return False return True
conddb.setGlobalTag(globalflags.ConditionsTag()) # Detector geometry and magnetic field if rec.LoadGeometry(): include("RecExCond/AllDet_detDescr.py") # Particle Property protectedInclude("PartPropSvc/PartPropSvc.py") include.block("PartPropSvc/PartPropSvc.py") # Detector Status if rec.doDetStatus() and not athenaCommonFlags.isOnline(): try: include("DetectorStatus/DetStatusSvc_CondDB.py") except Exception: treatException("Could not load DetStatusSvc_CondDb !") rec.doFileMetaData = False if rec.doFileMetaData(): #DR FIXME not sure about commissioing exception, filemetadata should be in filteredESD as well if rec.doWriteRDO() or rec.doWriteESD() or rec.doWriteAOD( ) or rec.doDPD(): protectedInclude("DetectorStatus/DetStatusSvc_ToFileMetaData.py") #Output file TagInfo and metadata if rec.oldFlagCompatibility: print "RecExCommon_flags.py flags values:" try: for o in RecExCommonFlags.keys(): exec 'print "%s =",%s ' % (o, o) except Exception:
# i.e. doTruth=True ==> RecExCommonFlags['doTruth"]=True # now update the job properties from the RecExCommonFlags # only if steering from old flags from RecExConfig.RecFlags import jobproperties, rec from RecExConfig.RecAlgsFlags import recAlgs from AthenaCommon.GlobalFlags import globalflags # only necessary during migration try: from CaloRec.CaloRecFlags import jobproperties CaloRecFlagsOK = True except Exception: treatException("Could not instantiate CaloRecFlags ") CaloRecFlagsOK = False try: from InDetRecExample.InDetJobProperties import InDetFlags # change default here InDetFlags.doxKalman = False InDetFlags.doPrintConfigurables = False except Exception: treatException("Could not instantiate InDetFlags ") try: from MuonRecExample.MuonRecFlags import muonRecFlags except Exception: treatException("Could not instantiate muonRecFlags ")
rec.doEgamma = True from egammaRec.egammaRecFlags import jobproperties jobproperties.egammaRecFlags.Enabled = True jobproperties.egammaRecFlags.cellContainerName = 'SubtractedCells' jobproperties.egammaRecFlags.doEgammaCaloSeeded = True jobproperties.egammaRecFlags.doEgammaForwardSeeded = False if DetFlags.haveRIO.Calo_on(): #combined clusters if jobproperties.CaloRecFlags.doCaloCluster(): try: from CaloRec.CaloClusterSWCmbGetter import CaloClusterSWCmbGetter CaloClusterSWCmbGetter() except Exception: treatException("Problem with CaloSWCmbCluster. Switched off.") jobproperties.CaloRecFlags.doCaloCluster = False #EM clusters if jobproperties.CaloRecFlags.doEmCluster(): try: include("LArClusterRec/LArCluster_jobOptions.py") except Exception: treatException("Problem with LArCluster. Switched off.") jobproperties.CaloRecFlags.doEmCluster = False # write digits of EM clusters if jobproperties.CaloRecFlags.doEMDigits() and globalflags.DataSource( ) == 'data' and globalflags.InputFormat() == 'bytestream': try: include("LArClusterRec/LArDigits_fromEMCluster_jobptions.py") except Exception: treatException(
from egammaPerformance.egammaPerformanceConf import TopphysicsMonTool TopMonTool = TopphysicsMonTool( name="TopMonTool", ElectronContainer="ElectronAODCollection", JetContainer="AntiKt4TopoEMJets", metName="MET_RefFinal", ProcessName="Topww", triggerXselection=WenutriggerXselection, Selection_Items=["all", "loose", "tight", "medium"], massShift=9460, massElectronClusterEtCut=1000, massLowerCut=0, massUpperCut=200, #PhiBinning = 64, LeadingElectronClusterPtCut=25000, MissingParticleEtCut=40000, JetEnergyCut=1000000, DeltaRCut=10, OutputLevel=egammaMonOutputLevel, TrigDecisionTool=MyTrigDecisionTool, UseTrigger=DQMonFlags.useTrigger()) ToolSvc += TopMonTool monManEgamma.AthenaMonTools += ["TopphysicsMonTool/TopMonTool"] except Exception: from AthenaCommon.Resilience import treatException treatException( "egammaMonitoring_jobOptions.py: exception when setting up Egamma monitoring" )
# functionality : FTK reconstruction if DetFlags.detdescr.FTK_on(): protectedInclude("FTK_RecExample/FTKRec_jobOptions.py") # functionality : Muon reconstruction pdr.flag_domain('muon') if DetFlags.detdescr.Muon_on(): try: from RecExConfig.RecConfFlags import recConfFlags from AthenaCommon.AthenaCommonFlags import athenaCommonFlags from MuonRecExample.MuonRecFlags import muonRecFlags muonRecFlags.applyResilience = athenaCommonFlags.AllowIgnoreConfigError( ) except Exception: treatException("Could not set muonRecFlags.applyResilience") # hack the merged jobo should test on rec.ScopingLevel=5 to run cosmic reco # 4 the essential collision reco 3 high priority 2 medium priodity 1 nice to have try: include("MuonRecExample/MuonRec_jobOptions.py") except Exception: treatException( "Problem with MuonRecExample/MuonRec_jobOptions.py. Switching off Moore and Muonboy" ) from MuonRecExample.MuonRecFlags import muonRecFlags muonRecFlags.doStandalone = False else: from MuonRecExample.MuonRecFlags import muonRecFlags
if DetFlags.detdescr.Tile_on() and not rec.doAODMerging(): protectedInclude("TileConditions/TileConditions_jobOptions.py") if DetFlags.detdescr.Calo_on() and not rec.doAODMerging(): protectedInclude("CaloIdCnv/CaloIdCnv_joboptions.py") #FIXME tile and lar not independent protectedInclude("TileIdCnv/TileIdCnv_jobOptions.py") if DetFlags.detdescr.LAr_on() and not rec.doAODMerging(): try: include("LArDetDescr/LArDetDescr_joboptions.py") except Exception: DetFlags.Calo_setOff() treatException( "could not load LArDetDescr_jobOptions. Calo switched off") from AthenaCommon.AppMgr import ServiceMgr import DetDescrCnvSvc.DetStoreConfig ServiceMgr.DetDescrCnvSvc.DecodeIdDict = TRUE # Beam Spot service (only if ID requested) from AthenaCommon.GlobalFlags import globalflags # use even if commisisoning and not globalflags.DetGeo=='commis' : if DetFlags.detdescr.ID_on() and not rec.doAODMerging(): protectedInclude("InDetBeamSpotService/BeamCondSvc.py") if DetFlags.detdescr.Muon_on() and not rec.doAODMerging(): protectedInclude("AmdcAth/AmdcAth_jobOptions.py") # MagneticField Service
#ancestors: the genealogy takes a selected list(s) as input # and select all ancestors theCBNTAA_Truth += CBNT_TruthSelector("AllAncestors", InputNames=[ "Boson", "Electron", "Lepton", "Tau", "HeavyQuark", "Photon", "VisibleCharged" ], PtMin=-1. * GeV, EtaMax=-1, Genealogy=1) # take all ancestors # CAREFUL : if this fails one should make sure to include CBNT_Athena/CBNT_Athena_jobOptions.py # finally add to CBNT_AthenaAware CBNT_AthenaAware += theCBNTAA_Truth # add special MonteCarlo => dropped # from CBNT_Truth.CBNT_TruthConf import CBNTAA_SpclMC # CBNT_AthenaAware+=CBNTAA_SpclMC() # spcial for HeavyIon simulation # spcial for HeavyIon simulation try: from HIRecExample.HIRecExampleFlags import jobproperties if jobproperties.HIRecExampleFlags.withHijingEventPars: from CBNT_Truth.CBNT_TruthConf import CBNTAA_HijingEventParams CBNT_AthenaAware += CBNTAA_HijingEventParams() except Exception: treatException("Could not configure CBNTAA_HijingEventParams")
## theCaloCellContainerCheckerTool.OutputLevel=DEBUG ## ToolSvc += theCaloCellContainerCheckerTool ## theCaloCellMaker.CaloCellMakerToolNames += [theCaloCellContainerCheckerTool] ## topSequence+=theCaloCellMaker; # create LArFebErrorSummary for BS input if rec.doLArg() and globalflags.DataSource( ) == 'data' and globalflags.InputFormat() == 'bytestream': from LArROD.LArRODFlags import larRODFlags if larRODFlags.doLArFebErrorSummary(): try: include("LArROD/LArFebErrorSummaryMaker_jobOptions.py") except Exception: treatException( "Problem with LArFebErrorSummaryMaker_jobOptions.py switch larRODFlags.doLArFebErrorSummary " ) larRODFlags.doLArFebErrorSummary = False # # functionality: Calorimeter cells # if DetFlags.makeRIO.Calo_on() and not rec.doWriteBS(): from AthenaCommon.Include import excludeTracePattern excludeTracePattern.append("*/CaloClusterCorrection/common.py") try: include("TileRec/TileDefaults_jobOptions.py") except Exception: treatException("Could not set up Tile default options.")
pupElm.bkgCaches["CavernCache"].OutputLevel = VERBOSE ## pupElm.bkgCaches["CavernCache"].NonIntersectingRings = ["-1:1","-3:5", "-2:1"] ## pupElm.bkgCaches["CavernCache"].AllowRingMigration = True #ServiceMgr.PileUpMergeSvc.OutputLevel=VERBOSE #subtract from central bunch xing one event, typically to compensate for # the fact that also the OriginalEvent stream contains MinBias #pupElm.bkgCaches["LowPtMinBiasCache"].SubtractBC0 = 1 #-------------------------------------------------------------- #monitor floating point exceptions #-------------------------------------------------------------- try: theApp.CreateSvc += ["FPEControlSvc"] except Exception: treatException("Could not load FPEControlSvc") #-------------------------------------------------------------- #print resource usage summary at the end of the job #-------------------------------------------------------------- theApp.AuditServices = True theApp.AuditAlgorithms = True from AthenaCommon.AppMgr import theAuditorSvc from AthenaCommon.ConfigurableDb import getConfigurable #theAuditorSvc += getConfigurable("ChronoAuditor")() #theAuditorSvc += getConfigurable("MemStatAuditor")() theAuditorSvc += getConfigurable("NameAuditor")() #-------------------------------------------------------------- #run perfmon #--------------------------------------------------------------
pdr.flag_domain('egamma') if rec.doEgamma(): protectedInclude( "egammaRec/egammaRec_jobOptions.py" ) AODFix_postEgammaRec() # # functionality : Muon combined reconstruction # pdr.flag_domain('muoncomb') if rec.doMuonCombined() and DetFlags.Muon_on() and DetFlags.ID_on(): try: include ("MuonCombinedRecExample/MuonCombinedRec_config.py") except Exception: treatException("Could not set up combined muon reconstruction. Switched off !") rec.doMuonCombined = False # # functionality : add cells crossed by high pt ID tracks # if rec.doESD() and recAlgs.doTrackParticleCellAssociation(): from AthenaCommon.CfgGetter import getPublicTool getPublicTool("MuonCombinedInDetDetailedTrackSelectorTool") topSequence += CfgMgr.TrackParticleCellAssociationAlg("TrackParticleCellAssociationAlg") # # functionality : energy flow # pdr.flag_domain('eflow') if recAlgs.doEFlow() and ( rec.readESD() or ( DetFlags.haveRIO.ID_on() and DetFlags.haveRIO.Calo_allOn() ) ) :