CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
HGCalCLUEAlgoT< TILE, STRATEGY > Class Template Reference

#include <HGCalCLUEAlgo.h>

Inheritance diagram for HGCalCLUEAlgoT< TILE, STRATEGY >:
HGCalClusteringAlgoBase

Classes

struct  CellsOnLayer
 

Public Types

typedef math::XYZPoint Point
 point in the space More...
 
- Public Types inherited from HGCalClusteringAlgoBase
enum  VerbosityLevel { pDEBUG = 0, pWARNING = 1, pINFO = 2, pERROR = 3 }
 

Public Member Functions

void computeThreshold ()
 
std::vector< reco::BasicClustergetClusters (bool) override
 
void getEventSetupPerAlgorithm (const edm::EventSetup &es) override
 
 HGCalCLUEAlgoT (const edm::ParameterSet &ps)
 
void makeClusters () override
 
void populate (const HGCRecHitCollection &hits) override
 
void reset () override
 
 ~HGCalCLUEAlgoT () override
 
- Public Member Functions inherited from HGCalClusteringAlgoBase
virtual hgcal_clustering::Density getDensity ()
 
void getEventSetup (const edm::EventSetup &es, hgcal::RecHitTools rhtools)
 
 HGCalClusteringAlgoBase (VerbosityLevel v, reco::CaloCluster::AlgoId algo)
 
void setAlgoId (reco::CaloCluster::AlgoId algo, bool isNose=false)
 
void setVerbosity (VerbosityLevel the_verbosity)
 
virtual ~HGCalClusteringAlgoBase ()
 

Static Public Member Functions

static void fillPSetDescription (edm::ParameterSetDescription &iDesc)
 

Private Member Functions

void calculateDistanceToHigher (const TILE &lt, const unsigned int layerId, float delta)
 
void calculateLocalDensity (const TILE &lt, const unsigned int layerId, float delta)
 
void calculateLocalDensity (const TILE &lt, const unsigned int layerId, float delta, HGCalSiliconStrategy strategy)
 
void calculateLocalDensity (const TILE &lt, const unsigned int layerId, float delta, HGCalScintillatorStrategy strategy)
 
float distance (const TILE &lt, int cell1, int cell2, int layerId) const
 
int findAndAssignClusters (const unsigned int layerId, float delta)
 
void prepareDataStructures (const unsigned int layerId)
 

Private Attributes

std::vector< CellsOnLayercells_
 
std::vector< double > dEdXweights_
 
int deltasi_index_regemfac_
 
bool dependSensor_
 
double ecut_
 
double fcPerEle_
 
std::vector< double > fcPerMip_
 
bool initialized_
 
double kappa_
 
unsigned maxNumberOfThickIndices_
 
double noiseMip_
 
std::vector< double > nonAgedNoises_
 
std::vector< int > numberOfClustersPerLayer_
 
float outlierDeltaFactor_ = 2.f
 
double sciThicknessCorrection_
 
std::vector< double > thicknessCorrection_
 
std::vector< std::vector< double > > thresholds_
 
bool use2x2_
 
std::vector< std::vector< double > > v_sigmaNoise_
 
std::vector< double > vecDeltas_
 

Additional Inherited Members

- Public Attributes inherited from HGCalClusteringAlgoBase
unsigned int firstLayerBH_
 
bool isNose_
 
unsigned int lastLayerEE_
 
unsigned int lastLayerFH_
 
unsigned int maxlayer_
 
int scintMaxIphi_
 
- Protected Attributes inherited from HGCalClusteringAlgoBase
reco::CaloCluster::AlgoId algoId_
 
edm::ESGetToken< CaloGeometry, CaloGeometryRecordcaloGeomToken_
 
std::vector< reco::BasicClusterclusters_v_
 
hgcal::RecHitTools rhtools_
 
VerbosityLevel verbosity_
 

Detailed Description

template<typename TILE, typename STRATEGY>
class HGCalCLUEAlgoT< TILE, STRATEGY >

Definition at line 29 of file HGCalCLUEAlgo.h.

Member Typedef Documentation

◆ Point

template<typename TILE , typename STRATEGY >
typedef math::XYZPoint HGCalCLUEAlgoT< TILE, STRATEGY >::Point

point in the space

Definition at line 116 of file HGCalCLUEAlgo.h.

Constructor & Destructor Documentation

◆ HGCalCLUEAlgoT()

template<typename TILE , typename STRATEGY >
HGCalCLUEAlgoT< TILE, STRATEGY >::HGCalCLUEAlgoT ( const edm::ParameterSet ps)
inline

Definition at line 31 of file HGCalCLUEAlgo.h.

