CMS 3D CMS Logo

Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes

L1MuonSeedsMerger Class Reference

#include <L1MuonSeedsMerger.h>

List of all members.

Classes

struct  Less

Public Types

typedef std::pair< const
reco::Track *, SeedingHitSet
TrackAndHits
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

enum L1MuonSeedsMerger::Action [private]
Enumerator:
goAhead 
killFirst 
killSecond 
mergeTwo 

Definition at line 18 of file L1MuonSeedsMerger.h.


Constructor & Destructor Documentation

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

Definition at line 6 of file L1MuonSeedsMerger.cc.

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

{
  theDeltaEtaCut  = cfg.getParameter<double>("deltaEtaCut");
  theDiffRelPtCut = cfg.getParameter<double>("diffRelPtCut");
}
virtual L1MuonSeedsMerger::~L1MuonSeedsMerger ( ) [inline, virtual]

Definition at line 15 of file L1MuonSeedsMerger.h.

{}

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

{
  int nshared = 0;
  const SeedingHitSet & hitsA = a->second;
  const SeedingHitSet & hitsB = b->second;
  for (unsigned int iHitA=0, nHitsA=hitsA.size(); iHitA < nHitsA; ++iHitA) {
    const TrackingRecHit* trhA = hitsA[iHitA]->hit();
    for (unsigned int iHitB=0, nHitsB=hitsB.size(); iHitB < nHitsB; ++iHitB) {
      const TrackingRecHit* trhB = hitsB[iHitB]->hit();
      if (trhA==trhB) nshared++;
    }
  }

  if (nshared >= 2) {
    if (hitsA.size() >= 3 && hitsB.size() >= 3 )
      return (a->first->chi2() > b->first->chi2()) ? killFirst : killSecond;
    else if (hitsB.size() >= 3)
      return killFirst;
    else
      return killSecond;
  }
  else if (nshared >= 1) {
    if (hitsA.size() != hitsB.size())
      return (hitsA.size() < hitsB.size()) ? killFirst : killSecond;
    else if (    hitsA.size() >= 3
              && a->first->charge()==b->first->charge()
              && fabs(a->first->pt()-b->first->pt())/b->first->pt() < theDiffRelPtCut )
      return (a->first->chi2() > b->first->chi2()) ? killFirst : killSecond;
    else if (    hitsA.size() == 2 )
      return (a->first->pt() < b->first->pt()) ? killFirst : killSecond;
    else
      return goAhead;
  }
  else return goAhead;
}
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().

{
// temporary algorith, takes track with bigger pt, to be reimplemented
  if (a->first->pt() > b->first->pt()) {
    delete b->first;
    return a;
  } else {
    delete a->first;
    return b;
  }
}
void L1MuonSeedsMerger::resolve ( TracksAndHits ) const [virtual]

Definition at line 12 of file L1MuonSeedsMerger.cc.

References compare(), goAhead, killFirst, killSecond, merge(), mergeTwo, python::multivaluedict::sort(), and theDeltaEtaCut.

Referenced by TSGFromL1Muon::produce().

{
  sort(tracks.begin(),tracks.end(), Less());
  typedef std::vector<TrackAndHits>::iterator Tracks_Itr; 
  Tracks_Itr it1 = tracks.begin();
  while (it1 != tracks.end() ) {
    for (Tracks_Itr it2 = it1+1; it1->first && it2<tracks.end(); it2++) {
      if (! it2->first) continue;
      if ( it2->first->eta() - it1->first->eta() > theDeltaEtaCut) break;
      switch ( compare( &(*it1), &(*it2) ) ) {
         case killFirst :
           delete it1->first;
           it1->first = 0;
           break;
         case killSecond :
           delete it2->first;
           it2->first = 0;
           break;
         case mergeTwo :
           *it2 = *(merge(&(*it1),&(*it2)));
           it1->first = 0;
           break;
         case goAhead : default: break;
      }
    }
    if (0 == it1->first) tracks.erase(it1); else it1++;
  }
}

Member Data Documentation

Definition at line 23 of file L1MuonSeedsMerger.h.

Referenced by L1MuonSeedsMerger(), and resolve().

Definition at line 24 of file L1MuonSeedsMerger.h.

Referenced by compare(), and L1MuonSeedsMerger().