Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Phase 2 Muon HLT validation #46860

Merged
merged 2 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Configuration/EventContent/python/EventContent_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions HLTriggerOffline/Common/python/HLTValidationHarvest_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
17 changes: 17 additions & 0 deletions SimMuon/MCTruth/plugins/Phase2SeedToTrackProducer.h
Original file line number Diff line number Diff line change
@@ -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<L2MuonTrajectorySeedCollection> Phase2SeedToTrackProducer;

#endif
4 changes: 4 additions & 0 deletions SimMuon/MCTruth/plugins/SealModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
78 changes: 14 additions & 64 deletions SimMuon/MCTruth/plugins/SeedToTrackProducer.h
Original file line number Diff line number Diff line change
@@ -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 <memory>

// 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<TrajectorySeedCollection> L2seedsTagT_;
edm::EDGetTokenT<edm::View<TrajectorySeed>> L2seedsTagS_;
typedef SeedToTrackProducerBase<TrajectorySeedCollection> SeedToTrackProducer;

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> theMGFieldToken;
const edm::ESGetToken<GlobalTrackingGeometry, GlobalTrackingGeometryRecord> theTrackingGeometryToken;
const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> theTopoToken;
};
#endif
Original file line number Diff line number Diff line change
@@ -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<std::vector<TrajectorySeed>>;
template class SeedToTrackProducerBase<std::vector<L2MuonTrajectorySeed>>;

//
// constructors and destructor
//
SeedToTrackProducer::SeedToTrackProducer(const edm::ParameterSet &iConfig)
template <typename SeedCollection>
SeedToTrackProducerBase<SeedCollection>::SeedToTrackProducerBase(const edm::ParameterSet &iConfig)
: theMGFieldToken(esConsumes()), theTrackingGeometryToken(esConsumes()), theTopoToken(esConsumes()) {
L2seedsTagT_ = consumes<TrajectorySeedCollection>(iConfig.getParameter<edm::InputTag>("L2seedsCollection"));
L2seedsTagT_ = consumes<SeedCollection>(iConfig.getParameter<edm::InputTag>("L2seedsCollection"));
L2seedsTagS_ = consumes<edm::View<TrajectorySeed>>(iConfig.getParameter<edm::InputTag>("L2seedsCollection"));

produces<reco::TrackCollection>();
Expand All @@ -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 <typename SeedCollection>
void SeedToTrackProducerBase<SeedCollection>::produce(edm::StreamID,
edm::Event &iEvent,
const edm::EventSetup &iSetup) const {
using namespace edm;
using namespace std;

Expand All @@ -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<TrajectorySeedCollection> L2seedsCollection;
edm::Handle<SeedCollection> L2seedsCollection;
iEvent.getByToken(L2seedsTagT_, L2seedsCollection);
const std::vector<TrajectorySeed> *L2seeds = nullptr;
const std::vector<SeedType> *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<edm::View<TrajectorySeed>> seedHandle;
iEvent.getByToken(L2seedsTagS_, seedHandle);
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -145,16 +142,13 @@ 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 <typename SeedCollection>
TrajectoryStateOnSurface SeedToTrackProducerBase<SeedCollection>::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);
TrajectoryStateOnSurface tmpTSOS =
trajectoryStateTransform::transientState(tmpTSOD, &(tmpGeomDet->surface()), &mgField);
return tmpTSOS;
}

// define this as a plug-in
DEFINE_FWK_MODULE(SeedToTrackProducer);
70 changes: 70 additions & 0 deletions SimMuon/MCTruth/plugins/SeedToTrackProducerBase.h
Original file line number Diff line number Diff line change
@@ -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 <memory>

// 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 <typename SeedCollection>
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<SeedCollection> L2seedsTagT_;
edm::EDGetTokenT<edm::View<TrajectorySeed>> L2seedsTagS_;

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> theMGFieldToken;
const edm::ESGetToken<GlobalTrackingGeometry, GlobalTrackingGeometryRecord> theTrackingGeometryToken;
const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> theTopoToken;
};

#endif
8 changes: 8 additions & 0 deletions SimMuon/MCTruth/python/SeedToTrackProducer_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Loading