CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch1/src/Alignment/CommonAlignmentProducer/plugins/AlignmentCSCTrackSelectorModule.cc

Go to the documentation of this file.
00001 
00002 #include "FWCore/Framework/interface/MakerMacros.h"
00003 #include "CommonTools/UtilAlgos/interface/ObjectSelector.h"
00004 
00005 //the selectores used to select the tracks
00006 #include "Alignment/CommonAlignmentProducer/interface/AlignmentCSCTrackSelector.h"
00007 #include "Alignment/CommonAlignmentProducer/interface/AlignmentGlobalTrackSelector.h"
00008 #include "Alignment/CommonAlignmentProducer/interface/AlignmentTwoBodyDecayTrackSelector.h"
00009 
00010 // the following include is necessary to clone all track branches
00011 // including recoTrackExtras and TrackingRecHitsOwned.
00012 // if you remove it the code will compile, but the cloned
00013 // tracks have only the recoTracks branch!
00014 #include "CommonTools/RecoAlgos/interface/TrackSelector.h"
00015 
00016 struct CSCTrackConfigSelector {
00017 
00018       typedef std::vector<const reco::Track*> container;
00019       typedef container::const_iterator const_iterator;
00020       typedef reco::TrackCollection collection; 
00021 
00022       CSCTrackConfigSelector( const edm::ParameterSet & cfg ) : theBaseSelector(cfg) {}
00023   
00024       const_iterator begin() const { return theSelectedTracks.begin(); }
00025       const_iterator end() const { return theSelectedTracks.end(); }
00026       size_t size() const { return theSelectedTracks.size(); }
00027 
00028       void select( const edm::Handle<reco::TrackCollection> & c,  const edm::Event & evt, const edm::EventSetup &/*dummy*/)
00029       {
00030          container all;
00031          for( reco::TrackCollection::const_iterator i=c.product()->begin();i!=c.product()->end();++i){
00032             all.push_back(& * i );
00033          }
00034          theSelectedTracks = theBaseSelector.select(all, evt); // might add dummy 
00035       }
00036 
00037    private:
00038       container theSelectedTracks;
00039 
00040       AlignmentCSCTrackSelector theBaseSelector;
00041 };
00042 
00043 typedef ObjectSelector<CSCTrackConfigSelector>  AlignmentCSCTrackSelectorModule;
00044 
00045 DEFINE_FWK_MODULE( AlignmentCSCTrackSelectorModule );