33  (HGCalClusteringAlgoBase::VerbosityLevel)ps.getUntrackedParameter<unsigned int>("verbosity", 3),
35  vecDeltas_(ps.getParameter<std::vector<double>>("deltac")),
36  kappa_(ps.getParameter<double>("kappa")),
37  ecut_(ps.getParameter<double>("ecut")),
38  dependSensor_(ps.getParameter<bool>("dependSensor")),
39  dEdXweights_(ps.getParameter<std::vector<double>>("dEdXweights")),
40  thicknessCorrection_(ps.getParameter<std::vector<double>>("thicknessCorrection")),
41  sciThicknessCorrection_(ps.getParameter<double>("sciThicknessCorrection")),
42  deltasi_index_regemfac_(ps.getParameter<int>("deltasi_index_regemfac")),
43  maxNumberOfThickIndices_(ps.getParameter<unsigned>("maxNumberOfThickIndices")),
44  fcPerMip_(ps.getParameter<std::vector<double>>("fcPerMip")),
45  fcPerEle_(ps.getParameter<double>("fcPerEle")),
46  nonAgedNoises_(ps.getParameter<std::vector<double>>("noises")),
47  noiseMip_(ps.getParameter<edm::ParameterSet>("noiseMip").getParameter<double>("noise_MIP")),
48  use2x2_(ps.getParameter<bool>("use2x2")),
49  initialized_(false) {}
std::vector< double > nonAgedNoises_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::vector< double > vecDeltas_
int deltasi_index_regemfac_
T getUntrackedParameter(std::string const &, T const &) const
HGCalClusteringAlgoBase(VerbosityLevel v, reco::CaloCluster::AlgoId algo)
double sciThicknessCorrection_
std::vector< double > thicknessCorrection_
std::vector< double > fcPerMip_
std::vector< double > dEdXweights_
unsigned maxNumberOfThickIndices_

◆ ~HGCalCLUEAlgoT()

template<typename TILE , typename STRATEGY >
HGCalCLUEAlgoT< TILE, STRATEGY >::~HGCalCLUEAlgoT ( )
inlineoverride

Definition at line 51 of file HGCalCLUEAlgo.h.

51 {}

Member Function Documentation

◆ calculateDistanceToHigher()

template<typename TILE , typename STRATEGY >
void HGCalCLUEAlgoT< T, STRATEGY >::calculateDistanceToHigher ( const TILE &  lt,
const unsigned int  layerId,
float  delta 
)
private

Definition at line 292 of file HGCalCLUEAlgo.cc.

References dumpMFGeometry_cfg::delta, HLT_2023v12_cff::distance, mps_fire::i, dqmiolumiharvest::j, LogDebug, SiStripPI::max, allConversions_cfi::maxDelta, and FastTimerService_cff::range.

292  {
293  auto& cellsOnLayer = cells_[layerId];
294  unsigned int numberOfCells = cellsOnLayer.detid.size();
295 
296  for (unsigned int i = 0; i < numberOfCells; i++) {
297  // initialize delta and nearest higher for i
299  float i_delta = maxDelta;
300  int i_nearestHigher = -1;
302  std::array<int, 4> search_box = lt.searchBox(cellsOnLayer.dim1[i] - range,
303  cellsOnLayer.dim1[i] + range,
304  cellsOnLayer.dim2[i] - range,
305  cellsOnLayer.dim2[i] + range);
306  // loop over all bins in the search box
307  for (int dim1Bin = search_box[0]; dim1Bin < search_box[1] + 1; ++dim1Bin) {
308  for (int dim2Bin = search_box[2]; dim2Bin < search_box[3] + 1; ++dim2Bin) {
309  // get the id of this bin
310  size_t binId = lt.getGlobalBinByBin(dim1Bin, dim2Bin);
311  if constexpr (std::is_same_v<STRATEGY, HGCalScintillatorStrategy>)
312  binId = lt.getGlobalBinByBin(dim1Bin, (dim2Bin % T::type::nRows));
313  // get the size of this bin
314  size_t binSize = lt[binId].size();
315 
316  // loop over all hits in this bin
317  for (unsigned int j = 0; j < binSize; j++) {
318  unsigned int otherId = lt[binId][j];
319  float dist = distance(lt, i, otherId, layerId);
320  bool foundHigher =
321  (cellsOnLayer.rho[otherId] > cellsOnLayer.rho[i]) ||
322  (cellsOnLayer.rho[otherId] == cellsOnLayer.rho[i] && cellsOnLayer.detid[otherId] > cellsOnLayer.detid[i]);
323  if (foundHigher && dist <= i_delta) {
324  // update i_delta
325  i_delta = dist;
326  // update i_nearestHigher
327  i_nearestHigher = otherId;
328  }
329  }
330  }
331  }
332  bool foundNearestHigherInSearchBox = (i_delta != maxDelta);
333  if (foundNearestHigherInSearchBox) {
334  cellsOnLayer.delta[i] = i_delta;
335  cellsOnLayer.nearestHigher[i] = i_nearestHigher;
336  } else {
337  // otherwise delta is guaranteed to be larger outlierDeltaFactor_*delta_c
338  // we can safely maximize delta to be maxDelta
339  cellsOnLayer.delta[i] = maxDelta;
340  cellsOnLayer.nearestHigher[i] = -1;
341  }
342 
343  LogDebug("HGCalCLUEAlgo") << "Debugging calculateDistanceToHigher: \n"
344  << " cell: " << i << " eta: " << cellsOnLayer.dim1[i] << " phi: " << cellsOnLayer.dim2[i]
345  << " energy: " << cellsOnLayer.weight[i] << " density: " << cellsOnLayer.rho[i]
346  << " nearest higher: " << cellsOnLayer.nearestHigher[i]
347  << " distance: " << cellsOnLayer.delta[i] << "\n";
348  }
349 }
float outlierDeltaFactor_
float distance(const TILE &lt, int cell1, int cell2, int layerId) const
std::vector< CellsOnLayer > cells_
#define LogDebug(id)

