CMS 3D CMS Logo

CrossingFramePSimHitToPSimHits.cc
Go to the documentation of this file.
7 
10 
12 public:
14 
15  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
16 
17  virtual void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override;
18 
19 private:
20  struct InputInfo {
22  InputInfo(Token t, const std::string& i): token(t), instance(i) {}
25  };
26 
27  std::vector<InputInfo> input_;
28 };
29 
31  auto src = iConfig.getParameter<std::vector<edm::InputTag> >("src");
32  input_.reserve(src.size());
33  for(const auto& tag: src) {
34  input_.emplace_back(consumes<CrossingFrame<PSimHit> >(tag), tag.instance());
35  produces<std::vector<PSimHit> >(input_.back().instance);
36  }
37 }
38 
41  desc.add<std::vector<edm::InputTag> >("src", std::vector<edm::InputTag>());
42  descriptions.add("crossingFramePSimHitToPSimHits", desc);
43 }
44 
46  for(const auto& input: input_) {
48  iEvent.getByToken(input.token, hframe);
49  const auto& frame = *hframe;
50  const auto& signalHits = frame.getSignal();
51  const auto& pileupHits = frame.getPileups();
52 
53  auto output = std::make_unique<std::vector<PSimHit>>();
54  output->reserve(signalHits.size() + pileupHits.size());
55  for(const auto& ptr: signalHits)
56  output->emplace_back(*ptr);
57  for(const auto& ptr: pileupHits)
58  output->emplace_back(*ptr);
59  iEvent.put(std::move(output), input.instance);
60  }
61 }
62 
63 //define this as a plug-in
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
static std::string const input
Definition: EdmProvDump.cc:44
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
int iEvent
Definition: GenABIO.cc:230
CrossingFramePSimHitToPSimHitsConverter(const edm::ParameterSet &iConfig)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
def move(src, dest)
Definition: eostools.py:510
virtual void produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override