CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 &)
 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 (TrajectorySeed seed1, 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 (TrajectorySeed seed)
 
int SeedLength (TrajectorySeed seed)
 
GlobalVector SeedMomentum (TrajectorySeed seed)
 retrieve seed global momentum More...
 
GlobalPoint SeedPosition (TrajectorySeed seed)
 retrieve seed global position More...
 

Private Attributes

const MagneticFieldBField
 
bool debug
 
int NShowerSeg
 
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 27 of file MuonSeedCleaner.h.

Member Typedef Documentation

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

Definition at line 33 of file MuonSeedCleaner.h.

Definition at line 32 of file MuonSeedCleaner.h.

Constructor & Destructor Documentation

MuonSeedCleaner::MuonSeedCleaner ( const edm::ParameterSet pset)
explicit

Constructor.

Definition at line 49 of file MuonSeedCleaner.cc.

References debug, edm::ParameterSet::getParameter(), MuonServiceProxy_cff::MuonServiceProxy, and theService.

49  {
50 
51  // Local Debug flag
52  debug = pset.getParameter<bool>("DebugMuonSeed");
53 
54  // muon service
55  edm::ParameterSet serviceParameters = pset.getParameter<edm::ParameterSet>("ServiceParameters");
56  theService = new MuonServiceProxy(serviceParameters);
57 
58 }
T getParameter(std::string const &) const
MuonServiceProxy * theService
MuonSeedCleaner::~MuonSeedCleaner ( )

Destructor.

Definition at line 63 of file MuonSeedCleaner.cc.

References theService.

63  {
64 
65  if (theService) delete theService;
66 }
MuonServiceProxy * theService

Member Function Documentation

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

select the seed with bigger projection cone to next layer

Definition at line 171 of file MuonSeedCleaner.cc.

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

Referenced by seedCleaner().

171  {
172 
173  if ( seeds.size() == 1 ) return seeds[0];
174 
175  float biggerProjErr = 9999.;
176  int winner = 0 ;
177  AlgebraicSymMatrix mat(5,0) ;
178  for ( size_t i = 0; i < seeds.size(); i++ ) {
179 
180  edm::OwnVector<TrackingRecHit>::const_iterator r1 = seeds[i].recHits().first ;
181  mat = r1->parametersError().similarityT( r1->projectionMatrix() );
182 
183  int NRecHits = NRecHitsFromSegment( *r1 );
184 
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 ) ;
190 
191  if ( NRecHits < 5 ) continue ;
192  if ( projectErr < biggerProjErr ) continue;
193 
194  winner = static_cast<int>(i) ;
195  biggerProjErr = projectErr ;
196  }
197  TrajectorySeed theSeed = seeds[winner];
198  seeds.erase( seeds.begin()+winner );
199  return theSeed;
200 
201 }
int i
Definition: DBlmapReader.cc:9
T sqrt(T t)
Definition: SSEVec.h:46
int NRecHitsFromSegment(const TrackingRecHit &rhit)
CLHEP::HepSymMatrix AlgebraicSymMatrix
TrajectorySeed MuonSeedCleaner::Chi2LengthSelection ( std::vector< TrajectorySeed > &  seeds)
private

select seed by balance length and chi2

Definition at line 131 of file MuonSeedCleaner.cc.

References i, and SeedChi2().

Referenced by seedCleaner().

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

group the seeds

Definition at line 345 of file MuonSeedCleaner.cc.

References PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, PV3DBase< T, PVType, FrameType >::eta(), i, j, lengthSorting(), OverlapSegments(), PV3DBase< T, PVType, FrameType >::phi(), SeedPosition(), python.multivaluedict::sort(), mathSSE::sqrt(), and funct::true.

Referenced by seedCleaner().

