diff --git a/Reconstruction/Jet/JetRec/share/simpleJetRecJobO.py b/Reconstruction/Jet/JetRec/share/simpleJetRecJobO.py new file mode 100644 index 0000000000000000000000000000000000000000..027959494e9af73be68413038ef10be646b8f593 --- /dev/null +++ b/Reconstruction/Jet/JetRec/share/simpleJetRecJobO.py @@ -0,0 +1,63 @@ +# JetRec standalone reconstruction jobOptions + +infile = "/atlas/data1/userdata/khoo/Data16/AOD_r21/mc16_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.merge.AOD.e3698_s2997_r8903_r8906/AOD.10226638._000244.pool.root.1" +from AthenaCommon.AppMgr import ServiceMgr +import AthenaPoolCnvSvc.ReadAthenaPool +ServiceMgr.EventSelector.InputCollections = [infile] + +theApp.EvtMax = 50 + +from AthenaCommon import CfgMgr +# Convert EM clusters to pseudojets +emget = CfgMgr.PseudoJetGetter( + "emget", + InputContainer = "CaloCalTopoClusters", + Label = "EMTopo", + OutputContainer = "PseudoJetEMTopo", + SkipNegativeEnergy = True, + GhostScale = 0.0 +) +ToolSvc += emget + +# Set up the jet finder +JetFinder_AntiKt4 = CfgMgr.JetFinder("MTAntiKt4EMTopoJetsFinder", + JetAlgorithm = "AntiKt", + JetRadius = 0.4, + GhostArea = 0.01, + PtMin = 2000) + +#Then we setup a jet builder to calculate the areas needed for the rho subtraction +# Actually, we don't really need the areas but we may as well use this one +from AthenaCommon.AppMgr import ToolSvc +JetBuilder_AntiKt4 = CfgMgr.JetFromPseudojet("jblda", Attributes = ["ActiveArea", "ActiveArea4vec"]) +ToolSvc += JetBuilder_AntiKt4 +JetFinder_AntiKt4.JetBuilder = JetBuilder_AntiKt4 +ToolSvc += JetFinder_AntiKt4 + +#Now we setup a JetRecTool which will use the above JetFinder +JetRecTool = CfgMgr.JetRecTool("MTAntiKt4EMTopoJets") +JetRecTool.JetFinder = JetFinder_AntiKt4 +ToolSvc += JetRecTool +JetRecTool.PseudoJetGetters = [emget] +JetRecTool.OutputContainer = "MTAntiKt4EMTopoJets" + +jpjretriever = CfgMgr.JetPseudojetRetriever("jpjretriever") +ToolSvc += jpjretriever + +from AthenaCommon.AlgSequence import AlgSequence +topSequence = AlgSequence() +topSequence += CfgMgr.JetAlgorithm("MTJetAlg",Tools = [JetRecTool]) + +write_xAOD = True +if write_xAOD: + from OutputStreamAthenaPool.MultipleStreamManager import MSMgr + xaodStream = MSMgr.NewPoolRootStream( "StreamAOD", "xAOD.pool.root" ) + xaodStream.AddItem("xAOD::EventInfo#EventInfo") + xaodStream.AddItem("xAOD::EventAuxInfo#EventInfoAux.") + xaodStream.AddItem("xAOD::JetContainer#AntiKt4EMTopoJets") + xaodStream.AddItem("xAOD::JetAuxContainer#AntiKt4EMTopoJetsAux.") + xaodStream.AddItem("xAOD::JetContainer#MTAntiKt4EMTopoJets") + xaodStream.AddItem("xAOD::JetAuxContainer#MTAntiKt4EMTopoJetsAux.") + xaodStream.AddItem("xAOD::CaloClusterContainer#CaloCalTopoClusters") + xaodStream.AddItem("xAOD::CaloClusterAuxContainer#CaloCalTopoClustersAux.") + diff --git a/Reconstruction/MET/METReconstruction/Root/METAssociator.cxx b/Reconstruction/MET/METReconstruction/Root/METAssociator.cxx index d2ce010b0c0b124877b787c3fd494c415fde890f..1edaab037275e6bda67c9cd0725a92a9ff48d096 100644 --- a/Reconstruction/MET/METReconstruction/Root/METAssociator.cxx +++ b/Reconstruction/MET/METReconstruction/Root/METAssociator.cxx @@ -90,8 +90,8 @@ namespace met { ATH_MSG_DEBUG ("Initializing " << name() << "..."); ATH_CHECK( m_trkseltool.retrieve() ); - ATH_CHECK(m_trkIsolationTool.retrieve()); - ATH_CHECK(m_caloIsolationTool.retrieve()); + // ATH_CHECK(m_trkIsolationTool.retrieve()); + // ATH_CHECK(m_caloIsolationTool.retrieve()); if(m_pflow) { ATH_CHECK( m_pfotool.retrieve() ); ATH_CHECK( m_pfoweighttool.retrieve() ); @@ -299,6 +299,13 @@ namespace met { bool METAssociator::isGoodEoverP(const xAOD::TrackParticle* trk) const { + // FIXME *************************************************** + // workaround for AthenaMT testing only! + if(m_trkIsolationTool.empty() && m_caloIsolationTool.empty()) { + return true; + } + // FIXME *************************************************** + if( (fabs(trk->eta())<1.5 && trk->pt()>m_cenTrackPtThr) || (fabs(trk->eta())>=1.5 && trk->pt()>m_forTrackPtThr) ) { @@ -321,17 +328,25 @@ namespace met { ptcone20 = trkIsoResult.ptcones.size() > 0 ? trkIsoResult.ptcones[0] : 0; isolfrac = ptcone20/trk->pt(); // etcone - CaloIsolation caloIsoResult_coreCone; - std::vector<Iso::IsolationType> caloIsoCones_coreCone; - caloIsoCones_coreCone.push_back(xAOD::Iso::IsolationType::etcone20); + CaloIsolation caloIsoResult; + std::vector<Iso::IsolationType> caloIsoCones; + // We can't actually configure the tool to give etcone10, so instead we have to compute etcone20, + // applying the core cone correction. + // Then, we retrieve the correction value, which is etcone10, rather than the isolation value + caloIsoCones.push_back(xAOD::Iso::IsolationType::etcone20); xAOD::CaloCorrection caloIsoCorr_coreCone; - caloIsoCorr_coreCone.calobitset.set(xAOD::Iso::IsolationCaloCorrection::noneCaloCorrection); - m_caloIsolationTool->caloTopoClusterIsolation(caloIsoResult_coreCone, + caloIsoCorr_coreCone.calobitset.set(xAOD::Iso::IsolationCaloCorrection::coreCone); // this is etcone10 + m_caloIsolationTool->caloTopoClusterIsolation(caloIsoResult, *trk, - caloIsoCones_coreCone, + caloIsoCones, caloIsoCorr_coreCone); - etcone10 = caloIsoResult_coreCone.etcones.size() > 0 ? - caloIsoResult_coreCone.coreCorrections[xAOD::Iso::IsolationCaloCorrection::coreCone][xAOD::Iso::IsolationCorrectionParameter::coreEnergy] : 0.; + if(caloIsoResult.etcones.size() > 0) { + // retrieve the correction value for the core cone + etcone10 = caloIsoResult.coreCorrections[xAOD::Iso::IsolationCaloCorrection::coreCone][xAOD::Iso::IsolationCorrectionParameter::coreEnergy]; + } else { + ATH_MSG_WARNING("isGoodEoverP: Failed to retrieve the isolation core correction (etcone10)! Setting etcone10=0"); + etcone10 = 0.; + } EoverP = etcone10/trk->pt(); ///////////////////////////////////////////////////////////////////////// ATH_MSG_VERBOSE( "Track isolation fraction: " << isolfrac ); diff --git a/Reconstruction/MET/METReconstruction/Root/METJetAssocTool.cxx b/Reconstruction/MET/METReconstruction/Root/METJetAssocTool.cxx index 284ae7a07161fe31e921095e78d7c9f74e2a2c85..d48ce9de4d2059cda07a1532a95e6d9844e1cda4 100644 --- a/Reconstruction/MET/METReconstruction/Root/METJetAssocTool.cxx +++ b/Reconstruction/MET/METReconstruction/Root/METJetAssocTool.cxx @@ -112,7 +112,7 @@ namespace met { for (size_t consti = 0; consti < jet->numConstituents(); consti++) { const xAOD::PFO *pfo = static_cast<const xAOD::PFO*>(jet->rawConstituent(consti)); ATH_MSG_VERBOSE("Jet constituent PFO, pt " << pfo->pt()); - if (fabs(pfo->charge())>1e-9 && isGoodEoverP(pfo->track(0))) { + if (fabs(pfo->charge())>1e-9 && (!m_cleanChargedPFO || isGoodEoverP(pfo->track(0)))) { ATH_MSG_VERBOSE(" Accepted charged PFO, pt " << pfo->pt()); selectedTracks.push_back(pfo); } diff --git a/Reconstruction/MET/METReconstruction/Root/METSoftAssociator.cxx b/Reconstruction/MET/METReconstruction/Root/METSoftAssociator.cxx index 116cd322739b7b12e55956d44654784481a54a32..08f749318c40ffee20c591132d70958120b1be36 100644 --- a/Reconstruction/MET/METReconstruction/Root/METSoftAssociator.cxx +++ b/Reconstruction/MET/METReconstruction/Root/METSoftAssociator.cxx @@ -166,6 +166,7 @@ namespace met { } } } + if(constits.pv) { for(const auto& trk : *uniqueTracks) { ATH_MSG_VERBOSE("Test core track with pt " << trk->pt()); diff --git a/Reconstruction/MET/METReconstruction/Root/METTauAssociator.cxx b/Reconstruction/MET/METReconstruction/Root/METTauAssociator.cxx index 84793a007d7c5f44e55701da2b0250e62282200a..f5360e1f930f383c09e2c256412128c73c4aa4ff 100644 --- a/Reconstruction/MET/METReconstruction/Root/METTauAssociator.cxx +++ b/Reconstruction/MET/METReconstruction/Root/METTauAssociator.cxx @@ -124,7 +124,7 @@ namespace met { const TauJet* tau = static_cast<const TauJet*>(obj); for( const xAOD::TauTrack* tauTrk : tau->tracks(xAOD::TauJetParameters::coreTrack) ){//all tracks dR<0.2 regardless of quality const TrackParticle* trk = tauTrk->track(); - if(acceptTrack(trk,constits.pv) && ( !m_cleanChargedPFO || isGoodEoverP(trk) ) ){ + if(acceptTrack(trk,constits.pv) && isGoodEoverP(trk) ){ ATH_MSG_VERBOSE("Accept tau track " << trk << " px, py = " << trk->p4().Px() << ", " << trk->p4().Py()); constlist.push_back(trk); } @@ -156,7 +156,7 @@ namespace met { const TrackParticle* tautrk = ttrk->track(); if(tautrk==pfotrk) { ATH_MSG_VERBOSE("Found cPFO with dR " << seedjet->p4().DeltaR(ttrk->p4())); - if(acceptChargedPFO(tautrk,constits.pv) && isGoodEoverP(pfotrk)) match = true; + if(acceptChargedPFO(tautrk,constits.pv) && ( !m_cleanChargedPFO || isGoodEoverP(pfotrk) )) match = true; } } } diff --git a/Reconstruction/MET/METReconstruction/python/METConfig_Calo.py b/Reconstruction/MET/METReconstruction/python/METConfig_Calo.py index 1dae514089d943787e38ef48ccb784dbb315702c..b41ccdfe9c3bdfaa95c6e8fd3ce93ce50c4a3c9c 100644 --- a/Reconstruction/MET/METReconstruction/python/METConfig_Calo.py +++ b/Reconstruction/MET/METReconstruction/python/METConfig_Calo.py @@ -9,9 +9,8 @@ from METReconstruction.METRecoConfig import BuildConfig, RefConfig, METConfig,cl cfg_emt = METConfig('EMTopo',[BuildConfig('SoftClus','EMTopo')], doRegions=True, - doOriginCorrClus=metFlags.UseTracks() + doOriginCorrClus=False ) -cfg_emt.builders['SoftClus'].SignalState = clusterSigStates['Mod'] metFlags.METConfigs()[cfg_emt.suffix] = cfg_emt metFlags.METOutputList().append(cfg_emt.suffix) @@ -22,9 +21,8 @@ metFlags.METOutputList().append(cfg_emt.suffix+"Regions") cfg_lht = METConfig('LocHadTopo',[BuildConfig('SoftClus','LocHadTopo')], doRegions=True, - doOriginCorrClus=metFlags.UseTracks() + doOriginCorrClus=False ) -cfg_lht.builders['SoftClus'].SignalState = clusterSigStates['LocHad'] metFlags.METConfigs()[cfg_lht.suffix] = cfg_lht metFlags.METOutputList().append(cfg_lht.suffix) diff --git a/Reconstruction/MET/METReconstruction/share/RunMETAssocTest.py b/Reconstruction/MET/METReconstruction/share/RunMETAssocTest.py index 7e17beda7b2dd3ba1995ae2d6238a291da54a958..57c62bfd3a6c00e57da8cf654e59625de8120582 100644 --- a/Reconstruction/MET/METReconstruction/share/RunMETAssocTest.py +++ b/Reconstruction/MET/METReconstruction/share/RunMETAssocTest.py @@ -5,26 +5,46 @@ from AthenaCommon import CfgMgr from RecExConfig.RecFlags import rec -filelist = [ - #"/atlas/data1/userdata/khoo/Data15/xAOD_20.7/mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.merge.AOD.e3698_s2608_s2183_r7725_r7676/AOD.07915894._000339.pool.root.1", - #"user.valentem.mc15_13TeV.361107.merge.DAOD_JETM3.e3601_s2576_s2132_r7725_r7676.2016-08-31_EXT0/user.valentem.9333594.EXT0._000547.DAOD_JETM3.test.pool.root" - #"DAOD_JETM3.MC15.pool.root" - "/atlas/data1/userdata/valentem/PFlow/AODs/user.valentem.mc15_13TeV.361107.merge.DAOD_JETM3.e3601_s2576_s2132_r7725_r7676.2016-09-04_EXT0/user.valentem.9354614.EXT0._002886.DAOD_JETM3.test.pool.root" - ] +from glob import glob +filelist = glob("/atlas/data1/userdata/khoo/Data16/AOD_r21/data16_13TeV.00302347.express_express.recon.AOD.r9112/*") + athenaCommonFlags.FilesInput = filelist ServiceMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput() from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() -topSequence += CfgMgr.met__METAssocTestAlg("TestMETAssocEMTopo", - #OutputLevel=VERBOSE, - FailOnInconsistency=True) -topSequence += CfgMgr.met__METAssocTestAlg("TestMETAssocEMPFlow", - #OutputLevel=VERBOSE, - FailOnInconsistency=True, - METMapSuffix="AntiKt4EMPFlow") +from GaudiSequencer.PyComps import PyEvtFilter +filterseq = CfgMgr.AthSequencer("AthFilterSeq") +#the following lines are examples, pick one... +filterseq += PyEvtFilter("PVSoftTrkTail", evt_list=[ + 106239409, + 103677144, + 210091212, + 647377331, + 649083254, + 679943194, + 676957592, + 931088975, + 930867220, + 932105457, + 932761543, + 500249532, + 498552012, + 8093981, + 7747623, + 9713934, + ]) +topSequence += filterseq + +filterseq += CfgMgr.met__METAssocTestAlg("TestMETAssocEMTopo", + OutputLevel=VERBOSE, + FailOnInconsistency=True) +filterseq += CfgMgr.met__METAssocTestAlg("TestMETAssocEMPFlow", + OutputLevel=VERBOSE, + FailOnInconsistency=True, + METMapSuffix="AntiKt4EMPFlow") -theApp.EvtMax = -1 +theApp.EvtMax = 5000 ServiceMgr.EventSelector.SkipEvents = 0 ServiceMgr.MessageSvc.defaultLimit = 9999 diff --git a/Reconstruction/MET/METReconstruction/share/RunMETReco_Associator_AOD.py b/Reconstruction/MET/METReconstruction/share/RunMETReco_Associator_AOD.py index c4aa17de227d2d350ca64b728358fe5484f28aff..d429f5fec49d67cea31d17905710cd98c54ded70 100644 --- a/Reconstruction/MET/METReconstruction/share/RunMETReco_Associator_AOD.py +++ b/Reconstruction/MET/METReconstruction/share/RunMETReco_Associator_AOD.py @@ -1,32 +1,16 @@ -options=locals() -options.setdefault('EvtMax',10) -options.setdefault('UseIsolationTools',True) -options.setdefault('Inputfile',"/home/masaito/maxi183/datafiles/mc15_13TeV/AOD/mc15_13TeV.361107.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zmumu.merge.AOD.e3601_s2576_s2132_r7725_r7676/AOD.07918963._000185.pool.root.1") -options.setdefault('Outputfile',"xAOD.pool.root") - import AthenaPoolCnvSvc.ReadAthenaPool from AthenaCommon.AthenaCommonFlags import athenaCommonFlags from AthenaCommon.AppMgr import ServiceMgr from AthenaCommon import CfgMgr -#import METReconstruction.METConfig_Calo - from RecExConfig.RecFlags import rec -#if rec.doTruth: -# import METReconstruction.METConfig_Truth - -filelist = [#"valid2.110401.PowhegPythia_P2012_ttbar_nonallhad.recon.AOD.e3099_s2578_r7226/AOD.06803710._000047.pool.root.1", - #"valid2.110401.PowhegPythia_P2012_ttbar_nonallhad.recon.AOD.e3099_s2578_r7226/AOD.06803710._000254.pool.root.1", -# "myESD.pool.root" -# "/atlas/data1/userdata/khoo/Data15/mc15_ESD/mc15_13TeV.422008.ParticleGun_single_ele_Pt100.recon.ESD.e4459_s2726_r7143_tid06642056_00/ESD.06642056._000021.pool.root.1" -# "/atlas/data1/userdata/khoo/Data15/mc15_ESD/mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.recon.ESD.e3698_s2608_s2183_r7509_tid07497143_00/ESD.07497143._000004.pool.root.1" -# "/atlas/data1/userdata/khoo/Data15/xAOD_20.7/mc15_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.merge.AOD.e3698_s2608_s2183_r7725_r7676/AOD.07915894._000339.pool.root.1" -# "/home/masaito/data4/QualificationTask/MakeMETReconstruction_aodtoaod3_2/test01/run/output_new/AODM/output.AOD.pool.root" -# "/home/masaito/maxi183/datafiles/mc15_13TeV/AOD/mc15_13TeV.361107.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zmumu.merge.AOD.e3601_s2576_s2132_r7725_r7676/AOD.07918963._000185.pool.root.1" - ] + +from glob import glob +filelist = glob("/atlas/data1/userdata/khoo/Data16/AOD_r21/data16_13TeV.00302347.express_express.recon.AOD.r9112/*") + from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -#athenaCommonFlags.FilesInput = filelist -athenaCommonFlags.FilesInput = [Inputfile] +athenaCommonFlags.FilesInput = filelist +#athenaCommonFlags.FilesInput = [Inputfile] ServiceMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput() ############################################################################ @@ -36,7 +20,7 @@ from AthenaCommon.GlobalFlags import globalflags globalflags.DetGeo = 'atlas' from RecExConfig.InputFilePeeker import inputFileSummary -print inputFileSummary +#print inputFileSummary if inputFileSummary['evt_type'][0] == 'IS_DATA': globalflags.DataSource = 'data' else: @@ -49,37 +33,39 @@ DetFlags.detdescr.all_setOff() #DetFlags.detdescr.Calo_setOn() if hasattr(DetFlags,'BField_on'): DetFlags.BField_setOn() include('RecExCond/AllDet_detDescr.py') -include('TrkDetDescrSvc/AtlasTrackingGeometrySvc.py') +from TrkDetDescrSvc.AtlasTrackingGeometrySvc import AtlasTrackingGeometrySvc from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() -############################################################################ -# Set up muon and egamma topocluster links -#egammaTCLinkAlg = CfgMgr.ClusterMatching__CaloClusterMatchLinkAlg("EgammaTCLinks", -# ClustersToDecorate="egammaClusters") -#egammatopoTCLinkAlg = CfgMgr.ClusterMatching__CaloClusterMatchLinkAlg("TopoEgammaTCLinks", -# ClustersToDecorate="egammaTopoSeededClusters") -#muonTCLinkAlg = CfgMgr.ClusterMatching__CaloClusterMatchLinkAlg("MuonTCLinks", -# ClustersToDecorate="MuonClusterCollection", -# UseLeadCellEtaPhi=True) -#topSequence += egammaTCLinkAlg -#topSequence += egammatopoTCLinkAlg -# topSequence += muonTCLinkAlg - -# Set up default configurations -#import METReconstruction.METConfig_Associator - -#include('RecExCond/AllDet_detDescr.py') -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() +from GaudiSequencer.PyComps import PyEvtFilter +filterseq = CfgMgr.AthSequencer("AthFilterSeq") +#the following lines are examples, pick one... +# filterseq += PyEvtFilter("PVSoftTrkTail", evt_list=[ +# # 106239409, +# # 103677144, +# # 210091212, +# # 647377331, +# # 649083254, +# # 679943194, +# # 676957592, +# # 931088975, +# # 930867220, +# # 932105457, +# # 932761543, +# # 500249532, +# # 498552012, +# # 8093981, +# # 7747623, +# # 9713934, +# ]) +topSequence += filterseq ############################################################################ # Set up an extra associator for testing from METReconstruction.METRecoFlags import metFlags -from METReconstruction.METAssocConfig_readAOD import AssocConfig, METAssocConfig +from METReconstruction.METAssocConfig import AssocConfig, METAssocConfig JetType = 'EMJet' -#todo check pflow associators = [AssocConfig(JetType), AssocConfig('Muon'), @@ -90,29 +76,55 @@ associators = [AssocConfig(JetType), cfg_akt4em = METAssocConfig('NewAntiKt4EMTopo', associators, doPFlow=False, - doOriginCorrClus=False + doOriginCorrClus=True ) -for assoc in cfg_akt4em.assoclist: - assoc.UseIsolationTools=UseIsolationTools metFlags.METAssocConfigs()[cfg_akt4em.suffix] = cfg_akt4em metFlags.METAssocOutputList().append(cfg_akt4em.suffix) +############################################################################ +# Set up an extra associator for testing +JetType = 'PFlowJet' + +associators = [AssocConfig(JetType), + AssocConfig('Muon'), + AssocConfig('Ele'), + AssocConfig('Gamma'), + AssocConfig('Tau'), + AssocConfig('Soft')] +cfg_akt4pf = METAssocConfig('NewAntiKt4EMPFlow', + associators, + doPFlow=True, + ) + +metFlags.METAssocConfigs()[cfg_akt4pf.suffix] = cfg_akt4pf +metFlags.METAssocOutputList().append(cfg_akt4pf.suffix) + from METReconstruction.METAssocConfig import getMETAssocAlg # Get the configuration directly from METRecoFlags # Can also provide a dict of configurations or list of RecoTools or both metAlg = getMETAssocAlg('METAssociation') -topSequence += metAlg +filterseq += metAlg from METUtilities.METMakerConfig import getMETMakerAlg -for key,conf in metFlags.METAssocConfigs().iteritems(): - if not conf.doTruth: - makerAlg = getMETMakerAlg(conf.suffix,jetColl="AntiKt4EMTopoJets") - topSequence += makerAlg -#ToolSvc.METMaker_NewAntiKt4EMTopo.OutputLevel = DEBUG - -from METReconstruction.METRecoConfig import METConfig,BuildConfig +makerAlgEM = getMETMakerAlg("NewAntiKt4EMTopo",jetColl="AntiKt4EMTopoJets") +# ToolSvc.METMaker_NewAntiKt4EMTopo.OutputLevel=VERBOSE +ToolSvc.METMaker_NewAntiKt4EMTopo.DoRemoveElecTrks=False +filterseq += makerAlgEM +makerAlgPF = getMETMakerAlg("NewAntiKt4EMPFlow",jetColl="AntiKt4EMPFlowJets") +# ToolSvc.METMaker_NewAntiKt4EMPFlow.OutputLevel=VERBOSE +ToolSvc.METMaker_NewAntiKt4EMPFlow.DoRemoveElecTrks=False +filterseq += makerAlgPF + +# filterseq += CfgMgr.met__METAssocTestAlg("TestMETAssocEMTopo", +# OutputLevel=VERBOSE, +# FailOnInconsistency=True, +# METMapSuffix="NewAntiKt4EMTopo") +# filterseq += CfgMgr.met__METAssocTestAlg("TestMETAssocEMPFlow", +# OutputLevel=VERBOSE, +# FailOnInconsistency=True, +# METMapSuffix="NewAntiKt4EMPFlow") write_xAOD = True if write_xAOD: @@ -123,13 +135,17 @@ if write_xAOD: protectedInclude("METReconstruction/METReconstructionOutputAODList_jobOptions.py") from OutputStreamAthenaPool.MultipleStreamManager import MSMgr - xaodStream = MSMgr.NewPoolRootStream( "StreamAOD", Outputfile ) + xaodStream = MSMgr.NewPoolRootStream( "StreamAOD", "xAOD3.pool.root" ) for item in MissingETAODList: xaodStream.AddItem(item) - xaodStream.AddItem('xAOD::MissingETContainer#MET_Reference_AntiKt4EMTopo') - xaodStream.AddItem('xAOD::MissingETAuxContainer#MET_Reference_AntiKt4EMTopoAux.') + xaodStream.AddItem('xAOD::MissingETContainer#MET_Reference_Anti*') + xaodStream.AddItem('xAOD::MissingETAuxContainer#MET_Reference_Anti*Aux.') + + xaodStream.AddItem('xAOD::TrackParticleContainer#InDetTrackParticles*') + xaodStream.AddItem('xAOD::TrackParticleAuxContainer#InDetTrackParticlesAux.') -theApp.EvtMax = EvtMax + # xaodStream.AddAcceptAlgs( "PVSoftTrkTail" ) +theApp.EvtMax = 200 ServiceMgr.EventSelector.SkipEvents = 0 ServiceMgr.MessageSvc.defaultLimit = 9999 diff --git a/Reconstruction/MET/METReconstruction/share/simpleMETRecoJobO.py b/Reconstruction/MET/METReconstruction/share/simpleMETRecoJobO.py new file mode 100644 index 0000000000000000000000000000000000000000..a868201e9c11930922f9ce8f593a1903d7b0b39b --- /dev/null +++ b/Reconstruction/MET/METReconstruction/share/simpleMETRecoJobO.py @@ -0,0 +1,100 @@ +# MET standalone reconstruction jobOptions + +infile = "/atlas/data1/userdata/khoo/Data16/AOD_r21/mc16_13TeV.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.merge.AOD.e3698_s2997_r8903_r8906/AOD.10226638._000244.pool.root.1" +from AthenaCommon.AppMgr import ServiceMgr +import AthenaPoolCnvSvc.ReadAthenaPool +ServiceMgr.EventSelector.InputCollections = [infile] + +theApp.EvtMax = 50 + +from METReconstruction.METAssocConfig import AssocConfig, getAssociator +from AthenaCommon.AlgSequence import AlgSequence +topSequence = AlgSequence() + +from AthenaCommon import CfgMgr +trkseltool=CfgMgr.InDet__InDetTrackSelectionTool("IDTrkSel_METAssoc", + CutLevel="TightPrimary", + maxZ0SinTheta=3, + maxD0=2) +from AthenaCommon.AppMgr import ToolSvc +ToolSvc += trkseltool + + +import cppyy +try: cppyy.loadDictionary('METReconstructionDict') +except: pass +from ROOT import met +assocList = [ + CfgMgr.met__METJetAssocTool('MET_EMJetAssocTool__AthenaMT', + InputCollection="AntiKt4EMTopoJets"), + CfgMgr.met__METMuonAssociator('MET_MuonAssociator__AthenaMT', + InputCollection="Muons"), + CfgMgr.met__METElectronAssociator('MET_ElectronAssociator__AthenaMT', + InputCollection="Electrons", + TCMatchMethod=met.ClusterLink), + CfgMgr.met__METPhotonAssociator('MET_PhotonAssociator__AthenaMT', + InputCollection="Photons", + TCMatchMethod=met.ClusterLink), + CfgMgr.met__METTauAssociator('MET_TauAssociator__AthenaMT', + InputCollection = "TauJets"), + CfgMgr.met__METSoftAssociator('MET_SoftAssociator__AthenaMT', + DecorateSoftConst = True, + LCModClusterKey = "LCOriginTopoClusters", + EMModClusterKey = "EMOriginTopoClusters") + ] +for assoc in assocList: + assoc.UseModifiedClus=True + assoc.ClusColl = "EMOriginTopoClusters" + assoc.TrackSelectorTool = trkseltool + #assoc.TrackIsolationTool = trkisotool + #assoc.CaloIsolationTool = caloisotool + ToolSvc += assoc + +EMAssocTool = CfgMgr.met__METAssociationTool('MET_AssociationTool_AntiKt4EMTopo', + METAssociators = assocList, + METSuffix = 'MTAntiKt4EMTopo', + TCSignalState=0) # EM clusters +ToolSvc += EMAssocTool + +METAssocAlg_MT = CfgMgr.met__METRecoAlg(name='METAssociation_MT',RecoTools=[EMAssocTool]) +topSequence += METAssocAlg_MT + +metMaker = CfgMgr.met__METMaker('METMaker_MTAntiKt4EMTopo', + DoPFlow=False, + DoSoftTruth=False, + JetSelection="Tier0", + ); +ToolSvc += metMaker + +makerAlg = CfgMgr.met__METMakerAlg('METMakerAlg_MTAntiKt4EMTopo', + METMapName='METAssoc_MTAntiKt4EMTopo', + METCoreName='MET_Core_MTAntiKt4EMTopo', + METName='MET_Reference_MTAntiKt4EMTopo', + InputJets="AntiKt4EMTopoJets", + Maker=metMaker, + MuonSelectionTool=None, + ElectronLHSelectionTool=None, + PhotonIsEMSelectionTool=None, + TauSelectionTool=None, + ) +topSequence += makerAlg + + +write_xAOD = True +if write_xAOD: + from OutputStreamAthenaPool.MultipleStreamManager import MSMgr + xaodStream = MSMgr.NewPoolRootStream( "StreamAOD", "xAOD.pool.root" ) + xaodStream.AddItem("xAOD::EventInfo#EventInfo") + xaodStream.AddItem("xAOD::EventAuxInfo#EventInfoAux.") + # + xaodStream.AddItem("xAOD::MissingETAssociationMap#MET_Assoc_AntiKt4EMTopo") + xaodStream.AddItem("xAOD::MissingETAuxAssociationMap#MET_Assoc_AntiKt4EMTopoAux.") + xaodStream.AddItem("xAOD::MissingETAssociationMap#MET_Assoc_MTAntiKt4EMTopo") + xaodStream.AddItem("xAOD::MissingETAuxAssociationMap#MET_Assoc_MTAntiKt4EMTopoAux.") + # + xaodStream.AddItem("xAOD::MissingETContainer#MET_Reference_AntiKt4EMTopo") + xaodStream.AddItem("xAOD::MissingETAuxContainer#MET_Reference_AntiKt4EMTopoAux.") + xaodStream.AddItem("xAOD::MissingETContainer#MET_Reference_MTAntiKt4EMTopo") + xaodStream.AddItem("xAOD::MissingETAuxContainer#MET_Reference_MTAntiKt4EMTopoAux.") + + diff --git a/Reconstruction/MET/METUtilities/Root/METMaker.cxx b/Reconstruction/MET/METUtilities/Root/METMaker.cxx index 22c6ed576e9ca61255c315b9aa1e77d4d3155ec5..4c05de2aa0de4f0e2331e28b28e04ba9a4b182c7 100644 --- a/Reconstruction/MET/METUtilities/Root/METMaker.cxx +++ b/Reconstruction/MET/METUtilities/Root/METMaker.cxx @@ -584,6 +584,14 @@ namespace met { bool caloverlap = false; caloverlap = calvec.ce()>0; ATH_MSG_DEBUG("Jet " << jet->index() << " is " << ( caloverlap ? "" : "non-") << "overlapping"); + if(caloverlap) { + for(const auto& object : assoc->objects()) { + if(assoc->objSelected(object)) { + ATH_MSG_VERBOSE(" Jet overlaps with " << object->type() << " " << object->index() + << " with pt " << object->pt() << ", phi " << object->phi() ); + } + } + } xAOD::JetFourMom_t constjet; double constSF(1); @@ -638,7 +646,7 @@ namespace met { if(obj->type()==xAOD::Type::Muon && !m_useGhostMuons) { const xAOD::Muon* mu_test(static_cast<const xAOD::Muon*>(obj)); ATH_MSG_VERBOSE("Muon " << mu_test->index() << " found in jet " << jet->index()); - if((m_doRemoveMuonJets || m_doSetMuonJetEMScale) && acc_ghostMuons.isAvailable(*jet)) { + if((m_doRemoveMuonJets || m_doSetMuonJetEMScale)) { if(acc_originalObject.isAvailable(*mu_test)) mu_test = static_cast<const xAOD::Muon*>(*acc_originalObject(*mu_test)); if(MissingETComposition::objSelected(map,mu_test)) { // muons_in_jet.push_back(mu_test); @@ -952,7 +960,6 @@ namespace met { if(acc_originalObject.isAvailable(*mu_test)) mu_test = static_cast<const xAOD::Muon*>(*acc_originalObject(*mu_test)); if(MissingETComposition::objSelected(map,mu_test)) { // float mu_Eloss = acc_Eloss(*mu_test); - switch(mu_test->energyLossType()) { case xAOD::Muon::Parametrized: case xAOD::Muon::MOP: diff --git a/Reconstruction/MET/METUtilities/src/METMakerAlg.cxx b/Reconstruction/MET/METUtilities/src/METMakerAlg.cxx index c3fd7b8f65e1037a4d21d5603f021e50a4e2b52f..225738f4440aee48deee1046349d2750ac49472e 100644 --- a/Reconstruction/MET/METUtilities/src/METMakerAlg.cxx +++ b/Reconstruction/MET/METUtilities/src/METMakerAlg.cxx @@ -75,31 +75,32 @@ namespace met { ATH_MSG_INFO("Retrieving tools..."); // retrieve tools - if( m_metmaker.retrieve().isFailure() ) { + if ( m_metmaker.retrieve().isFailure() ) { ATH_MSG_ERROR("Failed to retrieve tool: " << m_metmaker->name()); return StatusCode::FAILURE; - }; - - if( m_muonSelTool.retrieve().isFailure() ) { - ATH_MSG_ERROR("Failed to retrieve tool: " << m_muonSelTool->name()); - return StatusCode::FAILURE; - }; - - if( m_elecSelLHTool.retrieve().isFailure() ) { - ATH_MSG_ERROR("Failed to retrieve tool: " << m_elecSelLHTool->name()); - return StatusCode::FAILURE; - }; - - if( m_photonSelIsEMTool.retrieve().isFailure() ) { - ATH_MSG_ERROR("Failed to retrieve tool: " << m_photonSelIsEMTool->name()); - return StatusCode::FAILURE; - }; - - if( m_tauSelTool.retrieve().isFailure() ) { - ATH_MSG_ERROR("Failed to retrieve tool: " << m_tauSelTool->name()); - return StatusCode::FAILURE; - }; + } +// +// if ( m_muonSelTool.retrieve().isFailure() ) { +// ATH_MSG_ERROR("Failed to retrieve tool: " << m_muonSelTool->name()); +// return StatusCode::FAILURE; +// } +// +// if ( m_elecSelLHTool.retrieve().isFailure() ) { +// ATH_MSG_ERROR("Failed to retrieve tool: " << m_elecSelLHTool->name()); +// return StatusCode::FAILURE; +// } +// +// if ( m_photonSelIsEMTool.retrieve().isFailure() ) { +// ATH_MSG_ERROR("Failed to retrieve tool: " << m_photonSelIsEMTool->name()); +// return StatusCode::FAILURE; +// } +// +// if ( m_tauSelTool.retrieve().isFailure() ) { +// ATH_MSG_ERROR("Failed to retrieve tool: " << m_tauSelTool->name()); +// return StatusCode::FAILURE; +// } +// return StatusCode::SUCCESS; } @@ -293,22 +294,22 @@ namespace met { bool METMakerAlg::accept(const xAOD::Muon* mu) { if( mu->pt()<2.5e3 || mu->pt()/cosh(mu->eta())<4e3 ) return false; - return m_muonSelTool->accept(*mu); + return m_muonSelTool.empty() || m_muonSelTool->accept(*mu); } bool METMakerAlg::accept(const xAOD::Electron* el) { if( fabs(el->eta())>2.47 || el->pt()<10e3 ) return false; - return m_elecSelLHTool->accept(*el); + return m_elecSelLHTool.empty() || m_elecSelLHTool->accept(*el); } bool METMakerAlg::accept(const xAOD::Photon* ph) { if( !(ph->author()&20) || fabs(ph->eta())>2.47 || ph->pt()<10e3 ) return false; - return m_photonSelIsEMTool->accept(ph); + return m_photonSelIsEMTool.empty() || m_photonSelIsEMTool->accept(ph); } bool METMakerAlg::accept(const xAOD::TauJet* tau) - { return m_tauSelTool->accept( *tau ); } + { return m_tauSelTool.empty() || m_tauSelTool->accept( *tau ); } }