File indexing completed on 2024-04-06 11:59:26
0001
0002 #include "CommonTools/UtilAlgos/interface/ObjectSelector.h"
0003 #include "FWCore/Framework/interface/ConsumesCollector.h"
0004 #include "FWCore/Framework/interface/MakerMacros.h"
0005
0006
0007 #include "Calibration/TkAlCaRecoProducers/interface/CalibrationTrackSelector.h"
0008
0009
0010
0011
0012
0013 #include "CommonTools/RecoAlgos/interface/TrackSelector.h"
0014
0015 struct SiStripCalTrackConfigSelector {
0016 typedef std::vector<const reco::Track *> container;
0017 typedef container::const_iterator const_iterator;
0018 typedef reco::TrackCollection collection;
0019
0020 SiStripCalTrackConfigSelector(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC) : theBaseSelector(cfg, iC) {
0021
0022 theBaseSwitch = cfg.getParameter<bool>("applyBasicCuts") || cfg.getParameter<bool>("minHitsPerSubDet") ||
0023 cfg.getParameter<bool>("applyNHighestPt") || cfg.getParameter<bool>("applyMultiplicityFilter");
0024 }
0025
0026 const_iterator begin() const { return theSelectedTracks.begin(); }
0027 const_iterator end() const { return theSelectedTracks.end(); }
0028 size_t size() const { return theSelectedTracks.size(); }
0029
0030 void select(const edm::Handle<reco::TrackCollection> &c, const edm::Event &evt, const edm::EventSetup & ) {
0031 theSelectedTracks.clear();
0032 for (reco::TrackCollection::const_iterator i = c.product()->begin(); i != c.product()->end(); ++i) {
0033 theSelectedTracks.push_back(&*i);
0034 }
0035
0036 if (theBaseSwitch)
0037 theSelectedTracks = theBaseSelector.select(theSelectedTracks, evt);
0038 }
0039
0040 private:
0041 container theSelectedTracks;
0042
0043 bool theBaseSwitch;
0044 CalibrationTrackSelector theBaseSelector;
0045 };
0046
0047 typedef ObjectSelector<SiStripCalTrackConfigSelector> CalibrationTrackSelectorModule;
0048
0049 DEFINE_FWK_MODULE(CalibrationTrackSelectorModule);