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)) {}
40 "GeneralTracksImporter");
50 elems.reserve(elems.size() + tracks->size());
51 std::vector<bool> mask(tracks->size(),
true);
56 auto itr = elems.begin();
57 while( itr != elems.end() ) {
72 itr = elems.erase(itr);
83 auto TKs_end = std::partition(elems.begin(),elems.end(),
84 [](
const ElementType&
a){
87 auto btk_elems = elems.begin();
88 auto btrack = tracks->cbegin();
89 auto etrack = tracks->cend();
90 for(
auto track = btrack; track != etrack; ++track) {
91 auto tk_elem = std::find_if(btk_elems,TKs_end,
92 [&](
const ElementType&
a){
93 return ( a->trackRef() ==
96 if( tk_elem != TKs_end ) {
97 mask[std::distance(tracks->cbegin(),track)] =
false;
111 for(
auto track = btrack; track != etrack; ++track) {
112 const unsigned idx = std::distance(btrack,track);
115 if( !mask[idx] )
continue;
120 bool thisIsAPotentialMuon =
false;
128 if (thisIsAPotentialMuon &&
_debug) {
129 std::cout <<
"Potential Muon P " << pftrackref->trackRef()->p()
130 <<
" pt " << pftrackref->trackRef()->p() << std::endl;
132 if( muId != -1 ) trkElem->
setMuonRef(muonref);
133 elems.emplace_back(trkElem);
136 elems.shrink_to_fit();
142 const double P = trackref->p();
143 const double Pt = trackref->pt();
144 const double DPt = trackref->ptError();
145 const unsigned int NHit =
146 trackref->hitPattern().trackerLayersWithMeasurement();
147 const unsigned int NLostHit =
148 trackref->hitPattern().trackerLayersWithoutMeasurement();
149 const unsigned int LostHits = trackref->numberOfLostHits();
150 const double sigmaHad =
sqrt(1.20*1.20/P+0.06*0.06) / (1.+LostHits);
153 unsigned int Algo = 0;
154 switch (trackref->algo()) {
179 if ( P < 0.05 )
return false;
182 if ( Algo > 4 )
return false;
185 << Pt <<
" DPt = " << DPt << std::endl;
194 <<
", N(hits) = " << NHit <<
" (Lost : " << LostHits <<
"/" << NLostHit <<
")"
195 <<
", Algo = " << Algo
226 auto muon = std::find_if(muonh->cbegin(),muonh->cend(),
228 return (
m.track().isNonnull() &&
229 m.track() == trackref );
231 return (
muon != muonh->cend() ? std::distance(muonh->cbegin(),
muon) : -1 );
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
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
bool isNull() const
Checks for null.
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
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