345  {
346 
347  std::vector<SeedContainer> seedCollection;
348  seedCollection.clear();
349  std::vector<TrajectorySeed> theGroup ;
350  std::vector<bool> usedSeed(seeds.size(),false);
351 
352  // categorize seeds by comparing overlapping segments or a certian eta-phi cone
353  for (size_t i= 0; i<seeds.size(); i++){
354 
355  if (usedSeed[i]) continue;
356  theGroup.push_back( seeds[i] );
357  usedSeed[i] = true ;
358 
359  GlobalPoint pos1 = SeedPosition( seeds[i] );
360 
361  for (size_t j= i+1; j<seeds.size(); j++){
362 
363  // 1.1 seeds with overlaaping segments will be grouped together
364  unsigned int overlapping = OverlapSegments(seeds[i], seeds[j]) ;
365  if ( !usedSeed[j] && overlapping > 0 ) {
366  // reject the identical seeds
367  if ( seeds[i].nHits() == overlapping && seeds[j].nHits() == overlapping ) {
368  usedSeed[j] = true ;
369  continue;
370  }
371  theGroup.push_back( seeds[j] );
372  usedSeed[j] = true ;
373  }
374  if (usedSeed[j]) continue;
375 
376  // 1.2 seeds in a certain cone are grouped together
377  GlobalPoint pos2 = SeedPosition( seeds[j]);
378  double dh = pos1.eta() - pos2.eta() ;
379  double df = pos1.phi() - pos2.phi() ;
380  double dR = sqrt( (dh*dh) + (df*df) );
381 
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] );
385  usedSeed[j] = true ;
386  }
387  sort(theGroup.begin(), theGroup.end(), lengthSorting ) ;
388  seedCollection.push_back(theGroup);
389  //std::cout<<" group "<<seedCollection.size() <<" w/"<< theGroup.size() <<" seeds"<<std::endl;
390  theGroup.clear();
391  }
392  return seedCollection;
393 
394 }
int i
Definition: DBlmapReader.cc:9
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
static bool lengthSorting(const TrajectorySeed s1, const TrajectorySeed s2)
T sqrt(T t)
Definition: SSEVec.h:46
int j
Definition: DBlmapReader.cc:9
unsigned int OverlapSegments(TrajectorySeed seed1, TrajectorySeed seed2)
check overlapping segment for seeds
T eta() const
Definition: PV3DBase.h:75
GlobalPoint SeedPosition(TrajectorySeed seed)
retrieve seed global position
TrajectorySeed MuonSeedCleaner::LeanHighMomentum ( std::vector< TrajectorySeed > &  seeds)
private

select the highest momentum pt seed

Definition at line 203 of file MuonSeedCleaner.cc.

References i, SeedMomentum(), mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by seedCleaner().

203  {
204 
205  if ( seeds.size() == 1 ) return seeds[0];
206 
207  double highestPt = 0. ;
208  int winner = 0 ;
209  for ( size_t i = 0; i < seeds.size(); i++ ) {
210  GlobalVector mom = SeedMomentum( seeds[i] );
211  double pt = sqrt( (mom.x()*mom.x()) + (mom.y()*mom.y()) );
212  if ( pt > highestPt ) {
213  winner = static_cast<int>(i) ;
214  highestPt = pt ;
215  }
216  }
217  TrajectorySeed theSeed = seeds[winner];
218  seeds.erase( seeds.begin()+winner );
219  return theSeed;
220 
221 }
int i
Definition: DBlmapReader.cc:9
T y() const
Definition: PV3DBase.h:62
T sqrt(T t)
Definition: SSEVec.h:46
T x() const
Definition: PV3DBase.h:61
GlobalVector SeedMomentum(TrajectorySeed seed)
retrieve seed global momentum
SeedContainer MuonSeedCleaner::LengthFilter ( std::vector< TrajectorySeed > &  seeds)
private

pick the seed by better parameter error collect long seeds

Definition at line 256 of file MuonSeedCleaner.cc.

References i.

