20 DPtovPtCut_(conf.getParameter<
std::vector<double> >(
"DPtOverPtCuts_byTrackAlgo")),
21 NHitCut_(conf.getParameter<
std::vector<unsigned> >(
"NHitCuts_byTrackAlgo")),
43 std::unique_ptr<PFMuonAlgo>
pfmu_;
49 "GeneralTracksImporterWithVeto");
57 const auto&
vetos = *vetosH;
58 std::unordered_set<unsigned> vetoed;
59 for(
unsigned i = 0;
i <
vetos.size(); ++
i ) {
63 elems.reserve(elems.size() +
tracks->size());
70 auto itr = elems.begin();
71 while( itr != elems.end() ) {
86 itr = elems.erase(itr);
97 auto TKs_end = std::partition(elems.begin(),elems.end(),
98 [](
const ElementType&
a){
101 auto btk_elems = elems.begin();
102 auto btrack =
tracks->cbegin();
103 auto etrack =
tracks->cend();
105 auto tk_elem = std::find_if(btk_elems,TKs_end,
106 [&](
const ElementType&
a){
107 return ( a->trackRef() ==
110 if( tk_elem != TKs_end ) {
129 if( !
mask[idx] )
continue;
134 bool thisIsAPotentialMuon =
false;
142 if (thisIsAPotentialMuon &&
debug_) {
143 std::cout <<
"Potential Muon P " << pftrackref->trackRef()->p()
144 <<
" pt " << pftrackref->trackRef()->p() << std::endl;
146 if( muId != -1 ) trkElem->
setMuonRef(muonref);
147 if( vetoed.count(pftrackref->trackRef().
key()) == 0 || muonref.isNonnull()){
148 elems.emplace_back(trkElem);
153 elems.shrink_to_fit();
159 auto muon = std::find_if(muonh->cbegin(),muonh->cend(),
161 return (
m.track().isNonnull() &&
162 m.track() == trackref );
int muAssocToTrack(const reco::TrackRef &trackref, const edm::Handle< reco::MuonCollection > &muonh) const
static bool isMuon(const reco::PFBlockElement &elt)
const std::vector< double > DPtovPtCut_
edm::EDGetTokenT< reco::MuonCollection > muons_
const reco::TrackRef & trackRef() const override
const ConversionRefVector & convRefs() const override
bool trackType(TrackType trType) const override
edm::EDGetTokenT< reco::PFRecTrackCollection > veto_
const bool cleanBadConvBrems_
key_type key() const
Accessor for product key.
bool empty() const
Is the RefVector empty.
std::vector< Muon > MuonCollection
collection of Muon objects
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
Container::value_type value_type
edm::EDGetTokenT< reco::PFRecTrackCollection > src_
const bool useIterTracking_
edm::Ref< PFRecTrackCollection > PFRecTrackRef
persistent reference to PFRecTrack objects
const VertexCompositeCandidateRef & V0Ref() const override
edm::Ref< MuonCollection > MuonRef
presistent reference to a Muon
bool isNull() const
Checks for null.
const PFDisplacedTrackerVertexRef & displacedVertexRef(TrackType trType) const override
GeneralTracksImporterWithVeto(const edm::ParameterSet &conf, edm::ConsumesCollector &sumes)
void importToBlock(const edm::Event &, ElementList &) const override
static bool isLooseMuon(const reco::PFBlockElement &elt)
void setMuonRef(const MuonRef &muref) override
reference to the Muon
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::vector< std::unique_ptr< reco::PFBlockElement > > ElementList
std::unique_ptr< PFMuonAlgo > pfmu_
std::vector< PFRecTrack > PFRecTrackCollection
collection of PFRecTrack objects
const std::vector< unsigned > NHitCut_