CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
MuonSeedCleaner Class Reference

#include <MuonSeedCleaner.h>

Public Types

typedef std::deque< bool > BoolContainer
 
typedef MuonTransientTrackingRecHit::MuonRecHitContainer SegmentContainer
 

Public Member Functions

 MuonSeedCleaner (const edm::ParameterSet &, edm::ConsumesCollector &&)
 Constructor. More...
 
int NRecHitsFromSegment (const TrackingRecHit &rhit)
 
int NRecHitsFromSegment (MuonTransientTrackingRecHit *rhit)
 
std::vector< TrajectorySeedseedCleaner (const edm::EventSetup &eventSetup, std::vector< TrajectorySeed > &seeds)
 Cache pointer to geometry. More...
 
 ~MuonSeedCleaner ()
 Destructor. More...
 

Public Attributes

std::vector< int > badSeedLayer
 

Private Member Functions

TrajectorySeed BiggerCone (std::vector< TrajectorySeed > &seeds)
 select the seed with bigger projection cone to next layer More...
 
TrajectorySeed Chi2LengthSelection (std::vector< TrajectorySeed > &seeds)
 select seed by balance length and chi2 More...
 
std::vector< SeedContainerGroupSeeds (std::vector< TrajectorySeed > &seeds)
 group the seeds More...
 
TrajectorySeed LeanHighMomentum (std::vector< TrajectorySeed > &seeds)
 select the highest momentum pt seed More...
 
SeedContainer LengthFilter (std::vector< TrajectorySeed > &seeds)
 
bool MomentumFilter (std::vector< TrajectorySeed > &seeds)
 filter out the bad pt seeds, if all are bad pt seeds then keep all More...
 
TrajectorySeed MoreRecHits (std::vector< TrajectorySeed > &seeds)
 select the seed with more rechits More...
 
double NChi2OfSegment (const TrackingRecHit &rhit)
 retrieve number of rechits& normalized chi2 of associated segments of a seed More...
 
unsigned int OverlapSegments (const TrajectorySeed &seed1, const TrajectorySeed &seed2)
 check overlapping segment for seeds More...
 
SeedContainer SeedCandidates (std::vector< TrajectorySeed > &seeds, bool good)
 pick the seeds w/ 1st layer information and w/ more than 1 segments More...
 
double SeedChi2 (const TrajectorySeed &seed)
 
int SeedLength (const TrajectorySeed &seed)
 
GlobalVector SeedMomentum (const TrajectorySeed &seed)
 retrieve seed global momentum More...
 
GlobalPoint SeedPosition (const TrajectorySeed &seed)
 retrieve seed global position More...
 

Private Attributes

bool debug
 
std::vector< int > ShoweringLayers
 
SegmentContainer ShoweringSegments
 
MuonServiceProxytheService
 

Detailed Description

Algorith to clean duplicate seeds and select a right one

author: Shih-Chuan Kao - UCR

Definition at line 28 of file MuonSeedCleaner.h.

Member Typedef Documentation

◆ BoolContainer

typedef std::deque<bool> MuonSeedCleaner::BoolContainer

Definition at line 31 of file MuonSeedCleaner.h.

◆ SegmentContainer

Definition at line 30 of file MuonSeedCleaner.h.

Constructor & Destructor Documentation

◆ MuonSeedCleaner()

MuonSeedCleaner::MuonSeedCleaner ( const edm::ParameterSet pset,
edm::ConsumesCollector &&  iC 
)
explicit

Constructor.

Definition at line 49 of file MuonSeedCleaner.cc.

49  {
50  // Local Debug flag
51  debug = pset.getParameter<bool>("DebugMuonSeed");
52 
53  // muon service
54  edm::ParameterSet serviceParameters = pset.getParameter<edm::ParameterSet>("ServiceParameters");
55  theService = new MuonServiceProxy(serviceParameters, std::move(iC));
56 }

References debug, eostools::move(), MuonServiceProxy_cff::MuonServiceProxy, muonDTDigis_cfi::pset, and theService.

◆ ~MuonSeedCleaner()

MuonSeedCleaner::~MuonSeedCleaner ( )

Destructor.

Definition at line 61 of file MuonSeedCleaner.cc.

61  {
62  if (theService)
63  delete theService;
64 }

References theService.

Member Function Documentation

◆ BiggerCone()

TrajectorySeed MuonSeedCleaner::BiggerCone ( std::vector< TrajectorySeed > &  seeds)
private

select the seed with bigger projection cone to next layer

Definition at line 161 of file MuonSeedCleaner.cc.