◆ calculateLocalDensity() [1/3]

template<typename TILE , typename STRATEGY >
void HGCalCLUEAlgoT< TILE, STRATEGY >::calculateLocalDensity ( const TILE &  lt,
const unsigned int  layerId,
float  delta 
)
private

◆ calculateLocalDensity() [2/3]

template<typename TILE , typename STRATEGY >
void HGCalCLUEAlgoT< TILE, STRATEGY >::calculateLocalDensity ( const TILE &  lt,
const unsigned int  layerId,
float  delta,
HGCalSiliconStrategy  strategy 
)
private

◆ calculateLocalDensity() [3/3]

template<typename TILE , typename STRATEGY >
void HGCalCLUEAlgoT< TILE, STRATEGY >::calculateLocalDensity ( const TILE &  lt,
const unsigned int  layerId,
float  delta,
HGCalScintillatorStrategy  strategy 
)
private

◆ computeThreshold()

template<typename T , typename STRATEGY >
void HGCalCLUEAlgoT< T, STRATEGY >::computeThreshold ( )

Definition at line 397 of file HGCalCLUEAlgo.cc.

References LogDebug.

397  {
398  // To support the TDR geometry and also the post-TDR one (v9 onwards), we
399  // need to change the logic of the vectors containing signal to noise and
400  // thresholds. The first 3 indices will keep on addressing the different
401  // thicknesses of the Silicon detectors in CE_E , the next 3 indices will address
402  // the thicknesses of the Silicon detectors in CE_H, while the last one, number 6 (the
403  // seventh) will address the Scintillators. This change will support both
404  // geometries at the same time.
405 
406  if (initialized_)
407  return; // only need to calculate thresholds once
408 
409  initialized_ = true;
410 
411  std::vector<double> dummy;
412 
413  dummy.resize(maxNumberOfThickIndices_ + !isNose_, 0); // +1 to accomodate for the Scintillators
414  thresholds_.resize(maxlayer_, dummy);
415  v_sigmaNoise_.resize(maxlayer_, dummy);
416 
417  for (unsigned ilayer = 1; ilayer <= maxlayer_; ++ilayer) {
418  for (unsigned ithick = 0; ithick < maxNumberOfThickIndices_; ++ithick) {
419  float sigmaNoise = 0.001f * fcPerEle_ * nonAgedNoises_[ithick] * dEdXweights_[ilayer] /
420  (fcPerMip_[ithick] * thicknessCorrection_[ithick]);
421  thresholds_[ilayer - 1][ithick] = sigmaNoise * ecut_;
422  v_sigmaNoise_[ilayer - 1][ithick] = sigmaNoise;
423  LogDebug("HGCalCLUEAlgo") << "ilayer: " << ilayer << " nonAgedNoises: " << nonAgedNoises_[ithick]
424  << " fcPerEle: " << fcPerEle_ << " fcPerMip: " << fcPerMip_[ithick]
425  << " noiseMip: " << fcPerEle_ * nonAgedNoises_[ithick] / fcPerMip_[ithick]
426  << " sigmaNoise: " << sigmaNoise << "\n";
427  }
428 
429  if (!isNose_) {
430  float scintillators_sigmaNoise = 0.001f * noiseMip_ * dEdXweights_[ilayer] / sciThicknessCorrection_;
431  thresholds_[ilayer - 1][maxNumberOfThickIndices_] = ecut_ * scintillators_sigmaNoise;
432  v_sigmaNoise_[ilayer - 1][maxNumberOfThickIndices_] = scintillators_sigmaNoise;
433  LogDebug("HGCalCLUEAlgo") << "ilayer: " << ilayer << " noiseMip: " << noiseMip_
434  << " scintillators_sigmaNoise: " << scintillators_sigmaNoise << "\n";
435  }
436  }
437 }
std::vector< double > nonAgedNoises_
double sciThicknessCorrection_
std::vector< double > thicknessCorrection_
std::vector< double > fcPerMip_
std::vector< double > dEdXweights_
std::vector< std::vector< double > > v_sigmaNoise_
unsigned maxNumberOfThickIndices_
std::vector< std::vector< double > > thresholds_
#define LogDebug(id)

