Skip to content

Commit

Permalink
Merge pull request #36184 from AdrianoDee/larger_seeding
Browse files Browse the repository at this point in the history
Extending SeedingHitSet & SeedGeneratorFromProtoTracksEDProducer
  • Loading branch information
cmsbuild authored Jan 25, 2022
2 parents dbf0a21 + 7ce4dd6 commit ec200b2
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
namespace {
void fillNtuplets(RegionsSeedingHitSets::RegionFiller& seedingHitSetsFiller, const OrderedHitSeeds& quadruplets) {
for (const auto& quad : quadruplets) {
seedingHitSetsFiller.emplace_back(quad[0], quad[1], quad[2], quad[3]);
if (quad.size() == 3)
seedingHitSetsFiller.emplace_back(quad[0], quad[1], quad[2]);
if (quad.size() == 4)
seedingHitSetsFiller.emplace_back(quad[0], quad[1], quad[2], quad[3]);
}
}
} // namespace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"

#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include <vector>

using namespace edm;
Expand Down Expand Up @@ -140,12 +139,10 @@ void SeedGeneratorFromProtoTracksEDProducer::produce(edm::Event& ev, const edm::
GlobalTrackingRegion region(mom_perp, vtx, 0.2, 0.2);

seedCreator_.init(region, es, nullptr);
seedCreator_.makeSeed(
*result,
SeedingHitSet(hits[0],
hits[1],
hits.size() > 2 ? hits[2] : SeedingHitSet::nullPtr(),
(includeFourthHit_ && hits.size() > 3) ? hits[3] : SeedingHitSet::nullPtr()));
if (hits.size() > 3 and not includeFourthHit_)
seedCreator_.makeSeed(*result, {hits[0], hits[1], hits[2]});
else
seedCreator_.makeSeed(*result, hits);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
#include "FWCore/Utilities/interface/Visibility.h"

#include "FWCore/Framework/interface/stream/EDProducer.h"
#include "FWCore/Framework/interface/FrameworkfwdMostUsed.h"
#include "DataFormats/TrackReco/interface/TrackFwd.h"
#include "DataFormats/VertexReco/interface/VertexFwd.h"
#include "RecoTracker/TkSeedGenerator/interface/SeedFromProtoTrack.h"
#include "SeedFromConsecutiveHitsCreator.h"

#include <string>

class dso_hidden SeedGeneratorFromProtoTracksEDProducer : public edm::stream::EDProducer<> {
public:
SeedGeneratorFromProtoTracksEDProducer(const edm::ParameterSet& cfg);
Expand Down
49 changes: 26 additions & 23 deletions RecoTracker/TkSeedingLayers/interface/SeedingHitSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
#define TkSeedingLayers_SeedingHitSet_H

#include "DataFormats/TrackerRecHit2D/interface/BaseTrackerRecHit.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include <vector>
#include <algorithm>

class SeedingHitSet {
public:
Expand All @@ -11,40 +15,39 @@ class SeedingHitSet {

static ConstRecHitPointer nullPtr() { return nullptr; }

SeedingHitSet() { theRecHits[0] = theRecHits[1] = theRecHits[2] = theRecHits[3] = nullptr; }
SeedingHitSet() = default;

SeedingHitSet(ConstRecHitPointer one, ConstRecHitPointer two) : theRecHits({one, two}) { setSize(); }

SeedingHitSet(ConstRecHitPointer one, ConstRecHitPointer two)
// : theRecHits{{one,two,ConstRecHitPointer()}}
{
theRecHits[0] = one;
theRecHits[1] = two;
theRecHits[2] = theRecHits[3] = nullptr;
}
SeedingHitSet(ConstRecHitPointer one, ConstRecHitPointer two, ConstRecHitPointer three)
// : theRecHits{{one,two,three}},
{
theRecHits[0] = one;
theRecHits[1] = two;
theRecHits[2] = three;
theRecHits[3] = nullptr;
: theRecHits({one, two, three}) {
setSize();
}

SeedingHitSet(ConstRecHitPointer one, ConstRecHitPointer two, ConstRecHitPointer three, ConstRecHitPointer four) {
theRecHits[0] = one;
theRecHits[1] = two;
theRecHits[2] = three;
theRecHits[3] = four;
SeedingHitSet(ConstRecHitPointer one, ConstRecHitPointer two, ConstRecHitPointer three, ConstRecHitPointer four)
: theRecHits({one, two, three, four}) {
setSize();
}

ConstRecHitPointer const *data() const { return theRecHits; }
SeedingHitSet(const std::vector<ConstRecHitPointer> &hits) : theRecHits(hits) { setSize(); }

unsigned int size() const { return theRecHits[3] ? 4 : (theRecHits[2] ? 3 : (theRecHits[1] ? 2 : 0)); }
ConstRecHitPointer const *data() const { return theRecHits.data(); }

unsigned int size() const { return theSize; }

ConstRecHitPointer get(unsigned int i) const { return theRecHits[i]; }
ConstRecHitPointer operator[](unsigned int i) const { return theRecHits[i]; }

private:
ConstRecHitPointer theRecHits[4];
protected:
std::vector<ConstRecHitPointer> theRecHits;
unsigned int theSize = 0;

void setSize() {
theSize = 0;
while (theRecHits[++theSize] and theSize < theRecHits.size())
;
theSize = theSize > 1 ? theSize : 0;
}
};

#endif

0 comments on commit ec200b2

Please sign in to comment.