18 _DPtovPtCut(conf.getParameter<std::vector<double> >(
"DPtOverPtCuts_byTrackAlgo")),
19 _NHitCut(conf.getParameter<std::vector<unsigned> >(
"NHitCuts_byTrackAlgo")),
21 _cleanBadConvBrems(conf.existsAs<bool>(
"cleanBadConvertedBrems") ? conf.getParameter<bool>(
"cleanBadConvertedBrems") :
false),
22 _debug(conf.getUntrackedParameter<bool>(
"debug",
false)) {
25 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);
65 auto itr = elems.begin();
66 while( itr != elems.end() ) {
81 itr = elems.erase(itr);
92 auto TKs_end = std::partition(elems.begin(),elems.end(),
93 [](
const ElementType&
a){
96 auto btk_elems = elems.begin();
97 auto btrack = tracks->cbegin();
98 auto etrack = tracks->cend();
99 for(
auto track = btrack; track != etrack; ++track) {
100 auto tk_elem = std::find_if(btk_elems,TKs_end,
101 [&](
const ElementType&
a){
102 return ( a->trackRef() ==
105 if( tk_elem != TKs_end ) {
120 for(
auto track = btrack; track != etrack; ++track) {
124 if( !mask[idx] )
continue;
129 bool thisIsAPotentialMuon =
false;
137 if (thisIsAPotentialMuon &&
_debug) {
138 std::cout <<
"Potential Muon P " << pftrackref->trackRef()->p()
139 <<
" pt " << pftrackref->trackRef()->p() << std::endl;
141 if( muId != -1 ) trkElem->
setMuonRef(muonref);
142 elems.emplace_back(trkElem);
145 elems.shrink_to_fit();
151 const double P = trackref->p();
152 const double Pt = trackref->pt();
153 const double DPt = trackref->ptError();
154 const unsigned int NHit =
155 trackref->hitPattern().trackerLayersWithMeasurement();
156 const unsigned int NLostHit =
158 const unsigned int LostHits = trackref->numberOfLostHits();
159 const double sigmaHad =
sqrt(1.20*1.20/P+0.06*0.06) / (1.+LostHits);
162 if ( P < 0.05 )
return false;
165 << Pt <<
" DPt = " << DPt << std::endl;
171 if ( ( dptCut > 0. &&
172 DPt/Pt > dptCut*sigmaHad ) ||
178 <<
", N(hits) = " << NHit <<
" (Lost : " << LostHits <<
"/" << NLostHit <<
")"
179 <<
", Algo = " << trackref->algo()
181 if (
_debug)
std::cout <<
" cut is DPt/Pt < " << dptCut * sigmaHad << std::endl;
192 auto muon = std::find_if(muonh->cbegin(),muonh->cend(),
194 return (
m.track().isNonnull() &&
195 m.track() == trackref );
const VertexCompositeCandidateRef & V0Ref() const
const reco::TrackRef & trackRef() const
GeneralTracksImporter(const edm::ParameterSet &conf, edm::ConsumesCollector &sumes)
const bool _cleanBadConvBrems
static bool isMuon(const reco::PFBlockElement &elt)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::unique_ptr< PFMuonAlgo > pfmu_
const std::vector< double > _DPtovPtCut
int muAssocToTrack(const reco::TrackRef &trackref, const edm::Handle< reco::MuonCollection > &muonh) const
std::vector< Muon > MuonCollection
collection of Muon objects
bool goodPtResolution(const reco::TrackRef &trackref) const
void importToBlock(const edm::Event &, ElementList &) const override
Container::value_type value_type
const std::vector< unsigned > _NHitCut
const ConversionRefVector & convRefs() const
edm::EDGetTokenT< reco::MuonCollection > _muons
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
void setMuonRef(const MuonRef &muref)
reference to the Muon
static bool isLooseMuon(const reco::PFBlockElement &elt)
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
edm::EDGetTokenT< reco::PFRecTrackCollection > _src
const bool _useIterTracking
const PFDisplacedTrackerVertexRef & displacedVertexRef(TrackType trType) const
size_type size() const
Size of the RefVector.
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::vector< std::unique_ptr< reco::PFBlockElement > > ElementList
volatile std::atomic< bool > shutdown_flag false
std::vector< PFRecTrack > PFRecTrackCollection
collection of PFRecTrack objects