256  {
257 
258  SeedContainer longSeeds;
259  int NSegs = 0;
260  for (size_t i = 0; i< seeds.size(); i++) {
261 
262  int theLength = static_cast<int>( seeds[i].nHits());
263  if ( theLength > NSegs ) {
264  NSegs = theLength ;
265  longSeeds.clear();
266  longSeeds.push_back( seeds[i] );
267  }
268  else if ( theLength == NSegs ) {
269  longSeeds.push_back( seeds[i] );
270  } else {
271  continue;
272  }
273  }
274  //std::cout<<" final Length :"<<NSegs<<std::endl;
275 
276  return longSeeds ;
277 
278 }
int i
Definition: DBlmapReader.cc:9
std::vector< TrajectorySeed > SeedContainer
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 281 of file MuonSeedCleaner.cc.

References i, SeedMomentum(), mathSSE::sqrt(), PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by seedCleaner().

281  {
282 
283  bool findgoodMomentum = false;
284  SeedContainer goodMomentumSeeds = seeds;
285  seeds.clear();
286  for ( size_t i = 0; i < goodMomentumSeeds.size(); i++ ) {
287  GlobalVector mom = SeedMomentum( goodMomentumSeeds[i] );
288  double pt = sqrt( (mom.x()*mom.x()) + (mom.y()*mom.y()) );
289  if ( pt < 6. || pt > 2000. ) continue;
290  //if ( pt < 6. ) continue;
291  //std::cout<<" passed momentum :"<< pt <<std::endl;
292  seeds.push_back( goodMomentumSeeds[i] );
293  findgoodMomentum = true;
294  }
295  if ( seeds.size() == 0 ) seeds = goodMomentumSeeds;
296 
297  return findgoodMomentum;
298 }
int i
Definition: DBlmapReader.cc:9
T y() const
Definition: PV3DBase.h:62
T sqrt(T t)
Definition: SSEVec.h:46
std::vector< TrajectorySeed > SeedContainer
T x() const
Definition: PV3DBase.h:61
GlobalVector SeedMomentum(TrajectorySeed seed)
retrieve seed global momentum
TrajectorySeed MuonSeedCleaner::MoreRecHits ( std::vector< TrajectorySeed > &  seeds)
private

select the seed with more rechits

Definition at line 224 of file MuonSeedCleaner.cc.

References i, NRecHitsFromSegment(), diffTwoXMLs::r1, and SeedChi2().

Referenced by seedCleaner().

224  {
225 
226  if ( seeds.size() == 1 ) return seeds[0];
227 
228  int winner = 0 ;
229  int moreHits = 0 ;
230  double betterChi2 = 99999.;
231  for ( size_t i = 0; i < seeds.size(); i++ ) {
232 
233  int theHits = 0;
234  for (edm::OwnVector<TrackingRecHit>::const_iterator r1 = seeds[i].recHits().first; r1 != seeds[i].recHits().second; r1++){
235  theHits += NRecHitsFromSegment( *r1 );
236  }
237 
238  double theChi2 = SeedChi2( seeds[i] );
239 
240  if ( theHits == moreHits && theChi2 < betterChi2 ) {
241  betterChi2 = theChi2;
242  winner = static_cast<int>(i) ;
243  }
244  if ( theHits > moreHits ) {
245  moreHits = theHits ;
246  betterChi2 = theChi2;
247  winner = static_cast<int>(i) ;
248  }
249  }
250  TrajectorySeed theSeed = seeds[winner];
251  seeds.erase( seeds.begin()+winner );
252  return theSeed;
253 }
double SeedChi2(TrajectorySeed seed)
int i
Definition: DBlmapReader.cc:9
int NRecHitsFromSegment(const TrackingRecHit &rhit)
double MuonSeedCleaner::NChi2OfSegment ( const TrackingRecHit rhit)
private

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

Definition at line 527 of file MuonSeedCleaner.cc.

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

Referenced by SeedChi2().

527  {
528 
529  double NChi2 = 999999. ;
530  const GeomDet* gdet = theService->trackingGeometry()->idToDet( rhit.geographicalId() );
533 
534  double dof = static_cast<double>( theSeg->degreesOfFreedom() );
535  NChi2 = theSeg->chi2() / dof ;
536  //std::cout<<" Chi2 = "<< NChi2 <<" |" ;
537 
538  return NChi2 ;
539 }
MuonServiceProxy * theService
virtual TrackingRecHit * clone() const =0
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
get the tracking geometry
DetId geographicalId() const
static MuonRecHitPointer specificBuild(const GeomDet *geom, const TrackingRecHit *rh)
int MuonSeedCleaner::NRecHitsFromSegment ( const TrackingRecHit rhit)

