CMS 3D CMS Logo

TrackingParticleConversionRefSelector.cc
Go to the documentation of this file.
7 
11 
13 public:
15 
16  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
17 
18  void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override;
19 
20 private:
22 };
23 
25  : tpToken_(consumes<TrackingParticleCollection>(iConfig.getParameter<edm::InputTag>("src"))) {
26  produces<TrackingParticleRefVector>();
27 }
28 
31  desc.add<edm::InputTag>("src", edm::InputTag("mix", "MergedTrackTruth"));
32  descriptions.add("trackingParticleConversionRefSelectorDefault", desc);
33 }
34 
37  const edm::EventSetup& iSetup) const {
39  iEvent.getByToken(tpToken_, h_tps);
40 
41  auto ret = std::make_unique<TrackingParticleRefVector>();
42 
43  // Logic is similar to Validation/RecoEgamma/plugins/PhotonValidator.cc
44  // and RecoEgamma/EgammaMCTools/src/PhotonMCTruthFinder.cc,
45  // but implemented purely in terms of TrackingParticles (simpler and works for pileup too)
46  for (const auto& tp : *h_tps) {
47  if (tp.pdgId() == 22) {
48  for (const auto& vertRef : tp.decayVertices()) {
49  for (const auto& tpRef : vertRef->daughterTracks()) {
50  if (std::abs(tpRef->pdgId()) == 11) {
51  ret->push_back(tpRef);
52  }
53  }
54  }
55  }
56  }
57 
58  iEvent.put(std::move(ret));
59 }
60 
ConfigurationDescriptions.h
runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:355
edm::StreamID
Definition: StreamID.h:30
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
edm::Handle< TrackingParticleCollection >
MakerMacros.h
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
cmsswSequenceInfo.tp
tp
Definition: cmsswSequenceInfo.py:17
edm::global::EDProducer
Definition: EDProducer.h:32
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
TrackingParticleConversionRefSelector::TrackingParticleConversionRefSelector
TrackingParticleConversionRefSelector(const edm::ParameterSet &iConfig)
Definition: TrackingParticleConversionRefSelector.cc:24
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:57
TrackingParticle.h
TrackingParticleConversionRefSelector
Definition: TrackingParticleConversionRefSelector.cc:12
eostools.move
def move(src, dest)
Definition: eostools.py:511
TrackingParticleConversionRefSelector::produce
void produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
Definition: TrackingParticleConversionRefSelector.cc:35
TrackingParticleFwd.h
TrackingParticleCollection
std::vector< TrackingParticle > TrackingParticleCollection
Definition: TrackingParticleFwd.h:8
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ParameterSet.h
EDProducer.h
TrackingParticleConversionRefSelector::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: TrackingParticleConversionRefSelector.cc:29
edm::Event
Definition: Event.h:73
EDProductfwd.h
edm::InputTag
Definition: InputTag.h:15
TrackingParticleConversionRefSelector::tpToken_
edm::EDGetTokenT< TrackingParticleCollection > tpToken_
Definition: TrackingParticleConversionRefSelector.cc:21