◆ distance()

template<typename TILE , typename STRATEGY >
float HGCalCLUEAlgoT< TILE, STRATEGY >::distance ( const TILE &  lt,
int  cell1,
int  cell2,
int  layerId 
) const
inlineprivate

Definition at line 196 of file HGCalCLUEAlgo.h.

References hgcalTopologyTester_cfi::cell1, hgcalTopologyTester_cfi::cell2, HGCalCLUEAlgoT< TILE, STRATEGY >::cells_, and mathSSE::sqrt().

196  { // 2-d distance on the layer (x-y)
197  return std::sqrt(lt.distance2(cells_[layerId].dim1[cell1],
198  cells_[layerId].dim2[cell1],
199  cells_[layerId].dim1[cell2],
200  cells_[layerId].dim2[cell2]));
201  }
T sqrt(T t)
Definition: SSEVec.h:19
std::vector< CellsOnLayer > cells_

◆ fillPSetDescription()

template<typename TILE , typename STRATEGY >
static void HGCalCLUEAlgoT< TILE, STRATEGY >::fillPSetDescription ( edm::ParameterSetDescription iDesc)
inlinestatic

Definition at line 80 of file HGCalCLUEAlgo.h.

References edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addUntracked(), and AlCaHLTBitMon_QueryRunRegistry::string.

80  {
81  iDesc.add<std::vector<double>>("thresholdW0", {2.9, 2.9, 2.9});
82  iDesc.add<double>("positionDeltaRho2", 1.69);
83  iDesc.add<std::vector<double>>("deltac",
84  {
85  1.3,
86  1.3,
87  1.3,
88  0.0315, // for scintillator
89  });
90  iDesc.add<bool>("dependSensor", true);
91  iDesc.add<double>("ecut", 3.0);
92  iDesc.add<double>("kappa", 9.0);
93  iDesc.addUntracked<unsigned int>("verbosity", 3);
94  iDesc.add<std::vector<double>>("dEdXweights", {});
95  iDesc.add<std::vector<double>>("thicknessCorrection", {});
96  iDesc.add<double>("sciThicknessCorrection", 0.9);
97  iDesc.add<int>("deltasi_index_regemfac", 3);
98  iDesc.add<unsigned>("maxNumberOfThickIndices", 6);
99  iDesc.add<std::vector<double>>("fcPerMip", {});
100  iDesc.add<double>("fcPerEle", 0.0);
101  iDesc.add<std::vector<double>>("noises", {});
102  edm::ParameterSetDescription descNestedNoiseMIP;
103  descNestedNoiseMIP.add<bool>("scaleByDose", false);
104  descNestedNoiseMIP.add<unsigned int>("scaleByDoseAlgo", 0);
105  descNestedNoiseMIP.add<double>("scaleByDoseFactor", 1.);
106  descNestedNoiseMIP.add<std::string>("doseMap", "");
107  descNestedNoiseMIP.add<std::string>("sipmMap", "");
108  descNestedNoiseMIP.add<double>("referenceIdark", -1);
109  descNestedNoiseMIP.add<double>("referenceXtalk", -1);
110  descNestedNoiseMIP.add<double>("noise_MIP", 1. / 100.);
111  iDesc.add<edm::ParameterSetDescription>("noiseMip", descNestedNoiseMIP);
112  iDesc.add<bool>("use2x2", true); // use 2x2 or 3x3 scenario for scint density calculation
113  }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
ParameterDescriptionBase * add(U const &iLabel, T const &value)

◆ findAndAssignClusters()

template<typename T , typename STRATEGY >
int HGCalCLUEAlgoT< T, STRATEGY >::findAndAssignClusters ( const unsigned int  layerId,
float  delta 
)
private

Definition at line 352 of file HGCalCLUEAlgo.cc.

References dumpMFGeometry_cfg::delta, mps_fire::i, and dqmiolumiharvest::j.

352  {
353  // this is called once per layer and endcap...
354  // so when filling the cluster temporary vector of Hexels we resize each time
355  // by the number of clusters found. This is always equal to the number of
356  // cluster centers...
357  unsigned int nClustersOnLayer = 0;
358  auto& cellsOnLayer = cells_[layerId];
359  unsigned int numberOfCells = cellsOnLayer.detid.size();
360  std::vector<int> localStack;
361  // find cluster seeds and outlier
362  for (unsigned int i = 0; i < numberOfCells; i++) {
363  float rho_c = kappa_ * cellsOnLayer.sigmaNoise[i];
364  // initialize clusterIndex
365  cellsOnLayer.clusterIndex[i] = -1;
366  bool isSeed = (cellsOnLayer.delta[i] > delta) && (cellsOnLayer.rho[i] >= rho_c);
367  bool isOutlier = (cellsOnLayer.delta[i] > outlierDeltaFactor_ * delta) && (cellsOnLayer.rho[i] < rho_c);
368  if (isSeed) {
369  cellsOnLayer.clusterIndex[i] = nClustersOnLayer;
370  cellsOnLayer.isSeed[i] = true;
371  nClustersOnLayer++;
372  localStack.push_back(i);
373 
374  } else if (!isOutlier) {
375  cellsOnLayer.followers[cellsOnLayer.nearestHigher[i]].push_back(i);
376  }
377  }
378 
379  // need to pass clusterIndex to their followers
380  while (!localStack.empty()) {
381  int endStack = localStack.back();
382  auto& thisSeed = cellsOnLayer.followers[endStack];
383  localStack.pop_back();
384 
385  // loop over followers
386  for (int j : thisSeed) {
387  // pass id to a follower
388  cellsOnLayer.clusterIndex[j] = cellsOnLayer.clusterIndex[endStack];
389  // push this follower to localStack
390  localStack.push_back(j);
391  }
392  }
393  return nClustersOnLayer;
394 }
float outlierDeltaFactor_
std::vector< CellsOnLayer > cells_

◆ getClusters()

template<typename T , typename STRATEGY >
std::vector< reco::BasicCluster > HGCalCLUEAlgoT< T, STRATEGY >::getClusters ( bool  )
overridevirtual

Implements HGCalClusteringAlgoBase.

Definition at line 130 of file HGCalCLUEAlgo.cc.

References haddnano::cl, reco::CaloID::DET_HGCAL_ENDCAP, hcalRecHitTable_cff::energy, f, mps_fire::i, SiStripPI::max, unpackBuffers-CaloStage1::offsets, and position.

130  {
131  std::vector<int> offsets(numberOfClustersPerLayer_.size(), 0);
132 
133  int maxClustersOnLayer = numberOfClustersPerLayer_[0];
134 
135  for (unsigned layerId = 1; layerId < offsets.size(); ++layerId) {
136  offsets[layerId] = offsets[layerId - 1] + numberOfClustersPerLayer_[layerId - 1];
137 
138  maxClustersOnLayer = std::max(maxClustersOnLayer, numberOfClustersPerLayer_[layerId]);
139  }
140 
141  auto totalNumberOfClusters = offsets.back() + numberOfClustersPerLayer_.back();
142  clusters_v_.resize(totalNumberOfClusters);
143  std::vector<std::vector<int>> cellsIdInCluster;
144  cellsIdInCluster.reserve(maxClustersOnLayer);
145 
146  for (unsigned int layerId = 0; layerId < 2 * maxlayer_ + 2; ++layerId) {
147  cellsIdInCluster.resize(numberOfClustersPerLayer_[layerId]);
148  auto& cellsOnLayer = cells_[layerId];
149  unsigned int numberOfCells = cellsOnLayer.detid.size();
150  auto firstClusterIdx = offsets[layerId];
151 
152  for (unsigned int i = 0; i < numberOfCells; ++i) {
153  auto clusterIndex = cellsOnLayer.clusterIndex[i];
154  if (clusterIndex != -1)
155  cellsIdInCluster[clusterIndex].push_back(i);
156  }
157 
158  std::vector<std::pair<DetId, float>> thisCluster;
159 
160  for (auto& cl : cellsIdInCluster) {
162  float energy = 0.f;
163  int seedDetId = -1;
164 
165  for (auto cellIdx : cl) {
166  energy += cellsOnLayer.weight[cellIdx];
167  thisCluster.emplace_back(cellsOnLayer.detid[cellIdx], 1.f);
168  if (cellsOnLayer.isSeed[cellIdx]) {
169  seedDetId = cellsOnLayer.detid[cellIdx];
170  }
171  }
172  auto globalClusterIndex = cellsOnLayer.clusterIndex[cl[0]] + firstClusterIdx;
173 
174  clusters_v_[globalClusterIndex] =
176  clusters_v_[globalClusterIndex].setSeed(seedDetId);
177  thisCluster.clear();
178  }
179 
180  cellsIdInCluster.clear();
181  }
182  return clusters_v_;
183 }
CaloCluster BasicCluster
std::vector< reco::BasicCluster > clusters_v_
double f[11][100]
reco::CaloCluster::AlgoId algoId_
std::vector< int > numberOfClustersPerLayer_
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
std::vector< CellsOnLayer > cells_
static int position[264][3]
Definition: ReadPGInfo.cc:289