Definition at line 481 of file MuonSeedCleaner.cc.

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

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

481  {
482 
483  int NRechits = 0 ;
484  const GeomDet* gdet = theService->trackingGeometry()->idToDet( rhit.geographicalId() );
487 
488  DetId geoId = gdet->geographicalId();
489  if ( geoId.subdetId() == MuonSubdetId::DT ) {
490  DTChamberId DT_Id( rhit.geographicalId() );
491  std::vector<TrackingRecHit*> DThits = theSeg->recHits();
492  int dt1DHits = 0;
493  for (size_t j=0; j< DThits.size(); j++) {
494  dt1DHits += (DThits[j]->recHits()).size();
495  }
496  NRechits = dt1DHits ;
497  }
498 
499  if ( geoId.subdetId() == MuonSubdetId::CSC ) {
500  NRechits = (theSeg->recHits()).size() ;
501  }
502  return NRechits ;
503 }
MuonServiceProxy * theService
static const int CSC
Definition: MuonSubdetId.h:15
int j
Definition: DBlmapReader.cc:9
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:72
virtual TrackingRecHit * clone() const =0
Definition: DetId.h:20
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
get the tracking geometry
static const int DT
Definition: MuonSubdetId.h:14
DetId geographicalId() const
static MuonRecHitPointer specificBuild(const GeomDet *geom, const TrackingRecHit *rh)
tuple size
Write out results.
int MuonSeedCleaner::NRecHitsFromSegment ( MuonTransientTrackingRecHit rhit)

Definition at line 505 of file MuonSeedCleaner.cc.

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

505  {
506 
507  int NRechits = 0 ;
508  DetId geoId = rhit->geographicalId();
509  if ( geoId.subdetId() == MuonSubdetId::DT ) {
510  DTChamberId DT_Id( geoId );
511  std::vector<TrackingRecHit*> DThits = rhit->recHits();
512  int dt1DHits = 0;
513  for (size_t j=0; j< DThits.size(); j++) {
514  dt1DHits += (DThits[j]->recHits()).size();
515  }
516  NRechits = dt1DHits ;
517  //std::cout<<" D_rh("<< dt1DHits <<") " ;
518  }
519  if ( geoId.subdetId() == MuonSubdetId::CSC ) {
520  NRechits = (rhit->recHits()).size() ;
521  //std::cout<<" C_rh("<<(rhit->recHits()).size() <<") " ;
522  }
523  return NRechits;
524 
525 }
static const int CSC
Definition: MuonSubdetId.h:15
int j
Definition: DBlmapReader.cc:9
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
Definition: DetId.h:20
virtual std::vector< const TrackingRecHit * > recHits() const
Access to component RecHits (if any)
static const int DT
Definition: MuonSubdetId.h:14
DetId geographicalId() const
tuple size
Write out results.
unsigned int MuonSeedCleaner::OverlapSegments ( TrajectorySeed  seed1,
TrajectorySeed  seed2 
)
private

check overlapping segment for seeds

Definition at line 396 of file MuonSeedCleaner.cc.

References 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().

