20 : inputTagGenParticles_(iConfig.getParameter<
InputTag>(
"GenParticles")),
22 includeNeutrinos_(iConfig.getParameter<bool>(
"includeNeutrinos")),
23 verbose_(iConfig.getUntrackedParameter<bool>(
"verbose",
false)) {
24 produces<GenJetCollection>();
35 std::ostringstream
err;
41 auto pOutVisTaus = std::make_unique<GenJetCollection>();
43 using namespace GenParticlesHelper;
48 for (
IGR iTau = allStatus2Taus.begin(); iTau != allStatus2Taus.end(); ++iTau) {
57 if (!status2TauDaughters.
empty())
63 Jet::Constituents constituents;
66 cout <<
"tau " << (*iTau) << endl;
68 for (
IGR igr = descendents.
begin(); igr != descendents.
end(); ++igr) {
69 int absPdgId =
abs((*igr)->pdgId());
73 if (absPdgId == 12 || absPdgId == 14 || absPdgId == 16)
78 cout <<
"\t" << (*igr) << endl;
80 charge += (*igr)->charge();
81 sumVisMom += (*igr)->p4();
85 constituents.push_back(
refToPtr(*igr));
91 GenJet jet(sumVisMom, vertex, specific, constituents);
93 if (charge != (*iTau)->charge())
94 std::cout <<
" charge of Tau: " << (*iTau) <<
" not equal to charge of sum of charge of all descendents. "
98 pOutVisTaus->push_back(jet);
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
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_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
const edm::InputTag inputTagGenParticles_
Input PFCandidates.
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Log< level::Error, false > LogError
const_iterator end() const
Termination of iteration.
bool empty() const
Is the RefVector empty.
const bool verbose_
verbose ?
const_iterator begin() const
Initialize an iterator over the RefVector.
void setCharge(Charge q) final
set electric charge
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.
builds a GenJet from the visible daughters of each status 2 tau in the event.
XYZPointD XYZPoint
point in space with cartesian internal representation
~TauGenJetProducer() override
TauGenJetProducer(const edm::ParameterSet &)
void findDescendents(const reco::GenParticleRef &base, reco::GenParticleRefVector &descendents, int status, int pdgId=0)
find all descendents of a given status and pdgId (recursive)