def __init__(self, name, athStream, navThinSvc, **kwargs): # Remember the object's properties: self.athStream = athStream self.navThinSvc = navThinSvc # Set up a logger object: from AthenaCommon.Logging import logging self.log = logging.getLogger(name) # Call the initialisation of the base class: AthThinningSvc.__init__(self, name, **kwargs) return
# Ketevi A. Assamagan # BNL, September 2009 include.block("DPDUtils/ObjectThinner_jobOptions.py") from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() from AthenaCommon.AppMgr import ToolSvc from AthenaCommon.AppMgr import ServiceMgr as svcMgr # make an instance of the thinning service from AthenaServices.Configurables import ThinningSvc svcMgr += ThinningSvc() # the output stream(s) to apply thinning on svcMgr.ThinningSvc.Streams += ['StreamDPD'] # object selection tools - for the details selections of the objects to pass to the DPD include("UserAnalysisUtils/UserAnalysisSelectionTool_jobOptions.py") from DPDUtils.DPDUtilsConf import ObjectThinner ObjectThinner = ObjectThinner( ThinService=svcMgr.ThinningSvc, AnalysisSelectionTool=ToolSvc.UserAnalysisSelectionTool, InDetTrackParticles="TrackParticleCandidate", ObjectContainers=[ "ElectronAODCollection", "PhotonAODCollection", "StacoMuonCollection", "TauRecContainer", "Cone4H1TopoJets" ],
SGKeys=auxList, OutputLevel=INFO) ################################### # Create Output Stream and Thinning ################################### from OutputStreamAthenaPool.MultipleStreamManager import MSMgr xAODStreamName = "AST99Stream" AST99Stream = MSMgr.NewPoolRootStream(xAODStreamName, xAODFileName) from AthenaServices.Configurables import ThinningSvc svcMgr += ThinningSvc("AST99ThinningSvc", Streams=[xAODStreamName], OutputLevel=INFO) thinningTools = [] skimmingTools = [] ######################################### # Configure SUSYTools and object thinning ######################################### # Initial SUSYObjDef_xAOD # PRWConfigFiles and PRWLumiCalcFiles from minimalExampleJobOptions_mc.py AST99ObjDef = CfgMgr.ST__SUSYObjDef_xAOD( "AST99ObjDef", DataSource=dataSource, ConfigFile="SUSYTools/SUSYTools_Default.conf",
# AUTHOR: A.Kaczmarska (using egamma example) # CREATED: July 12 2007 # from AthenaCommon.Logging import logging from AthenaCommon.SystemOfUnits import * from AthenaCommon.Constants import * import traceback import EventKernel.ParticleDataType from RecExConfig.Configured import Configured from AthenaCommon.AppMgr import ServiceMgr as svcMgr from AthenaServices.Configurables import ThinningSvc if not hasattr(svcMgr, 'ThinningSvc'): svcMgr += ThinningSvc(OutputLevel=INFO) svcMgr.ThinningSvc.Streams += ['StreamAOD'] class tauTrackSlimmer(Configured): #_outputType = "TrackCollection" #_outputKey = "Tracks" #_output = { _outputType: _outputKey } def configure(self): mlog = logging.getLogger('tauTrackSlimmer.py::configure:') mlog.info('entering') # configure TauTrackSlimmer here: try:
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
topSequence += TrackSlimmer("slimTracks") #Electron Filter from DPDUtils.DpdLib import ElectronFilter topSequence += ElectronFilter("ElectronFilter") from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream StreamDPD = AthenaPoolOutputStream("StreamDPD") ## configure the thinning service from AthenaServices.Configurables import ThinningSvc svcMgr += ThinningSvc(Streams=['StreamDPD']) ######################Write Item List########################################## StreamDPD.ItemList = ['EventInfo#*', 'TrackRecordCollection#*'] StreamDPD.ItemList += ['ElectronContainer#ElectronAODCollection'] StreamDPD.ItemList += ['egDetailContainer#egDetailAOD'] StreamDPD.ItemList += ['Analysis::MuonContainer#StacoMuonCollection'] StreamDPD.ItemList += ['JetKeyDescriptor#JetKeyMap'] StreamDPD.ItemList += ['JetCollection#Cone4H1TowerJets'] StreamDPD.ItemList += ['JetCollection#Cone4TruthJets'] StreamDPD.ItemList += ['Rec::TrackParticleContainer#TrackParticleCandidate'] StreamDPD.ItemList += ['Rec::TrackParticleContainer#StacoTrackParticles'] StreamDPD.ItemList += ['VxContainer#*'] StreamDPD.ForceRead = TRUE #force read of output data objs