78 std::vector<TrajectorySeed> FinalSeeds;
81 std::vector<SeedContainer> theCollection =
GroupSeeds(seeds);
84 for (
size_t i=0;
i< theCollection.size();
i++ ) {
92 FinalSeeds.push_back( bestSeed );
95 double eta = fabs( seedgp.
eta() );
96 if ( goodSeeds.size() > 2 && eta > 1.5 ) {
98 FinalSeeds.push_back( anotherSeed );
104 FinalSeeds.push_back( bestSeed );
107 double eta = fabs( seedgp.
eta() );
108 if ( otherSeeds.size() > 2 && eta > 1.5 ) {
110 FinalSeeds.push_back( anotherSeed );
116 FinalSeeds.push_back( bestSeed );
119 double eta = fabs( seedgp.
eta() );
120 if ( theCollection.size() > 2 && eta > 1.5 ) {
122 FinalSeeds.push_back( anotherSeed );
133 if ( seeds.size() == 1 )
return seeds[0];
137 double bestChi2 = 99999.;
138 for (
size_t i = 0;
i < seeds.size();
i++ ) {
146 double dChi2 = fabs( 1. - (theChi2 / bestChi2)) ;
147 int theHits = seeds[
i].nHits() ;
148 int dHits = theHits - moreHits ;
152 if ( theChi2 < bestChi2 && dChi2 > 0.05 ) {
153 winner =
static_cast<int>(
i) ;
158 if ( theChi2 >= bestChi2 && dChi2 < 0.05 && dHits > 0 ) {
159 winner =
static_cast<int>(
i) ;
167 seeds.erase( seeds.begin()+winner );
173 if ( seeds.size() == 1 )
return seeds[0];
175 float biggerProjErr = 9999.;
178 for (
size_t i = 0;
i < seeds.size();
i++ ) {
181 mat = r1->parametersError().similarityT( r1->projectionMatrix() );
185 float ddx = mat[1][1];
186 float ddy = mat[2][2];
187 float dxx = mat[3][3];
188 float dyy = mat[4][4];
189 float projectErr =
sqrt( (ddx*10000.) + (ddy*10000.) + dxx + dyy ) ;
191 if ( NRecHits < 5 ) continue ;
192 if ( projectErr < biggerProjErr )
continue;
194 winner =
static_cast<int>(
i) ;
195 biggerProjErr = projectErr ;
198 seeds.erase( seeds.begin()+winner );
205 if ( seeds.size() == 1 )
return seeds[0];
207 double highestPt = 0. ;
209 for (
size_t i = 0;
i < seeds.size();
i++ ) {
211 double pt =
sqrt( (mom.
x()*mom.
x()) + (mom.
y()*mom.
y()) );
212 if ( pt > highestPt ) {
213 winner =
static_cast<int>(
i) ;
218 seeds.erase( seeds.begin()+winner );
226 if ( seeds.size() == 1 )
return seeds[0];
230 double betterChi2 = 99999.;
231 for (
size_t i = 0;
i < seeds.size();
i++ ) {
240 if ( theHits == moreHits && theChi2 < betterChi2 ) {
241 betterChi2 = theChi2;
242 winner =
static_cast<int>(
i) ;
244 if ( theHits > moreHits ) {
246 betterChi2 = theChi2;
247 winner =
static_cast<int>(
i) ;
251 seeds.erase( seeds.begin()+winner );
260 for (
size_t i = 0;
i< seeds.size();
i++) {
262 int theLength =
static_cast<int>( seeds[
i].nHits());
263 if ( theLength > NSegs ) {
266 longSeeds.push_back( seeds[
i] );
268 else if ( theLength == NSegs ) {
269 longSeeds.push_back( seeds[
i] );
283 bool findgoodMomentum =
false;
286 for (
size_t i = 0;
i < goodMomentumSeeds.size();
i++ ) {
288 double pt =
sqrt( (mom.
x()*mom.
x()) + (mom.
y()*mom.
y()) );
289 if ( pt < 6. || pt > 2000. )
continue;
292 seeds.push_back( goodMomentumSeeds[i] );
293 findgoodMomentum =
true;
295 if ( seeds.size() == 0 ) seeds = goodMomentumSeeds;
297 return findgoodMomentum;
305 theCandidate.clear();
307 bool longSeed =
false;
308 bool withFirstLayer =
false ;
311 for (
size_t i = 0;
i < seeds.size();
i++ ) {
313 if (seeds[
i].nHits() > 1 ) longSeed =
true ;
326 if (DT_Id.station() != 1)
continue;
327 withFirstLayer =
true;
333 if (CSC_Id.
station() != 1)
continue;
334 withFirstLayer =
true;
337 bool goodseed = (longSeed && withFirstLayer) ?
true :
false ;
339 if ( goodseed == good ) theCandidate.push_back( seeds[
i] );
347 std::vector<SeedContainer> seedCollection;
348 seedCollection.clear();
349 std::vector<TrajectorySeed> theGroup ;
350 std::vector<bool> usedSeed(seeds.size(),
false);
353 for (
size_t i= 0;
i<seeds.size();
i++){
355 if (usedSeed[
i])
continue;
356 theGroup.push_back( seeds[i] );
361 for (
size_t j= i+1;
j<seeds.size();
j++){
365 if ( !usedSeed[j] && overlapping > 0 ) {
367 if ( seeds[i].nHits() == overlapping && seeds[j].nHits() == overlapping ) {
371 theGroup.push_back( seeds[j] );
374 if (usedSeed[j])
continue;
378 double dh = pos1.
eta() - pos2.
eta() ;
379 double df = pos1.
phi() - pos2.
phi() ;
380 double dR =
sqrt( (dh*dh) + (df*df) );
382 if ( dR > 0.3 && seeds[j].nHits() == 1)
continue;
383 if ( dR > 0.2 && seeds[j].nHits() > 1)
continue;
384 theGroup.push_back( seeds[j] );
388 seedCollection.push_back(theGroup);
392 return seedCollection;
398 unsigned int overlapping = 0;
401 DetId id1 = (*r1).geographicalId();
407 DetId id2 = (*r2).geographicalId();
408 if (id1 != id2 )
continue;
413 double dx = gp1.
x() - gp2.
x() ;
414 double dy = gp1.
y() - gp2.
y() ;
415 double dz = gp1.
z() - gp2.
z() ;
416 double dL =
sqrt( dx*dx + dy*dy + dz*dz);
418 if ( dL < 1. ) overlapping ++;
433 theChi2 = theChi2 / seed.
nHits() ;
491 std::vector<TrackingRecHit*> DThits = theSeg->
recHits();
493 for (
size_t j=0;
j< DThits.size();
j++) {
494 dt1DHits += (DThits[
j]->recHits()).
size();
496 NRechits = dt1DHits ;
511 std::vector<TrackingRecHit*> DThits = rhit->
recHits();
513 for (
size_t j=0;
j< DThits.size();
j++) {
514 dt1DHits += (DThits[
j]->recHits()).
size();
516 NRechits = dt1DHits ;
529 double NChi2 = 999999. ;
535 NChi2 = theSeg->
chi2() / dof ;
virtual int degreesOfFreedom() const
Degrees of freedom for segments, else 0.
void update(const edm::EventSetup &setup)
update the services each event
T getParameter(std::string const &) const
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)
virtual double chi2() const
Chi square of the fit for segments, else 0.
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
GlobalPoint SeedPosition(const TrajectorySeed &seed)
retrieve seed global position
~MuonSeedCleaner()
Destructor.
double SeedChi2(const TrajectorySeed &seed)
MuonSeedCleaner(const edm::ParameterSet &)
Constructor.
edm::ESHandle< MagneticField > magneticField() const
get the magnetic field
unsigned int OverlapSegments(const TrajectorySeed &seed1, const TrajectorySeed &seed2)
check overlapping segment for seeds
virtual std::vector< const TrackingRecHit * > recHits() const override
Access to component RecHits (if any)
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
DetId geographicalId() const
The label of this GeomDet.
unsigned int detId() const
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
TrajectorySeed LeanHighMomentum(std::vector< TrajectorySeed > &seeds)
select the highest momentum pt seed
virtual TrackingRecHit * clone() const =0
int NRecHitsFromSegment(const TrackingRecHit &rhit)
PTrajectoryStateOnDet const & startingState() const
std::vector< SeedContainer > GroupSeeds(std::vector< TrajectorySeed > &seeds)
group the seeds
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
SeedContainer SeedCandidates(std::vector< TrajectorySeed > &seeds, bool good)
pick the seeds w/ 1st layer information and w/ more than 1 segments
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
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
volatile std::atomic< bool > shutdown_flag false
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