396  {
397 
398  unsigned int overlapping = 0;
399  for (edm::OwnVector<TrackingRecHit>::const_iterator r1 = seed1.recHits().first; r1 != seed1.recHits().second; r1++){
400 
401  DetId id1 = (*r1).geographicalId();
402  const GeomDet* gdet1 = theService->trackingGeometry()->idToDet( id1 );
403  GlobalPoint gp1 = gdet1->toGlobal( (*r1).localPosition() );
404 
405  for (edm::OwnVector<TrackingRecHit>::const_iterator r2 = seed2.recHits().first; r2 != seed2.recHits().second; r2++){
406 
407  DetId id2 = (*r2).geographicalId();
408  if (id1 != id2 ) continue;
409 
410  const GeomDet* gdet2 = theService->trackingGeometry()->idToDet( id2 );
411  GlobalPoint gp2 = gdet2->toGlobal( (*r2).localPosition() );
412 
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);
417 
418  if ( dL < 1. ) overlapping ++;
419 
420  }
421  }
422  return overlapping ;
423 
424 }
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
T y() const
Definition: PV3DBase.h:62
MuonServiceProxy * theService
T sqrt(T t)
Definition: SSEVec.h:46
T z() const
Definition: PV3DBase.h:63
Definition: DetId.h:20
range recHits() const
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
get the tracking geometry
T x() const
Definition: PV3DBase.h:61
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 302 of file MuonSeedCleaner.cc.

References MuonSubdetId::CSC, CSCDetId, MuonSubdetId::DT, funct::false, GeomDet::geographicalId(), i, diffTwoXMLs::r1, CSCDetId::station(), DetId::subdetId(), theService, and MuonServiceProxy::trackingGeometry().

Referenced by seedCleaner().

302  {
303 
304  SeedContainer theCandidate;
305  theCandidate.clear();
306 
307  bool longSeed = false;
308  bool withFirstLayer = false ;
309 
310  //std::cout<<"***** Seed Classification *****"<< seeds.size() <<std::endl;
311  for ( size_t i = 0; i < seeds.size(); i++ ) {
312 
313  if (seeds[i].nHits() > 1 ) longSeed = true ;
314  //std::cout<<" Seed: "<<i<<" w/"<<seeds[i].nHits()<<" segs "<<std::endl;
315  // looking for 1st layer segment
316  int idx = 0;
317  for (edm::OwnVector<TrackingRecHit>::const_iterator r1 = seeds[i].recHits().first; r1 != seeds[i].recHits().second; r1++){
318 
319  idx++;
320  const GeomDet* gdet = theService->trackingGeometry()->idToDet( (*r1).geographicalId() );
321  DetId geoId = gdet->geographicalId();
322 
323  if ( geoId.subdetId() == MuonSubdetId::DT ) {
324  DTChamberId DT_Id( (*r1).geographicalId() );
325  //std::cout<<" ID:"<<DT_Id <<" pos:"<< r1->localPosition() <<std::endl;
326  if (DT_Id.station() != 1) continue;
327  withFirstLayer = true;
328  }
329  if ( geoId.subdetId() == MuonSubdetId::CSC ) {
330  idx++;
331  CSCDetId CSC_Id = CSCDetId( (*r1).geographicalId() );
332  //std::cout<<" ID:"<<CSC_Id <<" pos:"<< r1->localPosition() <<std::endl;
333  if (CSC_Id.station() != 1) continue;
334  withFirstLayer = true;
335  }
336  }
337  bool goodseed = (longSeed && withFirstLayer) ? true : false ;
338 
339  if ( goodseed == good ) theCandidate.push_back( seeds[i] );
340  }
341  return theCandidate;
342 
343 }
int i
Definition: DBlmapReader.cc:9
MuonServiceProxy * theService
static const int CSC
Definition: MuonSubdetId.h:15
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:72
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
Definition: DetId.h:20
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
get the tracking geometry
int station() const
Definition: CSCDetId.h:88
static const int DT
Definition: MuonSubdetId.h:14
std::vector< TrajectorySeed > SeedContainer
double MuonSeedCleaner::SeedChi2 ( TrajectorySeed  seed)
private

Definition at line 426 of file MuonSeedCleaner.cc.

References NChi2OfSegment(), TrajectorySeed::nHits(), diffTwoXMLs::r1, and TrajectorySeed::recHits().

Referenced by Chi2LengthSelection(), and MoreRecHits().

