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 34 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 435 of file Multi5x5ClusterAlgo.cc.

References EcalBarrel.

Referenced by containsSeed().

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

References hits_.

Referenced by Multi5x5ClusterAlgo::mainSearch(), and Multi5x5ClusterAlgo::~Multi5x5ClusterAlgo().

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

Definition at line 456 of file Multi5x5ClusterAlgo.cc.

Referenced by containsSeed(), and ProtoBasicCluster().

457 {
458  for(size_t hitNr=0;hitNr<hits_.size();hitNr++){
459  if(seed_.id()==hits_[hitNr].first) return true;
460  }
461  return false;
462 }
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 420 of file Multi5x5ClusterAlgo.cc.

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

Referenced by containsSeed().

421 {
422  std::vector<std::pair<DetId,float> >::iterator hitPos;
423  for(hitPos=hits_.begin();hitPos<hits_.end();hitPos++){
424  if(hitToRM.id()==hitPos->first) break;
425  }
426  if(hitPos!=hits_.end()){
427  hits_.erase(hitPos);
428  energy_-=hitToRM.energy();
429  return true;
430  }return false;
431 }
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 44 of file Multi5x5ClusterAlgo.h.

References seed_.

Referenced by Multi5x5ClusterAlgo::mainSearch().

Member Data Documentation

bool Multi5x5ClusterAlgo::ProtoBasicCluster::containsSeed_
private

Definition at line 38 of file Multi5x5ClusterAlgo.h.

Referenced by containsSeed().

float Multi5x5ClusterAlgo::ProtoBasicCluster::energy_
private

Definition at line 35 of file Multi5x5ClusterAlgo.h.

Referenced by energy().

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

Definition at line 37 of file Multi5x5ClusterAlgo.h.

Referenced by hits().

EcalRecHit Multi5x5ClusterAlgo::ProtoBasicCluster::seed_
private

Definition at line 36 of file Multi5x5ClusterAlgo.h.

Referenced by seed().