test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackingParticleConversionSelector.cc
Go to the documentation of this file.
7 
11 
13 public:
15 
16  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
17 
18  virtual void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override;
19 
20 private:
22 };
23 
24 
26  tpToken_(consumes<TrackingParticleCollection>(iConfig.getParameter<edm::InputTag>("src")))
27 {
28  produces<TrackingParticleCollection>();
29 }
30 
33  desc.add<edm::InputTag>("src", edm::InputTag("mix", "MergedTrackTruth"));
34  descriptions.add("trackingParticleConversionSelector", desc);
35 }
36 
39  iEvent.getByToken(tpToken_, h_tps);
40 
41  // Copy TPs because currently we can't process RefVectors of TPs in downstream
42  auto ret = std::make_unique<TrackingParticleCollection>();
43 
44  // Logic is similar to Validation/RecoEgamma/plugins/PhotonValidator.cc
45  // and RecoEgamma/EgammaMCTools/src/PhotonMCTruthFinder.cc,
46  // but implemented purely in terms of TrackingParticles (simpler and works for pileup too)
47  for(const auto& tp: *h_tps) {
48  if(tp.pdgId() == 22) {
49  for(const auto& vertRef: tp.decayVertices()) {
50  for(const auto& tpRef: vertRef->daughterTracks()) {
51  if(std::abs(tpRef->pdgId()) == 11) {
52  ret->push_back(*tpRef);
53  }
54  }
55  }
56  }
57  }
58 
59  iEvent.put(std::move(ret));
60 }
61 
tuple ret
prodAgent to be discontinued
std::vector< TrackingParticle > TrackingParticleCollection
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
virtual void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
edm::EDGetTokenT< TrackingParticleCollection > tpToken_
int iEvent
Definition: GenABIO.cc:230
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
def move
Definition: eostools.py:510
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ParameterDescriptionBase * add(U const &iLabel, T const &value)
TrackingParticleConversionSelector(const edm::ParameterSet &iConfig)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)