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

Definition at line 41 of file Multi5x5ClusterAlgo.h.

42  : energy_(iEnergy), seed_(iSeed) {
43  hits_.swap(iHits);
45  }

References containsSeed_, hits_, and isSeedCrysInHits_().

Member Function Documentation

◆ addSeed()

bool Multi5x5ClusterAlgo::ProtoBasicCluster::addSeed ( )

Definition at line 403 of file Multi5x5ClusterAlgo.cc.

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 }

References EcalBarrel.

◆ containsSeed()

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

Definition at line 50 of file Multi5x5ClusterAlgo.h.

50 { return containsSeed_; }

References containsSeed_.

◆ energy()

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

Definition at line 47 of file Multi5x5ClusterAlgo.h.

47 { return energy_; }

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.

49 { return hits_; }

References hits_.

Referenced by Multi5x5ClusterAlgo::mainSearch().

◆ isSeedCrysInHits_()

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

Definition at line 423 of file Multi5x5ClusterAlgo.cc.

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 }

Referenced by ProtoBasicCluster().

◆ removeHit()

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

Definition at line 387 of file Multi5x5ClusterAlgo.cc.

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 }

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

◆ seed()

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

Definition at line 48 of file Multi5x5ClusterAlgo.h.

48 { return seed_; }

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

Multi5x5ClusterAlgo::ProtoBasicCluster::hits_
std::vector< std::pair< DetId, float > > hits_
Definition: Multi5x5ClusterAlgo.h:36
EcalRecHit::id
DetId id() const
get the id
Definition: EcalRecHit.h:77
Multi5x5ClusterAlgo::ProtoBasicCluster::energy_
float energy_
Definition: Multi5x5ClusterAlgo.h:34
Multi5x5ClusterAlgo::ProtoBasicCluster::seed_
EcalRecHit seed_
Definition: Multi5x5ClusterAlgo.h:35
EcalRecHit::energy
float energy() const
Definition: EcalRecHit.h:68
PairSortByFirst
Definition: Multi5x5ClusterAlgo.cc:16
EcalBarrel
Definition: EcalSubdetector.h:10
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
Multi5x5ClusterAlgo::ProtoBasicCluster::containsSeed_
bool containsSeed_
Definition: Multi5x5ClusterAlgo.h:37
Multi5x5ClusterAlgo::ProtoBasicCluster::isSeedCrysInHits_
bool isSeedCrysInHits_() const
Definition: Multi5x5ClusterAlgo.cc:423