426  {
427 
428  double theChi2 = 0.;
429  for (edm::OwnVector<TrackingRecHit>::const_iterator r1 = seed.recHits().first; r1 != seed.recHits().second; r1++){
430  //std::cout<<" segmet : "<<it <<std::endl;
431  theChi2 += NChi2OfSegment( *r1 );
432  }
433  theChi2 = theChi2 / seed.nHits() ;
434 
435  //std::cout<<" final Length :"<<NSegs<<std::endl;
436  return theChi2 ;
437 
438 }
double NChi2OfSegment(const TrackingRecHit &rhit)
retrieve number of rechits&amp; normalized chi2 of associated segments of a seed
range recHits() const
unsigned int nHits() const
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 74 of file MuonSeedCleaner.cc.

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

Referenced by MuonSeedBuilder::build().

74  {
75 
76  theService->update(eventSetup);
77 
78  std::vector<TrajectorySeed> FinalSeeds;
79 
80  // group the seeds
81  std::vector<SeedContainer> theCollection = GroupSeeds(seeds);
82 
83  // ckeck each group and pick the good one
84  for (size_t i=0; i< theCollection.size(); i++ ) {
85 
86  // separate seeds w/ more than 1 segments and w/ 1st layer segment information
87  SeedContainer goodSeeds = SeedCandidates( theCollection[i], true );
88  SeedContainer otherSeeds = SeedCandidates( theCollection[i], false );
89  if ( MomentumFilter( goodSeeds ) ) {
90  //std::cout<<" == type1 "<<std::endl;
91  TrajectorySeed bestSeed = Chi2LengthSelection( goodSeeds );
92  FinalSeeds.push_back( bestSeed );
93 
94  GlobalPoint seedgp = SeedPosition( bestSeed );
95  double eta = fabs( seedgp.eta() );
96  if ( goodSeeds.size() > 2 && eta > 1.5 ) {
97  TrajectorySeed anotherSeed = MoreRecHits( goodSeeds );
98  FinalSeeds.push_back( anotherSeed );
99  }
100  }
101  else if( MomentumFilter( otherSeeds ) ) {
102  //std::cout<<" == type2 "<<std::endl;
103  TrajectorySeed bestSeed = MoreRecHits( otherSeeds );
104  FinalSeeds.push_back( bestSeed );
105 
106  GlobalPoint seedgp = SeedPosition( bestSeed );
107  double eta = fabs( seedgp.eta() );
108  if ( otherSeeds.size() > 2 && eta > 1.5 ) {
109  TrajectorySeed anotherSeed = LeanHighMomentum( otherSeeds );
110  FinalSeeds.push_back( anotherSeed );
111  }
112  }
113  else {
114  //std::cout<<" == type3 "<<std::endl;
115  TrajectorySeed bestSeed = LeanHighMomentum( theCollection[i] );
116  FinalSeeds.push_back( bestSeed );
117 
118  GlobalPoint seedgp = SeedPosition( bestSeed );
119  double eta = fabs( seedgp.eta() );
120  if ( theCollection.size() > 2 && eta > 1.5 ) {
121  TrajectorySeed anotherSeed = BiggerCone( theCollection[i] );
122  FinalSeeds.push_back( anotherSeed );
123  }
124  }
125  }
126  return FinalSeeds ;
127 
128 }
void update(const edm::EventSetup &setup)
update the services each event
int i
Definition: DBlmapReader.cc:9
TrajectorySeed BiggerCone(std::vector< TrajectorySeed > &seeds)
select the seed with bigger projection cone to next layer
MuonServiceProxy * theService
T eta() const
bool MomentumFilter(std::vector< TrajectorySeed > &seeds)
filter out the bad pt seeds, if all are bad pt seeds then keep all
TrajectorySeed LeanHighMomentum(std::vector< TrajectorySeed > &seeds)
select the highest momentum pt seed
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 eta() const
Definition: PV3DBase.h:75
GlobalPoint SeedPosition(TrajectorySeed seed)
retrieve seed global position
TrajectorySeed MoreRecHits(std::vector< TrajectorySeed > &seeds)
select the seed with more rechits
std::vector< TrajectorySeed > SeedContainer
TrajectorySeed Chi2LengthSelection(std::vector< TrajectorySeed > &seeds)
select seed by balance length and chi2
int MuonSeedCleaner::SeedLength ( TrajectorySeed  seed)
private

