def setup_pool_skim(filename, accept_algs, type="AOD"): from OutputStreamAthenaPool.MultipleStreamManager import MSMgr from PrimaryDPDMaker import PrimaryDPD_OutputDefinitions as dpdOutput stream_name = "StreamD%s" % (type) stream = MSMgr.NewPoolStream(stream_name, filename) stream.AcceptAlgs( accept_algs ) dpdOutput.addAllItemsFromInputExceptExcludeList( stream_name, []) if False: dpdOutput.addBasicOutput(stream_name) dpdOutput.addBasicPhysics(stream_name) dpdOutput.addCalorimeter(stream_name) dpdOutput.addEGamma(stream_name) dpdOutput.addInnerDetectorPrepRawData(stream_name) dpdOutput.addMissingEt(stream_name) dpdOutput.addMuons(stream_name) dpdOutput.addPerfLite(stream_name) dpdOutput.addTau(stream_name) dpdOutput.addTrackParticles(stream_name) dpdOutput.addTracks(stream_name) dpdOutput.addTrigger(stream_name) dpdOutput.addTruth(stream_name)
if iAlg==0: combination_daod_2l=algsList[iAlg] else: combination_daod_2l+=" or "+algsList[iAlg] totalDecision_daod_2l=LogicalFilterCombiner("HSG2_2LDAODFilter",cmdstring = combination_daod_2l) theJob+=totalDecision_daod_2l ## This handles multiple output streams from OutputStreamAthenaPool.MultipleStreamManager import MSMgr from PrimaryDPDMaker import PrimaryDPD_OutputDefinitions as dpdOutHelper # define streams from AthenaCommon.JobProperties import jobproperties prodFlags = jobproperties.D2PDFlags from PrimaryDPDMaker.PrimaryDPDHelpers import buildFileName # Construct the stream and file names for the jp: streamName = prodFlags.WriteDAOD_2LHSG2Stream.StreamName fileName = buildFileName( prodFlags.WriteDAOD_2LHSG2Stream ) #streamOut = MSMgr.NewPoolStream("StreamDAOD_2LHSG2",runArgs.outputDAOD_2LHSG2File) streamOut_daod_2l = MSMgr.NewPoolStream(streamName,fileName) streamOut_daod_2l.AcceptAlgs([totalDecision_daod_2l.getName()]) streamOut_daod_2l.AddOtherAlgsToBookkeep(algsList) dpdOutHelper.addAllItemsFromInputExceptExcludeList(streamName,[]) streamOut_daod_2l.AddMetaDataItem("EventBookkeeperCollection#*")
# ==================================================================== # Define the test DPD output stream # ==================================================================== # This stream HAS TO start with "StreamD2AODM_"! If the input was an (D)ESD(M), this should start with "StreamD2ESD(M)_". # See this twiki for more information: https://twiki.cern.ch/twiki/bin/view/AtlasProtected/DPDNamingConvention fileName = "DAOD_WithPileupWeight.pool.root" streamName = "DAOD_TEST" PielupStream = MSMgr.NewPoolStream( streamName, fileName ) # Only events that pass the filters listed below are written out # AcceptAlgs = logical OR of filters # RequireAlgs = logical AND of filters #PileupStream.AcceptAlgs( [""] ) # --------------------------------------------------- # Add the containers to the output stream # --------------------------------------------------- from PrimaryDPDMaker import PrimaryDPD_OutputDefinitions as dpdOutput # Take all items from the input, except for the ones listed in the excludeList # If the excludeList is empty, all containers from the input file (e.g. AOD) # are copied to the output file. excludeList = [ "TrigMuonEFContainer#HLT_MuonEF" ] dpdOutput.addAllItemsFromInputExceptExcludeList( streamName, excludeList )
acceptFrwdE=jobproperties.HSG2.fourLeptonAcceptFrwdE()) theJob+=mixedFilterStaco_daod_4l msg.info("Added 2e2mu(staco) filter") theJob+=mixedFilterMuid_daod_4l msg.info("Added 2e2mu(muid) filter") combination="HSG2_DAOD_4ElectronFilter or "+"HSG2_DAOD_4StacoMuonFilter or "+"HSG2_DAOD_4MuidMuonFilter or "+"HSG2_DAOD_4MixedFilterStaco or "+"HSG2_DAOD_4MixedFilterMuid" totalDecision_daod_4l=LogicalFilterCombiner("HSG2_DAOD_4l_Filter",cmdstring = combination) theJob+=totalDecision_daod_4l ## This handles multiple output streams from OutputStreamAthenaPool.MultipleStreamManager import MSMgr from PrimaryDPDMaker import PrimaryDPD_OutputDefinitions as dpdOutHelper # define streams #streamOut = MSMgr.NewPoolStream("StreamDAOD_2LHSG2",runArgs.outputDAOD_2LHSG2File) streamOut_daod_4l = MSMgr.NewPoolStream("StreamDAOD_HSG2",runArgs.outputDAOD_HSG2File) streamOut_daod_4l.AcceptAlgs([totalDecision_daod_4l.getName()]) streamOut_daod_4l.AddOtherAlgsToBookkeep(["HSG2_DAOD_4ElectronFilter","HSG2_DAOD_4StacoMuonFilter","HSG2_DAOD_4MuidMuonFilter","HSG2_DAOD_4MixedFilterStaco","HSG2_DAOD_4MixedFilterMuid"]) dpdOutHelper.addAllItemsFromInputExceptExcludeList("StreamDAOD_HSG2",[]) streamOut_daod_4l.AddMetaDataItem("EventBookkeeperCollection#*")
filter1e1mMuid= AthSequencer("H4l_1e1mMuidFilter") # use sequencer to combine filters for 2e2m filter1e1mMuid += H4lDPDMaker.H4lMuonFilter("H4l_1MuonMuidFilter",nMu=1,\ pTCuts=[0*Units.GeV],\ etaCuts=[2.5],\ collectionName="MuidMuonCollection",\ qualityCuts=["any"]) filter1e1mMuid += H4lDPDMaker.H4lElectronFilter("H4l_1ElectronFilter2",nElec=1,\ eTCuts=[0*Units.GeV],\ etaCuts=[2.5],\ qualityCuts=["Loose"],\ collectionName="ElectronCollection") theJob+=filter1e1mMuid # define streams streamOut = MSMgr.NewPoolStream("HSG2_DPD","HSG2_DESD.pool.root") streamOut.AcceptAlgs(["H4l_2ElectronFilter","H4l_2StacoMuonFilter","H4l_2MuidMuonFilter","H4l_1e1mMuidFilter","H4l_1e1mStacoFilter"]) dpdOutHelper.addAllItemsFromInputExceptExcludeList("HSG2_DPD",[]) theApp.EvtMax=-1
#WenuStream.VetoAlgs( [ "JetMetCleaningSelectorInWenuStream" ] ) # Also record the MetaData for all other algorithms WenuStream.AddOtherAlgsToBookkeep(algsToBookkeep) #--------------------------------------------------- # Add the containers to the output stream #--------------------------------------------------- from PrimaryDPDMaker import PrimaryDPD_OutputDefinitions as dpdOutput # Take all items from the input, except for the ones listed in the excludeList # If the excludeList is empty, all containers from the input file (e.g. AOD) # are copied to the output file. excludeList = ["TrigMuonEFContainer#HLT_MuonEF"] excludeList = list(set(excludeList)) # This removes dublicates from the list dpdOutput.addAllItemsFromInputExceptExcludeList(streamName, excludeList) # Just copy a few containers by hand. This way is rather dangerous because # if you have a typo in the string or if a container name in the AOD changes, # you will loose this one in the output container! ## WenuStream.AddItem( ['EventInfo#*'] ) ## WenuStream.AddItem( ["egammaContainer#ElectronAODCollection"] ) ## WenuStream.AddItem( ["egammaContainer#PhotonAODCollection"] ) ## WenuStream.AddItem( ["egDetailContainer#egDetailAOD"] ) ## WenuStream.AddItem( ["egDetailContainer#egDetailContainer"] ) ## WenuStream.AddItem( ["egDetailContainer#SofteDetailContainer"] ) ## WenuStream.AddItem( ["CaloCompactCellContainer#AODCellContainer"] ) ## WenuStream.AddItem( ["CaloClusterContainer#egClusterCollection"] ) ## WenuStream.AddItem( ["CaloCellLinkContainer#egClusterCollection_Link"] ) ## WenuStream.AddItem( ["Analysis::MuonContainer#StacoMuonCollection"] ) ## WenuStream.AddItem( ["Analysis::MuonContainer#MuidMuonCollection"] )
filter1e1mMuid = AthSequencer("H4l_1e1mMuidFilter") # use sequencer to combine filters for 2e2m filter1e1mMuid += H4lDPDMaker.H4lMuonFilter("H4l_1MuonMuidFilter",nMu=1,\ pTCuts=[0*Units.GeV],\ etaCuts=[2.5],\ collectionName="MuidMuonCollection",\ qualityCuts=["any"]) filter1e1mMuid += H4lDPDMaker.H4lElectronFilter("H4l_1ElectronFilter2",nElec=1,\ eTCuts=[0*Units.GeV],\ etaCuts=[2.5],\ qualityCuts=["Loose"],\ collectionName="ElectronCollection") theJob += filter1e1mMuid # define streams streamOut = MSMgr.NewPoolStream("HSG2_DPD", "HSG2_DESD.pool.root") streamOut.AcceptAlgs([ "H4l_2ElectronFilter", "H4l_2StacoMuonFilter", "H4l_2MuidMuonFilter", "H4l_1e1mMuidFilter", "H4l_1e1mStacoFilter" ]) dpdOutHelper.addAllItemsFromInputExceptExcludeList("HSG2_DPD", []) theApp.EvtMax = -1
theJob += mixedFilterMuid_daod_4l msg.info("Added 2e2mu(muid) filter") combination = "HSG2_DAOD_4ElectronFilter or " + "HSG2_DAOD_4StacoMuonFilter or " + "HSG2_DAOD_4MuidMuonFilter or " + "HSG2_DAOD_4MixedFilterStaco or " + "HSG2_DAOD_4MixedFilterMuid" totalDecision_daod_4l = LogicalFilterCombiner("HSG2_DAOD_4l_Filter", cmdstring=combination) theJob += totalDecision_daod_4l ## This handles multiple output streams from OutputStreamAthenaPool.MultipleStreamManager import MSMgr from PrimaryDPDMaker import PrimaryDPD_OutputDefinitions as dpdOutHelper # define streams #streamOut = MSMgr.NewPoolStream("StreamDAOD_2LHSG2",runArgs.outputDAOD_2LHSG2File) streamOut_daod_4l = MSMgr.NewPoolStream("StreamDAOD_HSG2", runArgs.outputDAOD_HSG2File) streamOut_daod_4l.AcceptAlgs([totalDecision_daod_4l.getName()]) streamOut_daod_4l.AddOtherAlgsToBookkeep([ "HSG2_DAOD_4ElectronFilter", "HSG2_DAOD_4StacoMuonFilter", "HSG2_DAOD_4MuidMuonFilter", "HSG2_DAOD_4MixedFilterStaco", "HSG2_DAOD_4MixedFilterMuid" ]) dpdOutHelper.addAllItemsFromInputExceptExcludeList("StreamDAOD_HSG2", []) streamOut_daod_4l.AddMetaDataItem("EventBookkeeperCollection#*")