diff --git a/Configuration/EventContent/python/EventContent_cff.py b/Configuration/EventContent/python/EventContent_cff.py index 396b424cd3da2..927c439e01b94 100644 --- a/Configuration/EventContent/python/EventContent_cff.py +++ b/Configuration/EventContent/python/EventContent_cff.py @@ -692,7 +692,16 @@ def SwapKeepAndDrop(l): ]) phase2_muon.toModify(FEVTDEBUGHLTEventContent, - outputCommands = FEVTDEBUGHLTEventContent.outputCommands + ['keep recoMuons_muons1stStep_*_*']) + outputCommands = FEVTDEBUGHLTEventContent.outputCommands + [ + 'keep recoMuons_muons1stStep_*_*', + 'keep *_hltL2MuonSeedsFromL1TkMuon_*_*', + 'keep *_hltL2MuonsFromL1TkMuon_*_*', + 'keep *_hltIter2Phase2L3FromL1TkMuonMerged_*_*', + 'keep *_hltPhase2L3OIMuonTrackSelectionHighPurity_*_*', + 'keep *_hltPhase2L3MuonMerged_*_*', + 'keep *_hltPhase2L3GlbMuon_*_*', + 'keep *_hltPhase2L3MuonsNoID_*_*', + 'keep *_hltPhase2L3Muons_*_*']) phase2_hgcal.toModify(FEVTDEBUGHLTEventContent, outputCommands = FEVTDEBUGHLTEventContent.outputCommands + TICL_FEVTHLT.outputCommands) diff --git a/HLTriggerOffline/Common/python/HLTValidationHarvest_cff.py b/HLTriggerOffline/Common/python/HLTValidationHarvest_cff.py index a1af4fbd96783..27a9a40f89e26 100644 --- a/HLTriggerOffline/Common/python/HLTValidationHarvest_cff.py +++ b/HLTriggerOffline/Common/python/HLTValidationHarvest_cff.py @@ -42,11 +42,9 @@ # Temporary Phase-2 configuration # Exclude everything except JetMET for now from Configuration.Eras.Modifier_phase2_common_cff import phase2_common -phase2_common.toReplaceWith(hltpostvalidation, hltpostvalidation.copyAndExclude([HLTMuonPostVal, - HLTTauPostVal, +phase2_common.toReplaceWith(hltpostvalidation, hltpostvalidation.copyAndExclude([HLTTauPostVal, EgammaPostVal, postProcessorHLTgsfTrackingSequence, - postProcessorHLTmuonTrackingSequence, heavyFlavorValidationHarvestingSequence, #JetMETPostVal, #HLTAlCaPostVal, diff --git a/SimMuon/MCTruth/plugins/Phase2SeedToTrackProducer.h b/SimMuon/MCTruth/plugins/Phase2SeedToTrackProducer.h new file mode 100644 index 0000000000000..12fe7141af582 --- /dev/null +++ b/SimMuon/MCTruth/plugins/Phase2SeedToTrackProducer.h @@ -0,0 +1,17 @@ +#ifndef SimMuon_MCTruth_Phase2SeedToTrackProducer_h +#define SimMuon_MCTruth_Phase2SeedToTrackProducer_h + +/** \class SeedToTrackProducer + * + * SeedToTrackProducerBase class specialized for Phase 2 + * Muon seeds + * + * \author Luca Ferragina (INFN BO), 2024 + */ + +#include "SimMuon/MCTruth/plugins/SeedToTrackProducerBase.h" +#include "DataFormats/MuonSeed/interface/L2MuonTrajectorySeedCollection.h" + +typedef SeedToTrackProducerBase Phase2SeedToTrackProducer; + +#endif diff --git a/SimMuon/MCTruth/plugins/SealModule.cc b/SimMuon/MCTruth/plugins/SealModule.cc index cf557981fe9d6..b2988b656c8c3 100644 --- a/SimMuon/MCTruth/plugins/SealModule.cc +++ b/SimMuon/MCTruth/plugins/SealModule.cc @@ -2,6 +2,10 @@ #include "FWCore/PluginManager/interface/ModuleDef.h" #include "SimMuon/MCTruth/interface/CSCTruthTest.h" #include "SimMuon/MCTruth/plugins/MuonAssociatorEDProducer.h" +#include "SimMuon/MCTruth/plugins/SeedToTrackProducer.h" +#include "SimMuon/MCTruth/plugins/Phase2SeedToTrackProducer.h" DEFINE_FWK_MODULE(MuonAssociatorEDProducer); DEFINE_FWK_MODULE(CSCTruthTest); +DEFINE_FWK_MODULE(SeedToTrackProducer); +DEFINE_FWK_MODULE(Phase2SeedToTrackProducer); diff --git a/SimMuon/MCTruth/plugins/SeedToTrackProducer.h b/SimMuon/MCTruth/plugins/SeedToTrackProducer.h index eda27d0128d8a..c70eb1f14e8f6 100644 --- a/SimMuon/MCTruth/plugins/SeedToTrackProducer.h +++ b/SimMuon/MCTruth/plugins/SeedToTrackProducer.h @@ -1,67 +1,17 @@ -// -*- C++ -*- -// -// Package: SeedToTrackProducer -// Class: SeedToTrackProducer -// -/**\class SeedToTrackProducer SeedToTrackProducer.cc - hugues/SeedToTrackProducer/plugins/SeedToTrackProducer.cc - - Description: - -*/ -// -// Original Author: Hugues Brun -// Created: Tue, 05 Nov 2013 13:42:04 GMT -// $Id$ -// -// -// system include files -#include - -// user include files -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/global/EDProducer.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "MagneticField/Engine/interface/MagneticField.h" -#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" - -#include "Geometry/CommonDetUnit/interface/GeomDet.h" -#include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h" -#include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h" - -#include "TrackingTools/Records/interface/TransientRecHitRecord.h" -#include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h" -#include "TrackingTools/TransientTrack/interface/TransientTrack.h" -#include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHitBuilder.h" - -#include "DataFormats/TrackReco/interface/Track.h" -#include "DataFormats/TrackReco/interface/TrackFwd.h" +#ifndef SimMuon_MCTruth_SeedToTrackProducer_h +#define SimMuon_MCTruth_SeedToTrackProducer_h + +/** \class SeedToTrackProducer + * + * SeedToTrackProducerBase class specialized for Phase 1 + * Muon seeds + * + * \author Luca Ferragina (INFN BO), 2024 + */ + +#include "SimMuon/MCTruth/plugins/SeedToTrackProducerBase.h" #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h" -// -// class declaration -// - -typedef math::Error<5>::type CovarianceMatrix; - -class SeedToTrackProducer : public edm::global::EDProducer<> { -public: - explicit SeedToTrackProducer(const edm::ParameterSet &); - -private: - void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const final; - TrajectoryStateOnSurface seedTransientState(const TrajectorySeed &, - const MagneticField &, - const GlobalTrackingGeometry &) const; - // ----------member data --------------------------- - - edm::EDGetTokenT L2seedsTagT_; - edm::EDGetTokenT> L2seedsTagS_; +typedef SeedToTrackProducerBase SeedToTrackProducer; - const edm::ESGetToken theMGFieldToken; - const edm::ESGetToken theTrackingGeometryToken; - const edm::ESGetToken theTopoToken; -}; +#endif diff --git a/SimMuon/MCTruth/plugins/SeedToTrackProducer.cc b/SimMuon/MCTruth/plugins/SeedToTrackProducerBase.cc similarity index 76% rename from SimMuon/MCTruth/plugins/SeedToTrackProducer.cc rename to SimMuon/MCTruth/plugins/SeedToTrackProducerBase.cc index 22e92ad92964b..fb824635d83b0 100644 --- a/SimMuon/MCTruth/plugins/SeedToTrackProducer.cc +++ b/SimMuon/MCTruth/plugins/SeedToTrackProducerBase.cc @@ -1,34 +1,28 @@ -// -*- C++ -*- -// -// Package: SeedToTrackProducer -// Class: SeedToTrackProducer -// -/**\class SeedToTrackProducer SeedToTrackProducer.cc - hugues/SeedToTrackProducer/plugins/SeedToTrackProducer.cc - - Description: [one line class summary] - - Implementation: - [Notes on implementation] -*/ -// -// Original Author: Hugues Brun -// Created: Tue, 05 Nov 2013 13:42:04 GMT -// $Id$ -// -// +/** \class SeedToTrackProducerBase + * + * See header file for a description of the class + * + * \author Hugues Brun + */ -#include "SeedToTrackProducer.h" +#include "SimMuon/MCTruth/plugins/SeedToTrackProducerBase.h" #include "DataFormats/TrackerCommon/interface/TrackerTopology.h" #include "Geometry/Records/interface/TrackerTopologyRcd.h" +#include "DataFormats/TrajectorySeed/interface/TrajectorySeed.h" +#include "DataFormats/MuonSeed/interface/L2MuonTrajectorySeed.h" + +template class SeedToTrackProducerBase>; +template class SeedToTrackProducerBase>; + // // constructors and destructor // -SeedToTrackProducer::SeedToTrackProducer(const edm::ParameterSet &iConfig) +template +SeedToTrackProducerBase::SeedToTrackProducerBase(const edm::ParameterSet &iConfig) : theMGFieldToken(esConsumes()), theTrackingGeometryToken(esConsumes()), theTopoToken(esConsumes()) { - L2seedsTagT_ = consumes(iConfig.getParameter("L2seedsCollection")); + L2seedsTagT_ = consumes(iConfig.getParameter("L2seedsCollection")); L2seedsTagS_ = consumes>(iConfig.getParameter("L2seedsCollection")); produces(); @@ -41,7 +35,10 @@ SeedToTrackProducer::SeedToTrackProducer(const edm::ParameterSet &iConfig) // // ------------ method called to produce the data ------------ -void SeedToTrackProducer::produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const { +template +void SeedToTrackProducerBase::produce(edm::StreamID, + edm::Event &iEvent, + const edm::EventSetup &iSetup) const { using namespace edm; using namespace std; @@ -63,13 +60,13 @@ void SeedToTrackProducer::produce(edm::StreamID, edm::Event &iEvent, const edm:: const TrackerTopology &ttopo = iSetup.getData(theTopoToken); // now read the L2 seeds collection : - edm::Handle L2seedsCollection; + edm::Handle L2seedsCollection; iEvent.getByToken(L2seedsTagT_, L2seedsCollection); - const std::vector *L2seeds = nullptr; + const std::vector *L2seeds = nullptr; if (L2seedsCollection.isValid()) L2seeds = L2seedsCollection.product(); else - edm::LogError("SeedToTrackProducer") << "L2 seeds collection not found !! " << endl; + edm::LogError("SeedToTrackProducerBase") << "L2 seeds collection not found !! " << endl; edm::Handle> seedHandle; iEvent.getByToken(L2seedsTagS_, seedHandle); @@ -82,13 +79,13 @@ void SeedToTrackProducer::produce(edm::StreamID, edm::Event &iEvent, const edm:: float seedPhi = theTrajectory.globalMomentum().phi(); float seedPt = theTrajectory.globalMomentum().perp(); CovarianceMatrix matrixSeedErr = theTrajectory.curvilinearError().matrix(); - edm::LogVerbatim("SeedToTrackProducer") + edm::LogVerbatim("SeedToTrackProducerBase") << "seedPt=" << seedPt << " seedEta=" << seedEta << " seedPhi=" << seedPhi << endl; /*AlgebraicSymMatrix66 errors = theTrajectory.cartesianError().matrix(); double partialPterror = errors(3,3)*pow(theTrajectory.globalMomentum().x(),2) + errors(4,4)*pow(theTrajectory.globalMomentum().y(),2); - edm::LogVerbatim("SeedToTrackProducer") << "seedPtError=" << + edm::LogVerbatim("SeedToTrackProducerBase") << "seedPtError=" << sqrt(partialPterror)/theTrajectory.globalMomentum().perp() << "seedPhiError=" << theTrajectory.curvilinearError().matrix()(2,2) << endl;*/ // fill the track in a way that its pt, phi and eta will be the same as the @@ -122,9 +119,9 @@ void SeedToTrackProducer::produce(edm::StreamID, edm::Event &iEvent, const edm:: (L2seeds->at(i)).direction(), seed); theTrack.setExtra(reco::TrackExtraRef(rTrackExtras, idx++)); - edm::LogVerbatim("SeedToTrackProducer") + edm::LogVerbatim("SeedToTrackProducerBase") << "trackPt=" << theTrack.pt() << " trackEta=" << theTrack.eta() << " trackPhi=" << theTrack.phi() << endl; - edm::LogVerbatim("SeedToTrackProducer") + edm::LogVerbatim("SeedToTrackProducerBase") << "trackPtError=" << theTrack.ptError() << "trackPhiError=" << theTrack.phiError() << endl; // fill the seed segments in the track @@ -145,9 +142,9 @@ void SeedToTrackProducer::produce(edm::StreamID, edm::Event &iEvent, const edm:: iEvent.put(std::move(selectedTrackHits)); } -TrajectoryStateOnSurface SeedToTrackProducer::seedTransientState(const TrajectorySeed &tmpSeed, - const MagneticField &mgField, - const GlobalTrackingGeometry &trackingGeometry) const { +template +TrajectoryStateOnSurface SeedToTrackProducerBase::seedTransientState( + const SeedType &tmpSeed, const MagneticField &mgField, const GlobalTrackingGeometry &trackingGeometry) const { PTrajectoryStateOnDet tmpTSOD = tmpSeed.startingState(); DetId tmpDetId(tmpTSOD.detId()); const GeomDet *tmpGeomDet = trackingGeometry.idToDet(tmpDetId); @@ -155,6 +152,3 @@ TrajectoryStateOnSurface SeedToTrackProducer::seedTransientState(const Trajector trajectoryStateTransform::transientState(tmpTSOD, &(tmpGeomDet->surface()), &mgField); return tmpTSOS; } - -// define this as a plug-in -DEFINE_FWK_MODULE(SeedToTrackProducer); diff --git a/SimMuon/MCTruth/plugins/SeedToTrackProducerBase.h b/SimMuon/MCTruth/plugins/SeedToTrackProducerBase.h new file mode 100644 index 0000000000000..46764652ad840 --- /dev/null +++ b/SimMuon/MCTruth/plugins/SeedToTrackProducerBase.h @@ -0,0 +1,70 @@ +#ifndef SimMuon_MCTruth_SeedToTrackProducerBase_h +#define SimMuon_MCTruth_SeedToTrackProducerBase_h + +/** \class SeedToTrackProducerBase + * + * Base class used to produce MuonTracks from seeds + * + * \author Hugues Brun + * Created: Tue, 05 Nov 2013 13:42:04 GMT + * + * Modified to be templated on the seed collection type + * to make it compatible with Phase 2 seeds + * \author Luca Ferragina (INFN BO), 2024 + */ + +// system include files +#include + +// user include files +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/Framework/interface/global/EDProducer.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "MagneticField/Engine/interface/MagneticField.h" +#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" + +#include "Geometry/CommonDetUnit/interface/GeomDet.h" +#include "Geometry/CommonDetUnit/interface/GlobalTrackingGeometry.h" +#include "Geometry/Records/interface/GlobalTrackingGeometryRecord.h" + +#include "TrackingTools/Records/interface/TransientRecHitRecord.h" +#include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h" +#include "TrackingTools/TransientTrack/interface/TransientTrack.h" +#include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHitBuilder.h" + +#include "DataFormats/TrackReco/interface/Track.h" +#include "DataFormats/TrackReco/interface/TrackFwd.h" +#include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h" + +// +// class declaration +// + +typedef math::Error<5>::type CovarianceMatrix; + +template +class SeedToTrackProducerBase : public edm::global::EDProducer<> { +public: + explicit SeedToTrackProducerBase(const edm::ParameterSet &); + +private: + void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const final; + + using SeedType = typename SeedCollection::value_type; + TrajectoryStateOnSurface seedTransientState(const SeedType &, + const MagneticField &, + const GlobalTrackingGeometry &) const; + // ----------member data --------------------------- + + edm::EDGetTokenT L2seedsTagT_; + edm::EDGetTokenT> L2seedsTagS_; + + const edm::ESGetToken theMGFieldToken; + const edm::ESGetToken theTrackingGeometryToken; + const edm::ESGetToken theTopoToken; +}; + +#endif diff --git a/SimMuon/MCTruth/python/SeedToTrackProducer_cfi.py b/SimMuon/MCTruth/python/SeedToTrackProducer_cfi.py index bd5a1031689b5..6ec9834fcb6ba 100644 --- a/SimMuon/MCTruth/python/SeedToTrackProducer_cfi.py +++ b/SimMuon/MCTruth/python/SeedToTrackProducer_cfi.py @@ -3,3 +3,11 @@ SeedToTrackProducer = cms.EDProducer('SeedToTrackProducer', L2seedsCollection = cms.InputTag("ancientMuonSeed") ) + + +Phase2SeedToTrackProducer = cms.EDProducer('Phase2SeedToTrackProducer', + L2seedsCollection = cms.InputTag("hltL2MuonSeedsFromL1TkMuon") + ) + +from Configuration.Eras.Modifier_phase2_muon_cff import phase2_muon +phase2_muon.toReplaceWith(SeedToTrackProducer, Phase2SeedToTrackProducer) \ No newline at end of file diff --git a/Validation/RecoMuon/plugins/MuonTrackValidator.cc b/Validation/RecoMuon/plugins/MuonTrackValidator.cc index 693676ba943b8..d99ccf1013816 100644 --- a/Validation/RecoMuon/plugins/MuonTrackValidator.cc +++ b/Validation/RecoMuon/plugins/MuonTrackValidator.cc @@ -4,6 +4,7 @@ #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/TrackReco/interface/TrackFwd.h" +#include "DataFormats/Math/interface/deltaR.h" #include "SimDataFormats/Track/interface/SimTrackContainer.h" #include "SimDataFormats/Vertex/interface/SimVertexContainer.h" #include "SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h" @@ -13,7 +14,7 @@ #include "SimTracker/TrackAssociation/interface/TrackingParticleIP.h" #include "TMath.h" -#include +#include using namespace std; using namespace edm; @@ -83,6 +84,33 @@ void MuonTrackValidator::bookHistograms(DQMEDAnalyzer::DQMStore::IBooker& ibooke maxPt, setBinLogX)); + h_assocpTB.push_back(ibooker.book1D("num_assoSimToReco_pT_barrel", + "N of associated tracks (simToReco) vs pT - BARREL", + nintPt, + minPt, + maxPt, + setBinLogX)); + h_simulpTB.push_back(ibooker.book1D( + "num_simul_pT_barrel", "N of simulated tracks vs pT - BARREL", nintPt, minPt, maxPt, setBinLogX)); + + h_assocpTO.push_back(ibooker.book1D("num_assoSimToReco_pT_overlap", + "N of associated tracks (simToReco) vs pT - OVERLAP", + nintPt, + minPt, + maxPt, + setBinLogX)); + h_simulpTO.push_back(ibooker.book1D( + "num_simul_pT_overlap", "N of simulated tracks vs pT - OVERLAP", nintPt, minPt, maxPt, setBinLogX)); + + h_assocpTE.push_back(ibooker.book1D("num_assoSimToReco_pT_endcap", + "N of associated tracks (simToReco) vs pT - ENCAP", + nintPt, + minPt, + maxPt, + setBinLogX)); + h_simulpTE.push_back(ibooker.book1D( + "num_simul_pT_endcap", "N of simulated tracks vs pT - ENDCAP", nintPt, minPt, maxPt, setBinLogX)); + h_recophi.push_back(ibooker.book1D("num_reco_phi", "N of reco track vs phi", nintPhi, minPhi, maxPhi)); h_assocphi.push_back(ibooker.book1D( "num_assoSimToReco_phi", "N of associated tracks (simToReco) vs phi", nintPhi, minPhi, maxPhi)); @@ -95,6 +123,30 @@ void MuonTrackValidator::bookHistograms(DQMEDAnalyzer::DQMStore::IBooker& ibooke minPhi, maxPhi)); + h_assocphiB.push_back(ibooker.book1D("num_assoSimToReco_phi_barrel", + "N of associated tracks (simToReco) vs phi - BARREL", + nintPhi, + minPhi, + maxPhi)); + h_simulphiB.push_back( + ibooker.book1D("num_simul_phi_barrel", "N of simulated track vs phi - BARREL", nintPhi, minPhi, maxPhi)); + + h_assocphiO.push_back(ibooker.book1D("num_assoSimToReco_phi_overlap", + "N of associated tracks (simToReco) vs phi - OVERLAP", + nintPhi, + minPhi, + maxPhi)); + h_simulphiO.push_back( + ibooker.book1D("num_simul_phi_overlap", "N of simulated track vs phi - OVERLAP", nintPhi, minPhi, maxPhi)); + + h_assocphiE.push_back(ibooker.book1D("num_assoSimToReco_phi_endcap", + "N of associated tracks (simToReco) vs phi - ENDCAP", + nintPhi, + minPhi, + maxPhi)); + h_simulphiE.push_back( + ibooker.book1D("num_simul_phi_endcap", "N of simulated track vs phi - ENDCAP", nintPhi, minPhi, maxPhi)); + h_recohit.push_back(ibooker.book1D("num_reco_hit", "N of reco tracks vs N SimHits", nintNHit, minNHit, maxNHit)); h_assochit.push_back(ibooker.book1D( "num_assoSimToReco_hit", "N of associated tracks (simToReco) vs N SimHits", nintNHit, minNHit, maxNHit)); @@ -108,6 +160,19 @@ void MuonTrackValidator::bookHistograms(DQMEDAnalyzer::DQMStore::IBooker& ibooke minNHit, maxNHit)); + int bindR{200}; + double mindR{0.0}; + double maxdR{10.0}; + + h_recodR.push_back(ibooker.book1D("num_reco_dR", "N of reco track vs dR2", bindR, mindR, maxdR)); + h_assocdR.push_back( + ibooker.book1D("num_assoSimToReco_dR", "N of associated tracks (simToReco) vs dR2", bindR, mindR, maxdR)); + h_assoc2dR.push_back( + ibooker.book1D("num_assoRecoToSim_dR", "N of associated (recoToSim) tracks vs dR2", bindR, mindR, maxdR)); + h_simuldR.push_back(ibooker.book1D("num_simul_dR", "N of simulated tracks vs dR2", bindR, mindR, maxdR)); + h_misiddR.push_back(ibooker.book1D( + "num_chargemisid_dR", "N of associated (simToReco) tracks with charge misID vs dR2", bindR, mindR, maxdR)); + h_recodxy.push_back(ibooker.book1D("num_reco_dxy", "N of reco track vs dxy", nintDxy, minDxy, maxDxy)); h_assocdxy.push_back(ibooker.book1D( "num_assoSimToReco_dxy", "N of associated tracks (simToReco) vs dxy", nintDxy, minDxy, maxDxy)); @@ -475,6 +540,16 @@ void MuonTrackValidator::analyze(const edm::Event& event, const edm::EventSetup& int ats = 0; int st = 0; + std::optional dR2 = [&]() -> std::optional { + if (tPC.size() == 2) { + TrackingParticle::Vector p1 = lhcParametersDefinerTP_->momentum(event, setup, tPC[0]); + TrackingParticle::Vector p2 = lhcParametersDefinerTP_->momentum(event, setup, tPC[1]); + + return reco::deltaR2(p1, p2); + } + return {}; + }(); + for (size_t i = 0; i < tPC.size(); i++) { bool TP_is_matched = false; bool isChargeOK = true; @@ -569,16 +644,53 @@ void MuonTrackValidator::analyze(const edm::Event& event, const edm::EventSetup& // histos for efficiency vs phi fillPlotNoFlow(h_simulphi[w], TPphi); + if (xTPeta < 0.9) { + fillPlotNoFlow(h_simulphiB[w], TPphi); + } else if (xTPeta < 1.2) { + fillPlotNoFlow(h_simulphiO[w], TPphi); + } else { + fillPlotNoFlow(h_simulphiE[w], TPphi); + } if (TP_is_matched) { fillPlotNoFlow(h_assocphi[w], TPphi); + if (xTPeta < 0.9) { + fillPlotNoFlow(h_assocphiB[w], TPphi); + } else if (xTPeta < 1.2) { + fillPlotNoFlow(h_assocphiO[w], TPphi); + } else { + fillPlotNoFlow(h_assocphiE[w], TPphi); + } if (!isChargeOK) fillPlotNoFlow(h_misidphi[w], TPphi); } + if (dR2.has_value()) { + fillPlotNoFlow(h_simuldR[w], *dR2); + if (TP_is_matched) { + fillPlotNoFlow(h_assocdR[w], *dR2); + if (!isChargeOK) + fillPlotNoFlow(h_misiddR[w], *dR2); + } + } + // histos for efficiency vs pT fillPlotNoFlow(h_simulpT[w], xTPpt); + if (xTPeta < 0.9) { + fillPlotNoFlow(h_simulpTB[w], xTPpt); + } else if (xTPeta < 1.2) { + fillPlotNoFlow(h_simulpTO[w], xTPpt); + } else { + fillPlotNoFlow(h_simulpTE[w], xTPpt); + } if (TP_is_matched) { fillPlotNoFlow(h_assocpT[w], xTPpt); + if (xTPeta < 0.9) { + fillPlotNoFlow(h_assocpTB[w], xTPpt); + } else if (xTPeta < 1.2) { + fillPlotNoFlow(h_assocpTO[w], xTPpt); + } else { + fillPlotNoFlow(h_assocpTE[w], xTPpt); + } if (!isChargeOK) fillPlotNoFlow(h_misidpT[w], xTPpt); } @@ -740,6 +852,13 @@ void MuonTrackValidator::analyze(const edm::Event& event, const edm::EventSetup& fillPlotNoFlow(h_assoc2pT[w], xptRec); } + if (dR2.has_value()) { + fillPlotNoFlow(h_recodR[w], *dR2); + if (Track_is_matched) { + fillPlotNoFlow(h_assoc2pT[w], *dR2); + } + } + // histos for fake rate vs dxy fillPlotNoFlow(h_recodxy[w], dxyRec); if (Track_is_matched) { diff --git a/Validation/RecoMuon/plugins/MuonTrackValidatorBase.h b/Validation/RecoMuon/plugins/MuonTrackValidatorBase.h index d33ba31048fcf..d2614e2215a9c 100644 --- a/Validation/RecoMuon/plugins/MuonTrackValidatorBase.h +++ b/Validation/RecoMuon/plugins/MuonTrackValidatorBase.h @@ -282,6 +282,16 @@ class MuonTrackValidatorBase { std::vector h_recodxy, h_assocdxy, h_assoc2dxy, h_simuldxy, h_misiddxy; std::vector h_recodz, h_assocdz, h_assoc2dz, h_simuldz, h_misiddz; std::vector h_recopu, h_assocpu, h_assoc2pu, h_simulpu, h_misidpu; + std::vector h_recodR, h_assocdR, h_assoc2dR, h_simuldR, h_misiddR; + + std::vector h_assocpTB, h_simulpTB; + std::vector h_assocphiB, h_simulphiB; + + std::vector h_assocpTO, h_simulpTO; + std::vector h_assocphiO, h_simulphiO; + + std::vector h_assocpTE, h_simulpTE; + std::vector h_assocphiE, h_simulphiE; std::vector h_assocRpos, h_simulRpos, h_assocZpos, h_simulZpos; std::vector h_etaRes; diff --git a/Validation/RecoMuon/python/PostProcessorHLT_cff.py b/Validation/RecoMuon/python/PostProcessorHLT_cff.py index 0924a2e702789..4cd700f8cb3f3 100644 --- a/Validation/RecoMuon/python/PostProcessorHLT_cff.py +++ b/Validation/RecoMuon/python/PostProcessorHLT_cff.py @@ -4,25 +4,32 @@ from DQMServices.Core.DQMEDHarvester import DQMEDHarvester from Validation.RecoMuon.PostProcessor_cff import postProcessorMuonTrack + postProcessorMuonTrackHLT = postProcessorMuonTrack.clone( subDirs = ["HLT/Muon/MuonTrack/*"] ) postProcessorMuonTrackHLTComp = DQMEDHarvester( "DQMGenericClient", - subDirs = cms.untracked.vstring("HLT/Muon/MuonTrack/"), - efficiency = cms.vstring( - "Eff_L3Tk_Eta_mabh 'Eff_{L3,TK} vs #eta' hltL3Muons/effic_vs_eta hltL3TkFromL2/effic_vs_eta", - "Eff_L3Tk_Pt_mabh 'Eff_{L3,TK} vs p_{T}' hltL3Muons/effic_vs_pt hltL3TkFromL2/effic_vs_pt", - "Eff_L3Tk_Hit_mabh 'Eff_{L3,TK} vs n Hits' hltL3Muons/effic_vs_hit hltL3TkFromL2/effic_vs_hit", - "Eff_L3L2_Eta_mabh 'Eff_{L3,L2} vs #eta' hltL3Muons/effic_vs_eta hltL2Muons_UpdAtVtx/effic_vs_eta", - "Eff_L3L2_Pt_mabh 'Eff_{L3,L2} vs p_{T}' hltL3Muons/effic_vs_pt hltL2Muons_UpdAtVtx/effic_vs_pt", - "Eff_L3L2_Hit_mabh 'Eff_{L3,L2} vs n Hits' hltL3Muons/effic_vs_hit hltL2Muons_UpdAtVtx/effic_vs_hit", + subDirs=cms.untracked.vstring("HLT/Muon/MuonTrack/"), + efficiency=cms.vstring( + "Eff_L3Tk_Eta_mabh 'Eff_{L3,TK} vs #eta' hltL3Muons/effic_vs_eta hltL3TkFromL2/effic_vs_eta", + "Eff_L3Tk_Pt_mabh 'Eff_{L3,TK} vs p_{T}' hltL3Muons/effic_vs_pt hltL3TkFromL2/effic_vs_pt", + "Eff_L3Tk_Hit_mabh 'Eff_{L3,TK} vs n Hits' hltL3Muons/effic_vs_hit hltL3TkFromL2/effic_vs_hit", + "Eff_L3L2_Eta_mabh 'Eff_{L3,L2} vs #eta' hltL3Muons/effic_vs_eta hltL2Muons_UpdAtVtx/effic_vs_eta", + "Eff_L3L2_Pt_mabh 'Eff_{L3,L2} vs p_{T}' hltL3Muons/effic_vs_pt hltL2Muons_UpdAtVtx/effic_vs_pt", + "Eff_L3L2_Hit_mabh 'Eff_{L3,L2} vs n Hits' hltL3Muons/effic_vs_hit hltL2Muons_UpdAtVtx/effic_vs_hit", ), - resolution = cms.vstring(""), - outputFileName = cms.untracked.string("") - ) + resolution=cms.vstring(""), + outputFileName=cms.untracked.string(""), +) recoMuonPostProcessorsHLT = cms.Sequence( - postProcessorMuonTrackHLT - *postProcessorMuonTrackHLTComp - ) + postProcessorMuonTrackHLT + postProcessorMuonTrackHLTComp +) + +from Configuration.Eras.Modifier_phase2_muon_cff import phase2_muon + +phase2_muon.toReplaceWith( + recoMuonPostProcessorsHLT, + recoMuonPostProcessorsHLT.copyAndExclude(["postProcessorMuonTrackHLTComp"]), +) diff --git a/Validation/RecoMuon/python/PostProcessor_cff.py b/Validation/RecoMuon/python/PostProcessor_cff.py index 9d3ae5479f5df..995d18630db6d 100644 --- a/Validation/RecoMuon/python/PostProcessor_cff.py +++ b/Validation/RecoMuon/python/PostProcessor_cff.py @@ -15,9 +15,17 @@ "effic_vs_phi 'Efficiency vs #phi' num_assoSimToReco_phi num_simul_phi", "effic_vs_dxy 'Efficiency vs dxy' num_assoSimToReco_dxy num_simul_dxy", "effic_vs_dz 'Efficiency vs dz' num_assoSimToReco_dz num_simul_dz", + "effic_vs_dr 'Efficiency vs #Delta R' num_assoSimToReco_dR num_simul_dR", "effic_vs_pu 'Efficiency vs number of pile-up interactions' num_assoSimToReco_pu num_simul_pu", "effic_vs_Rpos 'Efficiency vs production Radius' num_assoSimToReco_Rpos num_simul_Rpos", "effic_vs_Zpos 'Efficiency vs production Z position' num_assoSimToReco_Zpos num_simul_Zpos", + + "effic_vs_pt_barrel 'Efficiency vs p_{T} BARREL' num_assoSimToReco_pT_barrel num_simul_pT_barrel", + "effic_vs_phi_barrel 'Efficiency vs #phi BARREL' num_assoSimToReco_phi_barrel num_simul_phi_barrel", + "effic_vs_pt_overlap 'Efficiency vs p_{T} OVERLAP' num_assoSimToReco_pT_overlap num_simul_pT_overlap", + "effic_vs_phi_overlap 'Efficiency vs #phi OVERLAP' num_assoSimToReco_phi_overlap num_simul_phi_overlap", + "effic_vs_pt_endcap 'Efficiency vs p_{T} ENDCAP' num_assoSimToReco_pT_endcap num_simul_pT_endcap", + "effic_vs_phi_endcap 'Efficiency vs #phi ENDCAP' num_assoSimToReco_phi_endcap num_simul_phi_endcap", "fakerate_vs_eta 'Fake rate vs #eta' num_assoRecoToSim_eta num_reco_eta fake", "fakerate_vs_pt 'Fake rate vs p_{T}' num_assoRecoToSim_pT num_reco_pT fake", @@ -25,6 +33,7 @@ "fakerate_vs_phi 'Fake rate vs #phi' num_assoRecoToSim_phi num_reco_phi fake", "fakerate_vs_dxy 'Fake rate vs dxy' num_assoRecoToSim_dxy num_reco_dxy fake", "fakerate_vs_dz 'Fake rate vs dz' num_assoRecoToSim_dz num_reco_dz fake", + "fakerate_vs_dr 'Fake rate vs #Delta R' num_assoRecoToSim_dR num_reco_dR fake", "fakerate_vs_pu 'Fake rate vs number of pile-up interactions' num_assoRecoToSim_pu num_reco_pu fake", "chargeMisId_vs_eta 'Charge MisID rate vs #eta' num_chargemisid_eta num_assoSimToReco_eta", diff --git a/Validation/RecoMuon/python/associators_cff.py b/Validation/RecoMuon/python/associators_cff.py index cb4722dc8769c..5c2b16a5ca16c 100644 --- a/Validation/RecoMuon/python/associators_cff.py +++ b/Validation/RecoMuon/python/associators_cff.py @@ -231,9 +231,71 @@ rejectBadGlobal = False ) +# +# The Phase-2 associators +# + +# L2 standalone muon seeds +Phase2tpToL2SeedAssociation = MABHhlt.clone( + tracksTag = "hltPhase2L2MuonSeedTracks", + UseTracker = False, + UseMuon = True +) +# L2 standalone muons +Phase2tpToL2MuonAssociation = MABHhlt.clone( + tracksTag = 'hltL2MuonsFromL1TkMuon', + UseTracker = False, + UseMuon = True +) +# L2 standalone muons updated at vertex +Phase2tpToL2MuonUpdAssociation = MABHhlt.clone( + tracksTag = 'hltL2MuonsFromL1TkMuon:UpdatedAtVtx', + UseTracker = False, + UseMuon = True +) +# L3 IO inner tracks +Phase2tpToL3IOTkAssociation = MABHhlt.clone( + tracksTag = 'hltIter2Phase2L3FromL1TkMuonMerged', + UseTracker = True, + UseMuon = False +) +# L3 OI inner tracks +Phase2tpToL3OITkAssociation = MABHhlt.clone( + tracksTag = 'hltPhase2L3OIMuonTrackSelectionHighPurity', + UseTracker = True, + UseMuon = False +) +# L3 inner tracks merged +Phase2tpToL3TkMergedAssociation = MABHhlt.clone( + tracksTag = 'hltPhase2L3MuonMerged', + UseTracker = True, + UseMuon = False +) +# L3 global muons +Phase2tpToL3GlbMuonMergedAssociation = MABHhlt.clone( + tracksTag = 'hltPhase2L3GlbMuon', + UseTracker = True, + UseMuon = True +) +# L3 Muons no ID (tracks) +Phase2tpToL3MuonNoIdAssociation = MABHhlt.clone( + tracksTag = 'hltPhase2L3MuonNoIdTracks', + UseTracker = True, + UseMuon = True, + rejectBadGlobal = False +) +# L3 Muons ID (tracks) +Phase2tpToL3MuonIdAssociation = MABHhlt.clone( + tracksTag = 'hltPhase2L3MuonIdTracks', + UseTracker = True, + UseMuon = True, + rejectBadGlobal = False +) # # COSMICS reco +# + MABHcosmic = SimMuon.MCTruth.MuonAssociatorByHits_cfi.muonAssociatorByHits.clone( # DEFAULTS ################################### # acceptOneStubMatchings = False, @@ -288,6 +350,7 @@ UseTracker = True, UseMuon = True ) + # # The full-sim association sequences # @@ -329,6 +392,21 @@ +hltIterL3MuonsTracks_seq+tpToL3MuonAssociation ) +# +# The Phase-2 sim association sequences +# + +Phase2MuonAssociationHLT_seq = cms.Sequence( + hltPhase2L2MuonSeedTracks+Phase2tpToL2SeedAssociation + +Phase2tpToL2MuonAssociation+Phase2tpToL2MuonUpdAssociation + +Phase2tpToL3IOTkAssociation+Phase2tpToL3OITkAssociation + +Phase2tpToL3TkMergedAssociation+Phase2tpToL3GlbMuonMergedAssociation + +hltPhase2L3MuonNoIdTracks+Phase2tpToL3MuonNoIdAssociation + +hltPhase2L3MuonIdTracks+Phase2tpToL3MuonIdAssociation + ) + +from Configuration.Eras.Modifier_phase2_muon_cff import phase2_muon +phase2_muon.toReplaceWith(muonAssociationHLT_seq, Phase2MuonAssociationHLT_seq) # fastsim has no hlt specific dt hit collection from Configuration.Eras.Modifier_fastSim_cff import fastSim @@ -342,3 +420,14 @@ fastSim.toModify(tpToL3GlbMuonAssociation, DTrechitTag = _DTrechitTag) fastSim.toModify(tpToL3NoIDMuonAssociation, DTrechitTag = _DTrechitTag) fastSim.toModify(tpToL3MuonAssociation, DTrechitTag = _DTrechitTag) + +# Phase-2 fastsim +fastSim.toModify(Phase2tpToL2SeedAssociation, DTrechitTag = _DTrechitTag) +fastSim.toModify(Phase2tpToL2MuonAssociation, DTrechitTag = _DTrechitTag) +fastSim.toModify(Phase2tpToL2MuonUpdAssociation, DTrechitTag = _DTrechitTag) +fastSim.toModify(Phase2tpToL3IOTkAssociation, DTrechitTag = _DTrechitTag) +fastSim.toModify(Phase2tpToL3OITkAssociation, DTrechitTag = _DTrechitTag) +fastSim.toModify(Phase2tpToL3TkMergedAssociation, DTrechitTag = _DTrechitTag) +fastSim.toModify(Phase2tpToL3GlbMuonMergedAssociation, DTrechitTag = _DTrechitTag) +fastSim.toModify(Phase2tpToL3MuonNoIdAssociation, DTrechitTag = _DTrechitTag) +fastSim.toModify(Phase2tpToL3MuonIdAssociation, DTrechitTag = _DTrechitTag) diff --git a/Validation/RecoMuon/python/muonValidationHLT_cff.py b/Validation/RecoMuon/python/muonValidationHLT_cff.py index 45102ad4c7c81..f677606f90065 100644 --- a/Validation/RecoMuon/python/muonValidationHLT_cff.py +++ b/Validation/RecoMuon/python/muonValidationHLT_cff.py @@ -66,20 +66,100 @@ label = ('hltIterL3MuonsTracks:',), muonHistoParameters = glbMuonHistoParameters ) + +# +# The Phase-2 validators +# + +# L2 standalone muons seeds +Phase2l2MuSeedV = MTVhlt.clone( + associatormap = 'Phase2tpToL2SeedAssociation', + label = ('hltPhase2L2MuonSeedTracks',), + muonHistoParameters = staSeedMuonHistoParameters +) +# L2 standalone muons +Phase2l2MuV = MTVhlt.clone( + associatormap = 'Phase2tpToL2MuonAssociation', + label = ('hltL2MuonsFromL1TkMuon',), + muonHistoParameters = staMuonHistoParameters +) +# L2 standalone muons updated at vertex +Phase2l2MuUpdV = MTVhlt.clone( + associatormap = 'Phase2tpToL2MuonUpdAssociation', + label = ('hltL2MuonsFromL1TkMuon:UpdatedAtVtx',), + muonHistoParameters = staMuonHistoParameters +) +# L3 IO inner tracks +Phase2l3IOTkV = MTVhlt.clone( + associatormap = 'Phase2tpToL3IOTkAssociation', + label = ('hltIter2Phase2L3FromL1TkMuonMerged',), + muonHistoParameters = trkMuonHistoParameters +) +# L3 OI inner tracks +Phase2l3OITkV = MTVhlt.clone( + associatormap = 'Phase2tpToL3OITkAssociation', + label = ('hltPhase2L3OIMuonTrackSelectionHighPurity',), + muonHistoParameters = trkMuonHistoParameters +) +# L3 inner tracks merged +Phase2l3TkMergedV = MTVhlt.clone( + associatormap = 'Phase2tpToL3TkMergedAssociation', + label = ('hltPhase2L3MuonMerged',), + muonHistoParameters = trkMuonHistoParameters +) +# L3 global muons +Phase2l3GlbMuonV = MTVhlt.clone( + associatormap = 'Phase2tpToL3GlbMuonMergedAssociation', + label = ('hltPhase2L3GlbMuon',), + muonHistoParameters = glbMuonHistoParameters +) +# L3 Muons no ID +Phase2l3MuNoIdTrackV = MTVhlt.clone( + associatormap = 'Phase2tpToL3MuonNoIdAssociation', + label = ('hltPhase2L3MuonNoIdTracks',), + muonHistoParameters = glbMuonHistoParameters +) +# L3 Muons ID +Phase2l3MuIdTrackV = MTVhlt.clone( + associatormap = 'Phase2tpToL3MuonIdAssociation', + label = ('hltPhase2L3MuonIdTracks',), + muonHistoParameters = glbMuonHistoParameters +) + # # The full Muon HLT validation sequence # -muonValidationHLT_seq = cms.Sequence( - tpToL2MuonAssociation + l2MuonMuTrackV - +tpToL2UpdMuonAssociation + l2UpdMuonMuTrackV - +tpToL3OITkMuonAssociation + l3OITkMuonMuTrackV - +tpToL3TkMuonAssociation + l3TkMuonMuTrackV - +tpToL3FromL1TkMuonAssociation + l3IOFromL1TkMuonMuTrackV - +tpToL0L3FromL1TkMuonAssociation + l0l3FromL1TkMuonMuTrackV - +tpToL3GlbMuonAssociation + l3GlbMuonMuTrackV - +hltIterL3MuonsNoIDTracks_seq + tpToL3NoIDMuonAssociation + l3NoIDMuonMuTrackV - +hltIterL3MuonsTracks_seq + tpToL3MuonAssociation + l3MuonMuTrackV - ) + +muonValidationHLT_seq = cms.Sequence(muonAssociationHLT_seq + +l2MuonMuTrackV + +l2UpdMuonMuTrackV + +l3OITkMuonMuTrackV + +l3TkMuonMuTrackV + +l3IOFromL1TkMuonMuTrackV + +l0l3FromL1TkMuonMuTrackV + +l3GlbMuonMuTrackV + +l3NoIDMuonMuTrackV + +l3MuonMuTrackV + ) + +# +# The Phase-2 sequences +# + +Phase2MuonValidationHLT_seq = cms.Sequence(muonAssociationHLT_seq + +Phase2l2MuSeedV + +Phase2l2MuV + +Phase2l2MuUpdV + +Phase2l3IOTkV + +Phase2l3OITkV + +Phase2l3TkMergedV + +Phase2l3GlbMuonV + +Phase2l3MuNoIdTrackV + +Phase2l3MuIdTrackV + ) + +from Configuration.Eras.Modifier_phase2_muon_cff import phase2_muon +phase2_muon.toReplaceWith(muonValidationHLT_seq, Phase2MuonValidationHLT_seq) recoMuonValidationHLT_seq = cms.Sequence( cms.SequencePlaceholder("TPmu") + diff --git a/Validation/RecoMuon/python/track_selectors_cff.py b/Validation/RecoMuon/python/track_selectors_cff.py index 7ca54dd218303..2c99989de77e5 100644 --- a/Validation/RecoMuon/python/track_selectors_cff.py +++ b/Validation/RecoMuon/python/track_selectors_cff.py @@ -65,6 +65,29 @@ ) hltIterL3MuonsTracks_seq = cms.Sequence( hltIterL3MuonsTracks ) +# +# Phase-2 tracks +# +# L3 Muon no ID tracks +hltPhase2L3MuonNoIdTracks = SimMuon.MCTruth.MuonTrackProducer_cfi.muonTrackProducer.clone( + muonsTag = "hltPhase2L3MuonsNoID", + inputDTRecSegment4DCollection = cms.InputTag("hltDt4DSegments"), + inputCSCSegmentCollection = cms.InputTag("hltCscSegments"), + selectionTags = ['All'], + trackType = "recomuonTrack", + ignoreMissingMuonCollection = True +) + +# L3 Muon ID tracks +hltPhase2L3MuonIdTracks = SimMuon.MCTruth.MuonTrackProducer_cfi.muonTrackProducer.clone( + muonsTag = "hltPhase2L3Muons", + inputDTRecSegment4DCollection = cms.InputTag("hltDt4DSegments"), + inputCSCSegmentCollection = cms.InputTag("hltCscSegments"), + selectionTags = ['All'], + trackType = "recomuonTrack", + ignoreMissingMuonCollection = True +) + # # Configuration for Seed track extractor # @@ -74,7 +97,13 @@ L2seedsCollection = "ancientMuonSeed" ) seedsOfSTAmuons_seq = cms.Sequence( seedsOfSTAmuons ) + seedsOfDisplacedSTAmuons = SimMuon.MCTruth.SeedToTrackProducer_cfi.SeedToTrackProducer.clone( L2seedsCollection = "displacedMuonSeeds" ) seedsOfDisplacedSTAmuons_seq = cms.Sequence( seedsOfDisplacedSTAmuons ) + +# Phase-2 L2 seeds from L1Tk Muons +hltPhase2L2MuonSeedTracks = SimMuon.MCTruth.SeedToTrackProducer_cfi.SeedToTrackProducer.clone( + L2seedsCollection = "hltL2MuonSeedsFromL1TkMuon" +)