162  {
163  if (seeds.size() == 1)
164  return seeds[0];
165 
166  float biggerProjErr = 9999.;
167  int winner = 0;
168  AlgebraicSymMatrix mat(5, 0);
169  for (size_t i = 0; i < seeds.size(); i++) {
171  mat = r1->parametersError().similarityT(r1->projectionMatrix());
172 
173  int NRecHits = NRecHitsFromSegment(*r1);
174 
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);
180 
181  if (NRecHits < 5)
182  continue;
183  if (projectErr < biggerProjErr)
184  continue;
185 
186  winner = static_cast<int>(i);
187  biggerProjErr = projectErr;
188  }
189  TrajectorySeed theSeed = seeds[winner];
190  seeds.erase(seeds.begin() + winner);
191  return theSeed;

References mps_fire::i, NRecHitsFromSegment(), diffTwoXMLs::r1, InitialStep_cff::seeds, and mathSSE::sqrt().

Referenced by seedCleaner().

◆ Chi2LengthSelection()

TrajectorySeed MuonSeedCleaner::Chi2LengthSelection ( std::vector< TrajectorySeed > &  seeds)
private

select seed by balance length and chi2

Definition at line 123 of file MuonSeedCleaner.cc.

124  {
125  if (seeds.size() == 1)
126  return seeds[0];
127 
128  int winner = 0;
129  int moreHits = 0;
130  double bestChi2 = 99999.;
131  for (size_t i = 0; i < seeds.size(); i++) {
132  // 1. fill out the Nchi2 of segments of the seed
133  //GlobalVector mom = SeedMomentum( seeds[i] ); // temporary use for debugging
134  //double pt = sqrt( (mom.x()*mom.x()) + (mom.y()*mom.y()) );
135  //std::cout<<" > SEED"<<i<<" pt:"<<pt<< std::endl;
136 
137  double theChi2 = SeedChi2(seeds[i]);
138  double dChi2 = fabs(1. - (theChi2 / bestChi2));
139  int theHits = seeds[i].nHits();
140  int dHits = theHits - moreHits;
141  //std::cout<<" ----- "<<std::endl;
142 
143  // 2. better chi2
144  if (theChi2 < bestChi2 && dChi2 > 0.05) {
145  winner = static_cast<int>(i);
146  bestChi2 = theChi2;
147  moreHits = theHits;
148  }
149  // 3. if chi2 is not much better, pick more rechits one
150  if (theChi2 >= bestChi2 && dChi2 < 0.05 && dHits > 0) {
151  winner = static_cast<int>(i);
152  bestChi2 = theChi2;
153  moreHits = theHits;
154  }
155  }
156  //std::cout<<" Winner is "<< winner <<std::endl;
157  TrajectorySeed theSeed = seeds[winner];
158  seeds.erase(seeds.begin() + winner);
159  return theSeed;

References mps_fire::i, SeedChi2(), InitialStep_cff::seeds, and bscTrigger_cfi::theHits.

Referenced by seedCleaner().

◆ GroupSeeds()

std::vector< SeedContainer > MuonSeedCleaner::GroupSeeds ( std::vector< TrajectorySeed > &  seeds)
private

group the seeds

Definition at line 327 of file MuonSeedCleaner.cc.

328  {
329  std::vector<SeedContainer> seedCollection;
330  seedCollection.clear();
331  std::vector<TrajectorySeed> theGroup;
332  std::vector<bool> usedSeed(seeds.size(), false);
333 
334  // categorize seeds by comparing overlapping segments or a certian eta-phi cone
335  for (size_t i = 0; i < seeds.size(); i++) {
336  if (usedSeed[i])
337  continue;
338  theGroup.push_back(seeds[i]);
339  usedSeed[i] = true;
340 
341  GlobalPoint pos1 = SeedPosition(seeds[i]);
342 
343  for (size_t j = i + 1; j < seeds.size(); j++) {
344  // 1.1 seeds with overlaaping segments will be grouped together
345  unsigned int overlapping = OverlapSegments(seeds[i], seeds[j]);
346  if (!usedSeed[j] && overlapping > 0) {
347  // reject the identical seeds
348  if (seeds[i].nHits() == overlapping && seeds[j].nHits() == overlapping) {
349  usedSeed[j] = true;
350  continue;
351  }
352  theGroup.push_back(seeds[j]);
353  usedSeed[j] = true;
354  }
355  if (usedSeed[j])
356  continue;
357 
358  // 1.2 seeds in a certain cone are grouped together
359  GlobalPoint pos2 = SeedPosition(seeds[j]);
360  double dh = pos1.eta() - pos2.eta();
361  double df = pos1.phi() - pos2.phi();
362  double dR = sqrt((dh * dh) + (df * df));
363 
364  if (dR > 0.3 && seeds[j].nHits() == 1)
365  continue;
366  if (dR > 0.2 && seeds[j].nHits() > 1)
367  continue;
368  theGroup.push_back(seeds[j]);
369  usedSeed[j] = true;
370  }
371  sort(theGroup.begin(), theGroup.end(), lengthSorting);
372  seedCollection.push_back(theGroup);
373  //std::cout<<" group "<<seedCollection.size() <<" w/"<< theGroup.size() <<" seeds"<<std::endl;
374  theGroup.clear();
375  }
376  return seedCollection;

References cuy::dh, HGC3DClusterGenMatchSelector_cfi::dR, PV3DBase< T, PVType, FrameType >::eta(), mps_fire::i, dqmiolumiharvest::j, lengthSorting(), OverlapSegments(), PV3DBase< T, PVType, FrameType >::phi(), ElectronSeedTrackRefFix_cfi::seedCollection, SeedPosition(), InitialStep_cff::seeds, and mathSSE::sqrt().

Referenced by seedCleaner().

◆ LeanHighMomentum()

TrajectorySeed MuonSeedCleaner::LeanHighMomentum ( std::vector< TrajectorySeed > &  seeds)
private

select the highest momentum pt seed

Definition at line 193 of file MuonSeedCleaner.cc.

194  {
195  if (seeds.size() == 1)
196  return seeds[0];
197 
198  double highestPt = 0.;
199  int winner = 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);
205  highestPt = pt;
206  }
207  }
208  TrajectorySeed theSeed = seeds[winner];
209  seeds.erase(seeds.begin() + winner);
210  return theSeed;

