def getMcAODBuilder(putype): """ putype is expected to be a string ! """ builder = createMcAodBuilder( name = "McAodBuilder"+putype, outMcEvtCollection = "GEN_AOD", # this is the input to the CnvTool outTruthParticles = "SpclMC"+putype, ) builder.CnvTool.SelectSignalType = PileUpClassification.fromString(putype) # min bias only objKeyStore.addStreamAOD("TruthParticleContainer","SpclMC"+putype) return builder
def configure(self): mlog = logging.getLogger( 'DetStatusMapGetter::configure :' ) mlog.info ('entering') # now configure the algorithm try: from DetectorStatus.DetectorStatusConf import DetStatusAlg except Exception: mlog.error("could not import DetStatusAlg") mlog.error (traceback.format_exc()) return False # sets up cond db # still use old include for time being from AthenaCommon.Include import include include("DetectorStatus/DetStatusSvc_CondDB.py") # instantiate algorithm with default properties theDetStatusAlg=DetStatusAlg(Write=True) self._DetStatusAlgHandle = theDetStatusAlg # register output in objKeyStore from RecExConfig.ObjKeyStore import objKeyStore # output both in ESD and AOD objKeyStore.addStreamESD(self.outputType(),self.outputKey()) objKeyStore.addStreamAOD(self.outputType(),self.outputKey()) # now add algorithm to topSequence # this should always come at the end mlog.info(" now adding to topSequence") from __main__ import topSequence topSequence += theDetStatusAlg return True
def configure(self): from CaloRec.CaloRecConf import CaloConstCellMaker theCaloCellMaker = CaloConstCellMaker( "CaloCellMakerFromCluster", CaloCellsOutputName=self.outputKey(), OwnPolicy=1) self._CaloCellMakerHandle = theCaloCellMaker from CaloRec.CaloRecConf import CaloCellContainerFinalizerTool theCaloCellContainerFinalizerTool = CaloCellContainerFinalizerTool() from AthenaCommon.AppMgr import ToolSvc ToolSvc += theCaloCellContainerFinalizerTool theCaloCellMaker.CaloCellMakerTools += [ theCaloCellContainerFinalizerTool ] from CaloRec.CaloRecConf import CaloCellContainerCheckerTool theCaloCellContainerCheckerTool = CaloCellContainerCheckerTool() ToolSvc += theCaloCellContainerCheckerTool theCaloCellMaker.CaloCellMakerTools += [ theCaloCellContainerCheckerTool ] from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() topSequence += theCaloCellMaker from RecExConfig.ObjKeyStore import objKeyStore objKeyStore.addStreamAOD(self.outputType(), self.outputKey()) #Schedule algorithm to update cluster->cell links from CaloRec.CaloRecConf import CaloClusterCellLinksUpdater theClusterUpdater = CaloClusterCellLinksUpdater( NewCaloCellName=self._output["CaloCellContainer"]) self._ClusterUpdateHandle = theClusterUpdater topSequence += theClusterUpdater return True
def configure(self): mlog = logging.getLogger('CaloClusterSWCmb.py::configure :') mlog.info('entering') # get handle to upstream object # combined calo tower try: from CaloRec.CaloTowerCmbGetter import CaloTowerCmbGetter theCaloTowerCmbGetter = CaloTowerCmbGetter() except: mlog.error("could not get handle to CaloTowerCmbGetter Quit") print traceback.format_exc() return False if not theCaloTowerCmbGetter.usable(): if not self.ignoreConfigError(): mlog.error("CaloTowerCmbGetter unusable. Quit.") return False else: mlog.error( "CaloTowerCmbGetter unusable. Continue nevertheless") # now configure the algorithm, part of this could be done in a separate class # cannot have same name try: from CaloRec.CaloRecConf import CaloClusterMaker except: mlog.error("could not import CaloRec.CaloClusterMaker") print traceback.format_exc() return False theCaloClusterMaker = CaloClusterMaker("CaloClusterMakerSWCmb") self._CaloClusterMakerHandle = theCaloClusterMaker # configure CaloClusterMaker here try: from CaloRec.CaloRecConf import CaloClusterBuilderSW theCaloClusterBuilderSW = CaloClusterBuilderSW( "CaloClusterBuilderSWCmb") except: mlog.error("could not get handle to CaloClusterBuilderSWCmb Quit") print traceback.format_exc() return False # add the tool to list of tool ( should use ToolHandle eventually) theCaloClusterMaker.ClusterMakerTools += [ theCaloClusterBuilderSW.getFullName() ] theCaloClusterBuilderSW.TowerContainer = theCaloTowerCmbGetter.outputKey( ) theCaloClusterBuilderSW.eta_size = 5 theCaloClusterBuilderSW.phi_size = 5 theCaloClusterBuilderSW.eta_sizep = 3 theCaloClusterBuilderSW.phi_sizep = 3 theCaloClusterBuilderSW.e_threshold = 15. * GeV theCaloClusterBuilderSW.FillClusterCells = True #fill cells in ClusterBuilderSW theCaloClusterBuilderSW.nextra = 0 theCaloClusterBuilderSW.eta_SeedGrid = 5 theCaloClusterBuilderSW.phi_SeedGrid = 5 theCaloClusterBuilderSW.eta_Duplicate = 5 theCaloClusterBuilderSW.phi_Duplicate = 5 # add tool to alg . From now on theCaloClusterBuilderSW will point # on a COPY of the tool, so property cannot be further modified ! theCaloClusterMaker += theCaloClusterBuilderSW # sets output key theCaloClusterMaker.ClustersOutputName = self.outputKey() # register output in objKeyStore from RecExConfig.ObjKeyStore import objKeyStore # write everything in ESD objKeyStore.addManyTypesStreamESD(self.output()) # only write cluster class in AOD objKeyStore.addStreamAOD(self.outputType(), self.outputKey()) # now add algorithm to topSequence # this should always come at the end mlog.info(" now adding to topSequence") from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() topSequence += theCaloClusterMaker return True
from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() include( "RecExCond/RecExCommon_flags.py" ) DetFlags.ID_setOn() DetFlags.LAr_setOn() include ("RecExCond/AllDet_detDescr.py") include ("InDetRecExample/InDetRec_jobOptions.py") include( "egammaBremRec/D2PDMakerElectronPostProcessing.py") from RecExConfig.ObjKeyStore import objKeyStore objKeyStore.addStreamAOD("ElectronContainer","GSFElectronAODCollection")
# # === configuration of tools/algs done BEFORE combined muon identification, # === such as container initialisation, track splitting and ID track extrapolation # include.block("MuonCombinedRecExample/MuonCombinedRec_preprocessing.py") from AthenaCommon import CfgMgr # if rec.doMuonCombined() and muonCombinedRecFlags.doMuonClusters() and ( rec.readAOD() or rec.readESD() or DetFlags.haveRIO.Calo_on()): # hack until MuonClusterCollection is properly added to ObjKeyStore # Needed by CaloCellAODGetter.addClusterToCaloCellAOD() if jobproperties.Beam.beamType( ) != 'cosmics' and jobproperties.Beam.beamType() != 'singlebeam': from RecExConfig.ObjKeyStore import objKeyStore objKeyStore.addStreamAOD("CaloClusterContainer", "MuonClusterCollection") if rec.doMuonCombined() and jobproperties.Beam.beamType()=='cosmics' and DetFlags.haveRIO.ID_on() and \ InDetFlags.Enabled() and not InDetFlags.disableInDetReco(): from InDetTrackSplitterTool.InDetTrackSplitterToolConf import InDet__InDetTrackSplitterTool splittertool = InDet__InDetTrackSplitterTool( name='InDetTrackSplitterToolForMuonCombined', TrackFitter=ToolSvc.InDetTrackFitter) ToolSvc += splittertool from InDetTrackValidation.InDetTrackValidationConf import InDet__InDetSplittedTracksCreator splitter = InDet__InDetSplittedTracksCreator( name='InDetTrackSplitterForMuonCombined', TrackSplitterTool=splittertool, TrackCollection=InDetKeys.Tracks(),
def configure(self): log = logging.getLogger("HLTTriggerResultGetter.py") from RecExConfig.ObjKeyStore import objKeyStore # set EDMDecodingVersion EDMDecodingVersion() # Set AODFULL for data unless it was set explicitly already if TriggerFlags.AODEDMSet.isDefault() and globalflags.DataSource( ) == 'data': TriggerFlags.AODEDMSet = 'AODFULL' from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() log.info("BS unpacking (TF.readBS): %d", TriggerFlags.readBS()) if TriggerFlags.readBS(): if TriggerFlags.EDMDecodingVersion() <= 2: bs = ByteStreamUnpackGetterRun2() # noqa: F841 else: bs = ByteStreamUnpackGetter() # noqa: F841 xAODContainers = {} # if not recAlgs.doTrigger(): #only convert when running on old data if TriggerFlags.EDMDecodingVersion() == 1: xaodcnvrt = xAODConversionGetter() xAODContainers = xaodcnvrt.xaodlist if recAlgs.doTrigger() or TriggerFlags.doTriggerConfigOnly(): if TriggerFlags.EDMDecodingVersion() <= 2: tdt = TrigDecisionGetterRun2() # noqa: F841 else: tdt = TrigDecisionGetter() # noqa: F841 # Temporary hack to add Run-3 navigation to ESD and AOD if (rec.doESD() or rec.doAOD()) and TriggerFlags.EDMDecodingVersion() == 3: # The hack with wildcards is needed for BS->ESD because we don't know the exact keys # of HLT navigation containers before unpacking them from the BS event. objKeyStore._store['streamESD'].allowWildCard(True) objKeyStore._store['streamAOD'].allowWildCard(True) objKeyStore.addManyTypesStreamESD([ 'xAOD::TrigCompositeContainer#HLTNav*', 'xAOD::TrigCompositeAuxContainer#HLTNav*' ]) objKeyStore.addManyTypesStreamAOD([ 'xAOD::TrigCompositeContainer#HLTNav*', 'xAOD::TrigCompositeAuxContainer#HLTNav*' ]) # TrigJetRec additions if rec.doWriteESD(): objKeyStore.addStreamESD("JetKeyDescriptor", "JetKeyMap") objKeyStore.addStreamESD("JetMomentMap", "TrigJetRecMomentMap") if rec.doWriteAOD(): objKeyStore.addStreamAOD("JetKeyDescriptor", "JetKeyMap") objKeyStore.addStreamAOD("JetMomentMap", "TrigJetRecMomentMap") # ID truth if not rec.readESD() and (not rec.readAOD()) and TriggerFlags.doID() \ and rec.doTruth(): try: from TrigInDetTruthAlgs.TrigInDetTruthAlgsConfig import \ TrigIDTruthMaker topSequence += TrigIDTruthMaker() except Exception: log.warning("Couldn't set up the trigger ID truth maker") pass if rec.doESD() or rec.doAOD(): from TrigEDMConfig.TriggerEDM import getTrigIDTruthList objKeyStore.addManyTypesStreamESD( getTrigIDTruthList(TriggerFlags.ESDEDMSet())) objKeyStore.addManyTypesStreamAOD( getTrigIDTruthList(TriggerFlags.AODEDMSet())) if (rec.doESD() or rec.doAOD()) and TriggerFlags.writeL1TopoValData(): objKeyStore.addManyTypesStreamESD([ 'xAOD::TrigCompositeContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValData', 'xAOD::TrigCompositeAuxContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValDataAux.' ]) objKeyStore.addManyTypesStreamAOD([ 'xAOD::TrigCompositeContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValData', 'xAOD::TrigCompositeAuxContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValDataAux.' ]) log.debug( "HLT_xAOD__TrigCompositeContainer_L1TopoValData(Aux.) for L1Topo validation added to the data." ) if rec.doAOD() or rec.doWriteAOD(): # schedule the RoiDescriptorStore conversion # log.warning( "HLTTriggerResultGetter - setting up RoiWriter" ) roiWriter = RoiWriter() # Add fictional input to ensure data dependency in AthenaMT roiWriter.ExtraInputs += [("TrigBSExtractionOutput", "StoreGateSvc+TrigBSExtractionOutput")] topSequence += roiWriter # write out the RoiDescriptorStores from TrigEDMConfig.TriggerEDMRun2 import TriggerRoiList objKeyStore.addManyTypesStreamAOD(TriggerRoiList) #Are we adding operational info objects in ESD? added = self._AddOPIToESD() if added: log.debug( "Operational Info object HLT_EXPRESS_OPI_HLT with extra information about express stream prescaling added to the data." ) # ESD objects definitions _TriggerESDList = {} from TrigEDMConfig.TriggerEDM import getTriggerEDMList # we have to store xAOD containers in the root file, NOT AOD, # if the xAOD container list is not empty if (xAODContainers): _TriggerESDList.update(xAODContainers) else: _TriggerESDList.update( getTriggerEDMList(TriggerFlags.ESDEDMSet(), TriggerFlags.EDMDecodingVersion())) log.info( "ESD content set according to the ESDEDMSet flag: %s and EDM version %d", TriggerFlags.ESDEDMSet(), TriggerFlags.EDMDecodingVersion()) # AOD objects choice _TriggerAODList = {} #from TrigEDMConfig.TriggerEDM import getAODList _TriggerAODList.update( getTriggerEDMList(TriggerFlags.AODEDMSet(), TriggerFlags.EDMDecodingVersion())) log.info( "AOD content set according to the AODEDMSet flag: %s and EDM version %d", TriggerFlags.AODEDMSet(), TriggerFlags.EDMDecodingVersion()) log.debug("ESD EDM list: %s", _TriggerESDList) log.debug("AOD EDM list: %s", _TriggerAODList) # Highlight what is in AOD list but not in ESD list, as this can cause # the "different number of entries in branch" problem, when it is in the # AOD list but the empty container per event is not created # Just compares keys of dicts, which are the class names, not their string keys in StoreGate not_in = [ element for element in _TriggerAODList if element not in _TriggerESDList ] if (len(not_in) > 0): log.warning("In AOD list but not in ESD list: ") log.warning(not_in) else: log.info("AOD list is subset of ESD list - good.") def _addSlimming(stream, edm): from TrigNavTools.TrigNavToolsConfig import navigationThinningSvc edmlist = list(y.split('-')[0] for x in edm.values() for y in x) #flatten names svc = navigationThinningSvc({ 'name': 'HLTNav_%s' % stream, 'mode': 'cleanup', 'result': 'HLTResult_HLT', 'features': edmlist }) from OutputStreamAthenaPool.CreateOutputStreams import registerTrigNavThinningSvc registerTrigNavThinningSvc(stream, svc) log.info("Configured slimming of HLT for %s", stream) print(svc) # noqa: ATL901 del edmlist if TriggerFlags.doNavigationSlimming() and rec.readRDO( ) and rec.doWriteAOD(): _addSlimming('StreamAOD', _TriggerESDList) #Use ESD item list also for AOD! log.info("configured navigation slimming for AOD output") if TriggerFlags.doNavigationSlimming() and rec.readRDO( ) and rec.doWriteESD(): _addSlimming('StreamESD', _TriggerESDList) log.info("configured navigation slimming for ESD output") objKeyStore.addManyTypesStreamESD(_TriggerESDList) objKeyStore.addManyTypesStreamAOD(_TriggerAODList) return True
#----------------------------------------------------------------------------- # TAG #----------------------------------------------------------------------------- # for LAr EC timing stuff... if rec.doLArg(): include("LArCellRec/LArCollisionTime_jobOptions.py") #Configure Algorithm to fill the tags from EventTagRawAlgs.EventTagRawAlgsConf import * from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() risftwriter = RawInfoSummaryForTagWriter() if rec.doInDet(): risftwriter.IDTrackKey = InDetKeys.Tracks() #MBTS threshold risftwriter.MBTS_Threshold = (60.0 / 222.0) topSequence += risftwriter # store the object in the ESD from RecExConfig.ObjKeyStore import objKeyStore objKeyStore.addStreamESD("RawInfoSummaryForTag", "RawInfoSummaryForTag") objKeyStore.addStreamAOD("RawInfoSummaryForTag", "RawInfoSummaryForTag")
from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() include("RecExCond/RecExCommon_flags.py") DetFlags.ID_setOn() DetFlags.LAr_setOn() include("RecExCond/AllDet_detDescr.py") include("InDetRecExample/InDetRec_jobOptions.py") include("egammaBremRec/D2PDMakerElectronPostProcessing.py") from RecExConfig.ObjKeyStore import objKeyStore objKeyStore.addStreamAOD("ElectronContainer", "GSFElectronAODCollection")
def configure(self): log = logging.getLogger("HLTTriggerResultGetter.py") from RecExConfig.ObjKeyStore import objKeyStore # set EDMDecodingVersion EDMDecodingVersion() # Set AODFULL for data unless it was set explicitly already if TriggerFlags.AODEDMSet.isDefault() and globalflags.DataSource()=='data': TriggerFlags.AODEDMSet = 'AODFULL' from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() log.info("BS unpacking (TF.readBS): %d" % TriggerFlags.readBS() ) if TriggerFlags.readBS(): bs = ByteStreamUnpackGetter() xAODContainers = {} # if not recAlgs.doTrigger(): #only convert when running on old data if TriggerFlags.EDMDecodingVersion()==1: xaodcnvrt = xAODConversionGetter() xAODContainers = xaodcnvrt.xaodlist if recAlgs.doTrigger() or TriggerFlags.doTriggerConfigOnly(): tdt = TrigDecisionGetter() # TrigJetRec additions if rec.doWriteESD(): objKeyStore.addStreamESD("JetKeyDescriptor","JetKeyMap") objKeyStore.addStreamESD("JetMomentMap","TrigJetRecMomentMap") if rec.doWriteAOD(): objKeyStore.addStreamAOD("JetKeyDescriptor","JetKeyMap") objKeyStore.addStreamAOD("JetMomentMap","TrigJetRecMomentMap") # ID truth if not rec.readESD() and (not rec.readAOD()) and TriggerFlags.doID() \ and rec.doTruth(): try: from TrigInDetTruthAlgs.TrigInDetTruthAlgsConfig import \ TrigIDTruthMaker topSequence += TrigIDTruthMaker() except Exception: log.warning( "Couldn't set up the trigger ID truth maker" ) pass if rec.doESD() or rec.doAOD(): from TrigEDMConfig.TriggerEDM import getTrigIDTruthList objKeyStore.addManyTypesStreamESD(getTrigIDTruthList(TriggerFlags.ESDEDMSet())) objKeyStore.addManyTypesStreamAOD(getTrigIDTruthList(TriggerFlags.AODEDMSet())) if (rec.doESD() or rec.doAOD()) and TriggerFlags.writeL1TopoValData(): objKeyStore.addManyTypesStreamESD(['xAOD::TrigCompositeContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValData', 'xAOD::TrigCompositeAuxContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValDataAux.']) objKeyStore.addManyTypesStreamAOD(['xAOD::TrigCompositeContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValData', 'xAOD::TrigCompositeAuxContainer#HLT_xAOD__TrigCompositeContainer_L1TopoValDataAux.']) log.debug("HLT_xAOD__TrigCompositeContainer_L1TopoValData(Aux.) for L1Topo validation added to the data.") if rec.doAOD() or rec.doWriteAOD(): # schedule the RoiDescriptorStore conversion # log.warning( "HLTTriggerResultGetter - setting up RoiWriter" ) topSequence += RoiWriter() # write out the RoiDescriptorStores from TrigEDMConfig.TriggerEDM import TriggerRoiList objKeyStore.addManyTypesStreamAOD( TriggerRoiList ) #Are we adding operational info objects in ESD? added=self._AddOPIToESD() if added: log.debug("Operational Info object HLT_EXPRESS_OPI_HLT with extra information about express stream prescaling added to the data.") # ESD objects definitions _TriggerESDList = {} from TrigEDMConfig.TriggerEDM import getTriggerEDMList # we have to store xAOD containers in the root file, NOT AOD, # if the xAOD container list is not empty if(xAODContainers): _TriggerESDList.update( xAODContainers ) else: _TriggerESDList.update( getTriggerEDMList(TriggerFlags.ESDEDMSet(), TriggerFlags.EDMDecodingVersion()) ) log.info("ESD content set according to the ESDEDMSet flag: %s and EDM version %d" % (TriggerFlags.ESDEDMSet() ,TriggerFlags.EDMDecodingVersion()) ) # AOD objects choice _TriggerAODList = {} #from TrigEDMConfig.TriggerEDM import getAODList _TriggerAODList.update( getTriggerEDMList(TriggerFlags.AODEDMSet(), TriggerFlags.EDMDecodingVersion()) ) log.info("AOD content set according to the AODEDMSet flag: %s and EDM version %d" % (TriggerFlags.AODEDMSet(),TriggerFlags.EDMDecodingVersion()) ) log.debug("ESD EDM list: %s", _TriggerESDList) log.debug("AOD EDM list: %s", _TriggerAODList) # Highlight what is in AOD list but not in ESD list, as this can cause # the "different number of entries in branch" problem, when it is in the # AOD list but the empty container per event is not created # Just compares keys of dicts, which are the class names, not their string keys in StoreGate not_in = [ element for element in _TriggerAODList if element not in _TriggerESDList ] if (len(not_in)>0): log.warning("In AOD list but not in ESD list: ") log.warning(not_in) else: log.info("AOD list is subset of ESD list - good.") def _addSlimming(stream, thinningSvc, edm): from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() from TrigNavTools.TrigNavToolsConf import HLT__StreamTrigNavSlimming, HLT__TrigNavigationSlimming from TrigNavTools.TrigNavToolsConfig import navigationSlimming edmlist = list(y.split('-')[0] for x in edm.values() for y in x) #flatten names # from HLT result drop unrecorded features # slimmerHLT = HLT__StreamTrigNavSlimming('HLTNavSlimmer_%s'%stream) slimmerHLT = HLT__TrigNavigationSlimming('TrigNavigationSlimmer_%s'%stream) tHLT = navigationSlimming({'name':'HLTNav_%s'%stream, 'mode':'cleanup', 'ThinningSvc':thinningSvc, 'result':'HLTResult_HLT', 'features':edmlist}) #tHLT.SlimmingTool.OutputLevel=DEBUG tHLT.ActInPlace=True slimmerHLT.ThinningTool = tHLT print slimmerHLT.ThinningTool topSequence += slimmerHLT log.info("Configured slimming of HLT") del edmlist from AthenaCommon.AppMgr import ServiceMgr as svcMgr from AthenaServices.Configurables import ThinningSvc, createThinningSvc _doSlimming = True if _doSlimming and rec.readRDO() and rec.doWriteAOD(): if not hasattr(svcMgr, 'ThinningSvc'): # if the default is there it is configured for AODs svcMgr += ThinningSvc(name='ThinningSvc', Streams=['StreamAOD']) _addSlimming('StreamAOD', svcMgr.ThinningSvc, _TriggerESDList ) #Use ESD item list also for AOD! log.info("configured navigation slimming for AOD output") if _doSlimming and rec.readRDO() and rec.doWriteESD(): #rec.doWriteESD() and not rec.readESD(): if not hasattr(svcMgr, 'ESDThinningSvc'): svcMgr += ThinningSvc(name='ESDThinningSvc', Streams=['StreamESD']) # the default is configured for AODs _addSlimming('StreamESD', svcMgr.ESDThinningSvc, _TriggerESDList ) log.info("configured navigation slimming for ESD output") objKeyStore.addManyTypesStreamESD( _TriggerESDList ) objKeyStore.addManyTypesStreamAOD( _TriggerAODList ) return True