42 : ecalSeedToken_{consumes<ElectronSeedCollection>(iConfig.
getParameter<
InputTag>(
"EcalBasedSeeds"))} {
44 if (!tkSeedLabel_.
label().empty())
45 tkSeedToken_ = consumes<ElectronSeedCollection>(tkSeedLabel_);
47 produces<ElectronSeedCollection>();
53 auto const& eSeeds =
iEvent.get(ecalSeedToken_);
56 auto const& tSeeds = tkSeedToken_.isUninitialized() ? tSeedsEmpty :
iEvent.get(tkSeedToken_);
59 auto output = std::make_unique<ElectronSeedCollection>();
60 output->reserve(eSeeds.size() + tSeeds.size());
63 vector<bool> tSeedsMatched(tSeeds.size(),
false);
66 for (
auto newSeed : eSeeds) {
70 for (
auto const& tSeed : tSeeds) {
74 unsigned int hitShared = 0;
75 unsigned int hitSeed = 0;
76 for (
auto const& eh : newSeed.recHits()) {
81 for (
auto const& th : tSeed.recHits()) {
91 if (hitShared == hitSeed) {
92 tSeedsMatched[
it] =
true;
93 newSeed.setCtfTrack(tSeed.ctfTrack());
96 if (hitShared == (hitSeed - 1)) {
97 newSeed.setCtfTrack(tSeed.ctfTrack());
98 }
else if ((hitShared > 0 || tSeed.nHits() == 0) && !newSeed.isTrackerDriven()) {
100 unsigned int hitSharedOnTrack = 0;
101 for (
auto const& eh : newSeed.recHits()) {
104 for (
auto const* th : tSeed.ctfTrack()->recHits()) {
114 if (hitSharedOnTrack == hitSeed) {
115 tSeedsMatched[
it] =
true;
116 newSeed.setCtfTrack(tSeed.ctfTrack());
119 if (hitSharedOnTrack == (hitSeed - 1)) {
120 newSeed.setCtfTrack(tSeed.ctfTrack());
125 output->push_back(newSeed);
129 for (
unsigned int it = 0;
it < tSeeds.size();
it++) {
130 if (!tSeedsMatched[
it])
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
T getParameter(std::string const &) const
ElectronSeedMerger(const edm::ParameterSet &)
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
#define DEFINE_FWK_MODULE(type)
std::vector< ElectronSeed > ElectronSeedCollection
collection of ElectronSeed objects
static void fillDescriptions(ConfigurationDescriptions &descriptions)
virtual void produce(StreamID, Event &, EventSetup const &) const =0
edm::EDGetTokenT< reco::ElectronSeedCollection > tkSeedToken_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const edm::EDGetTokenT< reco::ElectronSeedCollection > ecalSeedToken_