◆ getEventSetupPerAlgorithm()

template<typename T , typename STRATEGY >
void HGCalCLUEAlgoT< T, STRATEGY >::getEventSetupPerAlgorithm ( const edm::EventSetup es)
overridevirtual

Reimplemented from HGCalClusteringAlgoBase.

Definition at line 20 of file HGCalCLUEAlgo.cc.

20  {
21  cells_.clear();
23  cells_.resize(2 * (maxlayer_ + 1));
24  numberOfClustersPerLayer_.resize(2 * (maxlayer_ + 1), 0);
25 }
std::vector< int > numberOfClustersPerLayer_
std::vector< CellsOnLayer > cells_

◆ makeClusters()

template<typename T , typename STRATEGY >
void HGCalCLUEAlgoT< T, STRATEGY >::makeClusters ( )
overridevirtual

Implements HGCalClusteringAlgoBase.

Definition at line 95 of file HGCalCLUEAlgo.cc.

References dumpMFGeometry_cfg::delta, hitfit::delta_r(), mps_fire::i, and LogDebug.

95  {
96  // assign all hits in each layer to a cluster core
97  tbb::this_task_arena::isolate([&] {
98  tbb::parallel_for(size_t(0), size_t(2 * maxlayer_ + 2), [&](size_t i) {
100  T lt;
101  lt.clear();
102  lt.fill(cells_[i].dim1, cells_[i].dim2);
103 
104  float delta;
105  if constexpr (std::is_same_v<STRATEGY, HGCalSiliconStrategy>) {
106  // maximum search distance (critical distance) for local density calculation
107  float delta_c;
108  if (i % maxlayer_ < lastLayerEE_)
109  delta_c = vecDeltas_[0];
110  else if (i % maxlayer_ < (firstLayerBH_ - 1))
111  delta_c = vecDeltas_[1];
112  else
113  delta_c = vecDeltas_[2];
114  delta = delta_c;
115  } else {
116  float delta_r = vecDeltas_[3];
117  delta = delta_r;
118  }
119  LogDebug("HGCalCLUEAlgo") << "maxlayer: " << maxlayer_ << " lastLayerEE: " << lastLayerEE_
120  << " firstLayerBH: " << firstLayerBH_ << "\n";
121 
125  });
126  });
127 }
std::vector< double > vecDeltas_
void calculateDistanceToHigher(const TILE &lt, const unsigned int layerId, float delta)
double delta_r(const Fourvec &a, const Fourvec &b)
Find the distance between two four-vectors in the two-dimensional space .
Definition: fourvec.cc:238
std::vector< int > numberOfClustersPerLayer_
void calculateLocalDensity(const TILE &lt, const unsigned int layerId, float delta)
std::vector< CellsOnLayer > cells_
void prepareDataStructures(const unsigned int layerId)
long double T
int findAndAssignClusters(const unsigned int layerId, float delta)
#define LogDebug(id)

◆ populate()

template<typename T , typename STRATEGY >
void HGCalCLUEAlgoT< T, STRATEGY >::populate ( const HGCRecHitCollection hits)
overridevirtual

Implements HGCalClusteringAlgoBase.

Definition at line 28 of file HGCalCLUEAlgo.cc.

References DetId::det(), CaloRecHit::detid(), CaloRecHit::energy(), DetId::HGCalHSi, HGCHEF, hfClusterShapes_cfi::hits, mps_fire::i, hltrates_dqm_sourceclient-live_cfg::offset, position, and DetId::subdetId().

