CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

Multi5x5ClusterAlgo::ProtoBasicCluster Class Reference

#include <Multi5x5ClusterAlgo.h>

List of all members.

Public Member Functions

bool addSeed ()
bool containsSeed () const
float energy () const
const std::vector< std::pair
< DetId, float > > & 
hits () const
 ProtoBasicCluster (float iEnergy, const EcalRecHit &iSeed, std::vector< std::pair< DetId, float > > &iHits)
 ProtoBasicCluster ()
bool removeHit (const EcalRecHit &hitToRM)
const EcalRecHitseed () const

Private Member Functions

bool isSeedCrysInHits_ () const

Private Attributes

bool containsSeed_
float energy_
std::vector< std::pair< DetId,
float > > 
hits_
EcalRecHit seed_

Detailed Description

Definition at line 35 of file Multi5x5ClusterAlgo.h.


Constructor & Destructor Documentation

Multi5x5ClusterAlgo::ProtoBasicCluster::ProtoBasicCluster ( )
Multi5x5ClusterAlgo::ProtoBasicCluster::ProtoBasicCluster ( float  iEnergy,
const EcalRecHit iSeed,
std::vector< std::pair< DetId, float > > &  iHits 
) [inline]

Definition at line 42 of file Multi5x5ClusterAlgo.h.

References containsSeed_, hits_, and isSeedCrysInHits_().

:energy_(iEnergy),seed_(iSeed){hits_.swap(iHits);containsSeed_=isSeedCrysInHits_();}

Member Function Documentation

bool Multi5x5ClusterAlgo::ProtoBasicCluster::addSeed ( )

Definition at line 438 of file Multi5x5ClusterAlgo.cc.

References EcalBarrel.

{
  typedef std::vector<std::pair<DetId,float> >::iterator It;
  std::pair<It,It> hitPos;
 
  if(seed_.id().subdetId()==EcalBarrel){
    hitPos = std::equal_range(hits_.begin(),hits_.end(),seed_.id(),PairSortByFirst<DetId,float,EBDetIdSorter>());
  }else{
    hitPos = std::equal_range(hits_.begin(),hits_.end(),seed_.id(),PairSortByFirst<DetId,float,EEDetIdSorter>());
  }

  if(hitPos.first==hitPos.second){//it doesnt already exist in the vec, add it
    hits_.insert(hitPos.first,std::pair<DetId,float>(seed_.id(),1.));
    energy_+=seed_.energy(); 
    containsSeed_=true;

    return true;
  }else return false;
 
}
bool Multi5x5ClusterAlgo::ProtoBasicCluster::containsSeed ( ) const [inline]

Definition at line 47 of file Multi5x5ClusterAlgo.h.

References containsSeed_.

{return containsSeed_;}
float Multi5x5ClusterAlgo::ProtoBasicCluster::energy ( ) const [inline]

Definition at line 44 of file Multi5x5ClusterAlgo.h.

References energy_.

Referenced by Multi5x5ClusterAlgo::mainSearch().

{return energy_;}
const std::vector<std::pair<DetId,float> >& Multi5x5ClusterAlgo::ProtoBasicCluster::hits ( ) const [inline]

Definition at line 46 of file Multi5x5ClusterAlgo.h.

References hits_.

Referenced by Multi5x5ClusterAlgo::mainSearch().

{return hits_;}
bool Multi5x5ClusterAlgo::ProtoBasicCluster::isSeedCrysInHits_ ( ) const [private]

Definition at line 459 of file Multi5x5ClusterAlgo.cc.

Referenced by ProtoBasicCluster().

{
  for(size_t hitNr=0;hitNr<hits_.size();hitNr++){
    if(seed_.id()==hits_[hitNr].first) return true;
  }
  return false;
}
bool Multi5x5ClusterAlgo::ProtoBasicCluster::removeHit ( const EcalRecHit hitToRM)

Definition at line 423 of file Multi5x5ClusterAlgo.cc.

References CaloRecHit::energy(), energy_, hits_, and EcalRecHit::id().

{
  std::vector<std::pair<DetId,float> >::iterator hitPos;
  for(hitPos=hits_.begin();hitPos<hits_.end();hitPos++){
    if(hitToRM.id()==hitPos->first) break;
  }
  if(hitPos!=hits_.end()){
    hits_.erase(hitPos);
    energy_-=hitToRM.energy();
    return true;
  }return false;
}
const EcalRecHit& Multi5x5ClusterAlgo::ProtoBasicCluster::seed ( ) const [inline]

Definition at line 45 of file Multi5x5ClusterAlgo.h.

References seed_.

Referenced by Multi5x5ClusterAlgo::mainSearch().

{return seed_;}

Member Data Documentation

Definition at line 39 of file Multi5x5ClusterAlgo.h.

Referenced by containsSeed(), and ProtoBasicCluster().

Definition at line 36 of file Multi5x5ClusterAlgo.h.

Referenced by energy(), and removeHit().

std::vector<std::pair<DetId,float> > Multi5x5ClusterAlgo::ProtoBasicCluster::hits_ [private]

Definition at line 38 of file Multi5x5ClusterAlgo.h.

Referenced by hits(), ProtoBasicCluster(), and removeHit().

Definition at line 37 of file Multi5x5ClusterAlgo.h.

Referenced by seed().