|
|
#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 346 of file HGCalCLUEAlgo.cc.
350 auto& cellsOnLayer =
cells_[layerId];
351 unsigned int numberOfCells = cellsOnLayer.detid.size();
352 bool isOnlySi(
false);
356 for (
unsigned int i = 0;
i < numberOfCells;
i++) {
357 bool isSi = isOnlySi || cellsOnLayer.isSi[
i];
361 int i_nearestHigher = -1;
363 float delta = delta_c;
367 std::array<int, 4> search_box = lt.searchBox(
370 for (
int xBin = search_box[0];
xBin < search_box[1] + 1; ++
xBin) {
371 for (
int yBin = search_box[2];
yBin < search_box[3] + 1; ++
yBin) {
373 size_t binId = lt.getGlobalBinByBin(
xBin,
yBin);
375 size_t binSize = lt[binId].size();
378 for (
unsigned int j = 0;
j < binSize;
j++) {
379 unsigned int otherId = lt[binId][
j];
380 bool otherSi = isOnlySi || cellsOnLayer.isSi[otherId];
382 float dist =
distance(
i, otherId, layerId,
false);
383 bool foundHigher = (cellsOnLayer.rho[otherId] > cellsOnLayer.rho[
i]) ||
384 (cellsOnLayer.rho[otherId] == cellsOnLayer.rho[
i] &&
385 cellsOnLayer.detid[otherId] > cellsOnLayer.detid[
i]);
387 if (foundHigher && dist <= i_delta) {
391 i_nearestHigher = otherId;
398 bool foundNearestHigherInSearchBox = (i_delta !=
maxDelta);
399 if (foundNearestHigherInSearchBox) {
400 cellsOnLayer.delta[
i] = i_delta;
401 cellsOnLayer.nearestHigher[
i] = i_nearestHigher;
406 cellsOnLayer.nearestHigher[
i] = -1;
412 std::array<int, 4> search_box = lt.searchBoxEtaPhi(cellsOnLayer.eta[
i] -
range,
413 cellsOnLayer.eta[
i] +
range,
414 cellsOnLayer.phi[
i] -
range,
415 cellsOnLayer.phi[
i] +
range);
417 for (
int xBin = search_box[0];
xBin < search_box[1] + 1; ++
xBin) {
418 for (
int yBin = search_box[2];
yBin < search_box[3] + 1; ++
yBin) {
420 size_t binId = lt.getGlobalBinByBinEtaPhi(
xBin,
yBin);
422 size_t binSize = lt[binId].size();
425 for (
unsigned int j = 0;
j < binSize;
j++) {
426 unsigned int otherId = lt[binId][
j];
427 if (!cellsOnLayer.isSi[otherId]) {
428 float dist =
distance(
i, otherId, layerId,
true);
429 bool foundHigher = (cellsOnLayer.rho[otherId] > cellsOnLayer.rho[
i]) ||
430 (cellsOnLayer.rho[otherId] == cellsOnLayer.rho[
i] &&
431 cellsOnLayer.detid[otherId] > cellsOnLayer.detid[
i]);
433 if (foundHigher && dist <= i_delta) {
437 i_nearestHigher = otherId;
444 bool foundNearestHigherInSearchBox = (i_delta !=
maxDelta);
445 if (foundNearestHigherInSearchBox) {
446 cellsOnLayer.delta[
i] = i_delta;
447 cellsOnLayer.nearestHigher[
i] = i_nearestHigher;
452 cellsOnLayer.nearestHigher[
i] = -1;
455 LogDebug(
"HGCalCLUEAlgo") <<
"Debugging calculateDistanceToHigher: \n"
456 <<
" cell: " <<
i <<
" isSilicon: " << cellsOnLayer.isSi[
i]
457 <<
" eta: " << cellsOnLayer.eta[
i] <<
" phi: " << cellsOnLayer.phi[
i]
458 <<
" energy: " << cellsOnLayer.weight[
i] <<
" density: " << cellsOnLayer.rho[
i]
459 <<
" nearest higher: " << cellsOnLayer.nearestHigher[
i]
460 <<
" 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
304 int dIEta = otherIEta -
iEta;
305 LogDebug(
"HGCalCLUEAlgo") <<
" Debugging calculateLocalDensity for Scintillator: \n"
306 <<
" cell: " << otherId <<
" energy: " << cellsOnLayer.weight[otherId]
307 <<
" otherIPhi: " << otherIPhi <<
" iPhi: " << iPhi
308 <<
" otherIEta: " << otherIEta <<
" iEta: " <<
iEta <<
"\n";
311 auto neighborCellContribution = 0.5f * cellsOnLayer.weight[otherId];
312 all += neighborCellContribution;
313 if (dIPhi >= 0 && dIEta >= 0)
314 northeast += neighborCellContribution;
315 if (dIPhi <= 0 && dIEta >= 0)
316 southeast += neighborCellContribution;
317 if (dIPhi >= 0 && dIEta <= 0)
318 northwest += neighborCellContribution;
319 if (dIPhi <= 0 && dIEta <= 0)
320 southwest += neighborCellContribution;
322 LogDebug(
"HGCalCLUEAlgo") <<
" Debugging calculateLocalDensity for Scintillator: \n"
323 <<
" northeast: " << northeast <<
" southeast: " << southeast
324 <<
" northwest: " << northwest <<
" southwest: " << southwest <<
"\n";
330 float neighborsval = (
std::max(northeast, northwest) >
std::max(southeast, southwest))
334 cellsOnLayer.rho[
i] += neighborsval;
336 cellsOnLayer.rho[
i] +=
all;
338 LogDebug(
"HGCalCLUEAlgo") <<
"Debugging calculateLocalDensity: \n"
339 <<
" cell: " <<
i <<
" isSilicon: " << cellsOnLayer.isSi[
i]
340 <<
" eta: " << cellsOnLayer.eta[
i] <<
" phi: " << cellsOnLayer.phi[
i]
341 <<
" 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 513 of file HGCalCLUEAlgo.cc.
527 std::vector<double>
dummy;
533 for (
unsigned ilayer = 1; ilayer <=
maxlayer_; ++ilayer) {
542 <<
" sigmaNoise: " << sigmaNoise <<
"\n";
550 <<
" 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 86 of file HGCalCLUEAlgo.h.
87 iDesc.
add<std::vector<double>>(
"thresholdW0", {2.9, 2.9, 2.9});
88 iDesc.
add<
double>(
"positionDeltaRho2", 1.69);
89 iDesc.
add<std::vector<double>>(
"deltac",
96 iDesc.
add<
bool>(
"dependSensor",
true);
97 iDesc.
add<
double>(
"ecut", 3.0);
98 iDesc.
add<
double>(
"kappa", 9.0);
100 iDesc.
add<std::vector<double>>(
"dEdXweights", {});
101 iDesc.
add<std::vector<double>>(
"thicknessCorrection", {});
102 iDesc.
add<
double>(
"sciThicknessCorrection", 0.9);
103 iDesc.
add<
int>(
"deltasi_index_regemfac", 3);
104 iDesc.
add<
unsigned>(
"maxNumberOfThickIndices", 6);
105 iDesc.
add<std::vector<double>>(
"fcPerMip", {});
106 iDesc.
add<
double>(
"fcPerEle", 0.0);
107 iDesc.
add<std::vector<double>>(
"noises", {});
109 descNestedNoiseMIP.
add<
bool>(
"scaleByDose",
false);
110 descNestedNoiseMIP.add<
unsigned int>(
"scaleByDoseAlgo", 0);
111 descNestedNoiseMIP.add<
double>(
"scaleByDoseFactor", 1.);
112 descNestedNoiseMIP.add<
std::string>(
"doseMap",
"");
113 descNestedNoiseMIP.add<
double>(
"noise_MIP", 1. / 100.);
115 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 465 of file HGCalCLUEAlgo.cc.
470 unsigned int nClustersOnLayer = 0;
471 auto& cellsOnLayer =
cells_[layerId];
472 unsigned int numberOfCells = cellsOnLayer.detid.size();
473 std::vector<int> localStack;
475 for (
unsigned int i = 0;
i < numberOfCells;
i++) {
476 float rho_c =
kappa_ * cellsOnLayer.sigmaNoise[
i];
481 cellsOnLayer.clusterIndex[
i] = -1;
482 bool isSeed = (cellsOnLayer.delta[
i] >
delta) && (cellsOnLayer.rho[
i] >= rho_c);
485 cellsOnLayer.clusterIndex[
i] = nClustersOnLayer;
486 cellsOnLayer.isSeed[
i] =
true;
488 localStack.push_back(
i);
490 }
else if (!isOutlier) {
491 cellsOnLayer.followers[cellsOnLayer.nearestHigher[
i]].push_back(
i);
496 while (!localStack.empty()) {
497 int endStack = localStack.back();
498 auto& thisSeed = cellsOnLayer.followers[endStack];
499 localStack.pop_back();
502 for (
int j : thisSeed) {
504 cellsOnLayer.clusterIndex[
j] = cellsOnLayer.clusterIndex[endStack];
506 localStack.push_back(
j);
509 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 556 of file HGCalCLUEAlgo.cc.
557 auto& cellsOnLayer =
cells_[layerId];
558 unsigned int numberOfCells = cellsOnLayer.detid.size();
559 for (
unsigned int i = 0;
i < numberOfCells; ++
i)
560 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_
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_
HGCalClusteringAlgoBase(VerbosityLevel v, reco::CaloCluster::AlgoId algo)
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_