Definition at line 440 of file MuonSeedCleaner.cc.

References NRecHitsFromSegment(), diffTwoXMLs::r1, and TrajectorySeed::recHits().

440  {
441 
442  int theHits = 0;
443  for (edm::OwnVector<TrackingRecHit>::const_iterator r1 = seed.recHits().first; r1 != seed.recHits().second; r1++){
444  //std::cout<<" segmet : "<<it <<std::endl;
445  theHits += NRecHitsFromSegment( *r1 );
446  }
447 
448  //std::cout<<" final Length :"<<NSegs<<std::endl;
449  return theHits ;
450 
451 }
int NRecHitsFromSegment(const TrackingRecHit &rhit)
range recHits() const
GlobalVector MuonSeedCleaner::SeedMomentum ( TrajectorySeed  seed)
private

retrieve seed global momentum

Definition at line 467 of file MuonSeedCleaner.cc.

References PTrajectoryStateOnDet::detId(), TrajectoryStateOnSurface::globalMomentum(), MuonServiceProxy::magneticField(), TrajectorySeed::startingState(), theService, MuonServiceProxy::trackingGeometry(), and trajectoryStateTransform::transientState().

Referenced by LeanHighMomentum(), and MomentumFilter().

467  {
468 
469 
470 
471  PTrajectoryStateOnDet pTSOD = seed.startingState();
472  DetId SeedDetId(pTSOD.detId());
473  const GeomDet* geoDet = theService->trackingGeometry()->idToDet( SeedDetId );
475  GlobalVector mom = SeedTSOS.globalMomentum();
476 
477  return mom ;
478 
479 }
MuonServiceProxy * theService
edm::ESHandle< MagneticField > magneticField() const
get the magnetic field
unsigned int detId() const
Definition: DetId.h:20
PTrajectoryStateOnDet const & startingState() const
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
get the tracking geometry
GlobalVector globalMomentum() const
GlobalPoint MuonSeedCleaner::SeedPosition ( TrajectorySeed  seed)
private

retrieve seed global position

Definition at line 453 of file MuonSeedCleaner.cc.

References PTrajectoryStateOnDet::detId(), TrajectoryStateOnSurface::globalPosition(), MuonServiceProxy::magneticField(), pos, TrajectorySeed::startingState(), theService, MuonServiceProxy::trackingGeometry(), and trajectoryStateTransform::transientState().

Referenced by GroupSeeds(), and seedCleaner().

453  {
454 
455 
456 
457  PTrajectoryStateOnDet pTSOD = seed.startingState();
458  DetId SeedDetId(pTSOD.detId());
459  const GeomDet* geoDet = theService->trackingGeometry()->idToDet( SeedDetId );
461  GlobalPoint pos = SeedTSOS.globalPosition();
462 
463  return pos ;
464 
465 }
MuonServiceProxy * theService
GlobalPoint globalPosition() const
edm::ESHandle< MagneticField > magneticField() const
get the magnetic field
unsigned int detId() const
Definition: DetId.h:20
PTrajectoryStateOnDet const & startingState() const
TrajectoryStateOnSurface transientState(const PTrajectoryStateOnDet &ts, const Surface *surface, const MagneticField *field)
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
get the tracking geometry

Member Data Documentation

std::vector<int> MuonSeedCleaner::badSeedLayer

Definition at line 56 of file MuonSeedCleaner.h.

const MagneticField* MuonSeedCleaner::BField
private

Definition at line 110 of file MuonSeedCleaner.h.

bool MuonSeedCleaner::debug
private

Definition at line 99 of file MuonSeedCleaner.h.

Referenced by MuonSeedCleaner().

int MuonSeedCleaner::NShowerSeg
private

Definition at line 102 of file MuonSeedCleaner.h.

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

Definition at line 104 of file MuonSeedCleaner.h.

SegmentContainer MuonSeedCleaner::ShoweringSegments
private

Definition at line 103 of file MuonSeedCleaner.h.

MuonServiceProxy* MuonSeedCleaner::theService
private