00001 #include <memory> 00002 #include <string> 00003 #include <vector> 00004 #include <map> 00005 00006 #include "FWCore/Framework/interface/Event.h" 00007 #include "FWCore/Framework/interface/EDProducer.h" 00008 #include "FWCore/Framework/interface/Frameworkfwd.h" 00009 00010 #include "FWCore/ParameterSet/interface/InputTag.h" 00011 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00012 #include "DataFormats/HepMCCandidate/interface/GenParticle.h" 00013 00014 00015 class TopDecaySubset : public edm::EDProducer { 00016 00017 public: 00018 00021 enum FillMode {kStable, kME}; 00022 00024 explicit TopDecaySubset(const edm::ParameterSet&); 00026 ~TopDecaySubset(); 00027 00029 virtual void produce(edm::Event&, const edm::EventSetup&); 00030 00031 private: 00032 00035 void fillOutput(edm::Event& evt, const reco::GenParticleCollection& src, FillMode mode); 00038 bool wInDecayChain(const reco::GenParticleCollection& src, const int& partId); 00041 void fromFullListing(const reco::GenParticleCollection& src, reco::GenParticleCollection& target, const int& partId, FillMode mode); 00044 void fromTruncListing(const reco::GenParticleCollection& src, reco::GenParticleCollection& target, const int& partId, FillMode mode); 00046 void clearReferences(); 00048 void fillReferences(const reco::GenParticleRefProd& refProd, reco::GenParticleCollection& target); 00051 reco::Particle::LorentzVector p4(const std::vector<reco::GenParticle>::const_iterator top, int statusFlag); 00053 reco::Particle::LorentzVector p4(const reco::GenParticle::const_iterator part, int statusFlag); 00056 void addDaughters(int& idx, const reco::GenParticle::const_iterator part, reco::GenParticleCollection& target, bool recursive=true); 00059 void addRadiation(int& idx, const reco::GenParticle::const_iterator part, reco::GenParticleCollection& target); 00062 void printTarget(reco::GenParticleCollection& target); 00065 void printSource(const reco::GenParticleCollection& src); 00066 00067 private: 00068 00072 int motherPartIdx_; 00074 std::map<int,std::vector<int> > refs_; 00076 bool addRadiatedGluons_; 00078 edm::InputTag src_; 00079 00080 };