CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackingParticleNumberOfLayersProducer.cc
Go to the documentation of this file.
7 
9 
15 public:
17 
18  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
19 
20  virtual void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override;
21 
22 private:
24  std::vector<edm::EDGetTokenT<std::vector<PSimHit>>> simHitTokens_;
25 };
26 
27 
29  tpToken_(consumes<TrackingParticleCollection>(iConfig.getParameter<edm::InputTag>("trackingParticles")))
30 {
31  for(const auto& tag: iConfig.getParameter<std::vector<edm::InputTag>>("simHits")) {
32  simHitTokens_.push_back(consumes<std::vector<PSimHit>>(tag));
33  }
34 
35  produces<edm::ValueMap<unsigned int>>("trackerLayers");
36  produces<edm::ValueMap<unsigned int>>("pixelLayers");
37  produces<edm::ValueMap<unsigned int>>("stripStereoLayers");
38 }
39 
42  desc.add<edm::InputTag>("trackingParticles", edm::InputTag("mix", "MergedTrackTruth"));
43 
44  desc.add<std::vector<edm::InputTag> >("simHits", {
45  edm::InputTag("g4SimHits", "TrackerHitsPixelBarrelHighTof"),
46  edm::InputTag("g4SimHits", "TrackerHitsPixelBarrelLowTof"),
47  edm::InputTag("g4SimHits", "TrackerHitsPixelEndcapHighTof"),
48  edm::InputTag("g4SimHits", "TrackerHitsPixelEndcapLowTof"),
49  edm::InputTag("g4SimHits", "TrackerHitsTECHighTof"),
50  edm::InputTag("g4SimHits", "TrackerHitsTECLowTof"),
51  edm::InputTag("g4SimHits", "TrackerHitsTIBHighTof"),
52  edm::InputTag("g4SimHits", "TrackerHitsTIBLowTof"),
53  edm::InputTag("g4SimHits", "TrackerHitsTIDHighTof"),
54  edm::InputTag("g4SimHits", "TrackerHitsTIDLowTof"),
55  edm::InputTag("g4SimHits", "TrackerHitsTOBHighTof"),
56  edm::InputTag("g4SimHits", "TrackerHitsTOBLowTof")
57  });
58 
59  descriptions.add("trackingParticleNumberOfLayersProducer", desc);
60 }
61 
64  iEvent.getByToken(tpToken_, htps);
65 
67  auto ret = algo.calculate(htps, iSetup);
68  iEvent.put(std::move(std::get<TrackingParticleNumberOfLayers::nTrackerLayers>(ret)), "trackerLayers");
69  iEvent.put(std::move(std::get<TrackingParticleNumberOfLayers::nPixelLayers>(ret)), "pixelLayers");
70  iEvent.put(std::move(std::get<TrackingParticleNumberOfLayers::nStripMonoAndStereoLayers>(ret)), "stripStereoLayers");
71 }
72 
T getParameter(std::string const &) const
virtual 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:464
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
std::vector< edm::EDGetTokenT< std::vector< PSimHit > > > simHitTokens_
TrackingParticleNumberOfLayersProducer(const edm::ParameterSet &iConfig)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
int iEvent
Definition: GenABIO.cc:230
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
edm::EDGetTokenT< TrackingParticleCollection > tpToken_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::tuple< std::unique_ptr< edm::ValueMap< unsigned int > >, std::unique_ptr< edm::ValueMap< unsigned int > >, std::unique_ptr< edm::ValueMap< unsigned int > > > calculate(const edm::Handle< TrackingParticleCollection > &tps, const edm::EventSetup &iSetup) const