CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ClusterClusterMapping.cc
Go to the documentation of this file.
2 
3 // returns true as soon as the two clusters have one hit in common
4 bool ClusterClusterMapping::overlap(const reco::CaloCluster & sc1, const reco::CaloCluster & sc2, float minfrac,bool debug) {
5  const std::vector< std::pair<DetId, float> > & hits1 = sc1.hitsAndFractions();
6  const std::vector< std::pair<DetId, float> > & hits2 = sc2.hitsAndFractions();
7  unsigned nhits1=hits1.size();
8  unsigned nhits2=hits2.size();
9 
10  for(unsigned i1=0;i1<nhits1;++i1)
11  {
12  // consider only with a minimum fraction of minfrac (default 1%) of the RecHit
13  if(hits1[i1].second<minfrac) {
14  if(debug) std::cout << " Discarding " << hits1[i1].first << " with " << hits1[i1].second << std::endl;
15  continue;
16  }
17  for(unsigned i2=0;i2<nhits2;++i2)
18  {
19  // consider only with a minimum fraction of minfract (default 1%) of the RecHit
20  if(hits2[i2].second<minfrac ) {
21  if(debug) std::cout << " Discarding " << hits2[i2].first << " with " << hits2[i2].second << std::endl;
22  continue;
23  }
24  if(hits1[i1].first==hits2[i2].first)
25  {
26  if(debug)
27  {
28  std::cout << " Matching hits " << hits1[i1].first << " with " << hits1[i1].second << " and " << hits2[i2].first;
29  std::cout << " with " << hits2[i2].second << std::endl;
30  }
31  return true;
32  }
33  }
34  }
35  return false;
36 }
37 
38 int ClusterClusterMapping::checkOverlap(const reco::PFCluster & pfc, std::vector<const reco::SuperCluster *> sc,float minfrac,bool debug) {
39  int result=-1;
40  unsigned nsc=sc.size();
41 
42  for(unsigned isc=0;isc<nsc;++isc) {
43  if(overlap(pfc,*(sc[isc]),minfrac,debug))
44  return isc;
45  }
46  return result;
47 }
48 
49 int ClusterClusterMapping::checkOverlap(const reco::PFCluster & pfc, std::vector<reco::SuperClusterRef > sc,float minfrac,bool debug) {
50  int result=-1;
51  unsigned nsc=sc.size();
52 
53  for(unsigned isc=0;isc<nsc;++isc) {
54  if(overlap(pfc,*sc[isc],minfrac,debug))
55  return isc;
56  }
57  return result;
58 }
static bool overlap(const reco::CaloCluster &sc1, const reco::CaloCluster &sc, float minfrac=0.01, bool debug=false)
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:42
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:189
static int checkOverlap(const reco::PFCluster &pfc, std::vector< const reco::SuperCluster * > sc, float minfrac=0.01, bool debug=false)
U second(std::pair< T, U > const &p)
tuple result
Definition: query.py:137
bool first
Definition: L1TdeRCT.cc:94
tuple cout
Definition: gather_cfg.py:121
#define debug
Definition: MEtoEDMFormat.h:34