CMS 3D CMS Logo

EmptySimHits.cc
Go to the documentation of this file.
1 #include <memory>
2 
5 
8 
10 
13 
14 class EmptySimHits : public edm::EDProducer {
15 public:
16  explicit EmptySimHits(const edm::ParameterSet&);
17  ~EmptySimHits() override{};
18 
19  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
20 
21 private:
22  void beginJob() override{};
23  void produce(edm::Event&, const edm::EventSetup&) override;
24  void endJob() override{};
25 
26  std::vector<std::string> pCaloHitInstanceLabels;
27  std::vector<std::string> pSimHitInstanceLabels;
28 };
29 
31  pSimHitInstanceLabels = iConfig.getParameter<std::vector<std::string> >("pSimHitInstanceLabels");
32  pCaloHitInstanceLabels = iConfig.getParameter<std::vector<std::string> >("pCaloHitInstanceLabels");
33 
34  for (size_t i = 0; i < pSimHitInstanceLabels.size(); i++) {
35  produces<edm::PSimHitContainer>(pSimHitInstanceLabels[i]);
36  }
37 
38  for (size_t i = 0; i < pCaloHitInstanceLabels.size(); i++) {
39  produces<edm::PCaloHitContainer>(pCaloHitInstanceLabels[i]);
40  }
41 }
42 
44  for (size_t i = 0; i < pSimHitInstanceLabels.size(); i++) {
45  std::unique_ptr<edm::PSimHitContainer> pSimHitContainer(new edm::PSimHitContainer());
46  iEvent.put(std::move(pSimHitContainer), pSimHitInstanceLabels[i]);
47  }
48 
49  for (size_t i = 0; i < pCaloHitInstanceLabels.size(); i++) {
50  std::unique_ptr<edm::PCaloHitContainer> pCaloHitContainer(new edm::PCaloHitContainer());
51  iEvent.put(std::move(pCaloHitContainer), pCaloHitInstanceLabels[i]);
52  }
53 }
54 
56  //The following says we do not know what parameters are allowed so do no validation
57  // Please change this to state exactly what you do use, even if it is no parameters
59  desc.setUnknown();
60  descriptions.addDefault(desc);
61 }
62 
63 //define this as a plug-in
T getParameter(std::string const &) const
void beginJob() override
Definition: EmptySimHits.cc:22
std::vector< PCaloHit > PCaloHitContainer
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
std::vector< std::string > pCaloHitInstanceLabels
Definition: EmptySimHits.cc:24
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void addDefault(ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: EmptySimHits.cc:55
EmptySimHits(const edm::ParameterSet &)
Definition: EmptySimHits.cc:30
std::vector< std::string > pSimHitInstanceLabels
Definition: EmptySimHits.cc:27
std::vector< PSimHit > PSimHitContainer
void endJob() override
Definition: EmptySimHits.cc:24
def move(src, dest)
Definition: eostools.py:511
~EmptySimHits() override
Definition: EmptySimHits.cc:17
void produce(edm::Event &, const edm::EventSetup &) override
Definition: EmptySimHits.cc:43