CMS 3D CMS Logo

HGCalCLUEAlgo.cc
Go to the documentation of this file.
2 
3 // Geometry
8 
10 //
12 #include "tbb/task_arena.h"
13 #include "tbb/tbb.h"
14 #include <limits>
15 
16 using namespace hgcal_clustering;
17 
18 template <typename T>
20  cells_.clear();
21  numberOfClustersPerLayer_.clear();
22  cells_.resize(2 * (maxlayer_ + 1));
23  numberOfClustersPerLayer_.resize(2 * (maxlayer_ + 1), 0);
24 }
25 
26 template <typename T>
28  // loop over all hits and create the Hexel structure, skip energies below ecut
29 
30  if (dependSensor_) {
31  // for each layer and wafer calculate the thresholds (sigmaNoise and energy)
32  // once
33  computeThreshold();
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 = 3;
48  double storedThreshold = thresholds_[layerOnSide][thickness_index];
49  sigmaNoise = v_sigmaNoise_[layerOnSide][thickness_index];
50 
51  if (hgrh.energy() < storedThreshold)
52  continue; // this sets the ZS threshold at ecut times the sigma noise
53  // for the sensor
54  }
55  if (!dependSensor_ && hgrh.energy() < ecut_)
56  continue;
57  const GlobalPoint position(rhtools_.getPosition(detid));
58  int offset = ((rhtools_.zside(detid) + 1) >> 1) * maxlayer_;
59  int layer = layerOnSide + offset;
60 
61  cells_[layer].detid.emplace_back(detid);
62  cells_[layer].x.emplace_back(position.x());
63  cells_[layer].y.emplace_back(position.y());
64  if (!rhtools_.isOnlySilicon(layer)) {
65  cells_[layer].isSi.emplace_back(rhtools_.isSilicon(detid));
66  cells_[layer].eta.emplace_back(position.eta());
67  cells_[layer].phi.emplace_back(position.phi());
68  } // else, isSilicon == true and eta phi values will not be used
69  cells_[layer].weight.emplace_back(hgrh.energy());
70  cells_[layer].sigmaNoise.emplace_back(sigmaNoise);
71  }
72 }
73 
74 template <typename T>
76  auto cellsSize = cells_[l].detid.size();
77  cells_[l].rho.resize(cellsSize, 0.f);
78  cells_[l].delta.resize(cellsSize, 9999999);
79  cells_[l].nearestHigher.resize(cellsSize, -1);
80  cells_[l].clusterIndex.resize(cellsSize, -1);
81  cells_[l].followers.resize(cellsSize);
82  cells_[l].isSeed.resize(cellsSize, false);
83  if (rhtools_.isOnlySilicon(l)) {
84  cells_[l].isSi.resize(cellsSize, true);
85  cells_[l].eta.resize(cellsSize, 0.f);
86  cells_[l].phi.resize(cellsSize, 0.f);
87  }
88 }
89 
90 // Create a vector of Hexels associated to one cluster from a collection of
91 // HGCalRecHits - this can be used directly to make the final cluster list -
92 // this method can be invoked multiple times for the same event with different
93 // input (reset should be called between events)
94 template <typename T>
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) {
99  prepareDataStructures(i);
100  T lt;
101  lt.clear();
102  lt.fill(cells_[i].x, cells_[i].y, cells_[i].eta, cells_[i].phi, cells_[i].isSi);
103  float delta_c; // maximum search distance (critical distance) for local
104  // density calculation
105  if (i % maxlayer_ < lastLayerEE_)
106  delta_c = vecDeltas_[0];
107  else if (i % maxlayer_ < (firstLayerBH_ - 1))
108  delta_c = vecDeltas_[1];
109  else
110  delta_c = vecDeltas_[2];
111  float delta_r = vecDeltas_[3];
112  LogDebug("HGCalCLUEAlgo") << "maxlayer: " << maxlayer_ << " lastLayerEE: " << lastLayerEE_
113  << " firstLayerBH: " << firstLayerBH_ << "\n";
114 
115  calculateLocalDensity(lt, i, delta_c, delta_r);
116  calculateDistanceToHigher(lt, i, delta_c, delta_r);
117  numberOfClustersPerLayer_[i] = findAndAssignClusters(i, delta_c, delta_r);
118  });
119  });
120  //Now that we have the density per point we can store it
121  for (unsigned int i = 0; i < 2 * maxlayer_ + 2; ++i) {
122  setDensity(i);
123  }
124 }
125 
126 template <typename T>
127 std::vector<reco::BasicCluster> HGCalCLUEAlgoT<T>::getClusters(bool) {
128  std::vector<int> offsets(numberOfClustersPerLayer_.size(), 0);
129 
130  int maxClustersOnLayer = numberOfClustersPerLayer_[0];
131 
132  for (unsigned layerId = 1; layerId < offsets.size(); ++layerId) {
133  offsets[layerId] = offsets[layerId - 1] + numberOfClustersPerLayer_[layerId - 1];
134 
135  maxClustersOnLayer = std::max(maxClustersOnLayer, numberOfClustersPerLayer_[layerId]);
136  }
137 
138  auto totalNumberOfClusters = offsets.back() + numberOfClustersPerLayer_.back();
139  clusters_v_.resize(totalNumberOfClusters);
140  std::vector<std::vector<int>> cellsIdInCluster;
141  cellsIdInCluster.reserve(maxClustersOnLayer);
142 
143  for (unsigned int layerId = 0; layerId < 2 * maxlayer_ + 2; ++layerId) {
144  cellsIdInCluster.resize(numberOfClustersPerLayer_[layerId]);
145  auto& cellsOnLayer = cells_[layerId];
146  unsigned int numberOfCells = cellsOnLayer.detid.size();
147  auto firstClusterIdx = offsets[layerId];
148 
149  for (unsigned int i = 0; i < numberOfCells; ++i) {
150  auto clusterIndex = cellsOnLayer.clusterIndex[i];
151  if (clusterIndex != -1)
152  cellsIdInCluster[clusterIndex].push_back(i);
153  }
154 
155  std::vector<std::pair<DetId, float>> thisCluster;
156 
157  for (auto& cl : cellsIdInCluster) {
158  auto position = calculatePosition(cl, layerId);
159  float energy = 0.f;
160  int seedDetId = -1;
161 
162  for (auto cellIdx : cl) {
163  energy += cellsOnLayer.weight[cellIdx];
164  thisCluster.emplace_back(cellsOnLayer.detid[cellIdx], 1.f);
165  if (cellsOnLayer.isSeed[cellIdx]) {
166  seedDetId = cellsOnLayer.detid[cellIdx];
167  }
168  }
169  auto globalClusterIndex = cellsOnLayer.clusterIndex[cl[0]] + firstClusterIdx;
170 
171  clusters_v_[globalClusterIndex] =
173  clusters_v_[globalClusterIndex].setSeed(seedDetId);
174  thisCluster.clear();
175  }
176 
177  cellsIdInCluster.clear();
178  }
179  return clusters_v_;
180 }
181 
182 template <typename T>
183 math::XYZPoint HGCalCLUEAlgoT<T>::calculatePosition(const std::vector<int>& v, const unsigned int layerId) const {
184  float total_weight = 0.f;
185  float x = 0.f;
186  float y = 0.f;
187 
188  unsigned int maxEnergyIndex = 0;
189  float maxEnergyValue = 0.f;
190 
191  auto& cellsOnLayer = cells_[layerId];
192 
193  // loop over hits in cluster candidate
194  // determining the maximum energy hit
195  for (auto i : v) {
196  total_weight += cellsOnLayer.weight[i];
197  if (cellsOnLayer.weight[i] > maxEnergyValue) {
198  maxEnergyValue = cellsOnLayer.weight[i];
199  maxEnergyIndex = i;
200  }
201  }
202 
203  // Si cell or Scintillator. Used to set approach and parameters
204  auto thick = rhtools_.getSiThickIndex(cellsOnLayer.detid[maxEnergyIndex]);
205  bool isSiliconCell = (thick != -1);
206 
207  // TODO: this is recomputing everything twice and overwriting the position with log weighting position
208  if (isSiliconCell) {
209  float total_weight_log = 0.f;
210  float x_log = 0.f;
211  float y_log = 0.f;
212  for (auto i : v) {
213  float rhEnergy = cellsOnLayer.weight[i];
214  float Wi = std::max(thresholdW0_[thick] + std::log(rhEnergy / total_weight), 0.);
215  x_log += cellsOnLayer.x[i] * Wi;
216  y_log += cellsOnLayer.y[i] * Wi;
217  total_weight_log += Wi;
218  }
219 
220  total_weight = total_weight_log;
221  x = x_log;
222  y = y_log;
223  } else {
224  for (auto i : v) {
225  float rhEnergy = cellsOnLayer.weight[i];
226 
227  x += cellsOnLayer.x[i] * rhEnergy;
228  y += cellsOnLayer.y[i] * rhEnergy;
229  }
230  }
231  if (total_weight != 0.) {
232  float inv_tot_weight = 1.f / total_weight;
233  return math::XYZPoint(
234  x * inv_tot_weight, y * inv_tot_weight, rhtools_.getPosition(cellsOnLayer.detid[maxEnergyIndex]).z());
235  } else
236  return math::XYZPoint(0.f, 0.f, 0.f);
237 }
238 
239 template <typename T>
240 void HGCalCLUEAlgoT<T>::calculateLocalDensity(const T& lt, const unsigned int layerId, float delta_c, float delta_r) {
241  auto& cellsOnLayer = cells_[layerId];
242  unsigned int numberOfCells = cellsOnLayer.detid.size();
243  bool isOnlySi(false);
244  if (rhtools_.isOnlySilicon(layerId))
245  isOnlySi = true;
246 
247  for (unsigned int i = 0; i < numberOfCells; i++) {
248  bool isSi = isOnlySi || cellsOnLayer.isSi[i];
249  if (isSi) {
250  float delta = delta_c;
251  std::array<int, 4> search_box = lt.searchBox(
252  cellsOnLayer.x[i] - delta, cellsOnLayer.x[i] + delta, cellsOnLayer.y[i] - delta, cellsOnLayer.y[i] + delta);
253 
254  for (int xBin = search_box[0]; xBin < search_box[1] + 1; ++xBin) {
255  for (int yBin = search_box[2]; yBin < search_box[3] + 1; ++yBin) {
256  int binId = lt.getGlobalBinByBin(xBin, yBin);
257  size_t binSize = lt[binId].size();
258 
259  for (unsigned int j = 0; j < binSize; j++) {
260  unsigned int otherId = lt[binId][j];
261  bool otherSi = isOnlySi || cellsOnLayer.isSi[otherId];
262  if (otherSi) { //silicon cells cannot talk to scintillator cells
263  if (distance(i, otherId, layerId, false) < delta) {
264  cellsOnLayer.rho[i] += (i == otherId ? 1.f : 0.5f) * cellsOnLayer.weight[otherId];
265  }
266  }
267  }
268  }
269  }
270  } else {
271  float delta = delta_r;
272  std::array<int, 4> search_box = lt.searchBoxEtaPhi(cellsOnLayer.eta[i] - delta,
273  cellsOnLayer.eta[i] + delta,
274  cellsOnLayer.phi[i] - delta,
275  cellsOnLayer.phi[i] + delta);
276  cellsOnLayer.rho[i] += cellsOnLayer.weight[i];
277  float northeast(0), northwest(0), southeast(0), southwest(0), all(0);
278 
279  for (int etaBin = search_box[0]; etaBin < search_box[1] + 1; ++etaBin) {
280  for (int phiBin = search_box[2]; phiBin < search_box[3] + 1; ++phiBin) {
281  int binId = lt.getGlobalBinByBinEtaPhi(etaBin, phiBin);
282  size_t binSize = lt[binId].size();
283 
284  for (unsigned int j = 0; j < binSize; j++) {
285  unsigned int otherId = lt[binId][j];
286  if (!cellsOnLayer.isSi[otherId]) { //scintillator cells cannot talk to silicon cells
287  if (distance(i, otherId, layerId, true) < delta) {
288  int iPhi = HGCScintillatorDetId(cellsOnLayer.detid[i]).iphi();
289  int otherIPhi = HGCScintillatorDetId(cellsOnLayer.detid[otherId]).iphi();
290  int iEta = HGCScintillatorDetId(cellsOnLayer.detid[i]).ieta();
291  int otherIEta = HGCScintillatorDetId(cellsOnLayer.detid[otherId]).ieta();
292  int dIPhi = otherIPhi - iPhi;
293  dIPhi += abs(dIPhi) < 2
294  ? 0
295  : dIPhi < 0 ? scintMaxIphi_
296  : -scintMaxIphi_; // cells with iPhi=288 and iPhi=1 should be neiboring cells
297  int dIEta = otherIEta - iEta;
298  LogDebug("HGCalCLUEAlgo") << " Debugging calculateLocalDensity for Scintillator: \n"
299  << " cell: " << otherId << " energy: " << cellsOnLayer.weight[otherId]
300  << " otherIPhi: " << otherIPhi << " iPhi: " << iPhi
301  << " otherIEta: " << otherIEta << " iEta: " << iEta << "\n";
302 
303  if (otherId != i) {
304  auto neighborCellContribution = 0.5f * cellsOnLayer.weight[otherId];
305  all += neighborCellContribution;
306  if (dIPhi >= 0 && dIEta >= 0)
307  northeast += neighborCellContribution;
308  if (dIPhi <= 0 && dIEta >= 0)
309  southeast += neighborCellContribution;
310  if (dIPhi >= 0 && dIEta <= 0)
311  northwest += neighborCellContribution;
312  if (dIPhi <= 0 && dIEta <= 0)
313  southwest += neighborCellContribution;
314  }
315  LogDebug("HGCalCLUEAlgo") << " Debugging calculateLocalDensity for Scintillator: \n"
316  << " northeast: " << northeast << " southeast: " << southeast
317  << " northwest: " << northwest << " southwest: " << southwest << "\n";
318  }
319  }
320  }
321  }
322  }
323  float neighborsval = (std::max(northeast, northwest) > std::max(southeast, southwest))
324  ? std::max(northeast, northwest)
325  : std::max(southeast, southwest);
326  if (use2x2_)
327  cellsOnLayer.rho[i] += neighborsval;
328  else
329  cellsOnLayer.rho[i] += all;
330  }
331  LogDebug("HGCalCLUEAlgo") << "Debugging calculateLocalDensity: \n"
332  << " cell: " << i << " isSilicon: " << cellsOnLayer.isSi[i]
333  << " eta: " << cellsOnLayer.eta[i] << " phi: " << cellsOnLayer.phi[i]
334  << " energy: " << cellsOnLayer.weight[i] << " density: " << cellsOnLayer.rho[i] << "\n";
335  }
336 }
337 
338 template <typename T>
340  const unsigned int layerId,
341  float delta_c,
342  float delta_r) {
343  auto& cellsOnLayer = cells_[layerId];
344  unsigned int numberOfCells = cellsOnLayer.detid.size();
345  bool isOnlySi(false);
346  if (rhtools_.isOnlySilicon(layerId))
347  isOnlySi = true;
348 
349  for (unsigned int i = 0; i < numberOfCells; i++) {
350  bool isSi = isOnlySi || cellsOnLayer.isSi[i];
351  // initialize delta and nearest higher for i
353  float i_delta = maxDelta;
354  int i_nearestHigher = -1;
355  if (isSi) {
356  float delta = delta_c;
357  // get search box for ith hit
358  // guarantee to cover a range "outlierDeltaFactor_*delta_c"
359  auto range = outlierDeltaFactor_ * delta;
360  std::array<int, 4> search_box = lt.searchBox(
361  cellsOnLayer.x[i] - range, cellsOnLayer.x[i] + range, cellsOnLayer.y[i] - range, cellsOnLayer.y[i] + range);
362  // loop over all bins in the search box
363  for (int xBin = search_box[0]; xBin < search_box[1] + 1; ++xBin) {
364  for (int yBin = search_box[2]; yBin < search_box[3] + 1; ++yBin) {
365  // get the id of this bin
366  size_t binId = lt.getGlobalBinByBin(xBin, yBin);
367  // get the size of this bin
368  size_t binSize = lt[binId].size();
369 
370  // loop over all hits in this bin
371  for (unsigned int j = 0; j < binSize; j++) {
372  unsigned int otherId = lt[binId][j];
373  bool otherSi = isOnlySi || cellsOnLayer.isSi[otherId];
374  if (otherSi) { //silicon cells cannot talk to scintillator cells
375  float dist = distance(i, otherId, layerId, false);
376  bool foundHigher = (cellsOnLayer.rho[otherId] > cellsOnLayer.rho[i]) ||
377  (cellsOnLayer.rho[otherId] == cellsOnLayer.rho[i] &&
378  cellsOnLayer.detid[otherId] > cellsOnLayer.detid[i]);
379  // if dist == i_delta, then last comer being the nearest higher
380  if (foundHigher && dist <= i_delta) {
381  // update i_delta
382  i_delta = dist;
383  // update i_nearestHigher
384  i_nearestHigher = otherId;
385  }
386  }
387  }
388  }
389  }
390 
391  bool foundNearestHigherInSearchBox = (i_delta != maxDelta);
392  if (foundNearestHigherInSearchBox) {
393  cellsOnLayer.delta[i] = i_delta;
394  cellsOnLayer.nearestHigher[i] = i_nearestHigher;
395  } else {
396  // otherwise delta is guaranteed to be larger outlierDeltaFactor_*delta_c
397  // we can safely maximize delta to be maxDelta
398  cellsOnLayer.delta[i] = maxDelta;
399  cellsOnLayer.nearestHigher[i] = -1;
400  }
401  } else {
402  //similar to silicon
403  float delta = delta_r;
404  auto range = outlierDeltaFactor_ * delta;
405  std::array<int, 4> search_box = lt.searchBoxEtaPhi(cellsOnLayer.eta[i] - range,
406  cellsOnLayer.eta[i] + range,
407  cellsOnLayer.phi[i] - range,
408  cellsOnLayer.phi[i] + range);
409  // loop over all bins in the search box
410  for (int xBin = search_box[0]; xBin < search_box[1] + 1; ++xBin) {
411  for (int yBin = search_box[2]; yBin < search_box[3] + 1; ++yBin) {
412  // get the id of this bin
413  size_t binId = lt.getGlobalBinByBinEtaPhi(xBin, yBin);
414  // get the size of this bin
415  size_t binSize = lt[binId].size();
416 
417  // loop over all hits in this bin
418  for (unsigned int j = 0; j < binSize; j++) {
419  unsigned int otherId = lt[binId][j];
420  if (!cellsOnLayer.isSi[otherId]) { //scintillator cells cannot talk to silicon cells
421  float dist = distance(i, otherId, layerId, true);
422  bool foundHigher = (cellsOnLayer.rho[otherId] > cellsOnLayer.rho[i]) ||
423  (cellsOnLayer.rho[otherId] == cellsOnLayer.rho[i] &&
424  cellsOnLayer.detid[otherId] > cellsOnLayer.detid[i]);
425  // if dist == i_delta, then last comer being the nearest higher
426  if (foundHigher && dist <= i_delta) {
427  // update i_delta
428  i_delta = dist;
429  // update i_nearestHigher
430  i_nearestHigher = otherId;
431  }
432  }
433  }
434  }
435  }
436 
437  bool foundNearestHigherInSearchBox = (i_delta != maxDelta);
438  if (foundNearestHigherInSearchBox) {
439  cellsOnLayer.delta[i] = i_delta;
440  cellsOnLayer.nearestHigher[i] = i_nearestHigher;
441  } else {
442  // otherwise delta is guaranteed to be larger outlierDeltaFactor_*delta_c
443  // we can safely maximize delta to be maxDelta
444  cellsOnLayer.delta[i] = maxDelta;
445  cellsOnLayer.nearestHigher[i] = -1;
446  }
447  }
448  LogDebug("HGCalCLUEAlgo") << "Debugging calculateDistanceToHigher: \n"
449  << " cell: " << i << " isSilicon: " << cellsOnLayer.isSi[i]
450  << " eta: " << cellsOnLayer.eta[i] << " phi: " << cellsOnLayer.phi[i]
451  << " energy: " << cellsOnLayer.weight[i] << " density: " << cellsOnLayer.rho[i]
452  << " nearest higher: " << cellsOnLayer.nearestHigher[i]
453  << " distance: " << cellsOnLayer.delta[i] << "\n";
454  }
455 }
456 
457 template <typename T>
458 int HGCalCLUEAlgoT<T>::findAndAssignClusters(const unsigned int layerId, float delta_c, float delta_r) {
459  // this is called once per layer and endcap...
460  // so when filling the cluster temporary vector of Hexels we resize each time
461  // by the number of clusters found. This is always equal to the number of
462  // cluster centers...
463  unsigned int nClustersOnLayer = 0;
464  auto& cellsOnLayer = cells_[layerId];
465  unsigned int numberOfCells = cellsOnLayer.detid.size();
466  std::vector<int> localStack;
467  // find cluster seeds and outlier
468  for (unsigned int i = 0; i < numberOfCells; i++) {
469  float rho_c = kappa_ * cellsOnLayer.sigmaNoise[i];
470  bool isSi = rhtools_.isOnlySilicon(layerId) || cellsOnLayer.isSi[i];
471  float delta = isSi ? delta_c : delta_r;
472 
473  // initialize clusterIndex
474  cellsOnLayer.clusterIndex[i] = -1;
475  bool isSeed = (cellsOnLayer.delta[i] > delta) && (cellsOnLayer.rho[i] >= rho_c);
476  bool isOutlier = (cellsOnLayer.delta[i] > outlierDeltaFactor_ * delta) && (cellsOnLayer.rho[i] < rho_c);
477  if (isSeed) {
478  cellsOnLayer.clusterIndex[i] = nClustersOnLayer;
479  cellsOnLayer.isSeed[i] = true;
480  nClustersOnLayer++;
481  localStack.push_back(i);
482 
483  } else if (!isOutlier) {
484  cellsOnLayer.followers[cellsOnLayer.nearestHigher[i]].push_back(i);
485  }
486  }
487 
488  // need to pass clusterIndex to their followers
489  while (!localStack.empty()) {
490  int endStack = localStack.back();
491  auto& thisSeed = cellsOnLayer.followers[endStack];
492  localStack.pop_back();
493 
494  // loop over followers
495  for (int j : thisSeed) {
496  // pass id to a follower
497  cellsOnLayer.clusterIndex[j] = cellsOnLayer.clusterIndex[endStack];
498  // push this follower to localStack
499  localStack.push_back(j);
500  }
501  }
502  return nClustersOnLayer;
503 }
504 
505 template <typename T>
507  // To support the TDR geometry and also the post-TDR one (v9 onwards), we
508  // need to change the logic of the vectors containing signal to noise and
509  // thresholds. The first 3 indices will keep on addressing the different
510  // thicknesses of the Silicon detectors, while the last one, number 3 (the
511  // fourth) will address the Scintillators. This change will support both
512  // geometries at the same time.
513 
514  if (initialized_)
515  return; // only need to calculate thresholds once
516 
517  initialized_ = true;
518 
519  std::vector<double> dummy;
520  const unsigned maxNumberOfThickIndices = 3;
521  dummy.resize(maxNumberOfThickIndices + !isNose_, 0); // +1 to accomodate for the Scintillators
522  thresholds_.resize(maxlayer_, dummy);
523  v_sigmaNoise_.resize(maxlayer_, dummy);
524 
525  for (unsigned ilayer = 1; ilayer <= maxlayer_; ++ilayer) {
526  for (unsigned ithick = 0; ithick < maxNumberOfThickIndices; ++ithick) {
527  float sigmaNoise = 0.001f * fcPerEle_ * nonAgedNoises_[ithick] * dEdXweights_[ilayer] /
528  (fcPerMip_[ithick] * thicknessCorrection_[ithick]);
529  thresholds_[ilayer - 1][ithick] = sigmaNoise * ecut_;
530  v_sigmaNoise_[ilayer - 1][ithick] = sigmaNoise;
531  LogDebug("HGCalCLUEAlgo") << "ilayer: " << ilayer << " nonAgedNoises: " << nonAgedNoises_[ithick]
532  << " fcPerEle: " << fcPerEle_ << " fcPerMip: " << fcPerMip_[ithick]
533  << " noiseMip: " << fcPerEle_ * nonAgedNoises_[ithick] / fcPerMip_[ithick]
534  << " sigmaNoise: " << sigmaNoise << "\n";
535  }
536 
537  if (!isNose_) {
538  float scintillators_sigmaNoise = 0.001f * noiseMip_ * dEdXweights_[ilayer];
539  thresholds_[ilayer - 1][maxNumberOfThickIndices] = ecut_ * scintillators_sigmaNoise;
540  v_sigmaNoise_[ilayer - 1][maxNumberOfThickIndices] = scintillators_sigmaNoise;
541  LogDebug("HGCalCLUEAlgo") << "ilayer: " << ilayer << " noiseMip: " << noiseMip_
542  << " scintillators_sigmaNoise: " << scintillators_sigmaNoise << "\n";
543  }
544  }
545 }
546 
547 template <typename T>
548 void HGCalCLUEAlgoT<T>::setDensity(const unsigned int layerId) {
549  auto& cellsOnLayer = cells_[layerId];
550  unsigned int numberOfCells = cellsOnLayer.detid.size();
551  for (unsigned int i = 0; i < numberOfCells; ++i)
552  density_[cellsOnLayer.detid[i]] = cellsOnLayer.rho[i];
553 }
554 
555 template <typename T>
557  return density_;
558 }
559 
560 // explicit template instantiation
561 template class HGCalCLUEAlgoT<HGCalLayerTiles>;
562 template class HGCalCLUEAlgoT<HFNoseLayerTiles>;
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
mps_fire.i
i
Definition: mps_fire.py:355
PositionCalc.h
HGCScintillatorDetId::iphi
int iphi() const
get the phi index
Definition: HGCScintillatorDetId.cc:57
CaloRecHit::energy
constexpr float energy() const
Definition: CaloRecHit.h:29
photonAnalyzer_cfi.xBin
xBin
Definition: photonAnalyzer_cfi.py:81
HGCalCLUEAlgoT::findAndAssignClusters
int findAndAssignClusters(const unsigned int layerId, float delta_c, float delta_r)
Definition: HGCalCLUEAlgo.cc:458
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
etaBin
int etaBin(const l1t::HGCalMulticluster *cl)
Definition: L1EGammaEEProducer.cc:19
HGCalCLUEAlgoT::calculateLocalDensity
void calculateLocalDensity(const TILE &lt, const unsigned int layerId, float delta_c, float delta_r)
Definition: HGCalCLUEAlgo.cc:240
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
HGCScintillatorDetId::ieta
int ieta() const
Definition: HGCScintillatorDetId.h:53
reco::CaloID::DET_HGCAL_ENDCAP
Definition: CaloID.h:30
BeamMonitor_cff.phiBin
phiBin
Definition: BeamMonitor_cff.py:75
hitfit::delta_r
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
reco::BasicCluster
CaloCluster BasicCluster
Definition: BasicClusterFwd.h:13
HGCalCLUEAlgoT
Definition: HGCalCLUEAlgo.h:30
HGCalCLUEAlgoT::getEventSetupPerAlgorithm
void getEventSetupPerAlgorithm(const edm::EventSetup &es) override
Definition: HGCalCLUEAlgo.cc:19
HLT_2018_cff.distance
distance
Definition: HLT_2018_cff.py:6417
CaloID.h
edm::SortedCollection
Definition: SortedCollection.h:49
photonAnalyzer_cfi.yBin
yBin
Definition: photonAnalyzer_cfi.py:85
findQualityFiles.v
v
Definition: findQualityFiles.py:179
CaloRecHit::detid
constexpr const DetId & detid() const
Definition: CaloRecHit.h:33
allConversions_cfi.maxDelta
maxDelta
Definition: allConversions_cfi.py:44
python.cmstools.all
def all(container)
workaround iterator generators for ROOT classes
Definition: cmstools.py:26
GetRecoTauVFromDQM_MC_cff.cl
cl
Definition: GetRecoTauVFromDQM_MC_cff.py:38
DetId
Definition: DetId.h:17
HGCalCLUEAlgoT::makeClusters
void makeClusters() override
Definition: HGCalCLUEAlgo.cc:95
HGCalCLUEAlgoT::getClusters
std::vector< reco::BasicCluster > getClusters(bool) override
Definition: HGCalCLUEAlgo.cc:127
HGCalCLUEAlgoT::populate
void populate(const HGCRecHitCollection &hits) override
Definition: HGCalCLUEAlgo.cc:27
hgcal_clustering::Density
std::map< DetId, float > Density
Definition: HGCalClusteringAlgoBase.h:43
PVValHelper::eta
Definition: PVValidationHelpers.h:69
HGCalCLUEAlgoT::prepareDataStructures
void prepareDataStructures(const unsigned int layerId)
Definition: HGCalCLUEAlgo.cc:75
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
hgcal_clustering
Definition: HGCalClusteringAlgoBase.h:16
Point3DBase< float, GlobalTag >
HGCalCLUEAlgoT::computeThreshold
void computeThreshold()
Definition: HGCalCLUEAlgo.cc:506
HGCRecHit
Definition: HGCRecHit.h:14
HGCalCLUEAlgoT::getDensity
Density getDensity() override
Definition: HGCalCLUEAlgo.cc:556
CaloSubdetectorGeometry.h
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
dumpMFGeometry_cfg.delta
delta
Definition: dumpMFGeometry_cfg.py:25
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
IdealGeometryRecord.h
HGCalCLUEAlgoT::setDensity
void setDensity(const unsigned int layerId)
Definition: HGCalCLUEAlgo.cc:548
edm::EventSetup
Definition: EventSetup.h:57
HcalSubdetector.h
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:193
CaloCellGeometry.h
HGCalCLUEAlgoT::calculatePosition
math::XYZPoint calculatePosition(const std::vector< int > &v, const unsigned int layerId) const
Definition: HGCalCLUEAlgo.cc:183
AlignmentPI::calculatePosition
std::pair< double, double > calculatePosition(TVirtualPad *myPad, int boundary)
Definition: AlignmentPayloadInspectorHelper.h:768
HGCalCLUEAlgo.h
HGCScintillatorDetId
Definition: HGCScintillatorDetId.h:21
T
long double T
Definition: Basic3DVectorLD.h:48
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
unpackBuffers-CaloStage1.offsets
offsets
Definition: unpackBuffers-CaloStage1.py:127
L1TowerCalibrationProducer_cfi.iEta
iEta
Definition: L1TowerCalibrationProducer_cfi.py:60
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
dummy
Definition: DummySelector.h:38
HGCalCLUEAlgoT::calculateDistanceToHigher
void calculateDistanceToHigher(const TILE &lt, const unsigned int layerId, float delta_c, float delta_r)
Definition: HGCalCLUEAlgo.cc:339
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:78