28  {
29  // loop over all hits and create the Hexel structure, skip energies below ecut
30  if (dependSensor_) {
31  // for each layer and wafer calculate the thresholds (sigmaNoise and energy)
32  // once
34  }
35 
36  for (unsigned int i = 0; i < hits.size(); ++i) {
37  const HGCRecHit& hgrh = hits[i];
38  DetId detid = hgrh.detid();
39  unsigned int layerOnSide = (rhtools_.getLayerWithOffset(detid) - 1);
40 
41  // set sigmaNoise default value 1 to use kappa value directly in case of
42  // sensor-independent thresholds
43  float sigmaNoise = 1.f;
44  if (dependSensor_) {
45  int thickness_index = rhtools_.getSiThickIndex(detid);
46  if (thickness_index == -1)
47  thickness_index = maxNumberOfThickIndices_;
48 
49  double storedThreshold = thresholds_[layerOnSide][thickness_index];
50  if (detid.det() == DetId::HGCalHSi || detid.subdetId() == HGCHEF) {
51  storedThreshold = thresholds_[layerOnSide][thickness_index + deltasi_index_regemfac_];
52  }
53  sigmaNoise = v_sigmaNoise_[layerOnSide][thickness_index];
54 
55  if (hgrh.energy() < storedThreshold)
56  continue; // this sets the ZS threshold at ecut times the sigma noise
57  // for the sensor
58  }
59  if (!dependSensor_ && hgrh.energy() < ecut_)
60  continue;
62  int offset = ((rhtools_.zside(detid) + 1) >> 1) * maxlayer_;
63  int layer = layerOnSide + offset;
64 
65  cells_[layer].detid.emplace_back(detid);
66  if constexpr (std::is_same_v<STRATEGY, HGCalScintillatorStrategy>) {
67  cells_[layer].dim1.emplace_back(position.eta());
68  cells_[layer].dim2.emplace_back(position.phi());
69  } // else, isSilicon == true and eta phi values will not be used
70  else {
71  cells_[layer].dim1.emplace_back(position.x());
72  cells_[layer].dim2.emplace_back(position.y());
73  }
74  cells_[layer].weight.emplace_back(hgrh.energy());
75  cells_[layer].sigmaNoise.emplace_back(sigmaNoise);
76  }
77 }
void computeThreshold()
constexpr const DetId & detid() const
Definition: CaloRecHit.h:33
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
int zside(const DetId &id) const
Definition: RecHitTools.cc:174
int deltasi_index_regemfac_
constexpr float energy() const
Definition: CaloRecHit.h:29
GlobalPoint getPosition(const DetId &id) const
Definition: RecHitTools.cc:140
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
Definition: DetId.h:17
std::vector< std::vector< double > > v_sigmaNoise_
unsigned maxNumberOfThickIndices_
std::vector< CellsOnLayer > cells_
static int position[264][3]
Definition: ReadPGInfo.cc:289
std::vector< std::vector< double > > thresholds_
int getSiThickIndex(const DetId &) const
Definition: RecHitTools.cc:216
unsigned int getLayerWithOffset(const DetId &) const
Definition: RecHitTools.cc:376

◆ prepareDataStructures()

template<typename T , typename STRATEGY >
void HGCalCLUEAlgoT< T, STRATEGY >::prepareDataStructures ( const unsigned int  layerId)
private

Definition at line 80 of file HGCalCLUEAlgo.cc.

References f, and MainPageGenerator::l.

80  {
81  auto cellsSize = cells_[l].detid.size();
82  cells_[l].rho.resize(cellsSize, 0.f);
83  cells_[l].delta.resize(cellsSize, 9999999);
84  cells_[l].nearestHigher.resize(cellsSize, -1);
85  cells_[l].clusterIndex.resize(cellsSize, -1);
86  cells_[l].followers.resize(cellsSize);
87  cells_[l].isSeed.resize(cellsSize, false);
88 }
double f[11][100]
std::vector< CellsOnLayer > cells_

◆ reset()

template<typename TILE , typename STRATEGY >
void HGCalCLUEAlgoT< TILE, STRATEGY >::reset ( void  )
inlineoverridevirtual

Implements HGCalClusteringAlgoBase.

Definition at line 65 of file HGCalCLUEAlgo.h.

References hgcalTBTopologyTester_cfi::cells, HGCalCLUEAlgoT< TILE, STRATEGY >::cells_, haddnano::cl, HGCalClusteringAlgoBase::clusters_v_, and HGCalCLUEAlgoT< TILE, STRATEGY >::numberOfClustersPerLayer_.

65  {
66  clusters_v_.clear();
67  clusters_v_.shrink_to_fit();
68  for (auto& cl : numberOfClustersPerLayer_) {
69  cl = 0;
70  }
71 
72  for (auto& cells : cells_) {
73  cells.clear();
74  cells.shrink_to_fit();
75  }
76  }
std::vector< reco::BasicCluster > clusters_v_
std::vector< int > numberOfClustersPerLayer_
std::vector< CellsOnLayer > cells_

Member Data Documentation

◆ cells_

template<typename TILE , typename STRATEGY >
std::vector<CellsOnLayer> HGCalCLUEAlgoT< TILE, STRATEGY >::cells_
private

◆ dEdXweights_

