CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
TrackingParticleBHadronRefSelector Class Reference
Inheritance diagram for TrackingParticleBHadronRefSelector:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 TrackingParticleBHadronRefSelector (const edm::ParameterSet &iConfig)
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

edm::EDGetTokenT< TrackingParticleCollectiontpToken_
 
HistoryBase tracer_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 16 of file TrackingParticleBHadronRefSelector.cc.

Constructor & Destructor Documentation

TrackingParticleBHadronRefSelector::TrackingParticleBHadronRefSelector ( const edm::ParameterSet iConfig)

Definition at line 31 of file TrackingParticleBHadronRefSelector.cc.

References HistoryBase::depth(), and tracer_.

31  :
32  tpToken_(consumes<TrackingParticleCollection>(iConfig.getParameter<edm::InputTag>("src")))
33 {
34  tracer_.depth(-2); // as in SimTracker/TrackHistory/src/TrackClassifier.cc
35 
36  produces<TrackingParticleRefVector>();
37 }
T getParameter(std::string const &) const
edm::EDGetTokenT< TrackingParticleCollection > tpToken_
void depth(int d)
Set the depth of the history.
Definition: HistoryBase.h:53

Member Function Documentation

void TrackingParticleBHadronRefSelector::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 39 of file TrackingParticleBHadronRefSelector.cc.

References edm::ConfigurationDescriptions::add(), and edm::ParameterSetDescription::add().

39  {
41  desc.add<edm::InputTag>("src", edm::InputTag("mix", "MergedTrackTruth"));
42  descriptions.add("trackingParticleBHadronRefSelector", desc);
43 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void TrackingParticleBHadronRefSelector::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Definition at line 45 of file TrackingParticleBHadronRefSelector.cc.

References DEFINE_FWK_MODULE, end, HistoryBase::evaluate(), edm::Event::getByToken(), mps_fire::i, eostools::move(), EgammaObjectsElectrons_cfi::particleID, source_particleGun_cfi::ParticleID, edm::Event::put(), HistoryBase::recoGenParticleTrail(), tpToken_, and tracer_.

45  {
47  iEvent.getByToken(tpToken_, h_tps);
48 
49  auto ret = std::make_unique<TrackingParticleRefVector>();
50 
51  // Logic is similar to SimTracker/TrackHistory
52  for(size_t i=0, end=h_tps->size(); i<end; ++i) {
53  auto tpRef = TrackingParticleRef(h_tps, i);
54  if(tracer_.evaluate(tpRef)) { // ignore TP if history can not be traced
55  // following is from TrackClassifier::processesAtGenerator()
56  HistoryBase::RecoGenParticleTrail const & recoGenParticleTrail = tracer_.recoGenParticleTrail();
57  for(const auto& particle: recoGenParticleTrail) {
58  HepPDT::ParticleID particleID(particle->pdgId());
59  if(particleID.hasBottom()) {
60  ret->push_back(tpRef);
61  break;
62  }
63  }
64  }
65  }
66 
67  iEvent.put(std::move(ret));
68 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
std::vector< const reco::GenParticle * > RecoGenParticleTrail
reco::GenParticle trail type.
Definition: HistoryBase.h:21
edm::EDGetTokenT< TrackingParticleCollection > tpToken_
#define end
Definition: vmac.h:37
bool evaluate(TrackingParticleRef tpr)
Evaluate track history using a TrackingParticleRef.
Definition: HistoryBase.h:122
RecoGenParticleTrail const & recoGenParticleTrail() const
Return all reco::GenParticle in the history.
Definition: HistoryBase.h:83
edm::Ref< TrackingParticleCollection > TrackingParticleRef
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

edm::EDGetTokenT<TrackingParticleCollection> TrackingParticleBHadronRefSelector::tpToken_
private

Definition at line 25 of file TrackingParticleBHadronRefSelector.cc.

Referenced by produce().

HistoryBase TrackingParticleBHadronRefSelector::tracer_
private