From ce393820d30ebb5eea3af606f91f538b867e4ff6 Mon Sep 17 00:00:00 2001 From: Ryan McCarthy Date: Sun, 19 May 2024 14:02:43 +0200 Subject: [PATCH] Adding option to run displaced vertexing in ntupler maker, reverting changes to ntuple maker params, removing BDT requirement on displaced track quality --- .../test/L1TrackObjectNtupleMaker.cc | 84 ++++++++++--------- .../test/L1TrackObjectNtupleMaker_cfg.py | 12 ++- .../plugins/L1FPGATrackProducer.cc | 15 +--- 3 files changed, 54 insertions(+), 57 deletions(-) diff --git a/L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker.cc b/L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker.cc index fb1398a560335..70ac8f144907c 100644 --- a/L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker.cc +++ b/L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker.cc @@ -144,6 +144,7 @@ class L1TrackObjectNtupleMaker : public edm::one::EDAnalyzer= minNStub (this is mostly for tracklet purposes) bool SaveTrackJets; bool SaveTrackSums; + bool runDispVert; edm::InputTag L1TrackInputTag; // L1 track collection edm::InputTag MCTruthTrackInputTag; // MC truth collection @@ -621,7 +622,8 @@ L1TrackObjectNtupleMaker::L1TrackObjectNtupleMaker(edm::ParameterSet const& iCon SaveTrackJets = iConfig.getParameter("SaveTrackJets"); SaveTrackSums = iConfig.getParameter("SaveTrackSums"); - + runDispVert = iConfig.getParameter("runDispVert"); + L1StubInputTag = iConfig.getParameter("L1StubInputTag"); MCTruthClusterInputTag = iConfig.getParameter("MCTruthClusterInputTag"); MCTruthStubInputTag = iConfig.getParameter("MCTruthStubInputTag"); @@ -770,7 +772,7 @@ L1TrackObjectNtupleMaker::L1TrackObjectNtupleMaker(edm::ParameterSet const& iCon GenJetToken_ = consumes>(GenJetInputTag); GenParticleToken_ = consumes>(GenParticleInputTag); SimVertexToken_ = consumes>(SimVertexInputTag); - DispVertToken_ = consumes>(DisplacedVertexInputTag); + if(runDispVert) DispVertToken_ = consumes>(DisplacedVertexInputTag); L1VertexToken_ = consumes(RecoVertexInputTag); L1VertexEmuToken_ = consumes(RecoVertexEmuInputTag); tTopoToken_ = esConsumes(edm::ESInputTag("", "")); @@ -1577,25 +1579,25 @@ void L1TrackObjectNtupleMaker::beginJob() { eventTree->Branch("gen_mother_pdgid", &m_gen_mother_pdgid); eventTree->Branch("gen_z0", &m_gen_z0); - - eventTree->Branch("dv_d_T", &m_dv_d_T); - eventTree->Branch("dv_R_T", &m_dv_R_T); - eventTree->Branch("dv_cos_T", &m_dv_cos_T); - eventTree->Branch("dv_x", &m_dv_x); - eventTree->Branch("dv_y", &m_dv_y); - eventTree->Branch("dv_z", &m_dv_z); - eventTree->Branch("dv_openingAngle", &m_dv_openingAngle); - eventTree->Branch("dv_parentPt", &m_dv_parentPt); - eventTree->Branch("dv_firstIndexTrk", &m_dv_firstIndexTrk); - eventTree->Branch("dv_secondIndexTrk", &m_dv_secondIndexTrk); - eventTree->Branch("dv_firstIndexPt", &m_dv_firstIndexPt); - eventTree->Branch("dv_secondIndexPt", &m_dv_secondIndexPt); - eventTree->Branch("dv_inTraj", &m_dv_inTraj); - eventTree->Branch("dv_del_Z", &m_dv_del_Z); - eventTree->Branch("dv_delIndexPt", &m_dv_delIndexPt); - eventTree->Branch("dv_isReal", &m_dv_isReal); - eventTree->Branch("dv_score", &m_dv_score); - + if(runDispVert){ + eventTree->Branch("dv_d_T", &m_dv_d_T); + eventTree->Branch("dv_R_T", &m_dv_R_T); + eventTree->Branch("dv_cos_T", &m_dv_cos_T); + eventTree->Branch("dv_x", &m_dv_x); + eventTree->Branch("dv_y", &m_dv_y); + eventTree->Branch("dv_z", &m_dv_z); + eventTree->Branch("dv_openingAngle", &m_dv_openingAngle); + eventTree->Branch("dv_parentPt", &m_dv_parentPt); + eventTree->Branch("dv_firstIndexTrk", &m_dv_firstIndexTrk); + eventTree->Branch("dv_secondIndexTrk", &m_dv_secondIndexTrk); + eventTree->Branch("dv_firstIndexPt", &m_dv_firstIndexPt); + eventTree->Branch("dv_secondIndexPt", &m_dv_secondIndexPt); + eventTree->Branch("dv_inTraj", &m_dv_inTraj); + eventTree->Branch("dv_del_Z", &m_dv_del_Z); + eventTree->Branch("dv_delIndexPt", &m_dv_delIndexPt); + eventTree->Branch("dv_isReal", &m_dv_isReal); + eventTree->Branch("dv_score", &m_dv_score); + } if (SaveTrackJets) { eventTree->Branch("genjet_eta", &m_genjet_eta); eventTree->Branch("genjet_p", &m_genjet_p); @@ -1848,25 +1850,25 @@ void L1TrackObjectNtupleMaker::analyze(const edm::Event& iEvent, const edm::Even m_gen_mother_pdgid->clear(); m_gen_z0->clear(); - - m_dv_d_T->clear(); - m_dv_R_T->clear(); - m_dv_cos_T->clear(); - m_dv_x->clear(); - m_dv_y->clear(); - m_dv_z->clear(); - m_dv_openingAngle->clear(); - m_dv_parentPt->clear(); - m_dv_firstIndexTrk->clear(); - m_dv_secondIndexTrk->clear(); - m_dv_firstIndexPt->clear(); - m_dv_secondIndexPt->clear(); - m_dv_inTraj->clear(); - m_dv_del_Z->clear(); - m_dv_delIndexPt->clear(); - m_dv_isReal->clear(); - m_dv_score->clear(); - + if(runDispVert){ + m_dv_d_T->clear(); + m_dv_R_T->clear(); + m_dv_cos_T->clear(); + m_dv_x->clear(); + m_dv_y->clear(); + m_dv_z->clear(); + m_dv_openingAngle->clear(); + m_dv_parentPt->clear(); + m_dv_firstIndexTrk->clear(); + m_dv_secondIndexTrk->clear(); + m_dv_firstIndexPt->clear(); + m_dv_secondIndexPt->clear(); + m_dv_inTraj->clear(); + m_dv_del_Z->clear(); + m_dv_delIndexPt->clear(); + m_dv_isReal->clear(); + m_dv_score->clear(); + } if (Displaced == "Prompt" || Displaced == "Both") { m_matchtrk_pt->clear(); m_matchtrk_eta->clear(); @@ -2057,7 +2059,7 @@ void L1TrackObjectNtupleMaker::analyze(const edm::Event& iEvent, const edm::Even //Displaced vertices edm::Handle> DispVertHandle; - iEvent.getByToken(DispVertToken_, DispVertHandle); + if(runDispVert) iEvent.getByToken(DispVertToken_, DispVertHandle); //Vertex edm::Handle L1PrimaryVertexHandle; diff --git a/L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker_cfg.py b/L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker_cfg.py index fd48a0119802b..9244f0e54a434 100644 --- a/L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker_cfg.py +++ b/L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker_cfg.py @@ -20,6 +20,7 @@ runVtxNN = True +runDispVert = False ############################################################ # import standard configurations ############################################################ @@ -42,7 +43,6 @@ # input and output ############################################################ - process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(20)) readFiles = cms.untracked.vstring( @@ -170,7 +170,7 @@ process.pTkMET = cms.Path(process.l1tTrackerEtMissExtended) process.pTkMHT = cms.Path(process.l1tTrackerHTMissExtended) process.pTkMHTEmulator = cms.Path(process.l1tTrackerEmuHTMissExtended) - process.DispVert = cms.Path(process.DisplacedVertexProducer) + if(runDispVert): process.DispVert = cms.Path(process.DisplacedVertexProducer) DISPLACED = 'Displaced'# # HYBRID: extended tracking @@ -192,7 +192,7 @@ process.pTkMHT = cms.Path(process.l1tTrackerHTMiss*process.l1tTrackerHTMissExtended) process.pTkMHTEmulator = cms.Path(process.l1tTrackerEmuHTMiss*process.l1tTrackerEmuHTMissExtended) process.pL1TrackTripletEmulator = cms.Path(process.l1tTrackTripletEmulation) - process.DispVert = cms.Path(process.DisplacedVertexProducer) + if(runDispVert): process.DispVert = cms.Path(process.DisplacedVertexProducer) DISPLACED = 'Both' @@ -284,6 +284,7 @@ RecoVertexInputTag=cms.InputTag("l1tVertexFinder", "L1Vertices"), RecoVertexEmuInputTag=cms.InputTag("l1tVertexFinderEmulator", "L1VerticesEmulation"), DisplacedVertexInputTag = cms.InputTag("DisplacedVertexProducer","dispVertices"), + runDispVert = cms.bool(runDispVert) ) process.ntuple = cms.Path(process.L1TrackNtuple) @@ -304,4 +305,7 @@ # use this if cluster/stub associators not available # process.schedule = cms.Schedule(process.TTClusterStubTruth,process.TTTracksEmuWithTruth,process.ntuple) -process.schedule = cms.Schedule(process.TTClusterStub, process.TTClusterStubTruth, process.dtc, process.TTTracksEmuWithTruth, process.pL1GTTInput, process.pL1TrackSelection, process.pPV, process.pPVemu,process.pL1TrackVertexAssociation, process.pL1TrackJets, process.pL1TrackJetsEmu,process.pL1TrackFastJets, process.pTkMET, process.pTkMETEmu, process.pTkMHT, process.pTkMHTEmulator,process.pL1TrackTripletEmulator, process.DispVert, process.ntuple) +if(runDispVert): + process.schedule = cms.Schedule(process.TTClusterStub, process.TTClusterStubTruth, process.dtc, process.TTTracksEmuWithTruth, process.pL1GTTInput, process.pL1TrackSelection, process.pPV, process.pPVemu,process.pL1TrackVertexAssociation, process.pL1TrackJets, process.pL1TrackJetsEmu,process.pL1TrackFastJets, process.pTkMET, process.pTkMETEmu, process.pTkMHT, process.pTkMHTEmulator,process.pL1TrackTripletEmulator, process.DispVert, process.ntuple) +else: + process.schedule = cms.Schedule(process.TTClusterStub, process.TTClusterStubTruth, process.dtc, process.TTTracksEmuWithTruth, process.pL1GTTInput, process.pL1TrackSelection, process.pPV, process.pPVemu,process.pL1TrackVertexAssociation, process.pL1TrackJets, process.pL1TrackJetsEmu,process.pL1TrackFastJets, process.pTkMET, process.pTkMETEmu, process.pTkMHT, process.pTkMHTEmulator,process.pL1TrackTripletEmulator,process.ntuple) diff --git a/L1Trigger/TrackFindingTracklet/plugins/L1FPGATrackProducer.cc b/L1Trigger/TrackFindingTracklet/plugins/L1FPGATrackProducer.cc index f0a8a4b883272..36f824ebbc0d7 100644 --- a/L1Trigger/TrackFindingTracklet/plugins/L1FPGATrackProducer.cc +++ b/L1Trigger/TrackFindingTracklet/plugins/L1FPGATrackProducer.cc @@ -744,19 +744,10 @@ void L1FPGATrackProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSe aTrack.setTrackWordBits(); if (trackQuality_) { - double qualityScore = trackQualityModel_->getL1TrackQuality(aTrack); - aTrack.settrkMVA1(qualityScore); - if(extended_){ - qualityScore = trackQualityDispModel_->getL1TrackQuality(aTrack); - if(trackQualityDispModel_->getQualityAlgorithm()==L1TrackQuality::QualityAlgorithm::GBDT){ - aTrack.settrkMVA2(qualityScore); - } - else{ - aTrack.settrkMVA1(qualityScore); - } - } + aTrack.settrkMVA1(trackQualityModel_->getL1TrackQuality(aTrack)); + if(extended_) + aTrack.settrkMVA2(trackQualityDispModel_->getL1TrackQuality(aTrack)); } - // hph::HitPatternHelper hph(setupHPH_, tmp_hit, tmp_tanL, tmp_z0); // if (trackQuality_) { // trackQualityModel_->setBonusFeatures(hph.bonusFeatures());