20 DPtovPtCut_(conf.getParameter<
std::vector<double> >(
"DPtOverPtCuts_byTrackAlgo")),
21 NHitCut_(conf.getParameter<
std::vector<unsigned> >(
"NHitCuts_byTrackAlgo")),
26 cleanBadConvBrems_(conf.existsAs<bool>(
"cleanBadConvertedBrems") ? conf.getParameter<bool>(
"cleanBadConvertedBrems") :
false),
27 debug_(conf.getUntrackedParameter<bool>(
"debug",
false)) {
30 pfmu_->setParameters(conf);
49 std::unique_ptr<PFMuonAlgo>
pfmu_;
55 "GeneralTracksImporterWithVeto");
65 const auto&
vetos = *vetosH;
66 std::unordered_set<unsigned> vetoed;
67 for(
unsigned i = 0;
i <
vetos.size(); ++
i ) {
72 elems.reserve(elems.size() + tracks->size());
73 std::vector<bool>
mask(tracks->size(),
true);
83 auto itr = elems.begin();
84 while( itr != elems.end() ) {
99 itr = elems.erase(itr);
110 auto TKs_end = std::partition(elems.begin(),elems.end(),
111 [](
const ElementType&
a){
114 auto btk_elems = elems.begin();
115 auto btrack = tracks->cbegin();
116 auto etrack = tracks->cend();
118 auto tk_elem = std::find_if(btk_elems,TKs_end,
119 [&](
const ElementType&
a){
120 return ( a->trackRef() ==
123 if( tk_elem != TKs_end ) {
142 if( !
mask[idx] )
continue;
147 bool thisIsAPotentialMuon =
false;
155 if (thisIsAPotentialMuon &&
debug_) {
156 std::cout <<
"Potential Muon P " << pftrackref->trackRef()->p()
157 <<
" pt " << pftrackref->trackRef()->p() << std::endl;
159 if( muId != -1 ) trkElem->
setMuonRef(muonref);
161 trkElem->
setTime( (*timeH)[pftrackref->trackRef()], (*timeErrH)[pftrackref->trackRef()] );
163 if( vetoed.count(pftrackref->trackRef().
key()) == 0 || muonref.isNonnull()){
164 elems.emplace_back(trkElem);
168 elems.shrink_to_fit();
174 auto muon = std::find_if(muonh->cbegin(),muonh->cend(),
176 return (
m.track().isNonnull() &&
177 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.
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
edm::EDGetTokenT< edm::ValueMap< float > > srcTimeError_
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
size_type size() const
Size of the RefVector.
#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
void setTime(float time, float timeError=0.f)
the timing information
const std::vector< unsigned > NHitCut_
edm::EDGetTokenT< edm::ValueMap< float > > srcTime_