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 
void produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
ret
prodAgent to be discontinued
TrackingParticleConversionRefSelector(const edm::ParameterSet &iConfig)
int iEvent
Definition: GenABIO.cc:224
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::EDGetTokenT< TrackingParticleCollection > tpToken_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
HLT enums.
std::vector< TrackingParticle > TrackingParticleCollection
def move(src, dest)
Definition: eostools.py:511