1 #ifndef __TrackFromParentImporter_H__ 2 #define __TrackFromParentImporter_H__ 14 template <
class Collection>
22 static const std::vector<reco::PFRecTrackRef>
empty_;
26 template <
class Collection,
class Adaptor = noop::ParentCollectionAdaptor<Collection>>
65 template <
class Collection,
class Adaptor>
69 auto pfparents =
e.getHandle(src_);
72 typedef std::pair<edm::ProductID, unsigned> TrackProdIDKey;
73 std::vector<TrackProdIDKey> vetoed;
77 case pfRecTrackCollection: {
78 const auto& vetoes =
e.get(vetoPFTracksSrc_);
79 for (
const auto&
veto : vetoes) {
80 vetoed.emplace_back(
veto.trackRef().id(),
veto.trackRef().key());
84 case ticlSeedingRegion: {
85 const auto& vetoes =
e.get(vetoTICLSeedingSrc_);
86 auto tracksH =
e.getHandle(tracksSrc_);
87 for (
const auto&
veto : vetoes) {
89 vetoed.emplace_back(tracksH.id(),
veto.index);
94 const auto& vetoes =
e.get(vetoPFCandidatesSrc_);
95 for (
const auto&
veto : vetoes) {
96 if (
veto.trackRef().isNull())
98 vetoed.emplace_back(
veto.trackRef().id(),
veto.trackRef().key());
106 elems.reserve(elems.size() + 2 * pfparents->size());
111 auto bpar = pfparents->cbegin();
112 auto epar = pfparents->cend();
115 for (
auto pfparent = bpar; pfparent != epar; ++pfparent) {
116 if (Adaptor::check_importable(*pfparent)) {
118 const auto& pftracks = Adaptor::get_track_refs(*pfparent);
119 for (
const auto& pftrack : pftracks) {
121 TrackProdIDKey trk = std::make_pair(pftrack->trackRef().id(), pftrack->trackRef().key());
123 bool inVetoList = (lower != vetoed.end() && *lower == trk);
129 auto tk_elem = std::find_if(
130 elems.begin(), TKs_end, [&](
const ElementType&
a) {
return (
a->trackRef() == pftrack->trackRef()); });
131 if (tk_elem != TKs_end) {
132 Adaptor::set_element_info(tk_elem->get(), parentRef);
135 Adaptor::set_element_info(trkElem, parentRef);
136 TKs_end = elems.insert(TKs_end, ElementType(trkElem));
142 elems.shrink_to_fit();
static bool check_importable(const typename Collection::value_type &)
Abstract base class for a PFBlock element (track, cluster...)
T getParameter(std::string const &) const
static const std::vector< reco::PFRecTrackRef > empty_
edm::EDGetTokenT< reco::PFCandidateCollection > vetoPFCandidatesSrc_
edm::EDGetTokenT< reco::PFRecTrackCollection > vetoPFTracksSrc_
static void set_element_info(reco::PFBlockElement *, const typename edm::Ref< Collection > &)
uint32_t cc[maxCellsPerHit]
std::vector< Track > TrackCollection
collection of Tracks
edm::EDGetTokenT< Collection > src_
edm::EDGetTokenT< reco::TrackCollection > tracksSrc_
TrackFromParentImporter(const edm::ParameterSet &conf, edm::ConsumesCollector &cc)
Container::value_type value_type
static const std::vector< reco::PFRecTrackRef > & get_track_refs(const typename Collection::value_type &)
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
void importToBlock(const edm::Event &, ElementList &) const override
std::vector< std::unique_ptr< reco::PFBlockElement > > ElementList
std::vector< PFRecTrack > PFRecTrackCollection
collection of PFRecTrack objects
edm::EDGetTokenT< std::vector< TICLSeedingRegion > > vetoTICLSeedingSrc_