|
|
#include <HGCalCLUEAlgo.h>
|
void | calculateDistanceToHigher (const TILE <, const unsigned int layerId, float delta_c, float delta_r) |
|
void | calculateLocalDensity (const TILE <, const unsigned int layerId, float delta_c, float delta_r) |
|
math::XYZPoint | calculatePosition (const std::vector< int > &v, const unsigned int layerId) const |
|
float | distance (int cell1, int cell2, int layerId, bool isEtaPhi) const |
|
float | distance2 (int cell1, int cell2, int layerId, bool isEtaPhi) const |
|
int | findAndAssignClusters (const unsigned int layerId, float delta_c, float delta_r) |
|
void | prepareDataStructures (const unsigned int layerId) |
|
void | setDensity (const unsigned int layerId) |
|
template<typename TILE>
class HGCalCLUEAlgoT< TILE >
Definition at line 30 of file HGCalCLUEAlgo.h.
◆ Point
◆ HGCalCLUEAlgoT()
◆ ~HGCalCLUEAlgoT()
◆ calculateDistanceToHigher()
template<typename TILE >
void HGCalCLUEAlgoT< T >::calculateDistanceToHigher |
( |
const TILE & |
lt, |
|
|
const unsigned int |
layerId, |
|
|
float |
delta_c, |
|
|
float |
delta_r |
|
) |
| |
|
private |
Definition at line 339 of file HGCalCLUEAlgo.cc.
343 auto& cellsOnLayer =
cells_[layerId];
344 unsigned int numberOfCells = cellsOnLayer.detid.size();
345 bool isOnlySi(
false);
349 for (
unsigned int i = 0;
i < numberOfCells;
i++) {
350 bool isSi = isOnlySi || cellsOnLayer.isSi[
i];
354 int i_nearestHigher = -1;
356 float delta = delta_c;
360 std::array<int, 4> search_box = lt.searchBox(
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) {
366 size_t binId = lt.getGlobalBinByBin(
xBin,
yBin);
368 size_t binSize = lt[binId].size();
371 for (
unsigned int j = 0;
j < binSize;
j++) {
372 unsigned int otherId = lt[binId][
j];
373 bool otherSi = isOnlySi || cellsOnLayer.isSi[otherId];
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]);
380 if (foundHigher && dist <= i_delta) {
384 i_nearestHigher = otherId;
391 bool foundNearestHigherInSearchBox = (i_delta !=
maxDelta);
392 if (foundNearestHigherInSearchBox) {
393 cellsOnLayer.delta[
i] = i_delta;
394 cellsOnLayer.nearestHigher[
i] = i_nearestHigher;
399 cellsOnLayer.nearestHigher[
i] = -1;
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);
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) {
413 size_t binId = lt.getGlobalBinByBinEtaPhi(
xBin,
yBin);
415 size_t binSize = lt[binId].size();
418 for (
unsigned int j = 0;
j < binSize;
j++) {
419 unsigned int otherId = lt[binId][
j];
420 if (!cellsOnLayer.isSi[otherId]) {
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]);
426 if (foundHigher && dist <= i_delta) {
430 i_nearestHigher = otherId;
437 bool foundNearestHigherInSearchBox = (i_delta !=
maxDelta);
438 if (foundNearestHigherInSearchBox) {
439 cellsOnLayer.delta[
i] = i_delta;
440 cellsOnLayer.nearestHigher[
i] = i_nearestHigher;
445 cellsOnLayer.nearestHigher[
i] = -1;
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";
References dumpMFGeometry_cfg::delta, hitfit::delta_r(), HLT_2018_cff::distance, mps_fire::i, dqmiolumiharvest::j, LogDebug, SiStripPI::max, allConversions_cfi::maxDelta, FastTimerService_cff::range, photonAnalyzer_cfi::xBin, and photonAnalyzer_cfi::yBin.
◆ calculateLocalDensity()
template<typename TILE >
void HGCalCLUEAlgoT< T >::calculateLocalDensity |
( |
const TILE & |
lt, |
|
|
const unsigned int |
layerId, |
|
|
float |
delta_c, |
|
|
float |
delta_r |
|
) |
| |
|
private |
Definition at line 240 of file HGCalCLUEAlgo.cc.
241 auto& cellsOnLayer =
cells_[layerId];
242 unsigned int numberOfCells = cellsOnLayer.detid.size();
243 bool isOnlySi(
false);
247 for (
unsigned int i = 0;
i < numberOfCells;
i++) {
248 bool isSi = isOnlySi || cellsOnLayer.isSi[
i];
250 float delta = delta_c;
251 std::array<int, 4> search_box = lt.searchBox(
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();
259 for (
unsigned int j = 0;
j < binSize;
j++) {
260 unsigned int otherId = lt[binId][
j];
261 bool otherSi = isOnlySi || cellsOnLayer.isSi[otherId];
264 cellsOnLayer.rho[
i] += (
i == otherId ? 1.f : 0.5f) * cellsOnLayer.weight[otherId];
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);
282 size_t binSize = lt[binId].size();
284 for (
unsigned int j = 0;
j < binSize;
j++) {
285 unsigned int otherId = lt[binId][
j];
286 if (!cellsOnLayer.isSi[otherId]) {
292 int dIPhi = otherIPhi - iPhi;
293 dIPhi +=
abs(dIPhi) < 2
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";
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;
315 LogDebug(
"HGCalCLUEAlgo") <<
" Debugging calculateLocalDensity for Scintillator: \n"
316 <<
" northeast: " << northeast <<
" southeast: " << southeast
317 <<
" northwest: " << northwest <<
" southwest: " << southwest <<
"\n";
323 float neighborsval = (
std::max(northeast, northwest) >
std::max(southeast, southwest))
327 cellsOnLayer.rho[
i] += neighborsval;
329 cellsOnLayer.rho[
i] +=
all;
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";
References funct::abs(), python.cmstools::all(), dumpMFGeometry_cfg::delta, hitfit::delta_r(), HLT_2018_cff::distance, etaBin(), mps_fire::i, HGCScintillatorDetId::ieta(), L1TowerCalibrationProducer_cfi::iEta, HGCScintillatorDetId::iphi(), dqmiolumiharvest::j, LogDebug, SiStripPI::max, BeamMonitor_cff::phiBin, photonAnalyzer_cfi::xBin, and photonAnalyzer_cfi::yBin.
◆ calculatePosition()
Definition at line 183 of file HGCalCLUEAlgo.cc.
184 float total_weight = 0.f;
188 unsigned int maxEnergyIndex = 0;
189 float maxEnergyValue = 0.f;
191 auto& cellsOnLayer =
cells_[layerId];
196 total_weight += cellsOnLayer.weight[
i];
197 if (cellsOnLayer.weight[
i] > maxEnergyValue) {
198 maxEnergyValue = cellsOnLayer.weight[
i];
205 bool isSiliconCell = (thick != -1);
209 float total_weight_log = 0.f;
213 float rhEnergy = cellsOnLayer.weight[
i];
215 x_log += cellsOnLayer.x[
i] * Wi;
216 y_log += cellsOnLayer.y[
i] * Wi;
217 total_weight_log += Wi;
220 total_weight = total_weight_log;
225 float rhEnergy = cellsOnLayer.weight[
i];
227 x += cellsOnLayer.x[
i] * rhEnergy;
228 y += cellsOnLayer.y[
i] * rhEnergy;
231 if (total_weight != 0.) {
232 float inv_tot_weight = 1.f / total_weight;
References f, mps_fire::i, dqm-mbProfile::log, SiStripPI::max, and findQualityFiles::v.
◆ computeThreshold()
Definition at line 506 of file HGCalCLUEAlgo.cc.
519 std::vector<double>
dummy;
520 const unsigned maxNumberOfThickIndices = 3;
525 for (
unsigned ilayer = 1; ilayer <=
maxlayer_; ++ilayer) {
526 for (
unsigned ithick = 0; ithick < maxNumberOfThickIndices; ++ithick) {
534 <<
" sigmaNoise: " << sigmaNoise <<
"\n";
539 thresholds_[ilayer - 1][maxNumberOfThickIndices] =
ecut_ * scintillators_sigmaNoise;
540 v_sigmaNoise_[ilayer - 1][maxNumberOfThickIndices] = scintillators_sigmaNoise;
542 <<
" scintillators_sigmaNoise: " << scintillators_sigmaNoise <<
"\n";
References LogDebug.
◆ distance()
template<typename TILE >
float HGCalCLUEAlgoT< TILE >::distance |
( |
int |
cell1, |
|
|
int |
cell2, |
|
|
int |
layerId, |
|
|
bool |
isEtaPhi |
|
) |
| const |
|
inlineprivate |
◆ distance2()
template<typename TILE >
float HGCalCLUEAlgoT< TILE >::distance2 |
( |
int |
cell1, |
|
|
int |
cell2, |
|
|
int |
layerId, |
|
|
bool |
isEtaPhi |
|
) |
| const |
|
inlineprivate |
◆ fillPSetDescription()
Definition at line 78 of file HGCalCLUEAlgo.h.
79 iDesc.
add<std::vector<double>>(
"thresholdW0", {2.9, 2.9, 2.9});
80 iDesc.
add<std::vector<double>>(
"deltac",
87 iDesc.
add<
bool>(
"dependSensor",
true);
88 iDesc.
add<
double>(
"ecut", 3.0);
89 iDesc.
add<
double>(
"kappa", 9.0);
91 iDesc.
add<std::vector<double>>(
"dEdXweights", {});
92 iDesc.
add<std::vector<double>>(
"thicknessCorrection", {});
93 iDesc.
add<std::vector<double>>(
"fcPerMip", {});
94 iDesc.
add<
double>(
"fcPerEle", 0.0);
96 descNestedNoises.
add<std::vector<double>>(
"values", {});
99 descNestedNoiseMIP.
add<
bool>(
"scaleByDose",
false);
100 descNestedNoiseMIP.add<
unsigned int>(
"scaleByDoseAlgo", 0);
101 descNestedNoiseMIP.add<
std::string>(
"doseMap",
"");
102 descNestedNoiseMIP.add<
double>(
"noise_MIP", 1. / 100.);
104 iDesc.
add<
bool>(
"use2x2",
true);
References edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addUntracked(), and AlCaHLTBitMon_QueryRunRegistry::string.
◆ findAndAssignClusters()
template<typename T >
int HGCalCLUEAlgoT< T >::findAndAssignClusters |
( |
const unsigned int |
layerId, |
|
|
float |
delta_c, |
|
|
float |
delta_r |
|
) |
| |
|
private |
Definition at line 458 of file HGCalCLUEAlgo.cc.
463 unsigned int nClustersOnLayer = 0;
464 auto& cellsOnLayer =
cells_[layerId];
465 unsigned int numberOfCells = cellsOnLayer.detid.size();
466 std::vector<int> localStack;
468 for (
unsigned int i = 0;
i < numberOfCells;
i++) {
469 float rho_c =
kappa_ * cellsOnLayer.sigmaNoise[
i];
474 cellsOnLayer.clusterIndex[
i] = -1;
475 bool isSeed = (cellsOnLayer.delta[
i] >
delta) && (cellsOnLayer.rho[
i] >= rho_c);
478 cellsOnLayer.clusterIndex[
i] = nClustersOnLayer;
479 cellsOnLayer.isSeed[
i] =
true;
481 localStack.push_back(
i);
483 }
else if (!isOutlier) {
484 cellsOnLayer.followers[cellsOnLayer.nearestHigher[
i]].push_back(
i);
489 while (!localStack.empty()) {
490 int endStack = localStack.back();
491 auto& thisSeed = cellsOnLayer.followers[endStack];
492 localStack.pop_back();
495 for (
int j : thisSeed) {
497 cellsOnLayer.clusterIndex[
j] = cellsOnLayer.clusterIndex[endStack];
499 localStack.push_back(
j);
502 return nClustersOnLayer;
References dumpMFGeometry_cfg::delta, hitfit::delta_r(), mps_fire::i, and dqmiolumiharvest::j.
◆ getClusters()
◆ getDensity()
◆ getEventSetupPerAlgorithm()
◆ makeClusters()
◆ populate()
◆ prepareDataStructures()
template<typename T >
void HGCalCLUEAlgoT< T >::prepareDataStructures |
( |
const unsigned int |
layerId | ) |
|
|
private |
◆ reset()
◆ setDensity()
Definition at line 548 of file HGCalCLUEAlgo.cc.
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];
References mps_fire::i.
◆ cells_
◆ dEdXweights_
◆ density_
◆ dependSensor_
◆ ecut_
◆ fcPerEle_
◆ fcPerMip_
◆ initialized_
◆ kappa_
◆ noiseMip_
◆ nonAgedNoises_
◆ numberOfClustersPerLayer_
◆ outlierDeltaFactor_
◆ thicknessCorrection_
◆ thresholds_
◆ thresholdW0_
◆ use2x2_
◆ v_sigmaNoise_
template<typename TILE >
std::vector<std::vector<double> > HGCalCLUEAlgoT< TILE >::v_sigmaNoise_ |
|
private |
◆ vecDeltas_
std::vector< double > vecDeltas_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
int iphi() const
get the phi index
constexpr float energy() const
int findAndAssignClusters(const unsigned int layerId, float delta_c, float delta_r)
int etaBin(const l1t::HGCalMulticluster *cl)
void calculateLocalDensity(const TILE <, const unsigned int layerId, float delta_c, float delta_r)
constexpr double deltaPhi(double phi1, double phi2)
double delta_r(const Fourvec &a, const Fourvec &b)
Find the distance between two four-vectors in the two-dimensional space .
float outlierDeltaFactor_
std::vector< std::vector< double > > thresholds_
std::vector< double > thicknessCorrection_
std::vector< double > thresholdW0_
T getUntrackedParameter(std::string const &, T const &) const
constexpr const DetId & detid() const
std::vector< CellsOnLayer > cells_
std::vector< std::vector< double > > v_sigmaNoise_
std::vector< reco::BasicCluster > clusters_v_
unsigned int lastLayerEE_
unsigned int firstLayerBH_
HGCalClusteringAlgoBase(VerbosityLevel v, reco::CaloCluster::AlgoId algo)
void prepareDataStructures(const unsigned int layerId)
reco::CaloCluster::AlgoId algoId_
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
XYZPointD XYZPoint
point in space with cartesian internal representation
std::vector< double > fcPerMip_
hgcal::RecHitTools rhtools_
static int position[264][3]
void setDensity(const unsigned int layerId)
float distance(int cell1, int cell2, int layerId, bool isEtaPhi) const
T getParameter(std::string const &) const
math::XYZPoint calculatePosition(const std::vector< int > &v, const unsigned int layerId) const
std::vector< double > nonAgedNoises_
float distance2(int cell1, int cell2, int layerId, bool isEtaPhi) const
Abs< T >::type abs(const T &t)
void calculateDistanceToHigher(const TILE <, const unsigned int layerId, float delta_c, float delta_r)
std::vector< int > numberOfClustersPerLayer_
std::vector< double > dEdXweights_