References mps_fire::i, DiDispStaMuonMonitor_cfi::pt, SeedMomentum(), InitialStep_cff::seeds, mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by seedCleaner().

◆ LengthFilter()

SeedContainer MuonSeedCleaner::LengthFilter ( std::vector< TrajectorySeed > &  seeds)
private

pick the seed by better parameter error collect long seeds

Definition at line 243 of file MuonSeedCleaner.cc.

244  {
245  SeedContainer longSeeds;
246  int NSegs = 0;
247  for (size_t i = 0; i < seeds.size(); i++) {
248  int theLength = static_cast<int>(seeds[i].nHits());
249  if (theLength > NSegs) {
250  NSegs = theLength;
251  longSeeds.clear();
252  longSeeds.push_back(seeds[i]);
253  } else if (theLength == NSegs) {
254  longSeeds.push_back(seeds[i]);
255  } else {
256  continue;
257  }
258  }
259  //std::cout<<" final Length :"<<NSegs<<std::endl;
260 
261  return longSeeds;

References mps_fire::i, and InitialStep_cff::seeds.

◆ MomentumFilter()

bool MuonSeedCleaner::MomentumFilter ( std::vector< TrajectorySeed > &  seeds)
private

filter out the bad pt seeds, if all are bad pt seeds then keep all

Definition at line 263 of file MuonSeedCleaner.cc.

264  {
265  bool findgoodMomentum = false;
266  SeedContainer goodMomentumSeeds = seeds;
267  seeds.clear();
268  for (size_t i = 0; i < goodMomentumSeeds.size(); i++) {
269  GlobalVector mom = SeedMomentum(goodMomentumSeeds[i]);
270  double pt = sqrt((mom.x() * mom.x()) + (mom.y() * mom.y()));
271  if (pt < 6. || pt > 2000.)
272  continue;
273  //if ( pt < 6. ) continue;
274  //std::cout<<" passed momentum :"<< pt <<std::endl;
275  seeds.push_back(goodMomentumSeeds[i]);
276  findgoodMomentum = true;
277  }
278  if (seeds.empty())
279  seeds = goodMomentumSeeds;
280 
281  return findgoodMomentum;

References mps_fire::i, DiDispStaMuonMonitor_cfi::pt, SeedMomentum(), InitialStep_cff::seeds, mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by seedCleaner().

◆ MoreRecHits()

TrajectorySeed MuonSeedCleaner::MoreRecHits ( std::vector< TrajectorySeed > &  seeds)
private

select the seed with more rechits

Definition at line 212 of file MuonSeedCleaner.cc.

213  {
214  if (seeds.size() == 1)
215  return seeds[0];
216 
217  int winner = 0;
218  int moreHits = 0;
219  double betterChi2 = 99999.;
220  for (size_t i = 0; i < seeds.size(); i++) {
221  int theHits = 0;
222  for (edm::OwnVector<TrackingRecHit>::const_iterator r1 = seeds[i].recHits().first; r1 != seeds[i].recHits().second;
223  r1++) {
225  }
226 
227  double theChi2 = SeedChi2(seeds[i]);
228 
229  if (theHits == moreHits && theChi2 < betterChi2) {
230  betterChi2 = theChi2;
231  winner = static_cast<int>(i);
232  }
233  if (theHits > moreHits) {
234  moreHits = theHits;
235  betterChi2 = theChi2;
236  winner = static_cast<int>(i);
237  }
238  }
239  TrajectorySeed theSeed = seeds[winner];
240  seeds.erase(seeds.begin() + winner);
241  return theSeed;

References mps_fire::i, NRecHitsFromSegment(), diffTwoXMLs::r1, FastTrackerRecHitMaskProducer_cfi::recHits, SeedChi2(), InitialStep_cff::seeds, and bscTrigger_cfi::theHits.

Referenced by seedCleaner().

◆ NChi2OfSegment()

double MuonSeedCleaner::NChi2OfSegment ( const TrackingRecHit rhit)
private

retrieve number of rechits& normalized chi2 of associated segments of a seed

Definition at line 494 of file MuonSeedCleaner.cc.

495  {
496  double NChi2 = 999999.;
497  const GeomDet* gdet = theService->trackingGeometry()->idToDet(rhit.geographicalId());
500 
501  double dof = static_cast<double>(theSeg->degreesOfFreedom());
502  NChi2 = theSeg->chi2() / dof;
503  //std::cout<<" Chi2 = "<< NChi2 <<" |" ;
504 
505  return NChi2;

References TrackingRecHit::clone(), TrackingRecHit::geographicalId(), GlobalTrackingGeometry::idToDet(), MuonTransientTrackingRecHit::specificBuild(), theService, and MuonServiceProxy::trackingGeometry().

Referenced by SeedChi2().

◆ NRecHitsFromSegment() [1/2]

int MuonSeedCleaner::NRecHitsFromSegment ( const TrackingRecHit rhit)

Definition at line 451 of file MuonSeedCleaner.cc.

452  {
453  int NRechits = 0;
454  const GeomDet* gdet = theService->trackingGeometry()->idToDet(rhit.geographicalId());
457 
458  DetId geoId = gdet->geographicalId();
459  if (geoId.subdetId() == MuonSubdetId::DT) {
460  DTChamberId DT_Id(rhit.geographicalId());
461  std::vector<TrackingRecHit*> DThits = theSeg->recHits();
462  int dt1DHits = 0;
463  for (size_t j = 0; j < DThits.size(); j++) {
464  dt1DHits += (DThits[j]->recHits()).size();
465  }
466  NRechits = dt1DHits;
467  }
468 
469  if (geoId.subdetId() == MuonSubdetId::CSC) {
470  NRechits = (theSeg->recHits()).size();
471  }
472  return NRechits;

References TrackingRecHit::clone(), MuonSubdetId::CSC, MuonSubdetId::DT, GeomDet::geographicalId(), TrackingRecHit::geographicalId(), GlobalTrackingGeometry::idToDet(), dqmiolumiharvest::j, findQualityFiles::size, MuonTransientTrackingRecHit::specificBuild(), theService, and MuonServiceProxy::trackingGeometry().

Referenced by BiggerCone(), MuonSeedBuilder::foundMatchingSegment(), MuonSeedBuilder::IdentifyShowering(), MoreRecHits(), and SeedLength().

◆ NRecHitsFromSegment() [2/2]

int MuonSeedCleaner::NRecHitsFromSegment ( MuonTransientTrackingRecHit rhit)

Definition at line 474 of file MuonSeedCleaner.cc.

475  {
476  int NRechits = 0;
477  DetId geoId = rhit->geographicalId();
478  if (geoId.subdetId() == MuonSubdetId::DT) {
479  DTChamberId DT_Id(geoId);
480  std::vector<TrackingRecHit*> DThits = rhit->recHits();
481  int dt1DHits = 0;
482  for (size_t j = 0; j < DThits.size(); j++) {
483  dt1DHits += (DThits[j]->recHits()).size();
484  }
485  NRechits = dt1DHits;
486  //std::cout<<" D_rh("<< dt1DHits <<") " ;
487  }
488  if (geoId.subdetId() == MuonSubdetId::CSC) {
489  NRechits = (rhit->recHits()).size();
490  //std::cout<<" C_rh("<<(rhit->recHits()).size() <<") " ;
491  }
492  return NRechits;

References MuonSubdetId::CSC, MuonSubdetId::DT, TrackingRecHit::geographicalId(), dqmiolumiharvest::j, GenericTransientTrackingRecHit::recHits(), findQualityFiles::size, and DetId::subdetId().

◆ OverlapSegments()

unsigned int MuonSeedCleaner::OverlapSegments ( const TrajectorySeed seed1,
const TrajectorySeed seed2 
)
private

check overlapping segment for seeds

Definition at line 378 of file MuonSeedCleaner.cc.

379  {
380  unsigned int overlapping = 0;
381  for (edm::OwnVector<TrackingRecHit>::const_iterator r1 = seed1.recHits().first; r1 != seed1.recHits().second; r1++) {
382  DetId id1 = (*r1).geographicalId();
383  const GeomDet* gdet1 = theService->trackingGeometry()->idToDet(id1);
384  GlobalPoint gp1 = gdet1->toGlobal((*r1).localPosition());
385 
386  for (edm::OwnVector<TrackingRecHit>::const_iterator r2 = seed2.recHits().first; r2 != seed2.recHits().second;
387  r2++) {
388  DetId id2 = (*r2).geographicalId();
389  if (id1 != id2)
390  continue;
391 
392  const GeomDet* gdet2 = theService->trackingGeometry()->idToDet(id2);
393  GlobalPoint gp2 = gdet2->toGlobal((*r2).localPosition());
394 
395  double dx = gp1.x() - gp2.x();
396  double dy = gp1.y() - gp2.y();
397  double dz = gp1.z() - gp2.z();
398  double dL = sqrt(dx * dx + dy * dy + dz * dz);
399 
400  if (dL < 1.)
401  overlapping++;
402  }
403  }
404  return overlapping;

References PVValHelper::dx, PVValHelper::dy, PVValHelper::dz, globals_cff::id1, globals_cff::id2, GlobalTrackingGeometry::idToDet(), diffTwoXMLs::r1, diffTwoXMLs::r2, TrajectorySeed::recHits(), mathSSE::sqrt(), theService, GeomDet::toGlobal(), MuonServiceProxy::trackingGeometry(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by GroupSeeds().

◆ SeedCandidates()

SeedContainer MuonSeedCleaner::SeedCandidates ( std::vector< TrajectorySeed > &  seeds,
bool  good 
)
private

pick the seeds w/ 1st layer information and w/ more than 1 segments

Definition at line 283 of file MuonSeedCleaner.cc.

284  {
285  SeedContainer theCandidate;
286  theCandidate.clear();
287 
288  bool longSeed = false;
289  bool withFirstLayer = false;
290 
291  //std::cout<<"***** Seed Classification *****"<< seeds.size() <<std::endl;
292  for (size_t i = 0; i < seeds.size(); i++) {
293  if (seeds[i].nHits() > 1)
294  longSeed = true;
295  //std::cout<<" Seed: "<<i<<" w/"<<seeds[i].nHits()<<" segs "<<std::endl;
296  // looking for 1st layer segment
297  int idx = 0;
298  for (edm::OwnVector<TrackingRecHit>::const_iterator r1 = seeds[i].recHits().first; r1 != seeds[i].recHits().second;
299  r1++) {
300  idx++;
301  const GeomDet* gdet = theService->trackingGeometry()->idToDet((*r1).geographicalId());
302  DetId geoId = gdet->geographicalId();
303 
304  if (geoId.subdetId() == MuonSubdetId::DT) {
305  DTChamberId DT_Id((*r1).geographicalId());
306  //std::cout<<" ID:"<<DT_Id <<" pos:"<< r1->localPosition() <<std::endl;
307  if (DT_Id.station() != 1)
308  continue;
309  withFirstLayer = true;
310  }
311  if (geoId.subdetId() == MuonSubdetId::CSC) {
312  idx++;
313  CSCDetId CSC_Id = CSCDetId((*r1).geographicalId());
314  //std::cout<<" ID:"<<CSC_Id <<" pos:"<< r1->localPosition() <<std::endl;
315  if (CSC_Id.station() != 1)
316  continue;
317  withFirstLayer = true;
318  }
319  }
320  bool goodseed = (longSeed && withFirstLayer) ? true : false;
321 
322  if (goodseed == good)
323  theCandidate.push_back(seeds[i]);
324  }
325  return theCandidate;

References MuonSubdetId::CSC, MuonSubdetId::DT, GeomDet::geographicalId(), mps_fire::i, GlobalTrackingGeometry::idToDet(), training_settings::idx, diffTwoXMLs::r1, FastTrackerRecHitMaskProducer_cfi::recHits, InitialStep_cff::seeds, CSCDetId::station(), DetId::subdetId(), theService, and MuonServiceProxy::trackingGeometry().

Referenced by seedCleaner().

◆ SeedChi2()

double MuonSeedCleaner::SeedChi2 ( const TrajectorySeed seed)
private

Definition at line 406 of file MuonSeedCleaner.cc.

407  {
408  double theChi2 = 0.;
409  for (edm::OwnVector<TrackingRecHit>::const_iterator r1 = seed.recHits().first; r1 != seed.recHits().second; r1++) {
410  //std::cout<<" segmet : "<<it <<std::endl;
411  theChi2 += NChi2OfSegment(*r1);
412  }
413  theChi2 = theChi2 / seed.nHits();
414 
415  //std::cout<<" final Length :"<<NSegs<<std::endl;
416  return theChi2;

References NChi2OfSegment(), diffTwoXMLs::r1, and SurveyInfoScenario_cff::seed.

Referenced by Chi2LengthSelection(), and MoreRecHits().

◆ seedCleaner()

std::vector< TrajectorySeed > MuonSeedCleaner::seedCleaner ( const edm::EventSetup eventSetup,
std::vector< TrajectorySeed > &  seeds 
)

Cache pointer to geometry.

Cache pointer to Magnetic field cleaning the seeds

Definition at line 71 of file MuonSeedCleaner.cc.

73  {
74  theService->update(eventSetup);
75 
76  std::vector<TrajectorySeed> FinalSeeds;
77 
78  // group the seeds
79  std::vector<SeedContainer> theCollection = GroupSeeds(seeds);
80 
81  // ckeck each group and pick the good one
82  for (size_t i = 0; i < theCollection.size(); i++) {
83  // separate seeds w/ more than 1 segments and w/ 1st layer segment information
84  SeedContainer goodSeeds = SeedCandidates(theCollection[i], true);
85  SeedContainer otherSeeds = SeedCandidates(theCollection[i], false);
86  if (MomentumFilter(goodSeeds)) {
87  //std::cout<<" == type1 "<<std::endl;
88  TrajectorySeed bestSeed = Chi2LengthSelection(goodSeeds);
89  FinalSeeds.push_back(bestSeed);
90 
91  GlobalPoint seedgp = SeedPosition(bestSeed);
92  double eta = fabs(seedgp.eta());
93  if (goodSeeds.size() > 2 && eta > 1.5) {
94  TrajectorySeed anotherSeed = MoreRecHits(goodSeeds);
95  FinalSeeds.push_back(anotherSeed);
96  }
97  } else if (MomentumFilter(otherSeeds)) {
98  //std::cout<<" == type2 "<<std::endl;
99  TrajectorySeed bestSeed = MoreRecHits(otherSeeds);
100  FinalSeeds.push_back(bestSeed);
101 
102  GlobalPoint seedgp = SeedPosition(bestSeed);
103  double eta = fabs(seedgp.eta());
104  if (otherSeeds.size() > 2 && eta > 1.5) {
105  TrajectorySeed anotherSeed = LeanHighMomentum(otherSeeds);
106  FinalSeeds.push_back(anotherSeed);
107  }
108  } else {
109  //std::cout<<" == type3 "<<std::endl;
110  TrajectorySeed bestSeed = LeanHighMomentum(theCollection[i]);
111  FinalSeeds.push_back(bestSeed);
112 
113  GlobalPoint seedgp = SeedPosition(bestSeed);
114  double eta = fabs(seedgp.eta());
115  if (theCollection.size() > 2 && eta > 1.5) {
116  TrajectorySeed anotherSeed = BiggerCone(theCollection[i]);
117  FinalSeeds.push_back(anotherSeed);
118  }
119  }
120  }
121  return FinalSeeds;

References BiggerCone(), Chi2LengthSelection(), PVValHelper::eta, PV3DBase< T, PVType, FrameType >::eta(), GroupSeeds(), mps_fire::i, LeanHighMomentum(), MomentumFilter(), MoreRecHits(), SeedCandidates(), SeedPosition(), InitialStep_cff::seeds, theService, and MuonServiceProxy::update().

Referenced by MuonSeedBuilder::build().

◆ SeedLength()

int MuonSeedCleaner::SeedLength ( const TrajectorySeed seed)
private

Definition at line 418 of file MuonSeedCleaner.cc.

419  {
420  int theHits = 0;
421  for (edm::OwnVector<TrackingRecHit>::const_iterator r1 = seed.recHits().first; r1 != seed.recHits().second; r1++) {
422  //std::cout<<" segmet : "<<it <<std::endl;
424  }
425 
426  //std::cout<<" final Length :"<<NSegs<<std::endl;
427  return theHits;

References NRecHitsFromSegment(), diffTwoXMLs::r1, SurveyInfoScenario_cff::seed, and bscTrigger_cfi::theHits.

◆ SeedMomentum()

GlobalVector MuonSeedCleaner::SeedMomentum ( const TrajectorySeed seed)
private

retrieve seed global momentum

Definition at line 440 of file MuonSeedCleaner.cc.

441  {
442  PTrajectoryStateOnDet pTSOD = seed.startingState();
443  DetId SeedDetId(pTSOD.detId());
444  const GeomDet* geoDet = theService->trackingGeometry()->idToDet(SeedDetId);
445  TrajectoryStateOnSurface SeedTSOS =
446  trajectoryStateTransform::transientState(pTSOD, &(geoDet->surface()), &*theService->magneticField());
447  GlobalVector mom = SeedTSOS.globalMomentum();
448 
449  return mom;

References PTrajectoryStateOnDet::detId(), TrajectoryStateOnSurface::globalMomentum(), GlobalTrackingGeometry::idToDet(), MuonServiceProxy::magneticField(), SurveyInfoScenario_cff::seed, theService, MuonServiceProxy::trackingGeometry(), and trajectoryStateTransform::transientState().

Referenced by LeanHighMomentum(), and MomentumFilter().

◆ SeedPosition()

GlobalPoint MuonSeedCleaner::SeedPosition ( const TrajectorySeed seed)
private

retrieve seed global position

Definition at line 429 of file MuonSeedCleaner.cc.

430  {
431  PTrajectoryStateOnDet pTSOD = seed.startingState();
432  DetId SeedDetId(pTSOD.detId());
433  const GeomDet* geoDet = theService->trackingGeometry()->idToDet(SeedDetId);
434  TrajectoryStateOnSurface SeedTSOS =
435  trajectoryStateTransform::transientState(pTSOD, &(geoDet->surface()), &*theService->magneticField());
436  GlobalPoint pos = SeedTSOS.globalPosition();
437 
438  return pos;

References PTrajectoryStateOnDet::detId(), TrajectoryStateOnSurface::globalPosition(), GlobalTrackingGeometry::idToDet(), MuonServiceProxy::magneticField(), SurveyInfoScenario_cff::seed, theService, MuonServiceProxy::trackingGeometry(), and trajectoryStateTransform::transientState().

Referenced by GroupSeeds(), and seedCleaner().

Member Data Documentation

◆ badSeedLayer

std::vector<int> MuonSeedCleaner::badSeedLayer

Definition at line 54 of file MuonSeedCleaner.h.

◆ debug

bool MuonSeedCleaner::debug
private

◆ ShoweringLayers

std::vector<int> MuonSeedCleaner::ShoweringLayers
private

Definition at line 97 of file MuonSeedCleaner.h.

◆ ShoweringSegments

SegmentContainer MuonSeedCleaner::ShoweringSegments
private

Definition at line 96 of file MuonSeedCleaner.h.

◆ theService

MuonServiceProxy* MuonSeedCleaner::theService
private
Vector3DBase
Definition: Vector3DBase.h:8
MuonSubdetId::CSC
static constexpr int CSC
Definition: MuonSubdetId.h:12
DOFs::dof
dof
Definition: AlignPCLThresholdsWriter.cc:37
mps_fire.i
i
Definition: mps_fire.py:355
MuonTransientTrackingRecHit::specificBuild
static MuonRecHitPointer specificBuild(const GeomDet *geom, const TrackingRecHit *rh)
Definition: MuonTransientTrackingRecHit.h:75
GeomDet
Definition: GeomDet.h:27
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
globals_cff.id1
id1
Definition: globals_cff.py:32
TrajectoryStateOnSurface::globalPosition
GlobalPoint globalPosition() const
Definition: TrajectoryStateOnSurface.h:65
pos
Definition: PixelAliasList.h:18
MuonSeedCleaner::MoreRecHits
TrajectorySeed MoreRecHits(std::vector< TrajectorySeed > &seeds)
select the seed with more rechits
Definition: MuonSeedCleaner.cc:212
training_settings.idx
idx
Definition: training_settings.py:16
TrackingRecHit::geographicalId
DetId geographicalId() const
Definition: TrackingRecHit.h:120
MuonServiceProxy_cff.MuonServiceProxy
MuonServiceProxy
Definition: MuonServiceProxy_cff.py:15
MuonSeedCleaner::SeedChi2
double SeedChi2(const TrajectorySeed &seed)
Definition: MuonSeedCleaner.cc:406
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
DetId
Definition: DetId.h:17
lengthSorting
static bool lengthSorting(const TrajectorySeed &s1, const TrajectorySeed &s2)
Definition: MuonSeedCleaner.cc:44
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
MuonSeedCleaner::SeedPosition
GlobalPoint SeedPosition(const TrajectorySeed &seed)
retrieve seed global position
Definition: MuonSeedCleaner.cc:429
MuonTransientTrackingRecHit::MuonRecHitPointer
std::shared_ptr< MuonTransientTrackingRecHit > MuonRecHitPointer
Definition: MuonTransientTrackingRecHit.h:21
PTrajectoryStateOnDet::detId
unsigned int detId() const
Definition: PTrajectoryStateOnDet.h:65
MuonSeedCleaner::NChi2OfSegment
double NChi2OfSegment(const TrackingRecHit &rhit)
retrieve number of rechits& normalized chi2 of associated segments of a seed
Definition: MuonSeedCleaner.cc:494
MuonSeedCleaner::MomentumFilter
bool MomentumFilter(std::vector< TrajectorySeed > &seeds)
filter out the bad pt seeds, if all are bad pt seeds then keep all
Definition: MuonSeedCleaner.cc:263
ElectronSeedTrackRefFix_cfi.seedCollection
seedCollection
Definition: ElectronSeedTrackRefFix_cfi.py:9
PVValHelper::eta
Definition: PVValidationHelpers.h:69
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
MuonSeedCleaner::debug
bool debug
Definition: MuonSeedCleaner.h:93
SeedContainer
std::vector< TrajectorySeed > SeedContainer
Definition: MuonSeedBuilder.h:26
MuonSeedCleaner::NRecHitsFromSegment
int NRecHitsFromSegment(const TrackingRecHit &rhit)
Definition: MuonSeedCleaner.cc:451
MuonSubdetId::DT
static constexpr int DT
Definition: MuonSubdetId.h:11
Point3DBase< float, GlobalTag >
edm::OwnVector::const_iterator
Definition: OwnVector.h:41
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
MuonSeedCleaner::OverlapSegments
unsigned int OverlapSegments(const TrajectorySeed &seed1, const TrajectorySeed &seed2)
check overlapping segment for seeds
Definition: MuonSeedCleaner.cc:378
FastTrackerRecHitMaskProducer_cfi.recHits
recHits
Definition: FastTrackerRecHitMaskProducer_cfi.py:8
MuonServiceProxy::update
void update(const edm::EventSetup &setup, bool duringEvent=true)
update the services each event
Definition: MuonServiceProxy.cc:111
InitialStep_cff.seeds
seeds
Definition: InitialStep_cff.py:232
MuonSeedCleaner::BiggerCone
TrajectorySeed BiggerCone(std::vector< TrajectorySeed > &seeds)
select the seed with bigger projection cone to next layer
Definition: MuonSeedCleaner.cc:161
GeomDet::geographicalId
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
GeomDet::toGlobal
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
edm::ParameterSet
Definition: ParameterSet.h:36
MuonSeedCleaner::theService
MuonServiceProxy * theService
Definition: MuonSeedCleaner.h:100
MuonSeedCleaner::LeanHighMomentum
TrajectorySeed LeanHighMomentum(std::vector< TrajectorySeed > &seeds)
select the highest momentum pt seed
Definition: MuonSeedCleaner.cc:193
CSCDetId
Definition: CSCDetId.h:26
diffTwoXMLs.r2
r2
Definition: diffTwoXMLs.py:73
PV3DBase::eta
T eta() const
Definition: PV3DBase.h:73
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
trajectoryStateTransform::transientState
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)
Definition: TrajectoryStateTransform.cc:35
MuonSeedCleaner::SeedCandidates
SeedContainer SeedCandidates(std::vector< TrajectorySeed > &seeds, bool good)
pick the seeds w/ 1st layer information and w/ more than 1 segments
Definition: MuonSeedCleaner.cc:283
AlgebraicSymMatrix
CLHEP::HepSymMatrix AlgebraicSymMatrix
Definition: AlgebraicObjects.h:15
MuonSeedCleaner::GroupSeeds
std::vector< SeedContainer > GroupSeeds(std::vector< TrajectorySeed > &seeds)
group the seeds
Definition: MuonSeedCleaner.cc:327
PVValHelper::dy
Definition: PVValidationHelpers.h:49
MuonSeedCleaner::SeedMomentum
GlobalVector SeedMomentum(const TrajectorySeed &seed)
retrieve seed global momentum
Definition: MuonSeedCleaner.cc:440
TrackingRecHit::clone
virtual TrackingRecHit * clone() const =0
TrajectoryStateOnSurface::globalMomentum
GlobalVector globalMomentum() const
Definition: TrajectoryStateOnSurface.h:66
eostools.move
def move(src, dest)
Definition: eostools.py:511
GenericTransientTrackingRecHit::recHits
std::vector< const TrackingRecHit * > recHits() const override
Access to component RecHits (if any)
Definition: GenericTransientTrackingRecHit.h:30
bscTrigger_cfi.theHits
theHits
Definition: bscTrigger_cfi.py:18
PVValHelper::dz
Definition: PVValidationHelpers.h:50
diffTwoXMLs.r1
r1
Definition: diffTwoXMLs.py:53
MuonServiceProxy::trackingGeometry
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
get the tracking geometry
Definition: MuonServiceProxy.h:59
GlobalTrackingGeometry::idToDet
const GeomDet * idToDet(DetId) const override
Definition: GlobalTrackingGeometry.cc:44
TrajectorySeed::recHits
range recHits() const
Definition: TrajectorySeed.h:52
TrajectorySeed
Definition: TrajectorySeed.h:17
MuonServiceProxy::magneticField
edm::ESHandle< MagneticField > magneticField() const
get the magnetic field
Definition: MuonServiceProxy.h:56
DTChamberId
Definition: DTChamberId.h:14
PTrajectoryStateOnDet
Definition: PTrajectoryStateOnDet.h:10
HGC3DClusterGenMatchSelector_cfi.dR
dR
Definition: HGC3DClusterGenMatchSelector_cfi.py:7
CSCDetId::station
int station() const
Definition: CSCDetId.h:79
globals_cff.id2
id2
Definition: globals_cff.py:33
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
MuonSeedCleaner::Chi2LengthSelection
TrajectorySeed Chi2LengthSelection(std::vector< TrajectorySeed > &seeds)
select seed by balance length and chi2
Definition: MuonSeedCleaner.cc:123
PVValHelper::dx
Definition: PVValidationHelpers.h:48
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
cuy.dh
dh
Definition: cuy.py:355
SurveyInfoScenario_cff.seed
seed
Definition: SurveyInfoScenario_cff.py:295
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443