CMS 3D CMS Logo

ParticleDecayProducer Class Reference

Original Author: Nicola De Filippis. More...

Inheritance diagram for ParticleDecayProducer:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 ParticleDecayProducer (const edm::ParameterSet &)
 ~ParticleDecayProducer ()

Private Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &)

Private Attributes

std::vector< intdaughtersPdgId_
std::string decayChain_
edm::InputTag genCandidates_
int motherPdgId_
std::vector< std::string > valias


Detailed Description

Original Author: Nicola De Filippis.

Definition at line 14 of file ParticleDecayProducer.cc.


Constructor & Destructor Documentation

ParticleDecayProducer::ParticleDecayProducer ( const edm::ParameterSet iConfig  )  [explicit]

Definition at line 40 of file ParticleDecayProducer.cc.

References collection, daughtersPdgId_, decayChain_, index, j, and valias.

00040                                                                            :
00041   genCandidates_(iConfig.getParameter<InputTag>("src")),
00042   motherPdgId_(iConfig.getParameter<int>("motherPdgId")),
00043   daughtersPdgId_(iConfig.getParameter<vector<int> >("daughtersPdgId")),
00044   decayChain_(iConfig.getParameter<std::string>("decayChain")) {
00045   string alias;
00046   produces<CandidateCollection >(alias = decayChain_+ "Mother").setBranchAlias(alias);
00047   for (unsigned int j = 0; j < daughtersPdgId_.size(); ++ j) {
00048     ostringstream index,collection;
00049     index << j;
00050     collection << decayChain_ << "Lepton" << index.str();
00051     valias.push_back(collection.str());
00052     produces<CandidateCollection >(valias.at(j)).setBranchAlias( valias.at(j) );
00053   }
00054 }

ParticleDecayProducer::~ParticleDecayProducer (  ) 

Definition at line 57 of file ParticleDecayProducer.cc.

00057                                               {
00058 }


Member Function Documentation

void ParticleDecayProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 60 of file ParticleDecayProducer.cc.

References clone(), daughtersPdgId_, decayChain_, genCandidates_, edm::Event::getByLabel(), i, j, motherPdgId_, p, edm::Event::put(), row, and valias.

00060                                                                                  {
00061   // get gen particle candidates
00062   edm::Handle<CandidateCollection> genCandidatesCollection;
00063   iEvent.getByLabel(genCandidates_, genCandidatesCollection);
00064 
00065   auto_ptr<CandidateCollection> mothercands(new CandidateCollection);
00066   auto_ptr<CandidateCollection> daughterscands(new CandidateCollection);
00067   size_t daughtersize = daughtersPdgId_.size();
00068   for( CandidateCollection::const_iterator p = genCandidatesCollection->begin();p != genCandidatesCollection->end(); ++ p ) {
00069     if (p->pdgId() == motherPdgId_  && p->status() == 3){
00070       mothercands->push_back(p->clone());
00071       size_t ndau = p->numberOfDaughters();
00072       for(size_t i = 0; i < ndau; ++ i){
00073         for (size_t j = 0; j < daughtersize; ++j){
00074           if (p->daughter(i)->pdgId()==daughtersPdgId_[j] && p->daughter(i)->status()==3){
00075             daughterscands->push_back(p->daughter(i)->clone());
00076           }
00077         }
00078       }      
00079     }
00080   }
00081 
00082   iEvent.put(mothercands, decayChain_ + "Mother");
00083   daughterscands->sort(GreaterByPt<reco::Candidate>());
00084   
00085   for (unsigned int row = 0; row < daughtersize; ++ row ){
00086     auto_ptr<CandidateCollection> leptonscands_(new CandidateCollection);
00087     leptonscands_->push_back((daughterscands->begin()+row)->clone());
00088     iEvent.put(leptonscands_, valias.at(row));
00089   }
00090 }


Member Data Documentation

std::vector<int> ParticleDecayProducer::daughtersPdgId_ [private]

Definition at line 23 of file ParticleDecayProducer.cc.

Referenced by ParticleDecayProducer(), and produce().

std::string ParticleDecayProducer::decayChain_ [private]

Definition at line 24 of file ParticleDecayProducer.cc.

Referenced by ParticleDecayProducer(), and produce().

edm::InputTag ParticleDecayProducer::genCandidates_ [private]

Definition at line 21 of file ParticleDecayProducer.cc.

Referenced by produce().

int ParticleDecayProducer::motherPdgId_ [private]

Definition at line 22 of file ParticleDecayProducer.cc.

Referenced by produce().

std::vector<std::string> ParticleDecayProducer::valias [private]

Definition at line 25 of file ParticleDecayProducer.cc.

Referenced by ParticleDecayProducer(), and produce().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:29:27 2009 for CMSSW by  doxygen 1.5.4