CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/Alignment/CommonAlignmentProducer/plugins/AlignmentCSCOverlapSelectorModule.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/AlignmentCSCOverlapSelector.h"
00005 
00006 // the following include is necessary to clone all track branches
00007 // including recoTrackExtras and TrackingRecHitsOwned.
00008 // if you remove it the code will compile, but the cloned
00009 // tracks have only the recoTracks branch!
00010 #include "CommonTools/RecoAlgos/interface/TrackSelector.h"
00011 
00012 struct CSCOverlapConfigSelector {
00013 
00014   typedef std::vector<const reco::Track*> container;
00015   typedef container::const_iterator const_iterator;
00016   typedef reco::TrackCollection collection; 
00017 
00018   CSCOverlapConfigSelector( const edm::ParameterSet & cfg ) :
00019     theSelector(cfg) {}
00020 
00021   const_iterator begin() const { return selected_.begin(); }
00022   const_iterator end() const { return selected_.end(); }
00023   size_t size() const { return selected_.size(); }
00024 
00025   void select( const edm::Handle<reco::TrackCollection> & c,  const edm::Event & evt,
00026                const edm::EventSetup &/*dummy*/)
00027   {
00028     all_.clear();
00029     selected_.clear();
00030     for (collection::const_iterator i = c.product()->begin(), iE = c.product()->end();
00031          i != iE; ++i){
00032       all_.push_back(& * i );
00033     }
00034     selected_ = theSelector.select(all_, evt); // might add dummy...
00035   }
00036 
00037 private:
00038   container all_,selected_;
00039   AlignmentCSCOverlapSelector theSelector;
00040 };
00041 
00042 typedef ObjectSelector<CSCOverlapConfigSelector>  AlignmentCSCOverlapSelectorModule;
00043 
00044 DEFINE_FWK_MODULE( AlignmentCSCOverlapSelectorModule );