CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
Multi5x5ClusterAlgo::ProtoBasicCluster Class Reference

#include <Multi5x5ClusterAlgo.h>

Public Member Functions

bool addSeed ()
 
bool containsSeed () const
 
float energy () const
 
const std::vector< std::pair< DetId, float > > & hits () const
 
 ProtoBasicCluster ()
 
 ProtoBasicCluster (float iEnergy, const EcalRecHit &iSeed, std::vector< std::pair< DetId, float > > &iHits)
 
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

Member Function Documentation

bool Multi5x5ClusterAlgo::ProtoBasicCluster::addSeed ( )

Definition at line 436 of file Multi5x5ClusterAlgo.cc.

References EcalBarrel.

Referenced by containsSeed().

437 {
438  typedef std::vector<std::pair<DetId,float> >::iterator It;
439  std::pair<It,It> hitPos;
440 
441  if(seed_.id().subdetId()==EcalBarrel){
442  hitPos = std::equal_range(hits_.begin(),hits_.end(),seed_.id(),PairSortByFirst<DetId,float,EBDetIdSorter>());
443  }else{
444  hitPos = std::equal_range(hits_.begin(),hits_.end(),seed_.id(),PairSortByFirst<DetId,float,EEDetIdSorter>());
445  }
446 
447  if(hitPos.first==hitPos.second){//it doesnt already exist in the vec, add it
448  hits_.insert(hitPos.first,std::pair<DetId,float>(seed_.id(),1.));
449  energy_+=seed_.energy();
450  containsSeed_=true;
451 
452  return true;
453  }else return false;
454 
455 }
std::vector< std::pair< DetId, float > > hits_
float energy() const
Definition: EcalRecHit.h:68
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
DetId id() const
get the id
Definition: EcalRecHit.h:77
bool Multi5x5ClusterAlgo::ProtoBasicCluster::containsSeed ( ) const
inline
float Multi5x5ClusterAlgo::ProtoBasicCluster::energy ( ) const
inline
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(), and Multi5x5ClusterAlgo::~Multi5x5ClusterAlgo().

46 {return hits_;}
std::vector< std::pair< DetId, float > > hits_
bool Multi5x5ClusterAlgo::ProtoBasicCluster::isSeedCrysInHits_ ( ) const
private

Definition at line 457 of file Multi5x5ClusterAlgo.cc.

Referenced by containsSeed(), and ProtoBasicCluster().

458 {
459  for(size_t hitNr=0;hitNr<hits_.size();hitNr++){
460  if(seed_.id()==hits_[hitNr].first) return true;
461  }
462  return false;
463 }
std::vector< std::pair< DetId, float > > hits_
DetId id() const
get the id
Definition: EcalRecHit.h:77
bool Multi5x5ClusterAlgo::ProtoBasicCluster::removeHit ( const EcalRecHit hitToRM)

Definition at line 421 of file Multi5x5ClusterAlgo.cc.

References EcalRecHit::energy(), and EcalRecHit::id().

Referenced by containsSeed().

422 {
423  std::vector<std::pair<DetId,float> >::iterator hitPos;
424  for(hitPos=hits_.begin();hitPos<hits_.end();hitPos++){
425  if(hitToRM.id()==hitPos->first) break;
426  }
427  if(hitPos!=hits_.end()){
428  hits_.erase(hitPos);
429  energy_-=hitToRM.energy();
430  return true;
431  }return false;
432 }
std::vector< std::pair< DetId, float > > hits_
float energy() const
Definition: EcalRecHit.h:68
DetId id() const
get the id
Definition: EcalRecHit.h:77
const EcalRecHit& Multi5x5ClusterAlgo::ProtoBasicCluster::seed ( ) const
inline

Definition at line 45 of file Multi5x5ClusterAlgo.h.

References seed_.

Referenced by Multi5x5ClusterAlgo::mainSearch().

Member Data Documentation

bool Multi5x5ClusterAlgo::ProtoBasicCluster::containsSeed_
private

Definition at line 39 of file Multi5x5ClusterAlgo.h.

Referenced by containsSeed().

float Multi5x5ClusterAlgo::ProtoBasicCluster::energy_
private

Definition at line 36 of file Multi5x5ClusterAlgo.h.

Referenced by energy().

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

Definition at line 38 of file Multi5x5ClusterAlgo.h.

Referenced by hits().

EcalRecHit Multi5x5ClusterAlgo::ProtoBasicCluster::seed_
private

Definition at line 37 of file Multi5x5ClusterAlgo.h.

Referenced by seed().