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 12 of file L1MuonSeedsMerger.h.

Member Typedef Documentation

Definition at line 14 of file L1MuonSeedsMerger.h.

Definition at line 15 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.

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

Definition at line 17 of file L1MuonSeedsMerger.h.

17 {}

Member Function Documentation

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

Definition at line 61 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)
70  nshared++;
71  }
72  }
73 
74  if (nshared >= 2) {
75  if (hitsA.size() >= 3 && hitsB.size() >= 3)
76  return (a->first->chi2() > b->first->chi2()) ? killFirst : killSecond;
77  else if (hitsB.size() >= 3)
78  return killFirst;
79  else
80  return killSecond;
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 && a->first->charge() == b->first->charge() &&
85  fabs(a->first->pt() - b->first->pt()) / b->first->pt() < theDiffRelPtCut)
86  return (a->first->chi2() > b->first->chi2()) ? killFirst : killSecond;
87  else if (hitsA.size() == 2)
88  return (a->first->pt() < b->first->pt()) ? killFirst : killSecond;
89  else
90  return goAhead;
91  } else
92  return goAhead;
93 }
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119
unsigned int size() const
Definition: SeedingHitSet.h:41
const L1MuonSeedsMerger::TrackAndHits * L1MuonSeedsMerger::merge ( const TrackAndHits a,
const TrackAndHits b 
) const
private

Definition at line 50 of file L1MuonSeedsMerger.cc.

References a, and b.

Referenced by resolve().

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

Definition at line 11 of file L1MuonSeedsMerger.cc.

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

11  {
12  sort(tracks.begin(), tracks.end(), Less());
13  typedef std::vector<TrackAndHits>::iterator Tracks_Itr;
14  Tracks_Itr it1 = tracks.begin();
15  while (it1 != tracks.end()) {
16  for (Tracks_Itr it2 = it1 + 1; it1->first && it2 < tracks.end(); it2++) {
17  if (!it2->first)
18  continue;
19  if (it2->first->eta() - it1->first->eta() > theDeltaEtaCut)
20  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:
35  default:
36  break;
37  }
38  }
39  if (nullptr == it1->first)
40  tracks.erase(it1);
41  else
42  it1++;
43  }
44 }
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 29 of file L1MuonSeedsMerger.h.

Referenced by L1MuonSeedsMerger(), and resolve().

float L1MuonSeedsMerger::theDiffRelPtCut
private

Definition at line 30 of file L1MuonSeedsMerger.h.

Referenced by compare(), and L1MuonSeedsMerger().