19 collectionCloner ( *this, iConfig,
true ),
20 collectionClonerTokens ( iConfig.getParameter<
edm::InputTag>(
"track"), consumesCollector() ),
21 token_muon ( consumes< vector<
reco::
Muon> > ( iConfig.getParameter<
edm::InputTag>(
"muon" )) ),
22 token_originalMVAVals ( consumes<
MVACollection > ( iConfig.getParameter<
edm::InputTag>(
"originalMVAVals" )) ),
23 flag_copyMVA ( iConfig.getParameter<
bool>(
"copyMVA") )
25 produces<MVACollection>(
"MVAValues");
35 desc.
add<
bool>(
"copyMVA",
false);
37 descriptions.
add(
"HLTMuonTrackSelector", desc);
51 auto nMuon = handle_muon->size();
57 assert( (*handle_originalMVAVals).size() == nTrack );
61 std::vector<unsigned int> selectedIter;
62 auto selectedMVAVals = std::make_unique<MVACollection>();
72 for(
auto i_mu=0
U; 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 = 9999
U;
85 for(
auto i_trk=0
U; i_trk<nTrack; ++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 != 9999
U ) {
104 selectedIter.push_back(smallestDPtIter);
105 if(
flag_copyMVA ) selectedMVAVals->push_back( (*handle_originalMVAVals)[smallestDPtIter] );
115 assert( producer.selTracks_->size() == nSelected );
const TrackCollectionCloner::Tokens collectionClonerTokens
const edm::EDGetTokenT< MVACollection > token_originalMVAVals
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
~HLTMuonTrackSelector() override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
static void fill(edm::ParameterSetDescription &desc)
std::unique_ptr< reco::TrackCollection > selTracks_
static void fillDescriptions(edm::ConfigurationDescriptions &)
#define DEFINE_FWK_MODULE(type)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
HLTMuonTrackSelector(const edm::ParameterSet &)
reco::TrackCollection const & tracks(edm::Event &evt) const
const edm::EDGetTokenT< vector< reco::Muon > > token_muon
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
TrackCollectionCloner collectionCloner
std::vector< float > MVACollection