CMS 3D CMS Logo

DetSetVectorThingProducer.cc
Go to the documentation of this file.
2 #include "DataFormats/TestObjects/interface/ThingCollection.h"
3 #include "ThingAlgorithm.h"
9 
10 namespace edmtest {
12  public:
14  : detSets_(iConfig.getParameter<std::vector<int>>("detSets")),
15  nPerDetSet_(iConfig.getParameter<int>("nThings")),
16  alg_(iConfig.getParameter<int>("offsetDelta"),
18  iConfig.getParameter<bool>("grow")),
19  evToken_(produces<edmNew::DetSetVector<Thing>>()) {}
20 
21  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
23  desc.add<int>("offsetDelta", 0)
24  ->setComment(
25  "How much extra to increment the value used when creating Things for a new container. E.g. the last "
26  "value "
27  "used to create Thing from the previous event is incremented by 'offsetDelta' to compute the value to "
28  "use "
29  "of the first Thing created in the next Event.");
30  desc.add<std::vector<int>>("detSets", std::vector<int>{1, 2, 3})->setComment("Vector of DetSet ids");
31  desc.add<int>("nThings", 20)->setComment("How many Things to put in each DetSet.");
32  desc.add<bool>("grow", false)
33  ->setComment("If true, multiply 'nThings' by the value of offset for each run of the algorithm.");
34  descriptions.addWithDefaultLabel(desc);
35  }
36 
37  void produce(edm::StreamID, edm::Event& e, edm::EventSetup const& c) const override {
39 
40  ThingCollection tmp;
41  alg_.run(tmp);
42  assert(tmp.end() == tmp.begin() + nPerDetSet_ * detSets_.size());
43  auto begin = tmp.begin();
44  auto end = begin + nPerDetSet_;
45 
46  for (int detSetID : detSets_) {
48  std::copy(begin, end, std::back_inserter(filler));
49  begin = end;
50  std::advance(end, nPerDetSet_);
51  }
52 
53  e.emplace(evToken_, std::move(ret));
54  }
55 
56  private:
57  std::vector<int> detSets_;
58  unsigned int nPerDetSet_;
61  };
62 
63 } // namespace edmtest
64 
size
Write out results.
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
ret
prodAgent to be discontinued
void produce(edm::StreamID, edm::Event &e, edm::EventSetup const &c) const override
edm::EDPutTokenT< edmNew::DetSetVector< Thing > > evToken_
DetSetVectorThingProducer(edm::ParameterSet const &iConfig)
assert(be >=bs)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void run(ThingCollection &thingCollection) const
tmp
align.sh
Definition: createJobs.py:716
def move(src, dest)
Definition: eostools.py:511