CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch2/src/Alignment/CommonAlignmentProducer/plugins/AlignmentSeedSelectorModule.cc

Go to the documentation of this file.
00001 
00002 #include "FWCore/Framework/interface/MakerMacros.h"
00003 #include "CommonTools/UtilAlgos/interface/ObjectSelector.h"
00004 #include "Alignment/CommonAlignmentProducer/interface/AlignmentSeedSelector.h"
00005 #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h" 
00006 
00007 struct SeedConfigSelector {
00008 
00009   typedef std::vector<const TrajectorySeed*> container;
00010   typedef container::const_iterator const_iterator;
00011   typedef TrajectorySeedCollection collection; 
00012 
00013   SeedConfigSelector( const edm::ParameterSet & cfg ) :
00014     theSelector(cfg) {}
00015 
00016   const_iterator begin() const { return selected_.begin(); }
00017   const_iterator end() const { return selected_.end(); }
00018   size_t size() const { return selected_.size(); }
00019 
00020   void select( const edm::Handle<TrajectorySeedCollection> c,  const edm::Event & evt,
00021                const edm::EventSetup &/*dummy*/)
00022   {
00023     all_.clear();
00024     selected_.clear();
00025     for (collection::const_iterator i = c.product()->begin(), iE = c.product()->end();
00026          i != iE; ++i) {
00027       all_.push_back( & * i );
00028     }
00029     selected_ = theSelector.select(all_, evt); // might add dummy...
00030   }
00031 
00032 private:
00033   container all_,selected_;
00034   AlignmentSeedSelector theSelector;
00035 };
00036 
00037 typedef ObjectSelector<SeedConfigSelector>  AlignmentSeedSelectorModule;
00038 
00039 DEFINE_FWK_MODULE( AlignmentSeedSelectorModule );