51 debug =
pset.getParameter<
bool>(
"DebugMuonSeed");
73 std::vector<TrajectorySeed>&
seeds) {
76 std::vector<TrajectorySeed> FinalSeeds;
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));
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);
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;
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);
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);
234 betterChi2 = theChi2;
235 winner =
static_cast<int>(
i);
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]);
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) {
350 theGroup.push_back(
seeds[
j]);
358 double dh = pos1.
eta() - pos2.
eta();
359 double df = pos1.
phi() - pos2.
phi();
366 theGroup.push_back(
seeds[
j]);
378 unsigned int overlapping = 0;
392 double dx = gp1.
x() - gp2.
x();
393 double dy = gp1.
y() - gp2.
y();
394 double dz = gp1.
z() - gp2.
z();
406 for (
auto const&
r1 :
seed.recHits()) {
410 theChi2 = theChi2 /
seed.nHits();
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;
uint8_t geoId(const VFATFrame &frame)
retrieve the GEO information for this channel
MuonSeedCleaner(const edm::ParameterSet &, edm::ConsumesCollector &&)
Constructor.
TrajectorySeed BiggerCone(std::vector< TrajectorySeed > &seeds)
select the seed with bigger projection cone to next layer
auto const good
min quality of good
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
get the tracking geometry
edm::ESHandle< MagneticField > magneticField() const
get the magnetic field
static bool lengthSorting(const TrajectorySeed &s1, const TrajectorySeed &s2)
RecHitRange recHits() const
Geom::Phi< T > phi() const
MuonServiceProxy * theService
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)
const GeomDet * idToDet(DetId) const override
unsigned int OverlapSegments(const TrajectorySeed &seed1, const TrajectorySeed &seed2)
check overlapping segment for seeds
unsigned int detId() const
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
GlobalPoint globalPosition() const
std::shared_ptr< MuonTransientTrackingRecHit > MuonRecHitPointer
unsigned int nHits() const
DetId geographicalId() const
The label of this GeomDet.
TrajectorySeed LeanHighMomentum(std::vector< TrajectorySeed > &seeds)
select the highest momentum pt seed
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
virtual TrackingRecHit * clone() const =0
int NRecHitsFromSegment(const TrackingRecHit &rhit)
DetId geographicalId() const
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
GlobalVector globalMomentum() const
SeedContainer LengthFilter(std::vector< TrajectorySeed > &seeds)
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
TupleMultiplicity< TrackerTraits > const *__restrict__ uint32_t nHits
std::vector< TrajectorySeed > SeedContainer
static MuonRecHitPointer specificBuild(const GeomDet *geom, const TrackingRecHit *rh)
int SeedLength(const TrajectorySeed &seed)
TrajectorySeed Chi2LengthSelection(std::vector< TrajectorySeed > &seeds)
select seed by balance length and chi2