File indexing completed on 2024-04-06 11:56:14
0001 #include "FWCore/Framework/interface/ConsumesCollector.h"
0002 #include "FWCore/Framework/interface/MakerMacros.h"
0003 #include "CommonTools/UtilAlgos/interface/ObjectSelector.h"
0004
0005
0006 #include "Alignment/CommonAlignmentProducer/interface/AlignmentTracksFromVertexCompositeCandidateSelector.h"
0007
0008
0009
0010
0011
0012 #include "CommonTools/RecoAlgos/interface/TrackSelector.h"
0013
0014 struct TrackFromVertexCompositeCandidateConfigSelector {
0015 typedef std::vector<const reco::Track *> container;
0016 typedef container::const_iterator const_iterator;
0017 typedef reco::TrackCollection collection;
0018
0019 TrackFromVertexCompositeCandidateConfigSelector(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
0020 : theBaseSelector(cfg, iC) {}
0021
0022 const_iterator begin() const { return theSelectedTracks.begin(); }
0023 const_iterator end() const { return theSelectedTracks.end(); }
0024 size_t size() const { return theSelectedTracks.size(); }
0025
0026 void select(const edm::Handle<reco::TrackCollection> &c, const edm::Event &evt, const edm::EventSetup &setup) {
0027 theSelectedTracks = theBaseSelector.select(c, evt, setup);
0028 }
0029
0030 private:
0031 container theSelectedTracks;
0032
0033 AlignmentTrackFromVertexCompositeCandidateSelector theBaseSelector;
0034 };
0035
0036 class AlignmentTrackFromVertexCompositeCandidateSelectorModule
0037 : public ObjectSelector<TrackFromVertexCompositeCandidateConfigSelector> {
0038 public:
0039 AlignmentTrackFromVertexCompositeCandidateSelectorModule(const edm::ParameterSet &ps)
0040 : ObjectSelector<TrackFromVertexCompositeCandidateConfigSelector>(ps) {}
0041 static void fillDescriptions(edm::ConfigurationDescriptions &descriptions) {
0042 edm::ParameterSetDescription desc;
0043 desc.setComment("Alignment Tracks Selector from VertexCompositeCandidates");
0044 desc.add<edm::InputTag>("src", edm::InputTag("generalTracks"));
0045 desc.add<bool>("filter", false);
0046 desc.add<edm::InputTag>("vertexCompositeCandidates", edm::InputTag("generalV0Candidates:Kshort"));
0047 descriptions.addWithDefaultLabel(desc);
0048 }
0049 };
0050
0051 DEFINE_FWK_MODULE(AlignmentTrackFromVertexCompositeCandidateSelectorModule);