CMS 3D CMS Logo

Functions

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/RecoJets/JetProducers/plugins/InputGenJetsParticleSelector.cc File Reference

#include "InputGenJetsParticleSelector.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include <memory>
#include "CommonTools/CandUtils/interface/pdgIdUtils.h"

Go to the source code of this file.

Functions

 DEFINE_FWK_MODULE (InputGenJetsParticleSelector)
static void invalidateTree (InputGenJetsParticleSelector::ParticleBitmap &invalid, const InputGenJetsParticleSelector::ParticleVector &p, const reco::GenParticle *particle)
static unsigned int partIdx (const InputGenJetsParticleSelector::ParticleVector &p, const reco::GenParticle *particle)

Function Documentation

DEFINE_FWK_MODULE ( InputGenJetsParticleSelector  )
static void invalidateTree ( InputGenJetsParticleSelector::ParticleBitmap invalid,
const InputGenJetsParticleSelector::ParticleVector p,
const reco::GenParticle particle 
) [static]

Definition at line 129 of file InputGenJetsParticleSelector.cc.

References reco::CompositeRefCandidateT< D >::daughter(), i, customizeTrackingMonitorSeedNumber::idx, npart, reco::CompositeRefCandidateT< D >::numberOfDaughters(), and partIdx().

Referenced by InputGenJetsParticleSelector::produce().

{
  unsigned int npart=particle->numberOfDaughters();
  if (!npart) return;

  for (unsigned int i=0;i<npart;++i){
    unsigned int idx=partIdx(p,dynamic_cast<const reco::GenParticle*>(particle->daughter(i)));
    if (invalid[idx])
      continue;
    invalid[idx] = true;
    //cout<<"Invalidated: ["<<setw(4)<<idx<<"] With pt:"<<particle->daughter(i)->pt()<<endl;
    invalidateTree(invalid, p, dynamic_cast<const reco::GenParticle*>(particle->daughter(i)));
  }
}
static unsigned int partIdx ( const InputGenJetsParticleSelector::ParticleVector p,
const reco::GenParticle particle 
) [static]

Definition at line 115 of file InputGenJetsParticleSelector.cc.

References pos.

Referenced by InputGenJetsParticleSelector::fromResonance(), invalidateTree(), and InputGenJetsParticleSelector::testPartonChildren().

{
  InputGenJetsParticleSelector::ParticleVector::const_iterator pos =
    std::lower_bound(p.begin(), p.end(), particle);
  if (pos == p.end() || *pos != particle)
    throw cms::Exception("CorruptedData")
      << "reco::GenEvent corrupted: Unlisted particles"
      " in decay tree." << std::endl;

  return pos - p.begin();
}