Go to the documentation of this file.00001
00002 #include "FWCore/Framework/interface/MakerMacros.h"
00003 #include "CommonTools/UtilAlgos/interface/ObjectSelector.h"
00004
00005
00006 #include "Alignment/CommonAlignmentProducer/interface/AlignmentTrackSelector.h"
00007 #include "Alignment/CommonAlignmentProducer/interface/AlignmentGlobalTrackSelector.h"
00008 #include "Alignment/CommonAlignmentProducer/interface/AlignmentTwoBodyDecayTrackSelector.h"
00009
00010 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00011
00012
00013
00014
00015
00016 #include "CommonTools/RecoAlgos/interface/TrackSelector.h"
00017
00018 struct TrackConfigSelector {
00019
00020 typedef std::vector<const reco::Track*> container;
00021 typedef container::const_iterator const_iterator;
00022 typedef reco::TrackCollection collection;
00023
00024 TrackConfigSelector( const edm::ParameterSet & cfg ) :
00025 theBaseSelector(cfg),
00026 theGlobalSelector(cfg.getParameter<edm::ParameterSet>("GlobalSelector")),
00027 theTwoBodyDecaySelector(cfg.getParameter<edm::ParameterSet>("TwoBodyDecaySelector"))
00028 {
00029
00030 theBaseSwitch = theBaseSelector.useThisFilter();
00031
00032 theGlobalSwitch = theGlobalSelector.useThisFilter();
00033
00034 theTwoBodyDecaySwitch = theTwoBodyDecaySelector.useThisFilter();
00035 }
00036
00037 const_iterator begin() const { return theSelectedTracks.begin(); }
00038 const_iterator end() const { return theSelectedTracks.end(); }
00039 size_t size() const { return theSelectedTracks.size(); }
00040
00041 void select( const edm::Handle<reco::TrackCollection> & c, const edm::Event & evt,
00042 const edm::EventSetup& eSetup)
00043 {
00044 theSelectedTracks.clear();
00045 for( reco::TrackCollection::const_iterator i=c.product()->begin();i!=c.product()->end();++i){
00046 theSelectedTracks.push_back(& * i );
00047 }
00048
00049 if(theBaseSwitch)
00050 theSelectedTracks=theBaseSelector.select(theSelectedTracks,evt,eSetup);
00051 if(theGlobalSwitch)
00052 theSelectedTracks=theGlobalSelector.select(theSelectedTracks,evt,eSetup);
00053 if(theTwoBodyDecaySwitch)
00054 theSelectedTracks=theTwoBodyDecaySelector.select(theSelectedTracks,evt,eSetup);
00055 }
00056
00057 private:
00058 container theSelectedTracks;
00059
00060 bool theBaseSwitch, theGlobalSwitch, theTwoBodyDecaySwitch;
00061 AlignmentTrackSelector theBaseSelector;
00062 AlignmentGlobalTrackSelector theGlobalSelector;
00063 AlignmentTwoBodyDecayTrackSelector theTwoBodyDecaySelector;
00064
00065 };
00066
00067 typedef ObjectSelector<TrackConfigSelector> AlignmentTrackSelectorModule;
00068
00069 DEFINE_FWK_MODULE( AlignmentTrackSelectorModule );