CMS 3D CMS Logo

TrackingParticleBHadronRefSelector.cc
Go to the documentation of this file.
7 
11 
13 
14 #include "HepPDT/ParticleID.hh"
15 
17 public:
19 
20  static void fillDescriptions(edm::ConfigurationDescriptions &descriptions);
21 
22  void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override;
23 
24 private:
26 
28 };
29 
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 }
36 
39  desc.add<edm::InputTag>("src", edm::InputTag("mix", "MergedTrackTruth"));
40  descriptions.add("trackingParticleBHadronRefSelectorDefault", desc);
41 }
42 
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 }
67 
ConfigurationDescriptions.h
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::EDGetTokenT< TrackingParticleCollection >
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
EDProducer.h
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::TrackingParticleBHadronRefSelector
TrackingParticleBHadronRefSelector(const edm::ParameterSet &iConfig)
Definition: TrackingParticleBHadronRefSelector.cc:30
MakerMacros.h
TrackingParticleBHadronRefSelector::tpToken_
edm::EDGetTokenT< TrackingParticleCollection > tpToken_
Definition: TrackingParticleBHadronRefSelector.cc:25
EgammaObjectsElectrons_cfi.particleID
particleID
Definition: EgammaObjectsElectrons_cfi.py:4
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
ParameterSetDescription.h
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
HistoryBase.h
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
iEvent
int iEvent
Definition: GenABIO.cc:224
HistoryBase
Base class to all the history types.
Definition: HistoryBase.h:12
edm::stream::EDProducer
Definition: EDProducer.h:38
edm::EventSetup
Definition: EventSetup.h:57
TrackingParticleBHadronRefSelector::produce
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
Definition: TrackingParticleBHadronRefSelector.cc:43
TrackingParticle.h
eostools.move
def move(src, dest)
Definition: eostools.py:511
TrackingParticleBHadronRefSelector
Definition: TrackingParticleBHadronRefSelector.cc:16
TrackingParticleFwd.h
TrackingParticleCollection
std::vector< TrackingParticle > TrackingParticleCollection
Definition: TrackingParticleFwd.h:8
ParameterSet.h
TrackingParticleRef
edm::Ref< TrackingParticleCollection > TrackingParticleRef
Definition: TrackingParticleFwd.h:10
edm::Event
Definition: Event.h:73
TrackingParticleBHadronRefSelector::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: TrackingParticleBHadronRefSelector.cc:37
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
EDProductfwd.h
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