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<>

Public Member Functions

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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::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
 

Detailed Description

Definition at line 16 of file TrackingParticleBHadronRefSelector.cc.

Constructor & Destructor Documentation

◆ TrackingParticleBHadronRefSelector()

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

Definition at line 30 of file TrackingParticleBHadronRefSelector.cc.

31  : tpToken_(consumes<TrackingParticleCollection>(iConfig.getParameter<edm::InputTag>("src"))) {
32  tracer_.depth(-2); // as in SimTracker/TrackHistory/src/TrackClassifier.cc
33 
34  produces<TrackingParticleRefVector>();
35 }

References HistoryBase::depth(), and tracer_.

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 37 of file TrackingParticleBHadronRefSelector.cc.

37  {
39  desc.add<edm::InputTag>("src", edm::InputTag("mix", "MergedTrackTruth"));
40  descriptions.add("trackingParticleBHadronRefSelectorDefault", desc);
41 }

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

◆ produce()

void TrackingParticleBHadronRefSelector::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 43 of file TrackingParticleBHadronRefSelector.cc.

43  {
45  iEvent.getByToken(tpToken_, h_tps);
46 
47  auto ret = std::make_unique<TrackingParticleRefVector>();
48 
49  // Logic is similar to SimTracker/TrackHistory
50  for (size_t i = 0, end = h_tps->size(); i < end; ++i) {
51  auto tpRef = TrackingParticleRef(h_tps, i);
52  if (tracer_.evaluate(tpRef)) { // ignore TP if history can not be traced
53  // following is from TrackClassifier::processesAtGenerator()
54  HistoryBase::RecoGenParticleTrail const &recoGenParticleTrail = tracer_.recoGenParticleTrail();
55  for (const auto &particle : recoGenParticleTrail) {
56  HepPDT::ParticleID particleID(particle->pdgId());
57  if (particleID.hasBottom()) {
58  ret->push_back(tpRef);
59  break;
60  }
61  }
62  }
63  }
64 
65  iEvent.put(std::move(ret));
66 }

References end, HistoryBase::evaluate(), mps_fire::i, iEvent, eostools::move(), EgammaObjectsElectrons_cfi::particleID, LHEGenericFilter_cfi::ParticleID, HistoryBase::recoGenParticleTrail(), runTheMatrix::ret, tpToken_, and tracer_.

Member Data Documentation

◆ tpToken_

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

Definition at line 25 of file TrackingParticleBHadronRefSelector.cc.

Referenced by produce().

◆ tracer_

HistoryBase TrackingParticleBHadronRefSelector::tracer_
private
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:355
mps_fire.i
i
Definition: mps_fire.py:355
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
HistoryBase::recoGenParticleTrail
const RecoGenParticleTrail & recoGenParticleTrail() const
Return all reco::GenParticle in the history.
Definition: HistoryBase.h:64
HistoryBase::RecoGenParticleTrail
std::vector< const reco::GenParticle * > RecoGenParticleTrail
reco::GenParticle trail type.
Definition: HistoryBase.h:18
edm::Handle< TrackingParticleCollection >
end
#define end
Definition: vmac.h:39
TrackingParticleBHadronRefSelector::tpToken_
edm::EDGetTokenT< TrackingParticleCollection > tpToken_
Definition: TrackingParticleBHadronRefSelector.cc:25
EgammaObjectsElectrons_cfi.particleID
particleID
Definition: EgammaObjectsElectrons_cfi.py:4
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
TrackingParticleRef
edm::Ref< TrackingParticleCollection > TrackingParticleRef
Definition: TrackingParticleFwd.h:10
HistoryBase::evaluate
bool evaluate(TrackingParticleRef tpr)
Evaluate track history using a TrackingParticleRef.
Definition: HistoryBase.h:96
LHEGenericFilter_cfi.ParticleID
ParticleID
Definition: LHEGenericFilter_cfi.py:6
edm::InputTag
Definition: InputTag.h:15
TrackingParticleBHadronRefSelector::tracer_
HistoryBase tracer_
Definition: TrackingParticleBHadronRefSelector.cc:27
HistoryBase::depth
void depth(int d)
Set the depth of the history.
Definition: HistoryBase.h:49