Skip to content

Conversation

@kk428
Copy link

@kk428 kk428 commented Dec 8, 2025

In PR #187, I added branches to trackingNtuple.root input file after clustering sim tracks into jets using FastJet. However, this method prevents us from comparing reconstructed tracks to the jets, which I need to do in order to examine how the jets affect the duplicate and fake rates. Here I have replaced the former method of jet clustering with GenJets that are added to trackingNtuple.root at the step where it is produced.

These are the pertinent changes I've made:

  • Added GenJets to Validation/RecoTrack/plugins/TrackingNtuple.cc.
    When the trackingNtuple.root is created with cmsDriver.py, it now will include the GenJet branches for genJetPt, genJetEta, and genJetPhi. I did not include a way to optionally enable/disable this.
  • Created RecoTracker/LSTCore/standalone/analysis/jets/reformat_jets2.py to compute ΔR for the sim tracks and add it to trackingNtuple.root
    This completely replaces both reformat_jets.py and myjets.py from PR 187.
  • Computed ΔR for the reconstructed tracks in RecoTracker/LSTCore/standalone/efficiency/src/performance.cc
    This is still enabled/disabled when running LST by the use of the -j tag.
  • Modified RecoTracker/LSTCore/standalone/code/core/write_lst_ntuple.cc and RecoTracker/LSTCore/standalone/efficiency/python/lst_plot_performance.py in small ways to reflect these changes.

The input file differs from the standard one due to the addition of GenJet branches when it is created and due to the sim_deltaEta, sim_deltaPhi, and sim_deltaR branches that are tacked on after. The only change to the output is the inclusion of efficiency, DR, and FR vs. ΔR plots, where ΔR is the distance from a track to its closest GenJet. Otherwise, this PR should not impact the performance of LST at all. The presence of GenJets in the N-tuple also does not affect LST regardless of whether the jet branches are enabled or disabled.

Copy link

@slava77 slava77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as I mentioned during the meeting, it would help to fill the closest jet dr per sim_ (and per trk_ ) in this PR rather than to rely on the post-processing script

Comment on lines 97 to 100
#include "DataFormats/HepMCCandidate/interface/GenParticle.h"
#include "DataFormats/JetReco/interface/GenJet.h"
#include "DataFormats/JetReco/interface/GenJetCollection.h"
#include "DataFormats/HepMCCandidate/interface/GenParticleFwd.h"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alpha-order

Comment on lines 1298 to 1308
std::vector<uint16_t> ph2_clustSize;
std::vector<size_t> ph2_clustSize;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this reverts a recent change from @alexandertuna ; please undo

Comment on lines 1431 to 1433
std::vector<float> genJetPt;
std::vector<float> genJetEta;
std::vector<float> genJetPhi;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep the same naming style as other branches genjet_pt,eta,phi

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking at https://github.com/cms-sw/cmssw/blob/master/DataFormats/JetReco/interface/GenJet.h#L90C11-L99, I think it's worth to add invisibleEnergy, auxiliaryEnergy

@@ -1473,7 +1489,8 @@ TrackingNtuple::TrackingNtuple(const edm::ParameterSet& iConfig)
keepEleSimHits_(iConfig.getUntrackedParameter<bool>("keepEleSimHits")),
saveSimHitsP3_(iConfig.getUntrackedParameter<bool>("saveSimHitsP3")),
simHitBySignificance_(iConfig.getUntrackedParameter<bool>("simHitBySignificance")),
parametersDefiner_(iConfig.getUntrackedParameter<edm::InputTag>("beamSpot"), consumesCollector()) {
parametersDefiner_(iConfig.getUntrackedParameter<edm::InputTag>("beamSpot"), consumesCollector()),
tok_jets_(consumes<reco::GenJetCollection>(iConfig.getParameter<edm::InputTag>("JetSource"))) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
tok_jets_(consumes<reco::GenJetCollection>(iConfig.getParameter<edm::InputTag>("JetSource"))) {
tok_jets_(consumes<reco::GenJetCollection>(iConfig.getParameter<edm::InputTag>("jetSource"))) {

naming style from https://cms-sw.github.io/cms_coding_rules.html

Comment on lines 2772 to 2777
edm::Handle<reco::GenJetCollection> genJets;
iEvent.getByToken(tok_jets_, genJets);
if (genJets.isValid()) {
for (unsigned iGenJet = 0; iGenJet < genJets->size(); ++iGenJet) {
const reco::GenJet& genJet = (*genJets)[iGenJet];
genJetPt.push_back(genJet.pt());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
edm::Handle<reco::GenJetCollection> genJets;
iEvent.getByToken(tok_jets_, genJets);
if (genJets.isValid()) {
for (unsigned iGenJet = 0; iGenJet < genJets->size(); ++iGenJet) {
const reco::GenJet& genJet = (*genJets)[iGenJet];
genJetPt.push_back(genJet.pt());
auto const& genJets = iEvent.get(tok_jets_);
for (auto const& jet : genJets) {
genjet_pt.push_back(jet.pt());

more compact access.
Also, I prefer to not silently skip: jets should be available in every event; if missing there's something wrong with the configuration and this should fail.

@@ -1043,103 +1068,101 @@ void fillEfficiencySet(int isimtrk,
const float vtx_z_thresh = 30;
const float vtx_perp_thresh = 2.5;

if (pt > 0 && jet_eta < 140 && jet_eta > -140 && (jet_eta > -999 && deltaEta > -999)) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(not sure if I searched well enough) shouldn't we have some jet pt minimum requirement to make the jet-related plots?
I expect it to be configurable with a default (order of or e.g.) 100 GeV

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants