CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions

ClusterClusterMapping Class Reference

#include <ClusterClusterMapping.h>

List of all members.

Public Member Functions

 ClusterClusterMapping ()
 ~ClusterClusterMapping ()

Static Public Member Functions

static int checkOverlap (const reco::PFCluster &pfc, std::vector< const reco::SuperCluster * > sc, float minfrac=0.01, bool debug=false)
static int checkOverlap (const reco::PFCluster &pfc, std::vector< reco::SuperClusterRef > sc, float minfrac=0.01, bool debug=false)
static bool overlap (const reco::CaloCluster &sc1, const reco::CaloCluster &sc, float minfrac=0.01, bool debug=false)

Detailed Description

Definition at line 9 of file ClusterClusterMapping.h.


Constructor & Destructor Documentation

ClusterClusterMapping::ClusterClusterMapping ( ) [inline]

Definition at line 11 of file ClusterClusterMapping.h.

{;}
ClusterClusterMapping::~ClusterClusterMapping ( ) [inline]

Definition at line 12 of file ClusterClusterMapping.h.

{;}

Member Function Documentation

int ClusterClusterMapping::checkOverlap ( const reco::PFCluster pfc,
std::vector< const reco::SuperCluster * >  sc,
float  minfrac = 0.01,
bool  debug = false 
) [static]

Definition at line 38 of file ClusterClusterMapping.cc.

References overlap(), and query::result.

Referenced by PFBlockAlgo::setInput().

                                                                                                                                  {
  int result=-1;
  unsigned nsc=sc.size();
  
  for(unsigned isc=0;isc<nsc;++isc) {
    if(overlap(pfc,*(sc[isc]),minfrac,debug))
      return isc;
  }
  return result;
}
int ClusterClusterMapping::checkOverlap ( const reco::PFCluster pfc,
std::vector< reco::SuperClusterRef sc,
float  minfrac = 0.01,
bool  debug = false 
) [static]

Definition at line 49 of file ClusterClusterMapping.cc.

References overlap(), and query::result.

                                                                                                                              {
  int result=-1;
  unsigned nsc=sc.size();
  
  for(unsigned isc=0;isc<nsc;++isc) {
    if(overlap(pfc,*sc[isc],minfrac,debug))
      return isc;
  }
  return result;
}
bool ClusterClusterMapping::overlap ( const reco::CaloCluster sc1,
const reco::CaloCluster sc,
float  minfrac = 0.01,
bool  debug = false 
) [static]

Definition at line 4 of file ClusterClusterMapping.cc.

References gather_cfg::cout, first, reco::CaloCluster::hitsAndFractions(), and edm::second().

Referenced by checkOverlap().

                                                                                                                       {
  const std::vector< std::pair<DetId, float> > & hits1 = sc1.hitsAndFractions();
  const std::vector< std::pair<DetId, float> > & hits2 = sc2.hitsAndFractions();
  unsigned nhits1=hits1.size();
  unsigned nhits2=hits2.size();
  
  for(unsigned i1=0;i1<nhits1;++i1)
    { 
      // consider only with a minimum fraction of minfrac (default 1%) of the RecHit
      if(hits1[i1].second<minfrac) {
          if(debug) std::cout << " Discarding " << hits1[i1].first << " with " << hits1[i1].second << std::endl;
          continue;
        }
      for(unsigned i2=0;i2<nhits2;++i2)
        {
          // consider only with a minimum fraction of minfract (default 1%) of the RecHit
          if(hits2[i2].second<minfrac ) {
            if(debug) std::cout << " Discarding " << hits2[i2].first << " with " << hits2[i2].second << std::endl;
            continue;
          }
          if(hits1[i1].first==hits2[i2].first)
            {
              if(debug)
                {
                  std::cout << " Matching hits " << hits1[i1].first << " with " <<  hits1[i1].second << " and " <<  hits2[i2].first;
                  std::cout << " with " << hits2[i2].second << std::endl;                 
                }
              return true;
            }
        }
    }
  return false;
}