CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
Basic2DGenericTopoClusterizer Class Reference
Inheritance diagram for Basic2DGenericTopoClusterizer:
InitialClusteringStepBase

Public Member Functions

 Basic2DGenericTopoClusterizer (const edm::ParameterSet &conf, edm::ConsumesCollector &cc)
 
 Basic2DGenericTopoClusterizer (const B2DGT &)=delete
 
void buildClusters (const edm::Handle< reco::PFRecHitCollection > &, const std::vector< bool > &, const std::vector< bool > &, reco::PFClusterCollection &, const HcalPFCuts *) override
 
B2DGToperator= (const B2DGT &)=delete
 
 ~Basic2DGenericTopoClusterizer () override=default
 
- Public Member Functions inherited from InitialClusteringStepBase
 InitialClusteringStepBase (const edm::ParameterSet &conf, edm::ConsumesCollector &cc)
 
 InitialClusteringStepBase (const ICSB &)=delete
 
std::ostream & operator<< (std::ostream &o) const
 
ICSBoperator= (const ICSB &)=delete
 
void reset ()
 
virtual void update (const edm::EventSetup &)
 
virtual void updateEvent (const edm::Event &)
 
virtual ~InitialClusteringStepBase ()=default
 

Private Types

typedef Basic2DGenericTopoClusterizer B2DGT
 

Private Member Functions

void buildTopoCluster (const edm::Handle< reco::PFRecHitCollection > &, const std::vector< bool > &, unsigned int, std::vector< bool > &, reco::PFCluster &, const HcalPFCuts *)
 

Private Attributes

const bool _useCornerCells
 

Additional Inherited Members

- Protected Types inherited from InitialClusteringStepBase
typedef std::tuple< std::vector< int >, std::vector< double >, std::vector< double > > I3tuple
 
- Protected Member Functions inherited from InitialClusteringStepBase
reco::PFRecHitRef makeRefhit (const edm::Handle< reco::PFRecHitCollection > &h, const unsigned i) const
 
- Protected Attributes inherited from InitialClusteringStepBase
const std::unordered_map< std::string, int > _layerMap
 
unsigned _nClustersFound
 
unsigned _nSeeds
 
std::unordered_map< int, I3tuple_thresholds
 

Detailed Description

Definition at line 7 of file Basic2DGenericTopoClusterizer.cc.

Member Typedef Documentation

◆ B2DGT

Definition at line 8 of file Basic2DGenericTopoClusterizer.cc.

Constructor & Destructor Documentation

◆ Basic2DGenericTopoClusterizer() [1/2]

Basic2DGenericTopoClusterizer::Basic2DGenericTopoClusterizer ( const edm::ParameterSet conf,
edm::ConsumesCollector cc 
)
inline

Definition at line 11 of file Basic2DGenericTopoClusterizer.cc.

12  : InitialClusteringStepBase(conf, cc), _useCornerCells(conf.getParameter<bool>("useCornerCells")) {}
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
InitialClusteringStepBase(const edm::ParameterSet &conf, edm::ConsumesCollector &cc)

◆ ~Basic2DGenericTopoClusterizer()

Basic2DGenericTopoClusterizer::~Basic2DGenericTopoClusterizer ( )
overridedefault

◆ Basic2DGenericTopoClusterizer() [2/2]

Basic2DGenericTopoClusterizer::Basic2DGenericTopoClusterizer ( const B2DGT )
delete

Member Function Documentation

◆ buildClusters()

void Basic2DGenericTopoClusterizer::buildClusters ( const edm::Handle< reco::PFRecHitCollection > &  input,
const std::vector< bool > &  rechitMask,
const std::vector< bool > &  seedable,
reco::PFClusterCollection output,
const HcalPFCuts hcalCuts 
)
overridevirtual

Implements InitialClusteringStepBase.

Definition at line 47 of file Basic2DGenericTopoClusterizer.cc.

References buildTopoCluster(), hfClusterShapes_cfi::hits, mps_fire::i, input, dqmiolumiharvest::j, fileCollector::seed, HLT_2024v11_cff::seeds, jetUpdater_cfi::sort, and groupFilesInBlocks::temp.

51  {
52  auto const& hits = *input;
53  std::vector<bool> used(hits.size(), false);
54  std::vector<unsigned int> seeds;
55 
56  // get the seeds and sort them descending in energy
57  seeds.reserve(hits.size());
58  for (unsigned int i = 0; i < hits.size(); ++i) {
59  if (!rechitMask[i] || !seedable[i] || used[i])
60  continue;
61  seeds.emplace_back(i);
62  }
63  // maxHeap would be better
64  std::sort(
65  seeds.begin(), seeds.end(), [&](unsigned int i, unsigned int j) { return hits[i].energy() > hits[j].energy(); });
66 
68  for (auto seed : seeds) {
69  if (!rechitMask[seed] || !seedable[seed] || used[seed])
70  continue;
71  temp.reset();
72  buildTopoCluster(input, rechitMask, seed, used, temp, hcalCuts);
73  if (!temp.recHitFractions().empty())
74  output.push_back(temp);
75  }
76 }
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:42
void buildTopoCluster(const edm::Handle< reco::PFRecHitCollection > &, const std::vector< bool > &, unsigned int, std::vector< bool > &, reco::PFCluster &, const HcalPFCuts *)
static std::string const input
Definition: EdmProvDump.cc:50
Definition: output.py:1

