CMS 3D CMS Logo

TrackingRegionEDProducerT.h
Go to the documentation of this file.
1 #ifndef RecoTracker_TkTrackingRegions_TrackingRegionEDProducerT_H
2 #define RecoTracker_TkTrackingRegions_TrackingRegionEDProducerT_H
3 
7 
10 
11 template <typename T_TrackingRegionProducer>
13 public:
14  // using OwnVector as vector<shared_ptr> and vector<unique_ptr> cause problems
15  // I can't get dictionary compiled with unique_ptr
16  // shared_ptr fails with runtime error "Class name 'TrackingRegionstdshared_ptrs' contains an underscore ('_'), which is illegal in the name of a product."
18 
20  regionProducer_(iConfig, consumesCollector()) {
21  produces<ProductType>();
22  }
23 
24  ~TrackingRegionEDProducerT() override = default;
25 
26  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
28  }
29 
30  void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override {
31  auto regions = regionProducer_.regions(iEvent, iSetup);
32  auto ret = std::make_unique<ProductType>();
33  ret->reserve(regions.size());
34  for(auto& regionPtr: regions) {
35  ret->push_back(regionPtr.release());
36  }
37 
38  iEvent.put(std::move(ret));
39  }
40 
41 private:
42  T_TrackingRegionProducer regionProducer_;
43 };
44 
45 #endif
T_TrackingRegionProducer regionProducer_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
~TrackingRegionEDProducerT() override=default
TrackingRegionEDProducerT(const edm::ParameterSet &iConfig)
int iEvent
Definition: GenABIO.cc:230
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
def move(src, dest)
Definition: eostools.py:510