24 = consumes<GenParticleCollection>(inputTagGenParticles_);
32 produces<GenJetCollection>();
45 std::ostringstream err;
46 err<<
" cannot get collection: "
47 <<inputTagGenParticles_<<std::endl;
52 std::auto_ptr<GenJetCollection>
55 using namespace GenParticlesHelper;
59 allStatus2Taus, 15, 2);
61 for (
IGR iTau=allStatus2Taus.begin(); iTau!=allStatus2Taus.end(); ++iTau ) {
71 if ( status2TauDaughters.
size() > 0 )
continue;
75 Particle::Charge
charge = 0;
76 Jet::Constituents constituents;
79 cout<<
"tau "<<(*iTau)<<endl;
82 igr!= descendents.
end(); ++igr ) {
84 int absPdgId =
abs((*igr)->pdgId());
87 if(!includeNeutrinos_ ) {
95 cout<<
"\t"<<(*igr)<<endl;
97 charge += (*igr)->charge();
98 sumVisMom += (*igr)->p4();
102 constituents.push_back(
refToPtr( *igr) );
108 GenJet jet( sumVisMom, vertex, specific, constituents);
110 if (charge != (*iTau)->charge() )
111 std::cout<<
" charge of Tau: " << (*iTau) <<
" not equal to charge of sum of charge of all descendents. " <<
std::cout;
114 pOutVisTaus->push_back( jet );
117 iEvent.
put( pOutVisTaus );
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
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
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual void setCharge(Charge q)
set electric charge
#define DEFINE_FWK_MODULE(type)
std::vector< GenJet > GenJetCollection
collection of GenJet objects
const_iterator end() const
Termination of iteration.
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.
virtual void produce(edm::Event &, const edm::EventSetup &) override
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 &)
void findDescendents(const reco::GenParticleRef &base, reco::GenParticleRefVector &descendents, int status, int pdgId=0)
find all descendents of a given status and pdgId (recursive)