20 DPtovPtCut_(conf.getParameter<
std::vector<double> >(
"DPtOverPtCuts_byTrackAlgo")),
21 NHitCut_(conf.getParameter<
std::vector<unsigned> >(
"NHitCuts_byTrackAlgo")),
23 cleanBadConvBrems_(conf.existsAs<bool>(
"cleanBadConvertedBrems") ? conf.getParameter<bool>(
"cleanBadConvertedBrems") :
false),
24 debug_(conf.getUntrackedParameter<bool>(
"debug",
false)) {
27 pfmu_->setParameters(conf);
44 std::unique_ptr<PFMuonAlgo>
pfmu_;
50 "GeneralTracksImporterWithVeto");
60 const auto&
vetos = *vetosH;
61 std::unordered_set<unsigned> vetoed;
62 for(
unsigned i = 0;
i <
vetos.size(); ++
i ) {
67 elems.reserve(elems.size() + tracks->size());
68 std::vector<bool>
mask(tracks->size(),
true);
74 auto itr = elems.begin();
75 while( itr != elems.end() ) {
90 itr = elems.erase(itr);
101 auto TKs_end = std::partition(elems.begin(),elems.end(),
102 [](
const ElementType&
a){
105 auto btk_elems = elems.begin();
106 auto btrack = tracks->cbegin();
107 auto etrack = tracks->cend();
109 auto tk_elem = std::find_if(btk_elems,TKs_end,
110 [&](
const ElementType&
a){
111 return ( a->trackRef() ==
114 if( tk_elem != TKs_end ) {
133 if( !
mask[idx] )
continue;
138 bool thisIsAPotentialMuon =
false;
146 if (thisIsAPotentialMuon &&
debug_) {
147 std::cout <<
"Potential Muon P " << pftrackref->trackRef()->p()
148 <<
" pt " << pftrackref->trackRef()->p() << std::endl;
150 if( muId != -1 ) trkElem->
setMuonRef(muonref);
151 if( vetoed.count(pftrackref->trackRef().
key()) == 0 || muonref.isNonnull()){
152 elems.emplace_back(trkElem);
157 elems.shrink_to_fit();
163 auto muon = std::find_if(muonh->cbegin(),muonh->cend(),
165 return (
m.track().isNonnull() &&
166 m.track() == trackref );
const VertexCompositeCandidateRef & V0Ref() const
const reco::TrackRef & trackRef() const
int muAssocToTrack(const reco::TrackRef &trackref, const edm::Handle< reco::MuonCollection > &muonh) const
static bool isMuon(const reco::PFBlockElement &elt)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const std::vector< double > DPtovPtCut_
edm::EDGetTokenT< reco::MuonCollection > muons_
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
Container::value_type value_type
const ConversionRefVector & convRefs() const
edm::EDGetTokenT< reco::PFRecTrackCollection > src_
const bool useIterTracking_
edm::Ref< PFRecTrackCollection > PFRecTrackRef
persistent reference to PFRecTrack objects
edm::Ref< MuonCollection > MuonRef
presistent reference to a Muon
bool isNull() const
Checks for null.
virtual bool trackType(TrackType trType) const
GeneralTracksImporterWithVeto(const edm::ParameterSet &conf, edm::ConsumesCollector &sumes)
void setMuonRef(const MuonRef &muref)
reference to the Muon
void importToBlock(const edm::Event &, ElementList &) const override
static bool isLooseMuon(const reco::PFBlockElement &elt)
const PFDisplacedTrackerVertexRef & displacedVertexRef(TrackType trType) const
#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_