73 std::vector<TrajectorySeed>&
seeds) {
76 std::vector<TrajectorySeed> FinalSeeds;
79 std::vector<SeedContainer> theCollection =
GroupSeeds(seeds);
82 for (
size_t i = 0;
i < theCollection.size();
i++) {
89 FinalSeeds.push_back(bestSeed);
92 double eta = fabs(seedgp.
eta());
93 if (goodSeeds.size() > 2 && eta > 1.5) {
95 FinalSeeds.push_back(anotherSeed);
100 FinalSeeds.push_back(bestSeed);
103 double eta = fabs(seedgp.
eta());
104 if (otherSeeds.size() > 2 && eta > 1.5) {
106 FinalSeeds.push_back(anotherSeed);
111 FinalSeeds.push_back(bestSeed);
114 double eta = fabs(seedgp.
eta());
115 if (theCollection.size() > 2 && eta > 1.5) {
117 FinalSeeds.push_back(anotherSeed);
125 if (seeds.size() == 1)
130 double bestChi2 = 99999.;
131 for (
size_t i = 0;
i < seeds.size();
i++) {
138 double dChi2 = fabs(1. - (theChi2 / bestChi2));
139 int theHits = seeds[
i].nHits();
140 int dHits = theHits - moreHits;
144 if (theChi2 < bestChi2 && dChi2 > 0.05) {
145 winner =
static_cast<int>(
i);
150 if (theChi2 >= bestChi2 && dChi2 < 0.05 && dHits > 0) {
151 winner =
static_cast<int>(
i);
158 seeds.erase(seeds.begin() + winner);
163 if (seeds.size() == 1)
166 float biggerProjErr = 9999.;
169 for (
size_t i = 0;
i < seeds.size();
i++) {
170 auto r1 = seeds[
i].recHits().begin();
171 mat =
r1->parametersError().similarityT(
r1->projectionMatrix());
175 float ddx = mat[1][1];
176 float ddy = mat[2][2];
177 float dxx = mat[3][3];
178 float dyy = mat[4][4];
179 float projectErr =
sqrt((ddx * 10000.) + (ddy * 10000.) + dxx + dyy);
183 if (projectErr < biggerProjErr)
186 winner =
static_cast<int>(
i);
187 biggerProjErr = projectErr;
190 seeds.erase(seeds.begin() + winner);
195 if (seeds.size() == 1)
198 double highestPt = 0.;
200 for (
size_t i = 0;
i < seeds.size();
i++) {
202 double pt =
sqrt((mom.
x() * mom.
x()) + (mom.
y() * mom.
y()));
203 if (pt > highestPt) {
204 winner =
static_cast<int>(
i);
209 seeds.erase(seeds.begin() + winner);
214 if (seeds.size() == 1)
219 double betterChi2 = 99999.;
220 for (
size_t i = 0;
i < seeds.size();
i++) {
228 if (theHits == moreHits && theChi2 < betterChi2) {
229 betterChi2 = theChi2;
230 winner =
static_cast<int>(
i);
232 if (theHits > moreHits) {
234 betterChi2 = theChi2;
235 winner =
static_cast<int>(
i);
239 seeds.erase(seeds.begin() + winner);
246 for (
size_t i = 0;
i < seeds.size();
i++) {
247 int theLength =
static_cast<int>(seeds[
i].nHits());
248 if (theLength > NSegs) {
251 longSeeds.push_back(seeds[
i]);
252 }
else if (theLength == NSegs) {
253 longSeeds.push_back(seeds[
i]);
264 bool findgoodMomentum =
false;
267 for (
size_t i = 0;
i < goodMomentumSeeds.size();
i++) {
269 double pt =
sqrt((mom.
x() * mom.
x()) + (mom.
y() * mom.
y()));
270 if (pt < 6. || pt > 2000.)
274 seeds.push_back(goodMomentumSeeds[i]);
275 findgoodMomentum =
true;
278 seeds = goodMomentumSeeds;
280 return findgoodMomentum;
285 theCandidate.clear();
287 bool longSeed =
false;
288 bool withFirstLayer =
false;
291 for (
size_t i = 0;
i < seeds.size();
i++) {
305 if (DT_Id.station() != 1)
307 withFirstLayer =
true;
315 withFirstLayer =
true;
318 bool goodseed = (longSeed && withFirstLayer) ?
true :
false;
320 if (goodseed == good)
321 theCandidate.push_back(seeds[
i]);
327 std::vector<SeedContainer> seedCollection;
328 seedCollection.clear();
329 std::vector<TrajectorySeed> theGroup;
330 std::vector<bool> usedSeed(seeds.size(),
false);
333 for (
size_t i = 0;
i < seeds.size();
i++) {
336 theGroup.push_back(seeds[i]);
341 for (
size_t j = i + 1;
j < seeds.size();
j++) {
344 if (!usedSeed[j] && overlapping > 0) {
346 if (seeds[i].
nHits() == overlapping && seeds[j].
nHits() == overlapping) {
350 theGroup.push_back(seeds[j]);
358 double dh = pos1.
eta() - pos2.
eta();
359 double df = pos1.
phi() - pos2.
phi();
360 double dR =
sqrt((dh * dh) + (df * df));
362 if (dR > 0.3 && seeds[j].
nHits() == 1)
364 if (dR > 0.2 && seeds[j].
nHits() > 1)
366 theGroup.push_back(seeds[j]);
370 seedCollection.push_back(theGroup);
374 return seedCollection;
378 unsigned int overlapping = 0;
380 DetId id1 =
r1.geographicalId();
385 DetId id2 =
r2.geographicalId();
392 double dx = gp1.
x() - gp2.
x();
393 double dy = gp1.
y() - gp2.
y();
394 double dz = gp1.
z() - gp2.
z();
395 double dL =
sqrt(dx * dx + dy * dy + dz * dz);
410 theChi2 = theChi2 / seed.
nHits();
418 for (
auto const& recHit : seed.
recHits()) {
458 std::vector<TrackingRecHit*> DThits = theSeg->recHits();
460 for (
size_t j = 0;
j < DThits.size();
j++) {
461 dt1DHits += (DThits[
j]->recHits()).
size();
467 NRechits = (theSeg->recHits()).
size();
477 std::vector<TrackingRecHit*> DThits = rhit->
recHits();
479 for (
size_t j = 0;
j < DThits.size();
j++) {
480 dt1DHits += (DThits[
j]->recHits()).
size();
493 double NChi2 = 999999.;
498 double dof =
static_cast<double>(theSeg->degreesOfFreedom());
499 NChi2 = theSeg->chi2() /
dof;
MuonSeedCleaner(const edm::ParameterSet &, edm::ConsumesCollector &&)
Constructor.
TrajectorySeed BiggerCone(std::vector< TrajectorySeed > &seeds)
select the seed with bigger projection cone to next layer
static bool lengthSorting(const TrajectorySeed &s1, const TrajectorySeed &s2)
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Geom::Phi< T > phi() const
MuonServiceProxy * theService
GlobalPoint globalPosition() const
std::vector< const TrackingRecHit * > recHits() const override
Access to component RecHits (if any)
GlobalPoint SeedPosition(const TrajectorySeed &seed)
retrieve seed global position
~MuonSeedCleaner()
Destructor.
double SeedChi2(const TrajectorySeed &seed)
edm::ESHandle< MagneticField > magneticField() const
get the magnetic field
unsigned int OverlapSegments(const TrajectorySeed &seed1, const TrajectorySeed &seed2)
check overlapping segment for seeds
bool MomentumFilter(std::vector< TrajectorySeed > &seeds)
filter out the bad pt seeds, if all are bad pt seeds then keep all
double NChi2OfSegment(const TrackingRecHit &rhit)
retrieve number of rechits& normalized chi2 of associated segments of a seed
std::shared_ptr< MuonTransientTrackingRecHit > MuonRecHitPointer
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
DetId geographicalId() const
The label of this GeomDet.
unsigned int detId() const
TrajectorySeed LeanHighMomentum(std::vector< TrajectorySeed > &seeds)
select the highest momentum pt seed
virtual TrackingRecHit * clone() const =0
RecHitRange recHits() const
int NRecHitsFromSegment(const TrackingRecHit &rhit)
PTrajectoryStateOnDet const & startingState() const
auto const good
min quality of good
std::vector< SeedContainer > GroupSeeds(std::vector< TrajectorySeed > &seeds)
group the seeds
SeedContainer SeedCandidates(std::vector< TrajectorySeed > &seeds, bool good)
pick the seeds w/ 1st layer information and w/ more than 1 segments
T getParameter(std::string const &) const
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const gpuPixelDoublets::CellTracksVector const GPUCACell::OuterHitOfCell const int32_t nHits
SeedContainer LengthFilter(std::vector< TrajectorySeed > &seeds)
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
get the tracking geometry
unsigned int nHits() const
GlobalVector globalMomentum() const
CLHEP::HepSymMatrix AlgebraicSymMatrix
GlobalVector SeedMomentum(const TrajectorySeed &seed)
retrieve seed global momentum
void update(const edm::EventSetup &setup, bool duringEvent=true)
update the services each event
std::vector< TrajectorySeed > seedCleaner(const edm::EventSetup &eventSetup, std::vector< TrajectorySeed > &seeds)
Cache pointer to geometry.
TrajectorySeed MoreRecHits(std::vector< TrajectorySeed > &seeds)
select the seed with more rechits
DetId geographicalId() const
std::vector< TrajectorySeed > SeedContainer
static MuonRecHitPointer specificBuild(const GeomDet *geom, const TrackingRecHit *rh)
tuple size
Write out results.
int SeedLength(const TrajectorySeed &seed)
TrajectorySeed Chi2LengthSelection(std::vector< TrajectorySeed > &seeds)
select seed by balance length and chi2