File indexing completed on 2024-04-06 11:56:14
0001
0002 #include "FWCore/Framework/interface/ConsumesCollector.h"
0003 #include "FWCore/Framework/interface/MakerMacros.h"
0004 #include "CommonTools/UtilAlgos/interface/ObjectSelector.h"
0005
0006
0007 #include "Alignment/CommonAlignmentProducer/interface/AlignmentTrackSelector.h"
0008 #include "Alignment/CommonAlignmentProducer/interface/AlignmentGlobalTrackSelector.h"
0009 #include "Alignment/CommonAlignmentProducer/interface/AlignmentTwoBodyDecayTrackSelector.h"
0010
0011 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0012
0013
0014
0015
0016
0017 #include "CommonTools/RecoAlgos/interface/TrackSelector.h"
0018
0019 struct TrackConfigSelector {
0020 typedef std::vector<const reco::Track*> container;
0021 typedef container::const_iterator const_iterator;
0022 typedef reco::TrackCollection collection;
0023
0024 TrackConfigSelector(const edm::ParameterSet& cfg, edm::ConsumesCollector&& iC)
0025 : theBaseSelector(cfg, iC),
0026 theGlobalSelector(cfg.getParameter<edm::ParameterSet>("GlobalSelector"), iC),
0027 theTwoBodyDecaySelector(cfg.getParameter<edm::ParameterSet>("TwoBodyDecaySelector"), iC) {
0028
0029 theBaseSwitch = theBaseSelector.useThisFilter();
0030
0031 theGlobalSwitch = theGlobalSelector.useThisFilter();
0032
0033 theTwoBodyDecaySwitch = theTwoBodyDecaySelector.useThisFilter();
0034 }
0035
0036 const_iterator begin() const { return theSelectedTracks.begin(); }
0037 const_iterator end() const { return theSelectedTracks.end(); }
0038 size_t size() const { return theSelectedTracks.size(); }
0039
0040 void select(const edm::Handle<reco::TrackCollection>& c, const edm::Event& evt, const edm::EventSetup& eSetup) {
0041 theSelectedTracks.clear();
0042 for (reco::TrackCollection::const_iterator i = c.product()->begin(); i != c.product()->end(); ++i) {
0043 theSelectedTracks.push_back(&*i);
0044 }
0045
0046 if (theBaseSwitch)
0047 theSelectedTracks = theBaseSelector.select(theSelectedTracks, evt, eSetup);
0048 if (theGlobalSwitch)
0049 theSelectedTracks = theGlobalSelector.select(theSelectedTracks, evt, eSetup);
0050 if (theTwoBodyDecaySwitch)
0051 theSelectedTracks = theTwoBodyDecaySelector.select(theSelectedTracks, evt, eSetup);
0052 }
0053
0054 private:
0055 container theSelectedTracks;
0056
0057 bool theBaseSwitch, theGlobalSwitch, theTwoBodyDecaySwitch;
0058 AlignmentTrackSelector theBaseSelector;
0059 AlignmentGlobalTrackSelector theGlobalSelector;
0060 AlignmentTwoBodyDecayTrackSelector theTwoBodyDecaySelector;
0061 };
0062
0063 typedef ObjectSelector<TrackConfigSelector> AlignmentTrackSelectorModule;
0064
0065 DEFINE_FWK_MODULE(AlignmentTrackSelectorModule);