22 : collectionCloner(producesCollector(), iConfig,
true),
23 collectionClonerTokens(iConfig.getParameter<edm::
InputTag>(
"track"), consumesCollector()),
25 token_originalMVAVals(consumes<
MVACollection>(iConfig.getParameter<edm::
InputTag>(
"originalMVAVals"))),
26 flag_copyMVA(iConfig.getParameter<bool>(
"copyMVA")) {
27 produces<MVACollection>(
"MVAValues");
37 desc.
add<
bool>(
"copyMVA",
false);
39 descriptions.
add(
"HLTMuonTrackSelector", desc);
47 auto nTrack = originalTracks.size();
52 auto nMuon = handle_muon->size();
58 assert((*handle_originalMVAVals).size() == nTrack);
62 std::vector<unsigned int> selectedIter;
63 auto selectedMVAVals = std::make_unique<MVACollection>();
72 for (
auto i_mu = 0U; i_mu < nMuon; ++i_mu) {
75 TrackRef muonTrackRef = (
muon.innerTrack().isNonnull()) ?
muon.innerTrack() :
muon.muonBestTrack();
77 double muonPt = muonTrackRef->pt();
78 double muonEta = muonTrackRef->eta();
79 double muonPhi = muonTrackRef->phi();
81 double smallestDPt = 1e30;
82 unsigned int smallestDPtIter = 9999U;
85 for (
auto i_trk = 0U; i_trk < nTrack; ++i_trk) {
86 auto const&
track = originalTracks[i_trk];
92 if (
deltaR(trackEta, trackPhi, muonEta, muonPhi) < 0.1) {
93 double dPt = fabs(trackPt - muonPt);
95 if (dPt < smallestDPt) {
97 smallestDPtIter = i_trk;
103 if (smallestDPtIter != 9999U) {
104 selectedIter.push_back(smallestDPtIter);
106 selectedMVAVals->push_back((*handle_originalMVAVals)[smallestDPtIter]);
116 assert(producer.selTracks_->size() == nSelected);
const TrackCollectionCloner::Tokens collectionClonerTokens
const edm::EDGetTokenT< std::vector< reco::Muon > > token_muon
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
~HLTMuonTrackSelector() override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
static void fill(edm::ParameterSetDescription &desc)
std::unique_ptr< reco::TrackCollection > selTracks_
static void fillDescriptions(edm::ConfigurationDescriptions &)
const edm::EDGetTokenT< MVACollection > token_originalMVAVals
ParameterDescriptionBase * add(U const &iLabel, T const &value)
HLTMuonTrackSelector(const edm::ParameterSet &)
reco::TrackCollection const & tracks(edm::Event &evt) const
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
TrackCollectionCloner collectionCloner
std::vector< float > MVACollection