def ApplyPrescale(arg): #Supported args are 'SET_StreamName_Value' where arg is a string and value is an integer if isinstance(arg,str): if arg.startswith('SET_'): name_val=arg[4:] try: i=name_val.rindex('_') except: raise SyntaxError("ApplyPrescale arg needs to have the form 'SET_StreamName_val', arg= "+arg) name=name_val[:i] val=name_val[i+1:] try: prescale=int(val) except: raise TypeError("ApplyPrescale val needs to be an integer: val= "+val) else: raise SyntaxError("ApplyPrescale arg needs to start with 'SET_'. arg= "+arg) else: raise TypeError("ApplyPrescale arg of %s has to be a string. "%type(arg)+arg) from OutputStreamAthenaPool.MultipleStreamManager import MSMgr if MSMgr.StreamExists( name ): stream=MSMgr.GetStream( name ) origVal=stream.GetPrescale() stream.SetPrescale( prescale ) print ("INFO ApplyPrescale - SET prescale value %i to stream"%prescale,name,"(original value:",origVal,")") else: print ("WARNING ApplyPrescale - unable to get stream "+name+". No additional prescale applied.") return
def addBasicOutput(streamName=""): if not streamName == "": stream = MSMgr.GetStream(streamName) #stream.Stream.TakeItemsFromInput = True ##----------------------------------------------------------------------------- ## Write all IOV meta data containers ## IOV stands for "Interval Of Validity". This means that in one file, there ## can be several blocks of events corresponding to one MetaData block. ##----------------------------------------------------------------------------- stream.AddMetaDataItem(["IOVMetaDataContainer#*"]) stream.AddMetaDataItem(["LumiBlockCollection#*"]) ##----------------------------------------------------------------------------- ## Write event-based containers ##----------------------------------------------------------------------------- stream.AddItem(['EventInfo#*']) pass else: primaryDPD_BasicOutput_msg.warning( 'Can not add the basic output collections to the stream %s', streamName) pass return
def addTau(streamName=""): if not streamName=="" : stream = MSMgr.GetStream(streamName) ##----------------------------------------------------------------------------- ## Write Tau related containers ##----------------------------------------------------------------------------- stream.AddItem( ["Analysis::TauDetailsContainer#TauRecDetailsContainer"] ) stream.AddItem( ["Analysis::TauDetailsContainer#TauRecExtraDetailsContainer"] ) stream.AddItem( ["CaloClusterContainer#TauRecCellCluster"] ) stream.AddItem( ["CaloClusterContainer#Tau1P3PCellCluster"] ) stream.AddItem( ["CaloClusterContainer#Tau1P3PCellEM012ClusterContainer"] ) stream.AddItem( ["CaloClusterContainer#Tau1P3PPi0ClusterContainer"] ) stream.AddItem( ["CaloCellLinkContainer#TauRecCellCluster_Link"] ) stream.AddItem( ["CaloCellLinkContainer#Tau1P3PCellCluster_Link"] ) stream.AddItem( ["CaloCellLinkContainer#Tau1P3PCellEM012ClusterContainer_Link"] ) stream.AddItem( ["CaloCellLinkContainer#Tau1P3PPi0ClusterContainer_Link"] ) stream.AddItem( ["CaloShowerContainer#TauRecCellCluster_Data"] ) stream.AddItem( ["CaloShowerContainer#Tau1P3PCellCluster_Data"] ) stream.AddItem( ["CaloShowerContainer#Tau1P3PCellEM012ClusterContainer_Data"] ) stream.AddItem( ["CaloShowerContainer#Tau1P3PPi0ClusterContainer_Data"] ) pass else : primaryDPD_BasicOutput_msg.warning( 'Can not add the Tau collections to the stream %s', streamName ) pass return
def addCalorimeter(streamName=""): if not streamName=="" : stream = MSMgr.GetStream(streamName) #----------------------------------------------------------------------------- # Write Calorimeter information # for more info on the calorimeter collections, see: # https://twiki.cern.ch/twiki/bin/view/Atlas/CaloEvolution1200Persist #----------------------------------------------------------------------------- stream.AddItem( ["CaloClusterContainer#egClusterCollection"] ) stream.AddItem( ["CaloCellLinkContainer#egClusterCollection*"] ) stream.AddItem( ["CaloShowerContainer#egClusterCollection*"] ) stream.AddItem( ["CaloClusterContainer#EMTopoCluster*"] ) stream.AddItem( ["CaloCellLinkContainer#EMTopoCluster*"] ) stream.AddItem( ["CaloShowerContainer#EMTopoCluster*"] ) if rec.readESD() : stream.AddItem( ["CaloClusterContainer#LArClusterEM*"] ) stream.AddItem( ["CaloShowerContainer#LArClusterEM*"] ) stream.AddItem( ["CaloCellLinkContainer#LArClusterEM*"] ) stream.AddItem( ["CaloShowerContainer#egClusterCollection*"] ) pass pass else : primaryDPD_BasicOutput_msg.warning( 'Can not add the basic output collections to the stream %s', streamName ) pass return
def addMissingEt(streamName=""): if not streamName == "": stream = MSMgr.GetStream(streamName) #----------------------------------------------------------------------------- # MET_RefFinal and various terms contributing to it: #----------------------------------------------------------------------------- stream.AddItem(["MissingET#MET_RefFinal"]) stream.AddItem(["MissingET#MET_RefEle"]) stream.AddItem(["MissingET#MET_RefGamma"]) stream.AddItem(["MissingET#MET_RefJet"]) stream.AddItem(["MissingET#MET_RefMuon"]) stream.AddItem(["MissingET#MET_RefTau"]) stream.AddItem(["MissingET#MET_CellOut"]) stream.AddItem(["MissingET#MET_LocHadTopo"]) stream.AddItem(["MissingET#MET_LocHadTopoObj"]) stream.AddItem(["MissingET#MET_MuonBoy"]) stream.AddItem(["MissingET#MET_CryoCone"]) stream.AddItem(["MissingET#MET_Final"]) pass else: primaryDPD_BasicOutput_msg.warning( 'Can not add the basic output collections to the stream %s', streamName) pass return
def addBasicPhysics(streamName=""): if not streamName=="" : stream = MSMgr.GetStream(streamName) ##----------------------------------------------------------------------------- ## Write physics object related containers ##----------------------------------------------------------------------------- stream.AddItem( ["egammaContainer#ElectronAODCollection"] ) stream.AddItem( ["egammaContainer#PhotonAODCollection"] ) stream.AddItem( ["egDetailContainer#egDetailAOD"] ) stream.AddItem( ["Analysis::MuonContainer#StacoMuonCollection"] ) stream.AddItem( ["Analysis::MuonContainer#MuidMuonCollection"] ) stream.AddItem( ["Analysis::TauJetContainer#TauRecContainer"] ) stream.AddItem( ["JetCollection#Cone4TowerJets"] ) #stream.AddItem( ["JetCollection#AntiKt4TowerJets"] ) stream.AddItem( ["JetCollection#Cone4TopoJets"] ) stream.AddItem( ["JetCollection#AntiKt4TopoJets"] ) stream.AddItem( ["JetCollection#Cone7TowerJets"] ) #stream.AddItem( ["JetCollection#AntiKt6TowerJets"] ) stream.AddItem( ["JetKeyDescriptor#JetKeyMap"] ) # Needed to read rel 14.1.x jets in 14.2.0 pass else : primaryDPD_BasicOutput_msg.warning( 'Can not add the basic output collections to the stream %s', streamName ) pass return
def xAODTauConverter( sequence = None, stream = None, key = "TauRecContainer" ): """ Helper function that schedules all the components that create xAOD tau objects out of existing AOD objects. Arguments: sequence: Optional sequence to which the components should be added. If not specified, the main algorithm sequence is used. stream: Optional stream that the objects should be written to. If not specified, the objects are added to StreamXAOD. key: Optional StoreGate key for the AOD object that is supposed to be translated. """ # Create a logger for the function: if "logger" in dir(): orig_logger = logger from AthenaCommon.Logging import logging logger = logging.getLogger( "xAODTauConverter" ) # Tell the user what's happening: logger.info( "Creating xAOD TauJets from AOD objects" ) # Get the main sequence if necessary: if sequence == None: from AthenaCommon.AlgSequence import AlgSequence sequence = AlgSequence() pass # Access the stream if necessary: if stream == None: from OutputStreamAthenaPool.MultipleStreamManager import MSMgr try: stream = MSMgr.GetStream( "StreamAOD" ) except NameError: stream = None pass pass # Add the tau converter algorithm: outkey = "TauRecContainer" from xAODTauCnv.xAODTauCnvConf import xAODMaker__TauJetCnvAlg tauAlg = xAODMaker__TauJetCnvAlg() #tauAlg.OutputLevel = VERBOSE tauAlg.OutputLevel = 1 sequence += tauAlg # Add the tau objects to the output: if stream != None: stream.AddItem( "xAOD::TauJetContainer_v1#%s" % outkey ) stream.AddItem( "xAOD::TauJetAuxContainer_v1#%sAux." % outkey ) # Reinstate the old logger if it existed: if "orig_logger" in dir(): logger = orig_logger pass
def xAODTrigSpacePointCountsCreator(sequence=None, stream=None, key="HLT_spacepoints"): """ Helper function that schedules all the components that create xAOD TrigSpacePointCounts objects out of existing AOD objects. Arguments: sequence: Optional sequence to which the components should be added. If not specified, the main algorithm sequence is used. stream: Optional stream that the objects should be written to. If not specified, the objects are added to StreamAOD. key: Optional StoreGate key for the AOD object that is supposed to be translated. """ # Create a logger for the function: if "logger" in dir(): orig_logger = logger from AthenaCommon.Logging import logging logger = logging.getLogger("xAODTrigSpacePointCountsCreator") # Tell the user what's happening: logger.info( "Creating xAOD::TrigSpacePointCounts from TrigDec::TrigSpacePointCounts" ) # Get the main sequence if necessary: if sequence == None: from AthenaCommon.AlgSequence import AlgSequence sequence = AlgSequence() pass # Access the stream if necessary: if stream == None: from OutputStreamAthenaPool.MultipleStreamManager import MSMgr stream = MSMgr.GetStream("StreamAOD") pass # Schedule the converter algorithm: alg = xAODMaker__TrigSpacePointCountsCnvAlg() alg.AODKey = key alg.xAODKey = key sequence += alg # Add the created objects to the output: stream.AddItem("xAOD::TrigSpacePointCountsContainer_v1#%s" % key) stream.AddItem("xAOD::TrigSpacePointCountsAuxContainer_v1#%sAux." % key) # Reinstate the old logger if it existed: if "orig_logger" in dir(): logger = orig_logger pass
def addInnerDetectorPrepRawData(streamName=""): if not streamName=="" : stream = MSMgr.GetStream(streamName) stream.AddItem( ["InDet::PixelClusterContainer#PixelClusters"] ) stream.AddItem( ["InDet::SCT_ClusterContainer#SCT_Clusters"] ) stream.AddItem( ["InDet::TRT_DriftCircleContainer#TRT_DriftCircles"] ) stream.AddItem( ["InDet::PixelGangedClusterAmbiguities#PixelClusterAmbiguitiesMap"] ) pass else : primaryDPD_BasicOutput_msg.warning( 'Can not add the basic output collections to the stream %s', streamName ) pass return
def xAODEventInfoCreator(sequence=None, stream=None, key="", outkey="EventInfo"): """ Helper function that schedules the algorithm for creating an xAOD::EventInfo object out of the AOD's EventInfo one. Arguments: sequence: Optional sequence to which the components should be added. If not specified, the main algorithm sequence is used. stream: Optional stream that the objects should be written to. If not specified, the objects are added to StreamXAOD. key: Optional StoreGate key for the AOD object that is supposed to be translated. """ # Create a logger for the function: if "logger" in dir(): orig_logger = logger from AthenaCommon.Logging import logging logger = logging.getLogger("xAODRoICreator") # Tell the user what's happening: logger.info("Creating xAOD::EventInfo") # Get the main sequence if necessary: if sequence == None: from AthenaCommon.AlgSequence import AlgSequence sequence = AlgSequence() pass # Access the stream if necessary: if stream == None: from OutputStreamAthenaPool.MultipleStreamManager import MSMgr stream = MSMgr.GetStream("StreamXAOD") pass # Add the converter algorithm: alg = xAODMaker__EventInfoCnvAlg() alg.AODKey = key alg.xAODKey = outkey sequence += alg # Add the created objects to the output: stream.AddItem("xAOD::EventInfo#%s" % outkey) stream.AddItem("xAOD::EventAuxInfo#%sAux." % outkey) stream.AddItem("xAOD::EventInfoContainer#PileUp%s" % outkey) stream.AddItem("xAOD::EventInfoAuxContainer#PileUp%sAux." % outkey) return
def xAODBunchConfCreator( sequence = None, stream = None, source = "" ): """ Helper function that schedules all the components that create bunch configuration metadata for xAOD files. Arguments: sequence: Optional sequence to which the components should be added. If not specified, the main algorithm sequence is used. stream: Optional stream that the objects should be written to. If not specified, the objects are added to StreamAOD. source: Optional source specifying where the bunch configuration information should be taken from. """ # Create a logger for the function: if "logger" in dir(): orig_logger = logger from AthenaCommon.Logging import logging logger = logging.getLogger( "xAODBunchConfCreator" ) # Tell the user what's happening: logger.info( "Creating xAOD bunch configuration metadata" ) # Get the main sequence if necessary: if sequence == None: from AthenaCommon.AlgSequence import AlgSequence sequence = AlgSequence() pass # Access the stream if necessary: if stream == None: from OutputStreamAthenaPool.MultipleStreamManager import MSMgr stream = MSMgr.GetStream( "StreamAOD" ) pass # Schedule the converter algorithm: alg = xAODMaker__BunchConfCnvAlg() alg.BCConfProvider = BunchCrossingConfProvider( source ) sequence += alg # Add the created objects to the output: stream.AddItem( "xAOD::BunchConfKey_v1#BunchConfKey" ) stream.AddMetaDataItem( "xAOD::BunchConfContainer_v1#BunchConfiguration" ) stream.AddMetaDataItem( "xAOD::BunchConfAuxContainer_v1#BunchConfigurationAux." ) # Reinstate the old logger if it existed: if "orig_logger" in dir(): logger = orig_logger pass
def addAllItemsFromInputExceptExcludeList(streamName, ExcludeList): try: stream = MSMgr.GetStream(streamName) except: raise RuntimeError("Unable to get stream %s" % streamName) # Get the list of all input event-type containers try: # This is the new way, in 15.4.0 from RecExConfig.InputFilePeeker import inputFileSummary pass except ImportError: # This is here for backwards compatibility from RecExCommon.InputFilePeeker import inputFileSummary pass fullList = [] if inputFileSummary['file_type'] == 'pool': fullListTuple = inputFileSummary['eventdata_items'] for iTuple in fullListTuple: item = iTuple[0] + "#" + iTuple[1] fullList += [item] pass stream.AddItem(fullList) pass else: primaryDPD_BasicOutput_msg.info( 'Input file is NOT a pool file! Cannot build the list of eventdata_items from a non-pool input file for the output stream %s!', streamName) pass # Now, process the ExcludeList and only try to exclude what is actually there _exclList = [] for excludeItem in ExcludeList: if fullList.__contains__(excludeItem): _exclList.append(excludeItem) pass # Deal with a wildcard if excludeItem.endswith("*"): for fullItem in fullList: if fullItem.startswith(excludeItem.rstrip("*")): _exclList.append(fullItem) pass pass pass pass # Actually remove the scheduled items from the output stream stream.RemoveItem(_exclList) return
def addTracks(streamName=""): if not streamName=="" : stream = MSMgr.GetStream(streamName) ##----------------------------------------------------------------------------- ## Write Track and Vertex information ##----------------------------------------------------------------------------- stream.AddItem( ["TrackCollection#*"] ) stream.AddItem( ["TrackCollection#Tracks"] ) stream.AddItem( ["TrackCollection#CombinedInDetTracks"] ) pass else : primaryDPD_BasicOutput_msg.warning( 'Can not add the basic output collections to the stream %s', streamName ) pass return
def configure(self): mlog = logging.getLogger('TrkTrackPostExecStream.py::configure:') mlog.info('entering') # mlog.info("Now adding to AOD Stream") #Add to stream AOD streamName = "StreamAOD" from OutputStreamAthenaPool.MultipleStreamManager import MSMgr stream = MSMgr.GetStream(streamName) stream.AddItem("TrackCollection#GSFTracks") stream.AddItem("TrackCollection#CombinedMuonTracks") mlog.info("Done adding to AOD Stream") mlog.info(stream.Stream.ItemList) return True
def addMuons(streamName=""): if not streamName == "": stream = MSMgr.GetStream(streamName) ##----------------------------------------------------------------------------- ## Write Muon related containers ##----------------------------------------------------------------------------- stream.AddItem(["Analysis::MuonContainer#*"]) stream.AddItem(["TrackRecordCollection#MuonEntryRecordFilter"]) stream.AddItem(["Rec::TrackParticleContainer#MuidCombTrackParticles"]) stream.AddItem( ["Rec::TrackParticleContainer#MuidCombTrackParticlesLowPt"]) stream.AddItem(["Rec::TrackParticleContainer#MuidExtrTrackParticles"]) stream.AddItem(["Rec::TrackParticleContainer#MuTagTrackParticles"]) stream.AddItem([ "Rec::TrackParticleContainer#MuonboyMuonSpectroOnlyTrackParticles" ]) stream.AddItem(["Rec::TrackParticleContainer#MuonboyTrackParticles"]) stream.AddItem(["Rec::TrackParticleContainer#StacoTrackParticles"]) stream.AddItem(["Rec::TrackParticleContainer#MooreTrackParticles"]) stream.AddItem(["Rec::MuonSpShowerContainer#MuonSpShowers"]) stream.AddItem(["CaloCompactCellContainer#AODCellContainer" ]) ## Requires detector description stream.AddItem(["CaloCellContainer#AODCellContainer" ]) ## Requires detector description stream.AddItem(["CaloClusterContainer#CaloCalTopoCluster"]) if rec.readESD(): stream.AddItem(["TileMuContainer#TileMuObj"]) stream.AddItem(["Trk::SegmentCollection#*"]) stream.AddItem(["Muon::CscPrepDataContainer#CSC_Clusters"]) stream.AddItem(["Muon::MdtPrepDataContainer#MDT_DriftCircles"]) stream.AddItem(["Muon::RpcPrepDataContainer#RPC_Measurements"]) stream.AddItem(["Muon::TgcPrepDataContainer#TGC_Measurements"]) stream.AddItem( ["MuonCaloEnergyContainer#MuonCaloEnergyCollection"]) if primDPD.UseMCTruth(): stream.AddItem(["PRD_MultiTruthCollection#*"]) pass else: primaryDPD_BasicOutput_msg.warning( 'Can not add the basic output collections to the stream %s', streamName) pass return
def addTrackParticles(streamName=""): if not streamName=="" : stream = MSMgr.GetStream(streamName) ##----------------------------------------------------------------------------- ## Write Track and Vertex information ##----------------------------------------------------------------------------- stream.AddItem( ["Rec::TrackParticleContainer#TrackParticleCandidate"] ) stream.AddItem( ["VxContainer#SecVertices"] ) stream.AddItem( ["VxContainer#ConversionCandidate"] ) ## For photon conversions, new stream.AddItem( ["VxContainer#Conversions"] ) ## For photon conversions, before rel 14.2.20 stream.AddItem( ["VxContainer#VxPrimaryCandidate"] ) pass else : primaryDPD_BasicOutput_msg.warning( 'Can not add the basic output collections to the stream %s', streamName ) pass return
def addPerfLite(streamName=""): if not streamName=="" : stream = MSMgr.GetStream(streamName) stream.AddItem( ["egDetailContainer#egDetailAOD"] ) stream.AddItem( ["Analysis::TauDetailsContainer#TauRecDetailsContainer"] ) stream.AddItem( ["Rec::TrackParticleContainer#MuonboyMuonSpectroOnlyTrackParticles"] ) stream.AddItem( ["Rec::TrackParticleContainer#StacoTrackParticles"] ) stream.AddItem( ["Rec::MuonSpShowerContainer#MuonSpShowers"] ) stream.AddItem( ["Analysis::MuonContainer#CaloMuonCollection"] ) stream.AddItem( ["Rec::TrackParticleContainer#MuonboyTrackParticles"] ) stream.AddItem( ["Rec::TrackParticleContainer#MooreTrackParticles"] ) pass else : primaryDPD_BasicOutput_msg.warning( 'Can not add the basic output collections to the stream %s', streamName ) pass return
def addEGamma(streamName=""): if not streamName=="" : stream = MSMgr.GetStream(streamName) ##----------------------------------------------------------------------------- ## Write EGamma related containers ##----------------------------------------------------------------------------- stream.AddItem( ["egDetailContainer#egDetailAOD"] ) stream.AddItem( ["egDetailContainer#egDetailContainer"] ) stream.AddItem( ["egDetailContainer#SofteDetailContainer"] ) if rec.readESD() : stream.AddItem( ["ElectronContainer#softeCollection"] ) stream.AddItem( ["ElectronContainer#ElectronCollection"] ) stream.AddItem( ["PhotonContainer#PhotonCollection"] ) pass else : primaryDPD_BasicOutput_msg.warning( 'Can not add the basic output collections to the stream %s', streamName ) pass return
def addTruth(streamName=""): if not streamName == "": stream = MSMgr.GetStream(streamName) if primDPD.UseMCTruth(): from ParticleBuilderOptions.AODFlags import AODFlags if rec.readAOD: AODFlags.McEventKey = "GEN_AOD" else: AODFlags.McEventKey = "GEN_EVENT" if primDPD.ApplyTruthSlimming(): #include("PrimaryDPDMaker/SlimTruth.py") stream.AddItem(["McEventCollection#GEN_DPD"]) stream.AddItem(["TruthEtIsolationContainer#*"]) stream.AddItem(["TruthParticleContainer#SpclMC"]) pass else: stream.AddItem(["McEventCollection#GEN_AOD"]) stream.AddItem(["TruthParticleContainer#SpclMC"]) pass stream.AddItem(["JetCollection#Cone4TruthJets"]) stream.AddItem(["JetCollection#Cone7TruthJets"]) #stream.AddItem( ["JetCollection#AntiKt4TruthJets"] ) stream.AddItem(["MissingEtTruth#MET_Truth"]) stream.AddItem(["MissingEtTruth#MET_Truth_PileUp"]) stream.AddItem( ["TrackParticleTruthCollection#TrackParticleTruthCollection"]) pass pass else: primaryDPD_BasicOutput_msg.warning( 'Can not add the basic output collections to the stream %s', streamName) pass return
def xAODRoICreator( sequence = None, stream = None, key = "LVL1_ROI" ): """ Helper function that schedules all the components that create xAOD LVL1 RoI objects out of existing AOD objects. Arguments: sequence: Optional sequence to which the components should be added. If not specified, the main algorithm sequence is used. stream: Optional stream that the objects should be written to. If not specified, the objects are added to StreamAOD. key: Optional StoreGate key for the AOD object that is supposed to be translated. """ # Create a logger for the function: if "logger" in dir(): orig_logger = logger from AthenaCommon.Logging import logging logger = logging.getLogger( "xAODRoICreator" ) # Tell the user what's happening: logger.info( "Creating xAOD LVL1 RoIs from AOD objects" ) # Get the main sequence if necessary: if sequence == None: from AthenaCommon.AlgSequence import AlgSequence sequence = AlgSequence() pass # Access the stream if necessary (and possible): if stream == None: from OutputStreamAthenaPool.MultipleStreamManager import MSMgr try: stream = MSMgr.GetStream( "StreamAOD" ) except NameError: stream = None pass pass # Add the muon RoI converter algorithm: outkey = "LVL1MuonRoIs" alg = xAODMaker__MuonRoICnvAlg() alg.AODKey = key alg.xAODKey = outkey sequence += alg # Add the muon RoI objects to the output: if stream != None: stream.AddItem( "xAOD::MuonRoIContainer_v1#%s" % outkey ) stream.AddItem( "xAOD::MuonRoIAuxContainer_v1#%sAux." % outkey ) pass # Add the jet RoI converter algorithm: outkey = "LVL1JetRoIs" alg = xAODMaker__JetRoICnvAlg() alg.AODKey = key alg.xAODKey = outkey sequence += alg # Add the jet RoI objects to the output: if stream != None: stream.AddItem( "xAOD::JetRoIContainer_v1#%s" % outkey ) stream.AddItem( "xAOD::JetRoIAuxContainer_v1#%sAux." % outkey ) pass # Add the em/tau RoI converter algorithm: outkey = "LVL1EmTauRoIs" alg = xAODMaker__EmTauRoICnvAlg() alg.AODKey = key alg.xAODKey = outkey sequence += alg # Add the em/tau RoI objects to the output: if stream != None: stream.AddItem( "xAOD::EmTauRoIContainer_v1#%s" % outkey ) stream.AddItem( "xAOD::EmTauRoIAuxContainer_v1#%sAux." % outkey ) pass # Add the energy-sum RoI converter algorithm: outkey = "LVL1EnergySumRoI" alg = xAODMaker__EnergySumRoICnvAlg() alg.AODKey = key alg.xAODKey = outkey sequence += alg # Add the energy-sum RoI objects to the output: if stream != None: stream.AddItem( "xAOD::EnergySumRoI_v1#%s" % outkey ) stream.AddItem( "xAOD::EnergySumRoIAuxInfo_v1#%sAux." % outkey ) pass # Add the jet-Et RoI converter algorithm: outkey = "LVL1JetEtRoI" alg = xAODMaker__JetEtRoICnvAlg() alg.AODKey = key alg.xAODKey = outkey sequence += alg # Add the jet-Et RoI objects to the output: if stream != None: stream.AddItem( "xAOD::JetEtRoI_v1#%s" % outkey ) stream.AddItem( "xAOD::JetEtRoIAuxInfo_v1#%sAux." % outkey ) pass # Reinstate the old logger if it existed: if "orig_logger" in dir(): logger = orig_logger pass
# Set up a logger: from AthenaCommon.Logging import logging Wlnujj_msg = logging.getLogger('Wlnujj_branchSelection') if 'SkimOL' in dir(): Wlnujj_msg.setLevel(SkimOL) # name of the stream which should be modified if 'streamName' in dir(): Wlnujj_msg.info("Looking for output stream with name '%s' " % streamName) from OutputStreamAthenaPool.MultipleStreamManager import MSMgr try: SkimD3PDStream = MSMgr.GetStream(streamName) except: Wlnujj_msg.error("Output stream with name '%s' does not exist " % streamName) # do all manipulations only if stream is defined if 'SkimD3PDStream' in dir(): # # additional fillers for W->lnujj stream # def _args(level, name, kwin, **kw): kw = kw.copy() kw['level'] = level for (k, v) in kwin.items(): if k.startswith(name + '_'): kw[k[len(name) + 1:]] = v return kw
from AthenaCommon.AppMgr import ToolSvc #import copy #InDetPriVxFinderTool_Pix = copy.deepcopy(ToolSvc.InDetPriVxFinderTool) #InDetPriVxFinderTool_SCT = copy.deepcopy(ToolSvc.InDetPriVxFinderTool) from AthenaCommon.JobProperties import jobproperties from OutputStreamAthenaPool.MultipleStreamManager import MSMgr #MSMgr.Print() try: StreamName = jobproperties.PrimaryDPDFlags.WriteDESDM_BEAMSPOTStream.StreamName except: StreamName = "StreamDESDM_BEAMSPOT" #print xxx try: Stream = MSMgr.GetStream(StreamName) except: raise NameError("Stream %s undefined!" % StreamName) from InDetTrackSelectorTool.InDetTrackSelectorToolConf import InDet__InDetDetailedTrackSelectorTool InDetTrackSelectorTool_Pix = InDet__InDetDetailedTrackSelectorTool( name="InDetDetailedTrackSelectorTool_Pix", pTMin=InDetPrimaryVertexingCuts.minPT(), IPd0Max=InDetPrimaryVertexingCuts.IPd0Max(), IPz0Max=InDetPrimaryVertexingCuts.IPz0Max(), z0Max=InDetPrimaryVertexingCuts.z0Max(), sigIPd0Max=InDetPrimaryVertexingCuts.sigIPd0Max(), sigIPz0Max=InDetPrimaryVertexingCuts.sigIPz0Max(), d0significanceMax=InDetPrimaryVertexingCuts.d0significanceMax(), z0significanceMax=InDetPrimaryVertexingCuts.z0significanceMax(), etaMax=InDetPrimaryVertexingCuts.etaMax(),
### Steer output file content ################# ## Add service for metadata ToolSvc += CfgMgr.xAODMaker__TriggerMenuMetaDataTool("TriggerMenuMetaDataTool") svcMgr.MetaDataSvc.MetaDataTools += [ToolSvc.TriggerMenuMetaDataTool] ## Steer output file from OutputStreamAthenaPool.MultipleStreamManager import MSMgr from D2PDMaker.D2PDHelpers import buildFileName from PrimaryDPDMaker.PrimaryDPDFlags import primDPD streamName = primDPD.WriteDAOD_IDNCBStream.StreamName fileName = buildFileName(primDPD.WriteDAOD_IDNCBStream) IDNCBStream = MSMgr.NewPoolRootStream(streamName, fileName) IDNCBStream.AcceptAlgs(["DFIDNCB_KERN"]) from AthenaServices.Configurables import ThinningSvc, createThinningSvc augStream = MSMgr.GetStream(streamName) evtStream = augStream.GetEventStream() svcMgr += createThinningSvc(svcName="IDNCBThinningSvc", outStreams=[evtStream]) excludedAuxData = "-caloExtension.-cellAssociation.-clusterAssociation.-trackParameterCovarianceMatrices.-parameterX.-parameterY.-parameterZ.-parameterPX.-parameterPY.-parameterPZ.-parameterPosition" excludedTRTData = "-T0.-TRTboard.-TRTchip.-bitPattern.-driftTimeToTCorrection.-driftTimeHTCorrection.-highThreshold.-strawnumber" excludedSCTData = "-detectorElementID.-hitsInThirdTimeBin.-rdo_groupsize" # Add generic event information IDNCBStream.AddItem("xAOD::EventInfo#*") IDNCBStream.AddItem("xAOD::EventAuxInfo#*") #SKC Add jets! IDNCBStream.AddItem("xAOD::JetContainer#AntiKt4EMTopoJets") IDNCBStream.AddItem("xAOD::JetAuxContainer#AntiKt4EMTopoJetsAux.") IDNCBStream.AddItem("xAOD::JetContainer#AntiKt4LCTopoJets")
from OutputStreamAthenaPool.MultipleStreamManager import MSMgr if rec.doWriteAOD: streamAOD = MSMgr.GetStream('StreamAOD') streamAOD.AddItem("xAOD::TriggerTowerContainer#xAODTriggerTowers") streamAOD.AddItem("xAOD::TriggerTowerAuxContainer#xAODTriggerTowersAux.")
d3pd_tests += [('scells.root', 'scells.ref')] # Test LeadingPtAssociationTool. from D3PDMakerCoreComps.SimpleAssociation import SimpleAssociation from D3PDMakerCoreComps.D3PDObject import make_SGDataVector_D3PDObject import EventCommonD3PDMaker TestJetD3PDObject = make_SGDataVector_D3PDObject ('JetCollection', 'AntiKt4TopoEMJets,' + 'AntiKt4TopoJets,' + 'AntiKt4H1TopoJets', 'testjet_', 'testjet') TestJetD3PDObject.defineBlock (0, 'Kin', EventCommonD3PDMaker.FourMomFillerTool) LeadingConstitAssoc = SimpleAssociation \ (TestJetD3PDObject, EventCommonD3PDMaker.LeadingPtAssociationTool, level = 0, prefix = 'lconstit_', blockname = 'LeadingConstitAssoc', MultiAssocTool = EventCommonD3PDMaker.NavigableConstituentAssociationTool ('LeadingConstitMAssoc', TypeName = 'CaloCluster')) LeadingConstitAssoc.defineBlock (0, 'LeadKin', EventCommonD3PDMaker.FourMomFillerTool) from OutputStreamAthenaPool.MultipleStreamManager import MSMgr alg = MSMgr.GetStream('StreamNTUP_PHYSICS') alg += TestJetD3PDObject(10)
def addTrigger(streamName=""): if not streamName=="" : stream = MSMgr.GetStream(streamName) stream.AddItem( ["TrigConf::Lvl1AODPrescaleConfigData#AODConfig-0"] ) stream.AddItem( ["LVL1_ROI#LVL1_ROI"] ) stream.AddItem( ["TrigInDetTrackCollection#HLTAutoKey*"] ) stream.AddItem( ["TrigInDetTrackCollection#HLT"] ) stream.AddItem( ["TrigInDetTrackCollection#HLT_TRTSegmentFinder"] ) stream.AddItem( ["TrigInDetTrackCollection#HLT_TRTxK"] ) stream.AddItem( ["TrigInDetTrackCollection#HLT_TrigIDSCAN_eGamma*"] ) stream.AddItem( ["TrigInDetTrackCollection#HLT_TrigSiTrack_eGamma*"] ) stream.AddItem( ["CombinedMuonFeature#HLT_egamma"] ) stream.AddItem( ["TrigEMCluster#HLTAutoKey*"] ) stream.AddItem( ["TrigEMClusterContainer#HLT*"] ) stream.AddItem( ["TrigT2Jet#HLTAutoKey*"] ) stream.AddItem( ["TrigElectronContainer#HLTAutoKey*"] ) stream.AddItem( ["TrigPhotonContainer#HLTAutoKey*"] ) stream.AddItem( ["TrigTau#HLTAutoKey*"] ) stream.AddItem( ["JetCollection#HLTAutoKey*"] ) stream.AddItem( ["TrigMuonEFContainer#HLTAutoKey*"] ) stream.AddItem( ["egammaContainer#HLTAutoKey*"] ) stream.AddItem( ["egammaContainer#NoIDEF_RoI*"] ) stream.AddItem( ["egammaContainer#egamma_RoI*"] ) stream.AddItem( ["egammaContainer#HLT_egamma"] ) stream.AddItem( ["Analysis::TauDetailsContainer#HLTAutoKey*"] ) stream.AddItem( ["Analysis::TauJetContainer#HLTAutoKey*"] ) stream.AddItem( ["TrigMissingET#HLTAutoKey*"] ) stream.AddItem( ["HLT::HLTResult#HLTResult_EF"] ) stream.AddItem( ["HLT::HLTResult#HLTResult_L2"] ) stream.AddItem( ["egDetailContainer#HLTAutoKey*"] ) stream.AddItem( ["egDetailContainer#HLT_egamma*"] ) stream.AddItem( ["Rec::TrackParticleContainer#HLTAutoKey*" ] ) #Needed by one of the above trigger containers... stream.AddItem( [ "TrigDec::TrigDecision#TrigDecision*"] ) stream.AddItem( [ "TrigConf::HLTAODConfigData#AODConfig*"] ) stream.AddItem( [ "TrigConf::Lvl1AODConfigData#AODConfig*"] ) stream.AddItem( [ "TrigConf::Lvl1AODPrescaleConfigData#AODConfig*"] ) # new names and additional containers: stream.AddItem( ["LVL1::JEMRoI#JEMRoIs"] ) stream.AddItem( ["TrigRoiDescriptorCollection#HLT"] ) stream.AddItem( ["TrigRoiDescriptorCollection#HLT_T2TauFinal"] ) stream.AddItem( ["TrigRoiDescriptorCollection#HLT_TrigT2CaloEgamma"] ) stream.AddItem( ["TrigRoiDescriptorCollection#HLT_TrigT2CaloJet"] ) stream.AddItem( ["TrigRoiDescriptorCollection#HLT_TrigT2CaloTau"] ) stream.AddItem( ["TrigRoiDescriptorCollection#HLT_forMS"] ) stream.AddItem( ["TrigTauClusterContainer#HLT_TrigT2CaloTau"] ) stream.AddItem( ["TrigTauContainer#HLT"] ) stream.AddItem( ["Analysis::TauJetContainer#HLT_TrigTauRecMerged"] ) stream.AddItem( ["Analysis::TauJetContainer#HLT_TrigTauRecCalo"] ) stream.AddItem( ["TrigTauTracksInfoCollection#HLT"] ) stream.AddItem( ["Analysis::TauDetailsContainer#HLT_TrigTauDetailsCalo"] ) stream.AddItem( ["Analysis::TauDetailsContainer#HLT_TrigTauDetailsMerged"] ) stream.AddItem( ["VxContainer#HLT_PrimVx"] ) stream.AddItem( ["LVL1::TriggerTower#TriggerTowers"] ) stream.AddItem( ["LVL1::JEMEtSums#JEMEtSums"] ) stream.AddItem( ["TrigEMClusterContainer#HLT_TrigT2CaloEgamma"] ) stream.AddItem( ["TrigElectronContainer#HLT_L2IDCaloFex"] ) stream.AddItem( ["TrigPhotonContainer#HLT_L2PhotonFex"] ) stream.AddItem( ["JetCollection#HLT"] ) stream.AddItem( ["JetCollection#HLT_TrigJetRec"] ) stream.AddItem( ["TrigT2JetContainer#HLT_TrigT2CaloJet"] ) stream.AddItem( ["TrigMissingETContainer#HLT_T2MissingET"] ) stream.AddItem( ["TrigMissingETContainer#HLT_TrigEFMissingET"] ) stream.AddItem( ["TrigInDetTrackCollection#HLT_TrigIDSCAN_Tau"] ) stream.AddItem( ["TrigInDetTrackCollection#HLT_TrigSiTrack_Tau"] ) stream.AddItem( ["TrigInDetTrackCollection#HLT_TrigIDSCAN_Muon"] ) stream.AddItem( ["TrigInDetTrackCollection#HLT_TrigIDSCAN_Jet"] ) stream.AddItem( ["TrigInDetTrackCollection#HLT_TrigIDSCAN_eGamma"] ) stream.AddItem( ["Rec::TrackParticleContainer#HLT_InDetTrigParticleCreation_Tau_EFID"] ) stream.AddItem( ["CombinedMuonFeature#HLT"] ) stream.AddItem( ["MuonFeatureContainer#HLT"] ) stream.AddItem( ["TrigMuonEFContainer#HLT_MuonEF"] ) pass else : primaryDPD_BasicOutput_msg.warning( 'Can not add the basic output collections to the stream %s', streamName ) pass return
def xAODTrigL1CaloCreator(sequence=None, stream=None): """ Helper function that schedules all the components that create xAOD LVL1 RoI objects out of existing AOD objects. Arguments: sequence: Optional sequence to which the components should be added. If not specified, the main algorithm sequence is used. stream: Optional stream that the objects should be written to. If not specified, the objects are added to StreamXAOD. """ # Create a logger for the function: if "logger" in dir(): orig_logger = logger from AthenaCommon.Logging import logging logger = logging.getLogger("xAODTrigL1CaloCreator") # Tell the user what's happening: logger.info("Creating xAOD L1Calo objects from ESD L1Calo objects") # Get the main sequence if necessary: if sequence == None: from AthenaCommon.AlgSequence import AlgSequence sequence = AlgSequence() pass # Access the stream if necessary: if stream == None: from OutputStreamAthenaPool.MultipleStreamManager import MSMgr stream = MSMgr.GetStream("StreamXAOD") pass ### CMM Section # Add the CMMCPHits converter algorithm: SGkey = "CMMCPHits" alg = xAODMaker__CMMCPHitsCnvAlg() alg.ESDKey = SGkey alg.xAODKey = SGkey sequence += alg # Add the CMMCPHits objects to the output: stream.AddItem("xAOD::CMMCPHitsContainer_v1#%s" % SGkey) stream.AddItem("xAOD::CMMCPHitsAuxContainer_v1#%sAux." % SGkey) # Add the CMMEtSums converter algorithm: SGkey = "CMMEtSums" alg = xAODMaker__CMMEtSumsCnvAlg() alg.ESDKey = SGkey alg.xAODKey = SGkey sequence += alg # Add the CMMEtSums objects to the output: stream.AddItem("xAOD::CMMEtSumsContainer_v1#%s" % SGkey) stream.AddItem("xAOD::CMMEtSumsAuxContainer_v1#%sAux." % SGkey) # Add the CMMJetHits converter algorithm: SGkey = "CMMJetHits" alg = xAODMaker__CMMJetHitsCnvAlg() alg.ESDKey = SGkey alg.xAODKey = SGkey sequence += alg # Add the CMMJetHits objects to the output: stream.AddItem("xAOD::CMMJetHitsContainer_v1#%s" % SGkey) stream.AddItem("xAOD::CMMJetHitsAuxContainer_v1#%sAux." % SGkey) # Add the CMMRoIs converter algorithm: SGkey = "CMMRoIs" alg = xAODMaker__CMMRoICnvAlg() alg.ESDKey = SGkey alg.xAODKey = SGkey sequence += alg # Add the CMMRoI objects to the output: stream.AddItem("xAOD::CMMRoI_v1#%s" % SGkey) stream.AddItem("xAOD::CMMRoIAuxInfo_v1#%sAux." % SGkey) ### CPM Section # Add the CPMHits converter algorithm: SGkey = "CPMHits" alg = xAODMaker__CPMHitsCnvAlg() alg.ESDKey = SGkey alg.xAODKey = SGkey sequence += alg # Add the CMMCPHits objects to the output: stream.AddItem("xAOD::CPMHitsContainer_v1#%s" % SGkey) stream.AddItem("xAOD::CPMHitsAuxContainer_v1#%sAux." % SGkey) # Add the CPMTower converter algorithm: SGkey = "CPMTowers" alg = xAODMaker__CPMTowerCnvAlg() alg.ESDKey = SGkey alg.xAODKey = SGkey sequence += alg # Add the CMMCPHits objects to the output: stream.AddItem("xAOD::CPMTowerContainer_v1#%s" % SGkey) stream.AddItem("xAOD::CPMTowerAuxContainer_v1#%sAux." % SGkey) # Add the CPMRoI converter algorithm: SGkey = "CPMRoIs" alg = xAODMaker__CPMRoICnvAlg() alg.ESDKey = SGkey alg.xAODKey = SGkey sequence += alg # Add the CMMCPHits objects to the output: stream.AddItem("xAOD::CPMRoIContainer_v1#%s" % SGkey) stream.AddItem("xAOD::CPMRoIAuxContainer_v1#%sAux." % SGkey) ### JEM Section # Add the JEMHits converter algorithm: SGkey = "JEMHits" alg = xAODMaker__JEMHitsCnvAlg() alg.ESDKey = SGkey alg.xAODKey = SGkey sequence += alg # Add the CMMCPHits objects to the output: stream.AddItem("xAOD::JEMHitsContainer_v1#%s" % SGkey) stream.AddItem("xAOD::JEMHitsAuxContainer_v1#%sAux." % SGkey) # Add the JEMEtSums converter algorithm: SGkey = "JEMEtSums" alg = xAODMaker__JEMEtSumsCnvAlg() alg.ESDKey = SGkey alg.xAODKey = SGkey sequence += alg # Add the CMMCPHits objects to the output: stream.AddItem("xAOD::JEMEtSumsContainer_v1#%s" % SGkey) stream.AddItem("xAOD::JEMEtSumsAuxContainer_v1#%sAux." % SGkey) # Add the JEMRoI converter algorithm: SGkey = "JEMRoIs" alg = xAODMaker__JEMRoICnvAlg() alg.ESDKey = SGkey alg.xAODKey = SGkey sequence += alg # Add the CMMCPHits objects to the output: stream.AddItem("xAOD::JEMRoIContainer_v1#%s" % SGkey) stream.AddItem("xAOD::JEMRoIAuxContainer_v1#%sAux." % SGkey) # Add the JetElement converter algorithm: SGkey = "JetElements" alg = xAODMaker__JetElementCnvAlg() alg.ESDKey = SGkey alg.xAODKey = SGkey sequence += alg # Add the CMMCPHits objects to the output: stream.AddItem("xAOD::JetElementContainer_v1#%s" % SGkey) stream.AddItem("xAOD::JetElementAuxContainer_v1#%sAux." % SGkey) # Add the RODHeaders converter algorithm: SGkey = "RODHeaders" alg = xAODMaker__RODHeaderCnvAlg() alg.ESDKey = SGkey alg.xAODKey = SGkey sequence += alg # Add the CMMCPHits objects to the output: stream.AddItem("xAOD::RODHeaderContainer_v1#%s" % SGkey) stream.AddItem("xAOD::RODHeaderAuxContainer_v1#%sAux." % SGkey) # Add the TriggerTower converter algorithm: SGkey = "TriggerTowers" alg = xAODMaker__TriggerTowerCnvAlg() alg.ESDKey = SGkey alg.xAODKey = SGkey sequence += alg # Add the CMMCPHits objects to the output: stream.AddItem("xAOD::TriggerTowerContainer_v1#%s" % SGkey) stream.AddItem("xAOD::TriggerTowerAuxContainer_v1#%sAux." % SGkey) # Reinstate the old logger if it existed: if "orig_logger" in dir(): logger = orig_logger pass
from RecExConfig.RecFlags import rec rec.doApplyAODFix.set_Value_and_Lock(False) #from AthenaCommon.JobProperties import jobproperties #jobproperties.Global.DetDescrVersion = 'ATLAS-GEO-16-00-00' ##import AtlasGeoModel.GeoModelInit #import AtlasGeoModel.SetGeometryVersion from AthenaCommon.GlobalFlags import globalflags globalflags.DetDescrVersion.set_Value_and_Lock('ATLAS-GEO-18-00-00') include ('D3PDMakerTest/run-d3pd-test.py') svcMgr.GeoModelSvc.IgnoreTagDifference = True from OutputStreamAthenaPool.MultipleStreamManager import MSMgr alg = MSMgr.GetStream('StreamNTUP_EGAMMA') # Test adding another electron with a different container type. from egammaD3PDMaker.ElectronD3PDObject import ElectronD3PDObject #alg += ElectronD3PDObject (10, # sgkey = 'HLT_egamma', # typeName = 'egammaContainer', # exclude = ['EFInfo', 'L2Info', 'L1Info', # 'EFIndex', 'L2Index', 'L1Index'], # prefix = 'ef_el_') # Try doing some filtering... from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags from D3PDMakerCoreComps.resolveSGKey import resolveSGKey from AthenaCommon.AlgSequence import AlgSequence from D3PDMakerCoreComps.D3PDObject import D3PDObject
if primDPD.MakePrimaryDPD(): from OutputStreamAthenaPool.MultipleStreamManager import MSMgr from PrimaryDPDMaker.PrimaryDPDFlags import listESDtoDPD, listAODtoDPD for stream in listESDtoDPD + listAODtoDPD: if MSMgr.StreamExists(stream): StreamESD = MSMgr.GetStream(stream) StreamESD.AddItem(["JetCollection#*"]) StreamESD.AddItem(["MissingET#*"])
# modify ESD for 2013 p+Pb run from OutputStreamAthenaPool.MultipleStreamManager import MSMgr if MSMgr.StreamExists("StreamESD"): myStream = MSMgr.GetStream("StreamESD") myStream.AddItem("CaloClusterContainer#CaloTopoCluster") print 'CaloTopoClusterContainer added to ESD'