|
|
#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 345 of file HGCalCLUEAlgo.cc.
349 auto& cellsOnLayer =
cells_[layerId];
350 unsigned int numberOfCells = cellsOnLayer.detid.size();
351 bool isOnlySi(
false);
355 for (
unsigned int i = 0;
i < numberOfCells;
i++) {
356 bool isSi = isOnlySi || cellsOnLayer.isSi[
i];
360 int i_nearestHigher = -1;
362 float delta = delta_c;
366 std::array<int, 4> search_box = lt.searchBox(
369 for (
int xBin = search_box[0];
xBin < search_box[1] + 1; ++
xBin) {
370 for (
int yBin = search_box[2];
yBin < search_box[3] + 1; ++
yBin) {
372 size_t binId = lt.getGlobalBinByBin(
xBin,
yBin);
374 size_t binSize = lt[binId].size();
377 for (
unsigned int j = 0;
j < binSize;
j++) {
378 unsigned int otherId = lt[binId][
j];
379 bool otherSi = isOnlySi || cellsOnLayer.isSi[otherId];
381 float dist =
distance(
i, otherId, layerId,
false);
382 bool foundHigher = (cellsOnLayer.rho[otherId] > cellsOnLayer.rho[
i]) ||
383 (cellsOnLayer.rho[otherId] == cellsOnLayer.rho[
i] &&
384 cellsOnLayer.detid[otherId] > cellsOnLayer.detid[
i]);
386 if (foundHigher && dist <= i_delta) {
390 i_nearestHigher = otherId;
397 bool foundNearestHigherInSearchBox = (i_delta !=
maxDelta);
398 if (foundNearestHigherInSearchBox) {
399 cellsOnLayer.delta[
i] = i_delta;
400 cellsOnLayer.nearestHigher[
i] = i_nearestHigher;
405 cellsOnLayer.nearestHigher[
i] = -1;
411 std::array<int, 4> search_box = lt.searchBoxEtaPhi(cellsOnLayer.eta[
i] -
range,
412 cellsOnLayer.eta[
i] +
range,
413 cellsOnLayer.phi[
i] -
range,
414 cellsOnLayer.phi[
i] +
range);
416 for (
int xBin = search_box[0];
xBin < search_box[1] + 1; ++
xBin) {
417 for (
int yBin = search_box[2];
yBin < search_box[3] + 1; ++
yBin) {
419 size_t binId = lt.getGlobalBinByBinEtaPhi(
xBin,
yBin);
421 size_t binSize = lt[binId].size();
424 for (
unsigned int j = 0;
j < binSize;
j++) {
425 unsigned int otherId = lt[binId][
j];
426 if (!cellsOnLayer.isSi[otherId]) {
427 float dist =
distance(
i, otherId, layerId,
true);
428 bool foundHigher = (cellsOnLayer.rho[otherId] > cellsOnLayer.rho[
i]) ||
429 (cellsOnLayer.rho[otherId] == cellsOnLayer.rho[
i] &&
430 cellsOnLayer.detid[otherId] > cellsOnLayer.detid[
i]);
432 if (foundHigher && dist <= i_delta) {
436 i_nearestHigher = otherId;
443 bool foundNearestHigherInSearchBox = (i_delta !=
maxDelta);
444 if (foundNearestHigherInSearchBox) {
445 cellsOnLayer.delta[
i] = i_delta;
446 cellsOnLayer.nearestHigher[
i] = i_nearestHigher;
451 cellsOnLayer.nearestHigher[
i] = -1;
454 LogDebug(
"HGCalCLUEAlgo") <<
"Debugging calculateDistanceToHigher: \n"
455 <<
" cell: " <<
i <<
" isSilicon: " << cellsOnLayer.isSi[
i]
456 <<
" eta: " << cellsOnLayer.eta[
i] <<
" phi: " << cellsOnLayer.phi[
i]
457 <<
" energy: " << cellsOnLayer.weight[
i] <<
" density: " << cellsOnLayer.rho[
i]
458 <<
" nearest higher: " << cellsOnLayer.nearestHigher[
i]
459 <<
" distance: " << cellsOnLayer.delta[
i] <<
"\n";
References dumpMFGeometry_cfg::delta, hitfit::delta_r(), HLT_FULL_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 247 of file HGCalCLUEAlgo.cc.
248 auto& cellsOnLayer =
cells_[layerId];
249 unsigned int numberOfCells = cellsOnLayer.detid.size();
250 bool isOnlySi(
false);
254 for (
unsigned int i = 0;
i < numberOfCells;
i++) {
255 bool isSi = isOnlySi || cellsOnLayer.isSi[
i];
257 float delta = delta_c;
258 std::array<int, 4> search_box = lt.searchBox(
261 for (
int xBin = search_box[0];
xBin < search_box[1] + 1; ++
xBin) {
262 for (
int yBin = search_box[2];
yBin < search_box[3] + 1; ++
yBin) {
263 int binId = lt.getGlobalBinByBin(
xBin,
yBin);
264 size_t binSize = lt[binId].size();
266 for (
unsigned int j = 0;
j < binSize;
j++) {
267 unsigned int otherId = lt[binId][
j];
268 bool otherSi = isOnlySi || cellsOnLayer.isSi[otherId];
271 cellsOnLayer.rho[
i] += (
i == otherId ? 1.f : 0.5f) * cellsOnLayer.weight[otherId];
279 std::array<int, 4> search_box = lt.searchBoxEtaPhi(cellsOnLayer.eta[
i] -
delta,
280 cellsOnLayer.eta[
i] +
delta,
281 cellsOnLayer.phi[
i] -
delta,
282 cellsOnLayer.phi[
i] +
delta);
283 cellsOnLayer.rho[
i] += cellsOnLayer.weight[
i];
284 float northeast(0), northwest(0), southeast(0), southwest(0),
all(0);
289 size_t binSize = lt[binId].size();
291 for (
unsigned int j = 0;
j < binSize;
j++) {
292 unsigned int otherId = lt[binId][
j];
293 if (!cellsOnLayer.isSi[otherId]) {
299 int dIPhi = otherIPhi - iPhi;
300 dIPhi +=
abs(dIPhi) < 2 ? 0
303 int dIEta = otherIEta -
iEta;
304 LogDebug(
"HGCalCLUEAlgo") <<
" Debugging calculateLocalDensity for Scintillator: \n"
305 <<
" cell: " << otherId <<
" energy: " << cellsOnLayer.weight[otherId]
306 <<
" otherIPhi: " << otherIPhi <<
" iPhi: " << iPhi
307 <<
" otherIEta: " << otherIEta <<
" iEta: " <<
iEta <<
"\n";
310 auto neighborCellContribution = 0.5f * cellsOnLayer.weight[otherId];
311 all += neighborCellContribution;
312 if (dIPhi >= 0 && dIEta >= 0)
313 northeast += neighborCellContribution;
314 if (dIPhi <= 0 && dIEta >= 0)
315 southeast += neighborCellContribution;
316 if (dIPhi >= 0 && dIEta <= 0)
317 northwest += neighborCellContribution;
318 if (dIPhi <= 0 && dIEta <= 0)
319 southwest += neighborCellContribution;
321 LogDebug(
"HGCalCLUEAlgo") <<
" Debugging calculateLocalDensity for Scintillator: \n"
322 <<
" northeast: " << northeast <<
" southeast: " << southeast
323 <<
" northwest: " << northwest <<
" southwest: " << southwest <<
"\n";
329 float neighborsval = (
std::max(northeast, northwest) >
std::max(southeast, southwest))
333 cellsOnLayer.rho[
i] += neighborsval;
335 cellsOnLayer.rho[
i] +=
all;
337 LogDebug(
"HGCalCLUEAlgo") <<
"Debugging calculateLocalDensity: \n"
338 <<
" cell: " <<
i <<
" isSilicon: " << cellsOnLayer.isSi[
i]
339 <<
" eta: " << cellsOnLayer.eta[
i] <<
" phi: " << cellsOnLayer.phi[
i]
340 <<
" energy: " << cellsOnLayer.weight[
i] <<
" density: " << cellsOnLayer.rho[
i] <<
"\n";
References funct::abs(), python.cmstools::all(), dumpMFGeometry_cfg::delta, hitfit::delta_r(), HLT_FULL_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 187 of file HGCalCLUEAlgo.cc.
188 float total_weight = 0.f;
192 unsigned int maxEnergyIndex = 0;
193 float maxEnergyValue = 0.f;
195 auto& cellsOnLayer =
cells_[layerId];
200 total_weight += cellsOnLayer.weight[
i];
201 if (cellsOnLayer.weight[
i] > maxEnergyValue) {
202 maxEnergyValue = cellsOnLayer.weight[
i];
209 bool isSiliconCell = (thick != -1);
213 float total_weight_log = 0.f;
220 float rhEnergy = cellsOnLayer.weight[
i];
222 x_log += cellsOnLayer.x[
i] * Wi;
223 y_log += cellsOnLayer.y[
i] * Wi;
224 total_weight_log += Wi;
227 total_weight = total_weight_log;
232 float rhEnergy = cellsOnLayer.weight[
i];
234 x += cellsOnLayer.x[
i] * rhEnergy;
235 y += cellsOnLayer.y[
i] * rhEnergy;
238 if (total_weight != 0.) {
239 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 512 of file HGCalCLUEAlgo.cc.
526 std::vector<double>
dummy;
532 for (
unsigned ilayer = 1; ilayer <=
maxlayer_; ++ilayer) {
541 <<
" sigmaNoise: " << sigmaNoise <<
"\n";
549 <<
" 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 87 of file HGCalCLUEAlgo.h.
88 iDesc.
add<std::vector<double>>(
"thresholdW0", {2.9, 2.9, 2.9});
89 iDesc.
add<
double>(
"positionDeltaRho2", 1.69);
90 iDesc.
add<std::vector<double>>(
"deltac",
97 iDesc.
add<
bool>(
"dependSensor",
true);
98 iDesc.
add<
double>(
"ecut", 3.0);
99 iDesc.
add<
double>(
"kappa", 9.0);
101 iDesc.
add<std::vector<double>>(
"dEdXweights", {});
102 iDesc.
add<std::vector<double>>(
"thicknessCorrection", {});
103 iDesc.
add<
double>(
"sciThicknessCorrection", 0.9);
104 iDesc.
add<
int>(
"deltasi_index_regemfac", 3);
105 iDesc.
add<
unsigned>(
"maxNumberOfThickIndices", 6);
106 iDesc.
add<std::vector<double>>(
"fcPerMip", {});
107 iDesc.
add<
double>(
"fcPerEle", 0.0);
108 iDesc.
add<std::vector<double>>(
"noises", {});
110 descNestedNoiseMIP.
add<
bool>(
"scaleByDose",
false);
111 descNestedNoiseMIP.add<
unsigned int>(
"scaleByDoseAlgo", 0);
112 descNestedNoiseMIP.add<
double>(
"scaleByDoseFactor", 1.);
113 descNestedNoiseMIP.add<
std::string>(
"doseMap",
"");
114 descNestedNoiseMIP.add<
double>(
"noise_MIP", 1. / 100.);
116 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 464 of file HGCalCLUEAlgo.cc.
469 unsigned int nClustersOnLayer = 0;
470 auto& cellsOnLayer =
cells_[layerId];
471 unsigned int numberOfCells = cellsOnLayer.detid.size();
472 std::vector<int> localStack;
474 for (
unsigned int i = 0;
i < numberOfCells;
i++) {
475 float rho_c =
kappa_ * cellsOnLayer.sigmaNoise[
i];
480 cellsOnLayer.clusterIndex[
i] = -1;
481 bool isSeed = (cellsOnLayer.delta[
i] >
delta) && (cellsOnLayer.rho[
i] >= rho_c);
484 cellsOnLayer.clusterIndex[
i] = nClustersOnLayer;
485 cellsOnLayer.isSeed[
i] =
true;
487 localStack.push_back(
i);
489 }
else if (!isOutlier) {
490 cellsOnLayer.followers[cellsOnLayer.nearestHigher[
i]].push_back(
i);
495 while (!localStack.empty()) {
496 int endStack = localStack.back();
497 auto& thisSeed = cellsOnLayer.followers[endStack];
498 localStack.pop_back();
501 for (
int j : thisSeed) {
503 cellsOnLayer.clusterIndex[
j] = cellsOnLayer.clusterIndex[endStack];
505 localStack.push_back(
j);
508 return nClustersOnLayer;
References dumpMFGeometry_cfg::delta, hitfit::delta_r(), mps_fire::i, and dqmiolumiharvest::j.
◆ getClusters()
◆ getDensity()
◆ getEventSetupPerAlgorithm()
◆ makeClusters()
◆ populate()
Implements HGCalClusteringAlgoBase.
Definition at line 27 of file HGCalCLUEAlgo.cc.
36 for (
unsigned int i = 0;
i <
hits.size(); ++
i) {
43 float sigmaNoise = 1.f;
46 if (thickness_index == -1)
49 double storedThreshold =
thresholds_[layerOnSide][thickness_index];
55 if (hgrh.
energy() < storedThreshold)
References DetId::det(), CaloRecHit::detid(), CaloRecHit::energy(), DetId::HGCalHSi, HGCHEF, hfClusterShapes_cfi::hits, mps_fire::i, phase1PixelTopology::layer, hltrates_dqm_sourceclient-live_cfg::offset, position, and DetId::subdetId().
◆ prepareDataStructures()
template<typename T >
void HGCalCLUEAlgoT< T >::prepareDataStructures |
( |
const unsigned int |
layerId | ) |
|
|
private |
◆ reset()
◆ setDensity()
Definition at line 555 of file HGCalCLUEAlgo.cc.
556 auto& cellsOnLayer =
cells_[layerId];
557 unsigned int numberOfCells = cellsOnLayer.detid.size();
558 for (
unsigned int i = 0;
i < numberOfCells; ++
i)
559 density_[cellsOnLayer.detid[
i]] = cellsOnLayer.rho[
i];
References mps_fire::i.
◆ cells_
◆ dEdXweights_
◆ deltasi_index_regemfac_
◆ density_
◆ dependSensor_
◆ ecut_
◆ fcPerEle_
◆ fcPerMip_
◆ initialized_
◆ kappa_
◆ maxNumberOfThickIndices_
◆ noiseMip_
◆ nonAgedNoises_
◆ numberOfClustersPerLayer_
◆ outlierDeltaFactor_
◆ positionDeltaRho2_
◆ sciThicknessCorrection_
◆ 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 .
constexpr Detector det() const
get the detector field from this detid
float outlierDeltaFactor_
std::vector< std::vector< double > > thresholds_
const caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple cms::cuda::AtomicPairCounter const GPUCACell *__restrict__ cells
std::vector< double > thicknessCorrection_
HGCalClusteringAlgoBase(VerbosityLevel v, reco::CaloCluster::AlgoId algo, edm::ConsumesCollector iC)
std::vector< double > thresholdW0_
T getUntrackedParameter(std::string const &, T const &) const
constexpr const DetId & detid() const
const double positionDeltaRho2_
std::vector< CellsOnLayer > cells_
std::vector< std::vector< double > > v_sigmaNoise_
std::vector< reco::BasicCluster > clusters_v_
unsigned int lastLayerEE_
unsigned int firstLayerBH_
void prepareDataStructures(const unsigned int layerId)
unsigned maxNumberOfThickIndices_
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
reco::CaloCluster::AlgoId algoId_
constexpr std::array< uint8_t, layerIndexSize > layer
double sciThicknessCorrection_
int deltasi_index_regemfac_
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
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
T getParameter(std::string const &) 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_