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

Make jets in TauGenJetProducer from taus which are not decayed #41064

Merged
merged 1 commit into from
Mar 17, 2023
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
17 changes: 15 additions & 2 deletions PhysicsTools/JetMCAlgos/plugins/TauGenJetProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ using namespace edm;
using namespace reco;

TauGenJetProducer::TauGenJetProducer(const edm::ParameterSet& iConfig)
: inputTagGenParticles_(iConfig.getParameter<InputTag>("GenParticles")),
tokenGenParticles_(consumes<GenParticleCollection>(inputTagGenParticles_)),
: tokenGenParticles_(consumes<GenParticleCollection>(iConfig.getParameter<InputTag>("GenParticles"))),
includeNeutrinos_(iConfig.getParameter<bool>("includeNeutrinos")),
verbose_(iConfig.getUntrackedParameter<bool>("verbose", false)) {
produces<GenJetCollection>();
Expand All @@ -41,6 +40,20 @@ void TauGenJetProducer::produce(edm::StreamID, Event& iEvent, const EventSetup&
GenParticleRefVector descendents;
findDescendents(*iTau, descendents, 1);

if (descendents.empty()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Uhm, shouldn't this go after the check for the status 2 taus in the descendents?
@alebihan @mbluj

(Maybe @mbluj could cherry pick this commit and take care of making a PR with the whole fix, so that he can include also the modified status all at once)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The taus causing the problem were never in the descendants, they always came from the main list.

edm::LogWarning("NoTauDaughters") << "Tau p4: " << (*iTau)->p4() << " vtx: " << (*iTau)->vertex()
<< " has no daughters";

math::XYZPoint vertex;
GenJet::Specific specific;
Jet::Constituents constituents;

constituents.push_back(refToPtr(*iTau));
GenJet jet((*iTau)->p4(), vertex, specific, constituents);
jet.setCharge((*iTau)->charge());
pOutVisTaus->emplace_back(std::move(jet));
continue;
}
// CV: skip status 2 taus that radiate-off a photon
// --> have a status 2 tau lepton in the list of descendents
GenParticleRefVector status2TauDaughters;
Expand Down
1 change: 0 additions & 1 deletion PhysicsTools/JetMCAlgos/plugins/TauGenJetProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class TauGenJetProducer : public edm::global::EDProducer<> {

private:
/// Input PFCandidates
const edm::InputTag inputTagGenParticles_;
const edm::EDGetTokenT<reco::GenParticleCollection> tokenGenParticles_;

/// if yes, neutrinos will be included, for debug purposes
Expand Down