CMS 3D CMS Logo

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

#include <L1MuonSeedsMerger.h>

Classes

struct  Less
 

Public Types

typedef std::pair< const reco::Track *, SeedingHitSetTrackAndHits
 
typedef std::vector< TrackAndHitsTracksAndHits
 

Public Member Functions

 L1MuonSeedsMerger (const edm::ParameterSet &cfg)
 
virtual void resolve (TracksAndHits &) const
 
virtual ~L1MuonSeedsMerger ()
 

Private Types

enum  Action { goAhead, killFirst, killSecond, mergeTwo }
 

Private Member Functions

Action compare (const TrackAndHits *, const TrackAndHits *) const
 
const TrackAndHitsmerge (const TrackAndHits *, const TrackAndHits *) const
 

Private Attributes

float theDeltaEtaCut
 
float theDiffRelPtCut
 

Detailed Description

Definition at line 10 of file L1MuonSeedsMerger.h.

Member Typedef Documentation

Definition at line 12 of file L1MuonSeedsMerger.h.

Definition at line 13 of file L1MuonSeedsMerger.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

L1MuonSeedsMerger::L1MuonSeedsMerger ( const edm::ParameterSet cfg)

Definition at line 6 of file L1MuonSeedsMerger.cc.

References edm::ParameterSet::getParameter(), theDeltaEtaCut, and theDiffRelPtCut.

7 {
8  theDeltaEtaCut = cfg.getParameter<double>("deltaEtaCut");
9  theDiffRelPtCut = cfg.getParameter<double>("diffRelPtCut");
10 }
T getParameter(std::string const &) const
virtual L1MuonSeedsMerger::~L1MuonSeedsMerger ( )
inlinevirtual

Definition at line 15 of file L1MuonSeedsMerger.h.

15 {}

Member Function Documentation

L1MuonSeedsMerger::Action L1MuonSeedsMerger::compare ( const TrackAndHits a,
const TrackAndHits b 
) const
private

Definition at line 60 of file L1MuonSeedsMerger.cc.

References goAhead, killFirst, killSecond, SeedingHitSet::size(), and theDiffRelPtCut.

Referenced by resolve().

61 {
62  int nshared = 0;
63  const SeedingHitSet & hitsA = a->second;
64  const SeedingHitSet & hitsB = b->second;
65  for (unsigned int iHitA=0, nHitsA=hitsA.size(); iHitA < nHitsA; ++iHitA) {
66  const TrackingRecHit* trhA = hitsA[iHitA]->hit();
67  for (unsigned int iHitB=0, nHitsB=hitsB.size(); iHitB < nHitsB; ++iHitB) {
68  const TrackingRecHit* trhB = hitsB[iHitB]->hit();
69  if (trhA==trhB) nshared++;
70  }
71  }
72 
73  if (nshared >= 2) {
74  if (hitsA.size() >= 3 && hitsB.size() >= 3 )
75  return (a->first->chi2() > b->first->chi2()) ? killFirst : killSecond;
76  else if (hitsB.size() >= 3)
77  return killFirst;
78  else
79  return killSecond;
80  }
81  else if (nshared >= 1) {
82  if (hitsA.size() != hitsB.size())
83  return (hitsA.size() < hitsB.size()) ? killFirst : killSecond;
84  else if ( hitsA.size() >= 3
85  && a->first->charge()==b->first->charge()
86  && fabs(a->first->pt()-b->first->pt())/b->first->pt() < theDiffRelPtCut )
87  return (a->first->chi2() > b->first->chi2()) ? killFirst : killSecond;
88  else if ( hitsA.size() == 2 )
89  return (a->first->pt() < b->first->pt()) ? killFirst : killSecond;
90  else
91  return goAhead;
92  }
93  else return goAhead;
94 }
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
unsigned int size() const
Definition: SeedingHitSet.h:46
const L1MuonSeedsMerger::TrackAndHits * L1MuonSeedsMerger::merge ( const TrackAndHits a,
const TrackAndHits b 
) const
private

Definition at line 47 of file L1MuonSeedsMerger.cc.

References a, and b.

Referenced by resolve().

48 {
49 // temporary algorith, takes track with bigger pt, to be reimplemented
50  if (a->first->pt() > b->first->pt()) {
51  delete b->first;
52  return a;
53  } else {
54  delete a->first;
55  return b;
56  }
57 }
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
void L1MuonSeedsMerger::resolve ( TracksAndHits ) const
virtual

Definition at line 12 of file L1MuonSeedsMerger.cc.

References compare(), goAhead, killFirst, killSecond, merge(), mergeTwo, and theDeltaEtaCut.

13 {
14  sort(tracks.begin(),tracks.end(), Less());
15  typedef std::vector<TrackAndHits>::iterator Tracks_Itr;
16  Tracks_Itr it1 = tracks.begin();
17  while (it1 != tracks.end() ) {
18  for (Tracks_Itr it2 = it1+1; it1->first && it2<tracks.end(); it2++) {
19  if (! it2->first) continue;
20  if ( it2->first->eta() - it1->first->eta() > theDeltaEtaCut) break;
21  switch ( compare( &(*it1), &(*it2) ) ) {
22  case killFirst :
23  delete it1->first;
24  it1->first = nullptr;
25  break;
26  case killSecond :
27  delete it2->first;
28  it2->first = nullptr;
29  break;
30  case mergeTwo :
31  *it2 = *(merge(&(*it1),&(*it2)));
32  it1->first = nullptr;
33  break;
34  case goAhead : default: break;
35  }
36  }
37  if (nullptr == it1->first) tracks.erase(it1); else it1++;
38  }
39 }
Action compare(const TrackAndHits *, const TrackAndHits *) const
const TrackAndHits * merge(const TrackAndHits *, const TrackAndHits *) const

Member Data Documentation

float L1MuonSeedsMerger::theDeltaEtaCut
private

Definition at line 23 of file L1MuonSeedsMerger.h.

Referenced by L1MuonSeedsMerger(), and resolve().

float L1MuonSeedsMerger::theDiffRelPtCut
private

Definition at line 24 of file L1MuonSeedsMerger.h.

Referenced by compare(), and L1MuonSeedsMerger().