17 _DPtovPtCut(conf.getParameter<std::vector<double> >(
"DPtOverPtCuts_byTrackAlgo")),
18 _NHitCut(conf.getParameter<std::vector<unsigned> >(
"NHitCuts_byTrackAlgo")),
20 _cleanBadConvBrems(conf.existsAs<bool>(
"cleanBadConvertedBrems") ? conf.getParameter<bool>(
"cleanBadConvertedBrems") :
false),
21 _debug(conf.getUntrackedParameter<bool>(
"debug",
false)) {
24 pfmu_->setParameters(conf);
42 std::unique_ptr<PFMuonAlgo>
pfmu_;
48 "GeneralTracksImporter");
58 elems.reserve(elems.size() + tracks->size());
59 std::vector<bool> mask(tracks->size(),
true);
64 auto itr = elems.begin();
65 while( itr != elems.end() ) {
80 itr = elems.erase(itr);
91 auto TKs_end = std::partition(elems.begin(),elems.end(),
92 [](
const ElementType&
a){
95 auto btk_elems = elems.begin();
96 auto btrack = tracks->cbegin();
97 auto etrack = tracks->cend();
98 for(
auto track = btrack; track != etrack; ++track) {
99 auto tk_elem = std::find_if(btk_elems,TKs_end,
100 [&](
const ElementType&
a){
101 return ( a->trackRef() ==
104 if( tk_elem != TKs_end ) {
119 for(
auto track = btrack; track != etrack; ++track) {
123 if( !mask[idx] )
continue;
128 bool thisIsAPotentialMuon =
false;
136 if (thisIsAPotentialMuon &&
_debug) {
137 std::cout <<
"Potential Muon P " << pftrackref->trackRef()->p()
138 <<
" pt " << pftrackref->trackRef()->p() << std::endl;
140 if( muId != -1 ) trkElem->
setMuonRef(muonref);
141 elems.emplace_back(trkElem);
144 elems.shrink_to_fit();
150 const double P = trackref->p();
151 const double Pt = trackref->pt();
152 const double DPt = trackref->ptError();
153 const unsigned int NHit =
154 trackref->hitPattern().trackerLayersWithMeasurement();
155 const unsigned int NLostHit =
157 const unsigned int LostHits = trackref->numberOfLostHits();
158 const double sigmaHad =
sqrt(1.20*1.20/P+0.06*0.06) / (1.+LostHits);
161 unsigned int Algo = 0;
162 switch (trackref->algo()) {
206 if ( P < 0.05 )
return false;
210 << Pt <<
" DPt = " << DPt << std::endl;
218 <<
", N(hits) = " << NHit <<
" (Lost : " << LostHits <<
"/" << NLostHit <<
")"
219 <<
", Algo = " << Algo
232 auto muon = std::find_if(muonh->cbegin(),muonh->cend(),
234 return (
m.track().isNonnull() &&
235 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
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
Container::value_type value_type
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