CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 438 of file Multi5x5ClusterAlgo.cc.

References EcalBarrel.

439 {
440  typedef std::vector<std::pair<DetId,float> >::iterator It;
441  std::pair<It,It> hitPos;
442 
443  if(seed_.id().subdetId()==EcalBarrel){
444  hitPos = std::equal_range(hits_.begin(),hits_.end(),seed_.id(),PairSortByFirst<DetId,float,EBDetIdSorter>());
445  }else{
446  hitPos = std::equal_range(hits_.begin(),hits_.end(),seed_.id(),PairSortByFirst<DetId,float,EEDetIdSorter>());
447  }
448 
449  if(hitPos.first==hitPos.second){//it doesnt already exist in the vec, add it
450  hits_.insert(hitPos.first,std::pair<DetId,float>(seed_.id(),1.));
451  energy_+=seed_.energy();
452  containsSeed_=true;
453 
454  return true;
455  }else return false;
456 
457 }
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:76
bool Multi5x5ClusterAlgo::ProtoBasicCluster::containsSeed ( ) const
inline

Definition at line 47 of file Multi5x5ClusterAlgo.h.

References containsSeed_.

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().

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

Definition at line 459 of file Multi5x5ClusterAlgo.cc.

Referenced by ProtoBasicCluster().

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

Definition at line 423 of file Multi5x5ClusterAlgo.cc.

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

424 {
425  std::vector<std::pair<DetId,float> >::iterator hitPos;
426  for(hitPos=hits_.begin();hitPos<hits_.end();hitPos++){
427  if(hitToRM.id()==hitPos->first) break;
428  }
429  if(hitPos!=hits_.end()){
430  hits_.erase(hitPos);
431  energy_-=hitToRM.energy();
432  return true;
433  }return false;
434 }
std::vector< std::pair< DetId, float > > hits_
float energy() const
Definition: EcalRecHit.h:68
DetId id() const
get the id
Definition: EcalRecHit.h:76
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(), and ProtoBasicCluster().

float Multi5x5ClusterAlgo::ProtoBasicCluster::energy_
private

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().

EcalRecHit Multi5x5ClusterAlgo::ProtoBasicCluster::seed_
private

Definition at line 37 of file Multi5x5ClusterAlgo.h.

Referenced by seed().