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  void produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const override;
18 
19 private:
20  struct InputInfo {
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 
47  const edm::EventSetup& iSetup) const {
48  for (const auto& input : input_) {
50  iEvent.getByToken(input.token, hframe);
51  const auto& frame = *hframe;
52  const auto& signalHits = frame.getSignal();
53  const auto& pileupHits = frame.getPileups();
54 
55  auto output = std::make_unique<std::vector<PSimHit>>();
56  output->reserve(signalHits.size() + pileupHits.size());
57  for (const auto& ptr : signalHits)
58  output->emplace_back(*ptr);
59  for (const auto& ptr : pileupHits)
60  output->emplace_back(*ptr);
61  iEvent.put(std::move(output), input.instance);
62  }
63 }
64 
65 //define this as a plug-in
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
static std::string const input
Definition: EdmProvDump.cc:50
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
int iEvent
Definition: GenABIO.cc:224
CrossingFramePSimHitToPSimHitsConverter(const edm::ParameterSet &iConfig)
void produce(edm::StreamID, edm::Event &iEvent, const edm::EventSetup &iSetup) const override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: output.py:1
def move(src, dest)
Definition: eostools.py:511