20 : inputTagGenParticles_(iConfig.getParameter<
InputTag>(
"GenParticles")),
22 includeNeutrinos_(iConfig.getParameter<
bool>(
"includeNeutrinos")),
23 verbose_(iConfig.getUntrackedParameter<
bool>(
"verbose",
false)) {
24 produces<GenJetCollection>();
32 auto pOutVisTaus = std::make_unique<GenJetCollection>();
39 for (
IGR iTau = allStatus2Taus.
begin(); iTau != allStatus2Taus.
end(); ++iTau) {
48 if (!status2TauDaughters.
empty())
54 Jet::Constituents constituents;
57 cout <<
"tau " << (*iTau) << endl;
59 for (
IGR igr = descendents.
begin(); igr != descendents.
end(); ++igr) {
60 int absPdgId =
abs((*igr)->pdgId());
64 if (absPdgId == 12 || absPdgId == 14 || absPdgId == 16)
69 cout <<
"\t" << (*igr) << endl;
71 charge += (*igr)->charge();
72 sumVisMom += (*igr)->p4();
76 constituents.push_back(
refToPtr(*igr));
84 if (
charge != (*iTau)->charge())
85 edm::LogError(
"TauGenJetProducer") <<
" charge of Tau: " << (*iTau)
86 <<
" not equal to charge of sum of charge of all descendents.\n" 87 <<
" Tau's charge: " << (*iTau)->charge() <<
" sum: " <<
charge 88 <<
" # descendents: " << constituents.size() <<
"\n";
91 pOutVisTaus->push_back(
jet);
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
bool empty() const
Is the RefVector empty.
Ptr< typename C::value_type > refToPtr(Ref< C, typename C::value_type, refhelper::FindUsingAdvance< C, typename C::value_type > > const &ref)
void findParticles(const reco::GenParticleCollection &sourceParticles, reco::GenParticleRefVector &particleRefs, int pdgId, int status)
find all particles of a given pdgId and status
const edm::EDGetTokenT< reco::GenParticleCollection > tokenGenParticles_
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
const bool verbose_
verbose ?
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
const bool includeNeutrinos_
if yes, neutrinos will be included, for debug purposes
Abs< T >::type abs(const T &t)
Jets made from MC generator particles.
#define DEFINE_FWK_MODULE(type)
builds a GenJet from the visible daughters of each status 2 tau in the event.
XYZPointD XYZPoint
point in space with cartesian internal representation
const_iterator end() const
Termination of iteration.
~TauGenJetProducer() override
TauGenJetProducer(const edm::ParameterSet &)
const_iterator begin() const
Initialize an iterator over the RefVector.
void findDescendents(const reco::GenParticleRef &base, reco::GenParticleRefVector &descendents, int status, int pdgId=0)
find all descendents of a given status and pdgId (recursive)