SkimmingTools=[DRAW_TAUMUH_SkimmingTool]) topSequence += DRAW_TAUMUH_Seq ################## ### Output stream ################## from OutputStreamAthenaPool.MultipleStreamManager import MSMgr from D2PDMaker.D2PDHelpers import buildFileName from PrimaryDPDMaker.PrimaryDPDFlags import primDPD streamName = primDPD.WriteDRAW_TAUMUH.StreamName fileName = buildFileName(primDPD.WriteDRAW_TAUMUH) # Remove the .pool.root ending in the file name, this is a RAW file! if fileName.endswith(".pool.root"): fileName = fileName.rstrip(".pool.root") pass StreamDRAW_TAUMUH = MSMgr.NewByteStream(streamName, fileName) StreamDRAW_TAUMUH.AddRequireAlgs(["DRAW_TAUMUHKernel"]) # Don't write an output RAW file if it is empty StreamDRAW_TAUMUH.bsOutputSvc.WriteEventlessFiles = primDPD.WriteEventlessFiles( ) ######################################### # Add the containers to the output stream ######################################### from PrimaryDPDMaker import PrimaryDPD_OutputDefinitions as dpdOutput # Take everything from the input ExcludeList = [] dpdOutput.addAllItemsFromInputExceptExcludeList(streamName, ExcludeList)
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#*")
mixedFilterMuid=H4lDPDMaker.H4lMixedFilter("H4lMixedFilterMuid", nLept=2,\ pTCuts=[0,10*Units.GeV],\ eTCuts=[10*Units.GeV,0],\ qualityCuts=[eQual,muQual],\ types=["e","mu"],\ collections=["RobustLooseElectronCollection","MuidMuonCollection"],\ mass=5*Units.GeV) theJob += mixedFilterStaco theJob += mixedFilterMuid # The job starts here! rec.AutoConfiguration.append('FieldAndGeo') #rec.AutoConfiguration.append('BeamType') rec.AutoConfiguration.append('ConditionsTag') rec.AutoConfiguration.append('RealOrSim') include("RecExCommon/RecExCommon_topOptions.py") # define streams streamOut = MSMgr.NewPoolStream("HSG2_DPD", OutputFile2L) streamOut.AcceptAlgs([ "H4l_2ElectronFilter", "H4l_2StacoMuonFilter", "H4l_2MuidMuonFilter", "H4lMixedFilterStaco", "H4lMixedFilterMuid" ]) dpdOutHelper.addAllItemsFromInputExceptExcludeList("HSG2_DPD", []) theApp.EvtMax = evtMax
# ==================================================================== # 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 )
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#*")
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#*")
# keep all containers from the input ExcludeList = [] ################################################################################### #MET Filter #comment this section out if you don't want it ################################################################################### theJob += METFilter("MyStream_METFilter") theJob.MyStream_METFilter.cutEtMin = 15.0 * Units.GeV streamName = "METStream" fileName = "/afs/cern.ch/user/a/ayurkewi/scratch0/METperf_1540/Reconstruction/MissingETPerformance/run/output/METSkim.root" METStreamObject = MSMgr.NewPoolStream(streamName, fileName) METStreamObject.AcceptAlgs(["MyStream_METFilter"]) dpdOutput.addBasicOutput(streamName) dpdOutput.addAllItemsFromInputExceptExcludeList(streamName, ExcludeList) ################################################################################### #Run - Event Filter #comment this section out if you don't want it ################################################################################### theJob += EventFilter("MyStream_EventFilter") theJob.MyStream_EventFilter.OutputLevel = 1 streamName2 = "EventStream" fileName2 = "/afs/cern.ch/user/a/ayurkewi/scratch0/METperf_1540/Reconstruction/MissingETPerformance/run/output/RunEventSkim.root" EventStreamObject = MSMgr.NewPoolStream(streamName2, fileName2) EventStreamObject.AcceptAlgs(["MyStream_EventFilter"]) dpdOutput.addBasicOutput(streamName2)
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#*")
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)