CMS 3D CMS Logo

List of all members | Public Member Functions
GhostBuster Class Reference

#include <GhostBuster.h>

Inheritance diagram for GhostBuster:
IGhostBuster

Public Member Functions

std::vector< AlgoMuonselect (std::vector< AlgoMuon > refHitCands, int charge=0) override
 
 ~GhostBuster () override
 
- Public Member Functions inherited from IGhostBuster
virtual ~IGhostBuster ()
 

Detailed Description

Definition at line 15 of file GhostBuster.h.

Constructor & Destructor Documentation

GhostBuster::~GhostBuster ( )
inlineoverride

Definition at line 17 of file GhostBuster.h.

References ALCARECOTkAlJpsiMuMu_cff::charge, and select().

17 {};

Member Function Documentation

std::vector< AlgoMuon > GhostBuster::select ( std::vector< AlgoMuon refHitCands,
int  charge = 0 
)
overridevirtual

Implements IGhostBuster.

Definition at line 12 of file GhostBuster.cc.

References funct::abs().

Referenced by ~GhostBuster().

12  {
13 
14  std::vector<AlgoMuon> refHitCleanCands;
15  // Sort candidates with decreased goodness,
16  // where goodness definied in < operator of AlgoMuon
17  std::sort( refHitCands.rbegin(), refHitCands.rend() );
18 
19  for(std::vector<AlgoMuon>::iterator it1 = refHitCands.begin();
20  it1 != refHitCands.end(); ++it1){
21  bool isGhost=false;
22  for(std::vector<AlgoMuon>::iterator it2 = refHitCleanCands.begin();
23  it2 != refHitCleanCands.end(); ++it2){
24  //do not accept candidates with similar phi (any charge combination)
25  //veto window 5deg(=half of logic cone)=5/360*5760=80"logic strips"
26  //veto window 5 degree in GMT scale is 5/360*576=8 units
27  if (std::abs( phiGMT(it1->getPhi()) - phiGMT(it2->getPhi()) ) < 8 ) {
28 // if(std::abs(it1->getPhi() - it2->getPhi())<5/360.0*nPhiBins){
29  isGhost=true;
30  break;
31  //which one candidate is killed depends only on the order in the refHitCands (the one with smaller index is taken), and this order is assured by the sort above
32  //TODO here the candidate that is killed does not kill other candidates - check if the firmware does the same (KB)
33  }
34  }
35  if(it1->getQ()>0 && !isGhost) refHitCleanCands.push_back(*it1);
36  }
37 
38  refHitCleanCands.resize( 3, AlgoMuon(0,999,9999,0,0,0,0,0) ); //FIXME
39  //refHitCleanCands.resize( 3, AlgoMuon() );
40 
41 
42  std::stringstream myStr;
43  bool hasCandidates = false;
44  for(unsigned int iRefHit=0;iRefHit<refHitCands.size();++iRefHit){
45  if(refHitCands[iRefHit].getQ()){
46  hasCandidates=true;
47  break;
48  }
49  }
50  for(unsigned int iRefHit=0;iRefHit<refHitCands.size();++iRefHit){
51  if(refHitCands[iRefHit].getQ()) myStr<<"Ref hit: "<<iRefHit<<" "<<refHitCands[iRefHit]<<std::endl;
52  }
53  myStr<<"Selected Candidates with charge: "<<charge<<std::endl;
54  for(unsigned int iCand=0; iCand<refHitCleanCands.size(); ++iCand){
55  myStr<<"Cand: "<<iCand<<" "<<refHitCleanCands[iCand]<<std::endl;
56  }
57 
58  if(hasCandidates) edm::LogInfo("OMTF Sorter")<<myStr.str();
59 
60  // update refHitCands with refHitCleanCands
61  return refHitCleanCands;
62 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22