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/AlignmentTracksFromVertexSelector.h"
0007
0008
0009
0010
0011
0012 #include "CommonTools/RecoAlgos/interface/TrackSelector.h"
0013
0014 struct TrackFromVertexConfigSelector {
0015 typedef std::vector<const reco::Track *> container;
0016 typedef container::const_iterator const_iterator;
0017 typedef reco::TrackCollection collection;
0018
0019 TrackFromVertexConfigSelector(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC) : theBaseSelector(cfg, iC) {}
0020
0021 const_iterator begin() const { return theSelectedTracks.begin(); }
0022 const_iterator end() const { return theSelectedTracks.end(); }
0023 size_t size() const { return theSelectedTracks.size(); }
0024
0025 void select(const edm::Handle<reco::TrackCollection> &c, const edm::Event &evt, const edm::EventSetup &setup) {
0026 theSelectedTracks = theBaseSelector.select(c, evt, setup);
0027 }
0028
0029 private:
0030 container theSelectedTracks;
0031
0032 AlignmentTrackFromVertexSelector theBaseSelector;
0033 };
0034
0035 class AlignmentTrackFromVertexSelectorModule : public ObjectSelector<TrackFromVertexConfigSelector> {
0036 public:
0037 AlignmentTrackFromVertexSelectorModule(const edm::ParameterSet &ps)
0038 : ObjectSelector<TrackFromVertexConfigSelector>(ps) {}
0039 static void fillDescriptions(edm::ConfigurationDescriptions &descriptions) {
0040 edm::ParameterSetDescription desc;
0041 desc.setComment("Alignment Tracks Selector from Vertices");
0042 desc.add<edm::InputTag>("src", edm::InputTag("generalTracks"));
0043 desc.add<bool>("filter", false);
0044 desc.add<edm::InputTag>("vertices", edm::InputTag("offlinePrimaryVertices"));
0045 desc.add<edm::InputTag>("leptonTracks", edm::InputTag("ALCARECOTkAlDiMuon"));
0046 desc.add<bool>("useClosestVertexToDilepton", false);
0047 desc.add<unsigned int>("vertexIndex", 0);
0048 descriptions.addWithDefaultLabel(desc);
0049 }
0050 };
0051
0052 DEFINE_FWK_MODULE(AlignmentTrackFromVertexSelectorModule);