Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:44:45

0001 
0002 #include "FWCore/Framework/interface/ConsumesCollector.h"
0003 #include "FWCore/Framework/interface/MakerMacros.h"
0004 #include "CommonTools/UtilAlgos/interface/ObjectSelector.h"
0005 #include "Alignment/CommonAlignmentProducer/interface/AlignmentSeedSelector.h"
0006 #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
0007 
0008 struct SeedConfigSelector {
0009   typedef std::vector<const TrajectorySeed *> container;
0010   typedef container::const_iterator const_iterator;
0011   typedef TrajectorySeedCollection collection;
0012 
0013   SeedConfigSelector(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC) : theSelector(cfg) {}
0014 
0015   const_iterator begin() const { return selected_.begin(); }
0016   const_iterator end() const { return selected_.end(); }
0017   size_t size() const { return selected_.size(); }
0018 
0019   void select(const edm::Handle<TrajectorySeedCollection> c, const edm::Event &evt, const edm::EventSetup & /*dummy*/) {
0020     all_.clear();
0021     selected_.clear();
0022     for (collection::const_iterator i = c.product()->begin(), iE = c.product()->end(); i != iE; ++i) {
0023       all_.push_back(&*i);
0024     }
0025     selected_ = theSelector.select(all_, evt);  // might add dummy...
0026   }
0027 
0028 private:
0029   container all_, selected_;
0030   AlignmentSeedSelector theSelector;
0031 };
0032 
0033 typedef ObjectSelector<SeedConfigSelector> AlignmentSeedSelectorModule;
0034 
0035 DEFINE_FWK_MODULE(AlignmentSeedSelectorModule);