CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions
ClusterClusterMapping Class Reference

#include <ClusterClusterMapping.h>

Public Member Functions

 ClusterClusterMapping ()
 
 ~ClusterClusterMapping ()
 

Static Public Member Functions

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

Detailed Description

Definition at line 12 of file ClusterClusterMapping.h.

Constructor & Destructor Documentation

ClusterClusterMapping::ClusterClusterMapping ( )
inline

Definition at line 14 of file ClusterClusterMapping.h.

14 {;}
ClusterClusterMapping::~ClusterClusterMapping ( )
inline

Definition at line 15 of file ClusterClusterMapping.h.

References checkOverlap(), debug, overlap(), and SimDataFormats::CaloAnalysis::sc.

15 {;}

Member Function Documentation

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

Definition at line 51 of file ClusterClusterMapping.cc.

References overlap(), and mps_fire::result.

Referenced by ~ClusterClusterMapping().

51  {
52  int result=-1;
53  unsigned nsc=sc.size();
54 
55  for(unsigned isc=0;isc<nsc;++isc) {
56  if(overlap(pfc,*(sc[isc]),minfrac,debug))
57  return isc;
58  }
59  return result;
60 }
static bool overlap(const reco::CaloCluster &sc1, const reco::CaloCluster &sc, float minfrac=0.01, bool debug=false)
#define debug
Definition: HDRShower.cc:19
int ClusterClusterMapping::checkOverlap ( const reco::PFCluster pfc,
const std::vector< reco::SuperClusterRef > &  sc,
float  minfrac = 0.01,
bool  debug = false 
)
static

Definition at line 62 of file ClusterClusterMapping.cc.

References overlap(), and mps_fire::result.

62  {
63  int result=-1;
64  unsigned nsc=sc.size();
65 
66  for(unsigned isc=0;isc<nsc;++isc) {
67  if(overlap(pfc,*sc[isc],minfrac,debug))
68  return isc;
69  }
70  return result;
71 }
static bool overlap(const reco::CaloCluster &sc1, const reco::CaloCluster &sc, float minfrac=0.01, bool debug=false)
#define debug
Definition: HDRShower.cc:19
int ClusterClusterMapping::checkOverlap ( const reco::PFClusterRef pfc,
const std::vector< reco::SuperClusterRef > &  sc,
const edm::ValueMap< reco::CaloClusterPtr > &  pfclusassoc 
)
static

Definition at line 73 of file ClusterClusterMapping.cc.

References overlap(), and mps_fire::result.

73  {
74  int result=-1;
75  unsigned nsc=sc.size();
76 
77  for(unsigned isc=0;isc<nsc;++isc) {
78  if(overlap(pfc,*sc[isc],pfclusassoc))
79  return isc;
80  }
81  return result;
82 }
static bool overlap(const reco::CaloCluster &sc1, const reco::CaloCluster &sc, float minfrac=0.01, bool debug=false)
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, plotBeamSpotDB::first, reco::CaloCluster::hitsAndFractions(), and edm::second().

Referenced by checkOverlap(), SpecialClusterImporter< T >::importToBlock(), PFElecTkProducer::isSharingEcalEnergyWithEgSC(), SCAndECALLinker::testLink(), SCAndHGCalLinker::testLink(), and ~ClusterClusterMapping().

4  {
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 }
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:195
U second(std::pair< T, U > const &p)
#define debug
Definition: HDRShower.cc:19
bool ClusterClusterMapping::overlap ( const reco::PFClusterRef pfclustest,
const reco::SuperCluster sc,
const edm::ValueMap< reco::CaloClusterPtr > &  pfclusassoc 
)
static

Definition at line 38 of file ClusterClusterMapping.cc.

References reco::SuperCluster::clustersBegin(), reco::SuperCluster::clustersEnd(), edm::ValueMap< T >::contains(), edm::Ptr< T >::id(), edm::Ref< C, T, F >::id(), edm::Ptr< T >::key(), and edm::Ref< C, T, F >::key().

38  {
39 
40  for (reco::CaloCluster_iterator caloclus = sc.clustersBegin(); caloclus!=sc.clustersEnd(); ++caloclus) {
41 
42  if( pfclusassoc.contains(caloclus->id()) ) {
43  const reco::CaloClusterPtr &pfclus = pfclusassoc[*caloclus];
44  //printf("pfclus prodidx = %i, key = %i, pfclustest prodidx = %i, key = %i\n",pfclus.id().productIndex(),int(pfclus.key()),pfclustest.id().productIndex(),int(pfclustest.key()));
45  if (pfclus.id()==pfclustest.id() && pfclus.key()==pfclustest.key()) return true;
46  }
47  }
48  return false;
49 }
key_type key() const
Definition: Ptr.h:185
key_type key() const
Accessor for product key.
Definition: Ref.h:265
ProductID id() const
Accessor for product ID.
Definition: Ref.h:259
bool contains(ProductID id) const
Definition: ValueMap.h:155
ProductID id() const
Accessor for product ID.
Definition: Ptr.h:180
CaloCluster_iterator clustersBegin() const
fist iterator over BasicCluster constituents
Definition: SuperCluster.h:75
CaloCluster_iterator clustersEnd() const
last iterator over BasicCluster constituents
Definition: SuperCluster.h:78