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 };
30 
32 {
33  pSimHitInstanceLabels = iConfig.getParameter<std::vector<std::string> >("pSimHitInstanceLabels");
34  pCaloHitInstanceLabels = iConfig.getParameter<std::vector<std::string> >("pCaloHitInstanceLabels");
35 
36  for(size_t i = 0;i<pSimHitInstanceLabels.size();i++){
37  produces<edm::PSimHitContainer>(pSimHitInstanceLabels[i]);
38  }
39 
40  for(size_t i = 0;i<pCaloHitInstanceLabels.size();i++){
41  produces<edm::PCaloHitContainer>(pCaloHitInstanceLabels[i]);
42  }
43 }
44 
45 void
47 {
48  for(size_t i = 0;i<pSimHitInstanceLabels.size();i++){
49  std::unique_ptr<edm::PSimHitContainer> pSimHitContainer(new edm::PSimHitContainer());
50  iEvent.put(std::move(pSimHitContainer),pSimHitInstanceLabels[i]);
51  }
52 
53  for(size_t i = 0;i<pCaloHitInstanceLabels.size();i++){
54  std::unique_ptr<edm::PCaloHitContainer> pCaloHitContainer(new edm::PCaloHitContainer());
55  iEvent.put(std::move(pCaloHitContainer),pCaloHitInstanceLabels[i]);
56  }
57 
58 }
59 
60 void
62  //The following says we do not know what parameters are allowed so do no validation
63  // Please change this to state exactly what you do use, even if it is no parameters
65  desc.setUnknown();
66  descriptions.addDefault(desc);
67 }
68 
69 //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:127
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
std::vector< std::string > pCaloHitInstanceLabels
Definition: EmptySimHits.cc:24
int iEvent
Definition: GenABIO.cc:230
void addDefault(ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: EmptySimHits.cc:61
EmptySimHits(const edm::ParameterSet &)
Definition: EmptySimHits.cc:31
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:510
~EmptySimHits() override
Definition: EmptySimHits.cc:17
void produce(edm::Event &, const edm::EventSetup &) override
Definition: EmptySimHits.cc:46