builds a GenJet from the visible daughters of each status 2 tau in the event. More...
#include <TauGenJetProducer.h>
Public Member Functions | |
virtual void | beginJob () |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
TauGenJetProducer (const edm::ParameterSet &) | |
~TauGenJetProducer () | |
Private Attributes | |
bool | includeNeutrinos_ |
if yes, neutrinos will be included, for debug purposes | |
edm::InputTag | inputTagGenParticles_ |
Input PFCandidates. | |
bool | verbose_ |
verbose ? |
builds a GenJet from the visible daughters of each status 2 tau in the event.
Definition at line 23 of file TauGenJetProducer.h.
TauGenJetProducer::TauGenJetProducer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 20 of file TauGenJetProducer.cc.
References edm::ParameterSet::getParameter(), and edm::ParameterSet::getUntrackedParameter().
{ inputTagGenParticles_ = iConfig.getParameter<InputTag>("GenParticles"); includeNeutrinos_ = iConfig.getParameter<bool>("includeNeutrinos"); verbose_ = iConfig.getUntrackedParameter<bool>("verbose",false); produces<GenJetCollection>(); }
TauGenJetProducer::~TauGenJetProducer | ( | ) |
Definition at line 34 of file TauGenJetProducer.cc.
{ }
void TauGenJetProducer::beginJob | ( | void | ) | [virtual] |
void TauGenJetProducer::produce | ( | edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 38 of file TauGenJetProducer.cc.
References abs, edm::RefVector< C, T, F >::begin(), DeDxDiscriminatorTools::charge(), gather_cfg::cout, edm::RefVector< C, T, F >::end(), Exception, GenParticlesHelper::findDescendents(), GenParticlesHelper::findParticles(), newFWLiteAna::found, genParticleCandidates2GenParticles_cfi::genParticles, edm::Event::getByLabel(), metsig::jet, edm::Event::put(), edm::refToPtr(), reco::LeafCandidate::setCharge(), and edm::RefVector< C, T, F >::size().
{ Handle<GenParticleCollection> genParticles; bool found = iEvent.getByLabel( inputTagGenParticles_, genParticles); if ( !found ) { std::ostringstream err; err<<" cannot get collection: " <<inputTagGenParticles_<<std::endl; edm::LogError("TauGenJetProducer")<<err.str(); throw cms::Exception( "MissingProduct", err.str()); } std::auto_ptr<GenJetCollection> pOutVisTaus(new GenJetCollection()); using namespace GenParticlesHelper; GenParticleRefVector allStatus2Taus; findParticles( *genParticles, allStatus2Taus, 15, 2); for ( IGR iTau=allStatus2Taus.begin(); iTau!=allStatus2Taus.end(); ++iTau ) { // look for all status 1 (stable) descendents GenParticleRefVector descendents; findDescendents( *iTau, descendents, 1); // CV: skip status 2 taus that radiate-off a photon // --> have a status 2 tau lepton in the list of descendents GenParticleRefVector status2TauDaughters; findDescendents( *iTau, status2TauDaughters, 2, 15 ); if ( status2TauDaughters.size() > 0 ) continue; // loop on descendents, and take all except neutrinos math::XYZTLorentzVector sumVisMom; Particle::Charge charge = 0; Jet::Constituents constituents; if(verbose_) cout<<"tau "<<(*iTau)<<endl; for(IGR igr = descendents.begin(); igr!= descendents.end(); ++igr ) { int absPdgId = abs((*igr)->pdgId()); // neutrinos if(!includeNeutrinos_ ) { if( absPdgId == 12 || absPdgId == 14 || absPdgId == 16 ) continue; } if(verbose_) cout<<"\t"<<(*igr)<<endl; charge += (*igr)->charge(); sumVisMom += (*igr)->p4(); // need to convert the vector of reference to the constituents // to a vector of pointers to build the genjet constituents.push_back( refToPtr( *igr) ); } math::XYZPoint vertex; GenJet::Specific specific; GenJet jet( sumVisMom, vertex, specific, constituents); if (charge != (*iTau)->charge() ) std::cout<<" charge of Tau: " << (*iTau) << " not equal to charge of sum of charge of all descendents. " << std::cout; jet.setCharge(charge); pOutVisTaus->push_back( jet ); } iEvent.put( pOutVisTaus ); }
bool TauGenJetProducer::includeNeutrinos_ [private] |
if yes, neutrinos will be included, for debug purposes
Definition at line 40 of file TauGenJetProducer.h.
Input PFCandidates.
Definition at line 37 of file TauGenJetProducer.h.
bool TauGenJetProducer::verbose_ [private] |
verbose ?
Definition at line 43 of file TauGenJetProducer.h.