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 33 of file Multi5x5ClusterAlgo.h.

Constructor & Destructor Documentation

◆ ProtoBasicCluster() [1/2]

Multi5x5ClusterAlgo::ProtoBasicCluster::ProtoBasicCluster ( )

◆ ProtoBasicCluster() [2/2]

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

Member Function Documentation

◆ addSeed()

bool Multi5x5ClusterAlgo::ProtoBasicCluster::addSeed ( )

Definition at line 403 of file Multi5x5ClusterAlgo.cc.

References EcalBarrel.

403  {
404  typedef std::vector<std::pair<DetId, float> >::iterator It;
405  std::pair<It, It> hitPos;
406 
407  if (seed_.id().subdetId() == EcalBarrel) {
408  hitPos = std::equal_range(hits_.begin(), hits_.end(), seed_.id(), PairSortByFirst<DetId, float, EBDetIdSorter>());
409  } else {
410  hitPos = std::equal_range(hits_.begin(), hits_.end(), seed_.id(), PairSortByFirst<DetId, float, EEDetIdSorter>());
411  }
412 
413  if (hitPos.first == hitPos.second) { //it doesnt already exist in the vec, add it
414  hits_.insert(hitPos.first, std::pair<DetId, float>(seed_.id(), 1.));
415  energy_ += seed_.energy();
416  containsSeed_ = true;
417 
418  return true;
419  } else
420  return false;
421 }
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
std::vector< std::pair< DetId, float > > hits_
DetId id() const
get the id
Definition: EcalRecHit.h:77
float energy() const
Definition: EcalRecHit.h:68

◆ containsSeed()

bool Multi5x5ClusterAlgo::ProtoBasicCluster::containsSeed ( ) const
inline

Definition at line 50 of file Multi5x5ClusterAlgo.h.

References containsSeed_.

◆ energy()

float Multi5x5ClusterAlgo::ProtoBasicCluster::energy ( ) const
inline

Definition at line 47 of file Multi5x5ClusterAlgo.h.

References energy_.

Referenced by Multi5x5ClusterAlgo::mainSearch(), and Jet.Jet::rawEnergy().

◆ hits()

const std::vector<std::pair<DetId, float> >& Multi5x5ClusterAlgo::ProtoBasicCluster::hits ( ) const
inline

Definition at line 49 of file Multi5x5ClusterAlgo.h.

References hits_.

Referenced by Multi5x5ClusterAlgo::mainSearch().

49 { return hits_; }
std::vector< std::pair< DetId, float > > hits_

◆ isSeedCrysInHits_()

bool Multi5x5ClusterAlgo::ProtoBasicCluster::isSeedCrysInHits_ ( ) const
private

Definition at line 423 of file Multi5x5ClusterAlgo.cc.

Referenced by ProtoBasicCluster().

423  {
424  for (size_t hitNr = 0; hitNr < hits_.size(); hitNr++) {
425  if (seed_.id() == hits_[hitNr].first)
426  return true;
427  }
428  return false;
429 }
std::vector< std::pair< DetId, float > > hits_
DetId id() const
get the id
Definition: EcalRecHit.h:77

◆ removeHit()

bool Multi5x5ClusterAlgo::ProtoBasicCluster::removeHit ( const EcalRecHit hitToRM)

Definition at line 387 of file Multi5x5ClusterAlgo.cc.

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

387  {
388  std::vector<std::pair<DetId, float> >::iterator hitPos;
389  for (hitPos = hits_.begin(); hitPos < hits_.end(); hitPos++) {
390  if (hitToRM.id() == hitPos->first)
391  break;
392  }
393  if (hitPos != hits_.end()) {
394  hits_.erase(hitPos);
395  energy_ -= hitToRM.energy();
396  return true;
397  }
398  return false;
399 }
std::vector< std::pair< DetId, float > > hits_
DetId id() const
get the id
Definition: EcalRecHit.h:77
float energy() const
Definition: EcalRecHit.h:68

◆ seed()

const EcalRecHit& Multi5x5ClusterAlgo::ProtoBasicCluster::seed ( ) const
inline

Definition at line 48 of file Multi5x5ClusterAlgo.h.

References seed_.

Referenced by Multi5x5ClusterAlgo::mainSearch().

Member Data Documentation

◆ containsSeed_

bool Multi5x5ClusterAlgo::ProtoBasicCluster::containsSeed_
private

Definition at line 37 of file Multi5x5ClusterAlgo.h.

Referenced by containsSeed(), and ProtoBasicCluster().

◆ energy_

float Multi5x5ClusterAlgo::ProtoBasicCluster::energy_
private

Definition at line 34 of file Multi5x5ClusterAlgo.h.

Referenced by energy(), and removeHit().

◆ hits_

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

Definition at line 36 of file Multi5x5ClusterAlgo.h.

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

◆ seed_

EcalRecHit Multi5x5ClusterAlgo::ProtoBasicCluster::seed_
private

Definition at line 35 of file Multi5x5ClusterAlgo.h.

Referenced by seed().