template<typename TILE , typename STRATEGY >
std::vector<double> HGCalCLUEAlgoT< TILE, STRATEGY >::dEdXweights_
private

Definition at line 129 of file HGCalCLUEAlgo.h.

◆ deltasi_index_regemfac_

template<typename TILE , typename STRATEGY >
int HGCalCLUEAlgoT< TILE, STRATEGY >::deltasi_index_regemfac_
private

Definition at line 132 of file HGCalCLUEAlgo.h.

◆ dependSensor_

template<typename TILE , typename STRATEGY >
bool HGCalCLUEAlgoT< TILE, STRATEGY >::dependSensor_
private

Definition at line 128 of file HGCalCLUEAlgo.h.

◆ ecut_

template<typename TILE , typename STRATEGY >
double HGCalCLUEAlgoT< TILE, STRATEGY >::ecut_
private

Definition at line 124 of file HGCalCLUEAlgo.h.

◆ fcPerEle_

template<typename TILE , typename STRATEGY >
double HGCalCLUEAlgoT< TILE, STRATEGY >::fcPerEle_
private

Definition at line 135 of file HGCalCLUEAlgo.h.

◆ fcPerMip_

template<typename TILE , typename STRATEGY >
std::vector<double> HGCalCLUEAlgoT< TILE, STRATEGY >::fcPerMip_
private

Definition at line 134 of file HGCalCLUEAlgo.h.

◆ initialized_

template<typename TILE , typename STRATEGY >
bool HGCalCLUEAlgoT< TILE, STRATEGY >::initialized_
private

Definition at line 144 of file HGCalCLUEAlgo.h.

◆ kappa_

template<typename TILE , typename STRATEGY >
double HGCalCLUEAlgoT< TILE, STRATEGY >::kappa_
private

Definition at line 121 of file HGCalCLUEAlgo.h.

◆ maxNumberOfThickIndices_

template<typename TILE , typename STRATEGY >
unsigned HGCalCLUEAlgoT< TILE, STRATEGY >::maxNumberOfThickIndices_
private

Definition at line 133 of file HGCalCLUEAlgo.h.

◆ noiseMip_

template<typename TILE , typename STRATEGY >
double HGCalCLUEAlgoT< TILE, STRATEGY >::noiseMip_
private

Definition at line 137 of file HGCalCLUEAlgo.h.

◆ nonAgedNoises_

template<typename TILE , typename STRATEGY >
std::vector<double> HGCalCLUEAlgoT< TILE, STRATEGY >::nonAgedNoises_
private

Definition at line 136 of file HGCalCLUEAlgo.h.

◆ numberOfClustersPerLayer_

template<typename TILE , typename STRATEGY >
std::vector<int> HGCalCLUEAlgoT< TILE, STRATEGY >::numberOfClustersPerLayer_
private

Definition at line 194 of file HGCalCLUEAlgo.h.

Referenced by HGCalCLUEAlgoT< TILE, STRATEGY >::reset().

◆ outlierDeltaFactor_

template<typename TILE , typename STRATEGY >
float HGCalCLUEAlgoT< TILE, STRATEGY >::outlierDeltaFactor_ = 2.f
private

Definition at line 146 of file HGCalCLUEAlgo.h.

◆ sciThicknessCorrection_

template<typename TILE , typename STRATEGY >
double HGCalCLUEAlgoT< TILE, STRATEGY >::sciThicknessCorrection_
private

Definition at line 131 of file HGCalCLUEAlgo.h.

◆ thicknessCorrection_

template<typename TILE , typename STRATEGY >
std::vector<double> HGCalCLUEAlgoT< TILE, STRATEGY >::thicknessCorrection_
private

Definition at line 130 of file HGCalCLUEAlgo.h.

◆ thresholds_

template<typename TILE , typename STRATEGY >
std::vector<std::vector<double> > HGCalCLUEAlgoT< TILE, STRATEGY >::thresholds_
private

Definition at line 138 of file HGCalCLUEAlgo.h.

◆ use2x2_

template<typename TILE , typename STRATEGY >
bool HGCalCLUEAlgoT< TILE, STRATEGY >::use2x2_
private

Definition at line 141 of file HGCalCLUEAlgo.h.

◆ v_sigmaNoise_

template<typename TILE , typename STRATEGY >
std::vector<std::vector<double> > HGCalCLUEAlgoT< TILE, STRATEGY >::v_sigmaNoise_
private

Definition at line 139 of file HGCalCLUEAlgo.h.

◆ vecDeltas_

template<typename TILE , typename STRATEGY >
std::vector<double> HGCalCLUEAlgoT< TILE, STRATEGY >::vecDeltas_
private

Definition at line 120 of file HGCalCLUEAlgo.h.