◆ buildTopoCluster()

void Basic2DGenericTopoClusterizer::buildTopoCluster ( const edm::Handle< reco::PFRecHitCollection > &  input,
const std::vector< bool > &  rechitMask,
unsigned int  kcell,
std::vector< bool > &  used,
reco::PFCluster topocluster,
const HcalPFCuts hcalCuts 
)
private

Definition at line 78 of file Basic2DGenericTopoClusterizer.cc.

References InitialClusteringStepBase::_thresholds, _useCornerCells, funct::abs(), reco::PFCluster::addRecHitFraction(), hcalRecHitTable_cff::depth, HcalCondObjectContainer< Item >::getValues(), PFLayer::HCAL_BARREL1, PFLayer::HCAL_BARREL2, PFLayer::HCAL_ENDCAP, input, createfilelist::int, B2GTnPMonitor_cfi::item, dqmiolumiharvest::j, dqmdumpme::k, LOGDRESSED, InitialClusteringStepBase::makeRefhit(), DetId::rawId(), and particleFlowZeroSuppressionECAL_cff::thresholds.

Referenced by buildClusters().

83  {
84  auto const& cell = (*input)[kcell];
85  int cell_layer = (int)cell.layer();
86  if (cell_layer == PFLayer::HCAL_BARREL2 && std::abs(cell.positionREP().eta()) > 0.34) {
87  cell_layer *= 100;
88  }
89 
90  auto const& thresholds = _thresholds.find(cell_layer)->second;
91  double thresholdE = 0.;
92  double thresholdPT2 = 0.;
93 
94  for (unsigned int j = 0; j < (std::get<1>(thresholds)).size(); ++j) {
95  int depth = std::get<0>(thresholds)[j];
96 
97  if ((cell_layer == PFLayer::HCAL_BARREL1 && cell.depth() == depth) ||
98  (cell_layer == PFLayer::HCAL_ENDCAP && cell.depth() == depth) ||
99  (cell_layer != PFLayer::HCAL_BARREL1 && cell_layer != PFLayer::HCAL_ENDCAP)) {
100  thresholdE = std::get<1>(thresholds)[j];
101  thresholdPT2 = std::get<2>(thresholds)[j];
102  }
103  }
104 
105  if (hcalCuts != nullptr) { // this means, cutsFromDB is set to True in PFClusterProducer.cc
106  if ((cell_layer == PFLayer::HCAL_BARREL1) || (cell_layer == PFLayer::HCAL_ENDCAP)) {
107  HcalDetId thisId = cell.detId();
108  const HcalPFCut* item = hcalCuts->getValues(thisId.rawId());
109  thresholdE = item->noiseThreshold();
110  }
111  }
112 
113  if (cell.energy() < thresholdE || cell.pt2() < thresholdPT2) {
114  LOGDRESSED("GenericTopoCluster::buildTopoCluster()")
115  << "RecHit " << cell.detId() << " with enegy " << cell.energy() << " GeV was rejected!." << std::endl;
116  return;
117  }
118 
119  auto k = kcell;
120  used[k] = true;
121  auto ref = makeRefhit(input, k);
122  topocluster.addRecHitFraction(reco::PFRecHitFraction(ref, 1.0));
123 
124  auto const& neighbours = (_useCornerCells ? cell.neighbours8() : cell.neighbours4());
125 
126  for (auto nb : neighbours) {
127  if (used[nb] || !rechitMask[nb]) {
128  LOGDRESSED("GenericTopoCluster::buildTopoCluster()")
129  << " RecHit " << cell.detId() << "\'s"
130  << " neighbor RecHit " << input->at(nb).detId() << " with enegy " << input->at(nb).energy()
131  << " GeV was rejected!"
132  << " Reasons : " << used[nb] << " (used) " << !rechitMask[nb] << " (masked)." << std::endl;
133  continue;
134  }
135  buildTopoCluster(input, rechitMask, nb, used, topocluster, hcalCuts);
136  }
137 }
reco::PFRecHitRef makeRefhit(const edm::Handle< reco::PFRecHitCollection > &h, const unsigned i) const
Fraction of a PFRecHit (rechits can be shared between several PFCluster&#39;s)
void buildTopoCluster(const edm::Handle< reco::PFRecHitCollection > &, const std::vector< bool > &, unsigned int, std::vector< bool > &, reco::PFCluster &, const HcalPFCuts *)
const Item * getValues(DetId fId, bool throwOnFail=true) const
static std::string const input
Definition: EdmProvDump.cc:50
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
void addRecHitFraction(const reco::PFRecHitFraction &frac)
add a given fraction of the rechit
Definition: PFCluster.cc:33
#define LOGDRESSED(x)
std::unordered_map< int, I3tuple > _thresholds

◆ operator=()

B2DGT& Basic2DGenericTopoClusterizer::operator= ( const B2DGT )
delete

Member Data Documentation

◆ _useCornerCells

const bool Basic2DGenericTopoClusterizer::_useCornerCells
private

Definition at line 24 of file Basic2DGenericTopoClusterizer.cc.

Referenced by buildTopoCluster().