19 DPtovPtCut_(conf.getParameter<
std::vector<double> >(
"DPtOverPtCuts_byTrackAlgo")),
20 NHitCut_(conf.getParameter<
std::vector<unsigned> >(
"NHitCuts_byTrackAlgo")),
22 cleanBadConvBrems_(conf.existsAs<bool>(
"cleanBadConvertedBrems") ? conf.getParameter<bool>(
"cleanBadConvertedBrems") :
false),
23 debug_(conf.getUntrackedParameter<bool>(
"debug",
false)) {
26 pfmu_->setParameters(conf);
43 std::unique_ptr<PFMuonAlgo>
pfmu_;
49 "GeneralTracksImporter");
59 elems.reserve(elems.size() + tracks->size());
60 std::vector<bool>
mask(tracks->size(),
true);
66 auto itr = elems.begin();
67 while( itr != elems.end() ) {
82 itr = elems.erase(itr);
93 auto TKs_end = std::partition(elems.begin(),elems.end(),
94 [](
const ElementType&
a){
97 auto btk_elems = elems.begin();
98 auto btrack = tracks->cbegin();
99 auto etrack = tracks->cend();
101 auto tk_elem = std::find_if(btk_elems,TKs_end,
102 [&](
const ElementType&
a){
103 return ( a->trackRef() ==
106 if( tk_elem != TKs_end ) {
125 if( !
mask[idx] )
continue;
130 bool thisIsAPotentialMuon =
false;
138 if (thisIsAPotentialMuon &&
debug_) {
139 std::cout <<
"Potential Muon P " << pftrackref->trackRef()->p()
140 <<
" pt " << pftrackref->trackRef()->p() << std::endl;
142 if( muId != -1 ) trkElem->
setMuonRef(muonref);
143 elems.emplace_back(trkElem);
146 elems.shrink_to_fit();
152 auto muon = std::find_if(muonh->cbegin(),muonh->cend(),
154 return (
m.track().isNonnull() &&
155 m.track() == trackref );
const VertexCompositeCandidateRef & V0Ref() const
void importToBlock(const edm::Event &, ElementList &) const override
const reco::TrackRef & trackRef() const
GeneralTracksImporter(const edm::ParameterSet &conf, edm::ConsumesCollector &sumes)
const bool useIterTracking_
const std::vector< double > DPtovPtCut_
edm::EDGetTokenT< reco::MuonCollection > muons_
static bool isMuon(const reco::PFBlockElement &elt)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::unique_ptr< PFMuonAlgo > pfmu_
int muAssocToTrack(const reco::TrackRef &trackref, const edm::Handle< reco::MuonCollection > &muonh) const
bool empty() const
Is the RefVector empty.
edm::EDGetTokenT< reco::PFRecTrackCollection > src_
std::vector< Muon > MuonCollection
collection of Muon objects
Container::value_type value_type
const ConversionRefVector & convRefs() const
edm::Ref< PFRecTrackCollection > PFRecTrackRef
persistent reference to PFRecTrack objects
edm::Ref< MuonCollection > MuonRef
presistent reference to a Muon
const std::vector< unsigned > NHitCut_
bool isNull() const
Checks for null.
virtual bool trackType(TrackType trType) const
void setMuonRef(const MuonRef &muref)
reference to the Muon
static bool isLooseMuon(const reco::PFBlockElement &elt)
const bool cleanBadConvBrems_
const PFDisplacedTrackerVertexRef & displacedVertexRef(TrackType trType) const
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::vector< std::unique_ptr< reco::PFBlockElement > > ElementList
std::vector< PFRecTrack > PFRecTrackCollection
collection of PFRecTrack objects