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 
24 
26  tpToken_(consumes<TrackingParticleCollection>(iConfig.getParameter<edm::InputTag>("src")))
27 {
28  produces<TrackingParticleRefVector>();
29 }
30 
33  desc.add<edm::InputTag>("src", edm::InputTag("mix", "MergedTrackTruth"));
34  descriptions.add("trackingParticleConversionRefSelectorDefault", desc);
35 }
36 
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 
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
void produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
std::vector< TrackingParticle > TrackingParticleCollection
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
TrackingParticleConversionRefSelector(const edm::ParameterSet &iConfig)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
int iEvent
Definition: GenABIO.cc:230
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::EDGetTokenT< TrackingParticleCollection > tpToken_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
HLT enums.
def move(src, dest)
Definition: eostools.py:510