CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
PFB Namespace Reference

Functions

template<typename C , typename M >
void match (const C &candCollection, const M &matchedCandCollection, std::vector< int > &matchIndices, bool matchCharge=false, float dRMax=-1)
 
template<typename C , typename M >
void match (const C &candCollection, const M &matchedCandCollection, std::vector< int > &matchIndices, const edm::ParameterSet &parameterSet, edm::View< reco::Muon > muonMatchedCandCollection, bool matchCharge=false, float dRMax=-1)
 

Function Documentation

template<typename C , typename M >
void PFB::match ( const C &  candCollection,
const M &  matchedCandCollection,
std::vector< int > &  matchIndices,
bool  matchCharge = false,
float  dRMax = -1 
)

Definition at line 17 of file Matchers.h.

References RecoTauCleanerPlugins::charge, reco::deltaR2(), dR2Max, HLT_25ns14e33_v1_cff::dRMax, and i.

Referenced by PFCandidateMonitor::fill(), PFJetMonitor::fill(), and PFCandidateManager::fill().

21  {
22 
23  // compute distance to each candidate in the matchedCandCollection.
24 
25  float dR2Max = 0;
26  if(dRMax>0) dR2Max = dRMax*dRMax;
27 
28  matchIndices.clear();
29  matchIndices.resize( candCollection.size(), -1);
30 
31  for( unsigned i=0; i<candCollection.size(); ++i) {
32 
33  static const double bigNumber = 1e14;
34  double dR2min = bigNumber;
35  int jMin = -1;
36  for( unsigned jm=0; jm<matchedCandCollection.size(); ++jm) {
37 
38  if( matchCharge &&
39  candCollection[i].charge() != matchedCandCollection[jm].charge() )
40  continue;
41 
42  double dR2 = reco::deltaR2( candCollection[i],
43  matchedCandCollection[jm] );
44  if( dR2<dR2min ) {
45  dR2min = dR2;
46  jMin = jm;
47  }
48  }
49 
50  if( (dR2Max>0 && dR2min < dR2Max) || dRMax<=0 ) {
51  matchIndices[i] = jMin;
52  /* std::cout<<"match "<<dR2min<<std::endl; */
53  }
54  // store the closest match, no cut on deltaR.
55  }
56  }
const double dR2Max
int i
Definition: DBlmapReader.cc:9
double deltaR2(const T1 &t1, const T2 &t2)
Definition: deltaR.h:36
template<typename C , typename M >
void PFB::match ( const C &  candCollection,
const M &  matchedCandCollection,
std::vector< int > &  matchIndices,
const edm::ParameterSet parameterSet,
edm::View< reco::Muon muonMatchedCandCollection,
bool  matchCharge = false,
float  dRMax = -1 
)

Definition at line 61 of file Matchers.h.

References RecoTauCleanerPlugins::charge, reco::deltaR2(), dR2Max, HLT_25ns14e33_v1_cff::dRMax, edm::ParameterSet::getParameter(), i, muon::isGoodMuon(), EnergyCorrector::pt, and muon::RPCMuLoose.

68  {
69 
70  // compute distance to each candidate in the matchedCandCollection.
71 
72  float dR2Max = 0;
73  if(dRMax>0) dR2Max = dRMax*dRMax;
74 
75  matchIndices.clear();
76  matchIndices.resize( candCollection.size(), -1);
77 
78  for( unsigned i=0; i<candCollection.size(); ++i) {
79 
80  static const double bigNumber = 1e14;
81  double dR2min = bigNumber;
82  int jMin = -1;
83  for( unsigned jm=0; jm<matchedCandCollection.size(); ++jm) {
84 
85  if ( parameterSet.getParameter<bool>("slimmedLikeSelection") ) {
86  if ( !( muonMatchedCandCollection[jm].pt() > parameterSet.getParameter<double>("ptBase") ||
87  muonMatchedCandCollection[jm].isPFMuon() ||
88  ( muonMatchedCandCollection[jm].pt() > parameterSet.getParameter<double>("ptNotPF") &&
89  (muonMatchedCandCollection[jm].isGlobalMuon() || muonMatchedCandCollection[jm].isStandAloneMuon() || muonMatchedCandCollection[jm].numberOfMatches() > 0 || muon::isGoodMuon(muonMatchedCandCollection[jm], muon::RPCMuLoose) ) )
90  ) )
91  continue ;
92  }
93 
94  if( matchCharge &&
95  candCollection[i].charge() != matchedCandCollection[jm].charge() )
96  continue ;
97 
98  double dR2 = reco::deltaR2( candCollection[i],
99  matchedCandCollection[jm] );
100  if( dR2<dR2min ) {
101  dR2min = dR2;
102  jMin = jm;
103  }
104  }
105 
106  if( (dR2Max>0 && dR2min < dR2Max) || dRMax<=0 ) {
107  matchIndices[i] = jMin;
108  /* std::cout<<"match "<<dR2min<<std::endl; */
109  }
110  // store the closest match, no cut on deltaR.
111  }
112  }
T getParameter(std::string const &) const
const double dR2Max
int i
Definition: DBlmapReader.cc:9
double deltaR2(const T1 &t1, const T2 &t2)
Definition: deltaR.h:36
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call