20 inputTagGenParticles_(iConfig.getParameter<
InputTag>(
"GenParticles")),
22 includeNeutrinos_(iConfig.getParameter<bool>(
"includeNeutrinos")),
23 verbose_(iConfig.getUntrackedParameter<bool>(
"verbose",
false))
27 produces<GenJetCollection>();
40 std::ostringstream err;
41 err<<
" cannot get collection: "
47 std::auto_ptr<GenJetCollection>
50 using namespace GenParticlesHelper;
54 allStatus2Taus, 15, 2);
56 for (
IGR iTau=allStatus2Taus.begin(); iTau!=allStatus2Taus.end(); ++iTau ) {
66 if ( status2TauDaughters.
size() > 0 )
continue;
70 Particle::Charge
charge = 0;
71 Jet::Constituents constituents;
74 cout<<
"tau "<<(*iTau)<<endl;
77 igr!= descendents.
end(); ++igr ) {
79 int absPdgId =
abs((*igr)->pdgId());
90 cout<<
"\t"<<(*igr)<<endl;
92 charge += (*igr)->charge();
93 sumVisMom += (*igr)->p4();
97 constituents.push_back(
refToPtr( *igr) );
103 GenJet jet( sumVisMom, vertex, specific, constituents);
105 if (charge != (*iTau)->charge() )
106 std::cout<<
" charge of Tau: " << (*iTau) <<
" not equal to charge of sum of charge of all descendents. " <<
std::cout;
109 pOutVisTaus->push_back( jet );
112 iEvent.
put( pOutVisTaus );
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
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
virtual void setCharge(Charge q)
set electric charge
#define DEFINE_FWK_MODULE(type)
const edm::InputTag inputTagGenParticles_
Input PFCandidates.
virtual void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
std::vector< GenJet > GenJetCollection
collection of GenJet objects
const_iterator end() const
Termination of iteration.
const bool verbose_
verbose ?
const_iterator begin() const
Initialize an iterator over the RefVector.
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
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
size_type size() const
Size of the RefVector.
TauGenJetProducer(const edm::ParameterSet &)
volatile std::atomic< bool > shutdown_flag false
void findDescendents(const reco::GenParticleRef &base, reco::GenParticleRefVector &descendents, int status, int pdgId=0)
find all descendents of a given status and pdgId (recursive)