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
mps_fire.i
i
Definition: mps_fire.py:355
EDProducer.h
EmptySimHits::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: EmptySimHits.cc:43
EmptySimHits::EmptySimHits
EmptySimHits(const edm::ParameterSet &)
Definition: EmptySimHits.cc:30
PSimHitContainer.h
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
EmptySimHits::pSimHitInstanceLabels
std::vector< std::string > pSimHitInstanceLabels
Definition: EmptySimHits.cc:27
MakerMacros.h
EmptySimHits::endJob
void endJob() override
Definition: EmptySimHits.cc:24
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
EmptySimHits::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: EmptySimHits.cc:55
EmptySimHits::~EmptySimHits
~EmptySimHits() override
Definition: EmptySimHits.cc:17
EmptySimHits
Definition: EmptySimHits.cc:14
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::ParameterSetDescription::setUnknown
void setUnknown()
Definition: ParameterSetDescription.cc:39
edm::EventSetup
Definition: EventSetup.h:57
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
Frameworkfwd.h
EmptySimHits::pCaloHitInstanceLabels
std::vector< std::string > pCaloHitInstanceLabels
Definition: EmptySimHits.cc:24
edm::PCaloHitContainer
std::vector< PCaloHit > PCaloHitContainer
Definition: PCaloHitContainer.h:8
edm::EDProducer
Definition: EDProducer.h:36
PCaloHitContainer.h
EmptySimHits::beginJob
void beginJob() override
Definition: EmptySimHits.cc:22
edm::PSimHitContainer
std::vector< PSimHit > PSimHitContainer
Definition: PSimHitContainer.h:11
ParameterSet.h
edm::Event
Definition: Event.h:73
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99