8 : seedingAlgoType_(conf.getParameter<
std::
string>(
"type_histoalgo")),
9 nBins1_(conf.getParameter<unsigned>(
"nBins_X1_histo_multicluster")),
10 nBins2_(conf.getParameter<unsigned>(
"nBins_X2_histo_multicluster")),
11 binsSumsHisto_(conf.getParameter<
std::
vector<unsigned>>(
"binSumsHisto")),
12 histoThreshold_(conf.getParameter<double>(
"threshold_histo_multicluster")),
13 neighbour_weights_(conf.getParameter<
std::
vector<double>>(
"neighbour_weights")),
14 smoothing_ecal_(conf.getParameter<
std::
vector<double>>(
"seed_smoothing_ecal")),
15 smoothing_hcal_(conf.getParameter<
std::
vector<double>>(
"seed_smoothing_hcal")),
16 kROverZMin_(conf.getParameter<double>(
"kROverZMin")),
17 kROverZMax_(conf.getParameter<double>(
"kROverZMax")) {
50 <<
"\nMulticluster number of X1-bins for the histo algorithm: " <<
nBins1_ 51 <<
"\nMulticluster number of X2-bins for the histo algorithm: " <<
nBins2_ 52 <<
"\nMulticluster MIPT threshold for histo threshold algorithm: " <<
histoThreshold_ 58 <<
"Inconsistent nBins_X1_histo_multicluster ( " <<
nBins1_ <<
" ) and binSumsHisto ( " <<
binsSumsHisto_.size()
59 <<
" ) size in HGCalMulticlustering\n";
64 <<
"Inconsistent size of neighbour weights vector in HGCalMulticlustering ( " <<
neighbour_weights_.size()
73 double minx1 = std::get<0>(
bounds);
74 double maxx1 = std::get<1>(
bounds);
75 double minx2 = std::get<2>(
bounds);
76 double maxx2 = std::get<3>(
bounds);
78 for (
auto& clu : clustersPtrs) {
79 float x1 = 0.,
x2 = 0;
82 x1 =
sqrt(
pow(clu->centreProj().x(), 2) +
pow(clu->centreProj().y(), 2));
86 x1 = clu->centreProj().x();
87 x2 = clu->centreProj().y();
90 if (x1 < minx1 || x1 >= maxx1) {
91 throw cms::Exception(
"OutOfBound") <<
"TC X1 = " <<
x1 <<
" out of the seeding histogram bounds " << minx1
94 if (x2 < minx2 || x2 >= maxx2) {
95 throw cms::Exception(
"OutOfBound") <<
"TC X2 = " <<
x2 <<
" out of the seeding histogram bounds " << minx2
98 unsigned bin1 = unsigned((
x1 - minx1) *
nBins1_ / (maxx1 - minx1));
99 unsigned bin2 = unsigned((
x2 - minx2) *
nBins2_ / (maxx2 - minx2));
104 bin.values[Bin::Content::Ecal] += clu->mipPt();
106 bin.values[Bin::Content::Hcal] += clu->mipPt();
108 bin.weighted_x += (clu->centreProj().x()) * clu->mipPt();
109 bin.weighted_y += (clu->centreProj().y()) * clu->mipPt();
112 for (
auto&
bin : histoClusters) {
117 return histoClusters;
121 const vector<double>& kernel,
125 unsigned kernel_size =
std::sqrt(kernel.size());
126 if (kernel_size * kernel_size != kernel.size()) {
127 throw cms::Exception(
"HGCTriggerParameterError") <<
"Only square kernels can be used.";
129 if (kernel_size % 2 != 1) {
130 throw cms::Exception(
"HGCTriggerParameterError") <<
"The kernel size must be an odd value.";
132 int shift_max = (kernel_size - 1) / 2;
133 double normalization = std::accumulate(kernel.begin(), kernel.end(), 0.);
134 for (
int z_side : {-1, 1}) {
137 const auto& bin_orig = histoClusters.
at(z_side,
x1,
x2);
140 for (
int x1_shift = -shift_max; x1_shift <= shift_max; x1_shift++) {
141 int index1 = x1_shift + shift_max;
142 for (
int x2_shift = -shift_max; x2_shift <= shift_max; x2_shift++) {
144 int index2 = x2_shift + shift_max;
145 double kernel_value = kernel.at(index1 * kernel_size + index2);
146 bool out = shifted[0] == -1 || shifted[1] == -1;
147 double content = (
out ? 0. : histoClusters.
at(z_side, shifted[0], shifted[1]).values[binContent]);
148 smooth +=
content * kernel_value;
151 auto&
bin = histoSmooth.
at(z_side,
x1,
x2);
153 bin.weighted_x = bin_orig.weighted_x;
154 bin.weighted_y = bin_orig.weighted_y;
163 const vector<unsigned>&
binSums) {
166 for (
int z_side : {-1, 1}) {
167 for (
unsigned bin1 = 0; bin1 <
nBins1_; bin1++) {
168 int nBinsSide = (
binSums[bin1] - 1) / 2;
179 for (
unsigned bin2 = 0; bin2 <
nBins2_; bin2++) {
180 const auto& bin_orig = histoClusters.
at(z_side, bin1, bin2);
183 for (
int bin22 = 1; bin22 <= nBinsSide; bin22++) {
184 int binToSumLeft = bin2 - bin22;
185 if (binToSumLeft < 0)
187 unsigned binToSumRight = bin2 + bin22;
198 auto&
bin = histoSumPhiClusters.
at(z_side, bin1, bin2);
200 bin.weighted_x = bin_orig.weighted_x;
201 bin.weighted_y = bin_orig.weighted_y;
206 return histoSumPhiClusters;
212 for (
int z_side : {-1, 1}) {
213 for (
unsigned bin1 = 0; bin1 <
nBins1_; bin1++) {
215 (bin1 == 0 || bin1 ==
nBins1_ - 1) ? 1.5 : 2.;
217 for (
unsigned bin2 = 0; bin2 <
nBins2_; bin2++) {
218 const auto& bin_orig = histoClusters.
at(z_side, bin1, bin2);
220 float contentDown = bin1 > 0 ? histoClusters.
at(z_side, bin1 - 1, bin2).values[
Bin::Content::Sum] : 0;
223 auto&
bin = histoSumRPhiClusters.
at(z_side, bin1, bin2);
225 bin.weighted_x = bin_orig.weighted_x;
226 bin.weighted_y = bin_orig.weighted_y;
231 return histoSumRPhiClusters;
238 const Bin& histBin) {
242 double minx1 = std::get<0>(
bounds);
243 double maxx1 = std::get<1>(
bounds);
244 double minx2 = std::get<2>(
bounds);
245 double maxx2 = std::get<3>(
bounds);
248 float x1_seed = minx1 + (bin1 + 0.5) * (maxx1 - minx1) /
nBins1_;
249 float x2_seed = minx2 + (bin2 + 0.5) * (maxx2 - minx2) /
nBins2_;
252 x_seed = x1_seed *
cos(x2_seed);
253 y_seed = x1_seed *
sin(x2_seed);
268 std::vector<std::pair<GlobalPoint, double>> seedPositionsEnergy;
270 for (
int z_side : {-1, 1}) {
271 for (
unsigned bin1 = 0; bin1 <
nBins1_; bin1++) {
272 for (
unsigned bin2 = 0; bin2 <
nBins2_; bin2++) {
288 float MIPT_N = (pos_N[0] != -1 && pos_N[1] != -1)
291 float MIPT_S = (pos_S[0] != -1 && pos_S[1] != -1)
294 float MIPT_W = (pos_W[0] != -1 && pos_W[1] != -1)
297 float MIPT_E = (pos_E[0] != -1 && pos_E[1] != -1)
300 float MIPT_NW = (pos_NW[0] != -1 && pos_NW[1] != -1)
303 float MIPT_NE = (pos_NE[0] != -1 && pos_NE[1] != -1)
306 float MIPT_SW = (pos_SW[0] != -1 && pos_SW[1] != -1)
309 float MIPT_SE = (pos_SE[0] != -1 && pos_SE[1] != -1)
313 isMax &= MIPT_seed >= MIPT_S && MIPT_seed > MIPT_N && MIPT_seed >= MIPT_E && MIPT_seed >= MIPT_SE &&
314 MIPT_seed >= MIPT_NE && MIPT_seed > MIPT_W && MIPT_seed > MIPT_SW && MIPT_seed > MIPT_NW;
323 return seedPositionsEnergy;
328 std::vector<std::pair<GlobalPoint, double>> seedPositionsEnergy;
330 for (
int z_side : {-1, 1}) {
331 for (
unsigned bin1 = 0; bin1 <
nBins1_; bin1++) {
332 for (
unsigned bin2 = 0; bin2 <
nBins2_; bin2++) {
345 float MIPT_N = (pos_N[0] != -1 && pos_N[1] != -1)
348 float MIPT_S = (pos_S[0] != -1 && pos_S[1] != -1)
351 float MIPT_W = (pos_W[0] != -1 && pos_W[1] != -1)
354 float MIPT_E = (pos_E[0] != -1 && pos_E[1] != -1)
357 float MIPT_NW = (pos_NW[0] != -1 && pos_NW[1] != -1)
360 float MIPT_NE = (pos_NE[0] != -1 && pos_NE[1] != -1)
363 float MIPT_SW = (pos_SW[0] != -1 && pos_SW[1] != -1)
366 float MIPT_SE = (pos_SE[0] != -1 && pos_SE[1] != -1)
384 return seedPositionsEnergy;
389 std::vector<std::pair<GlobalPoint, double>> seedPositionsEnergy;
391 for (
int z_side : {-1, 1}) {
392 for (
unsigned bin1 = 0; bin1 <
nBins1_; bin1++) {
393 for (
unsigned bin2 = 0; bin2 <
nBins2_; bin2++) {
404 return seedPositionsEnergy;
409 std::vector<std::pair<GlobalPoint, double>> seedPositionsEnergy;
415 for (
int z_side : {-1, 1}) {
416 for (
unsigned bin1 = 0; bin1 <
nBins1_; bin1++) {
417 for (
unsigned bin2 = 0; bin2 <
nBins2_; bin2++) {
425 float MIPT_N = bin1 > 0 ? histoClusters.
at(z_side, bin1 - 1, bin2).values[
Bin::Content::Sum] : 0;
427 int binLeft = bin2 - 1;
430 unsigned binRight = bin2 + 1;
436 float MIPT_NW = bin1 > 0 ? histoClusters.
at(z_side, bin1 - 1, binLeft).values[
Bin::Content::Sum] : 0;
437 float MIPT_NE = bin1 > 0 ? histoClusters.
at(z_side, bin1 - 1, binRight).values[
Bin::Content::Sum] : 0;
443 isMax &= MIPT_seed >= MIPT_S && MIPT_seed > MIPT_N && MIPT_seed >= MIPT_E && MIPT_seed >= MIPT_SE &&
444 MIPT_seed >= MIPT_NE && MIPT_seed > MIPT_W && MIPT_seed > MIPT_SW && MIPT_seed > MIPT_NW;
449 primarySeedPositions.
at(z_side, bin1, bin2) =
true;
451 vetoPositions.
at(z_side, bin1, binLeft) =
true;
452 vetoPositions.
at(z_side, bin1, binRight) =
true;
454 vetoPositions.
at(z_side, bin1 - 1, bin2) =
true;
455 vetoPositions.
at(z_side, bin1 - 1, binRight) =
true;
456 vetoPositions.
at(z_side, bin1 - 1, binLeft) =
true;
459 vetoPositions.
at(z_side, bin1 + 1, bin2) =
true;
460 vetoPositions.
at(z_side, bin1 + 1, binRight) =
true;
461 vetoPositions.
at(z_side, bin1 + 1, binLeft) =
true;
470 for (
int z_side : {-1, 1}) {
471 for (
unsigned bin1 = 0; bin1 <
nBins1_; bin1++) {
472 for (
unsigned bin2 = 0; bin2 <
nBins2_; bin2++) {
474 if (primarySeedPositions.
at(z_side, bin1, bin2) || vetoPositions.
at(z_side, bin1, bin2))
481 float MIPT_N = bin1 > 0 ? histoClusters.
at(z_side, bin1 - 1, bin2).values[
Bin::Content::Sum] : 0;
483 int binLeft = bin2 - 1;
486 unsigned binRight = bin2 + 1;
492 float MIPT_NW = bin1 > 0 ? histoClusters.
at(z_side, bin1 - 1, binLeft).values[
Bin::Content::Sum] : 0;
493 float MIPT_NE = bin1 > 0 ? histoClusters.
at(z_side, bin1 - 1, binRight).values[
Bin::Content::Sum] : 0;
499 isMax &= (((bin1 <
nBins1_ - 1) && vetoPositions.
at(z_side, bin1 + 1, bin2))
or MIPT_seed >= MIPT_S) &&
500 (((bin1 > 0) && vetoPositions.
at(z_side, bin1 - 1, bin2))
or MIPT_seed > MIPT_N) &&
501 ((vetoPositions.
at(z_side, bin1, binRight))
or MIPT_seed >= MIPT_E) &&
502 (((bin1 <
nBins1_ - 1) && vetoPositions.
at(z_side, bin1 + 1, binRight))
or MIPT_seed >= MIPT_SE) &&
503 (((bin1 > 0) && vetoPositions.
at(z_side, bin1 - 1, binRight))
or MIPT_seed >= MIPT_NE) &&
504 ((vetoPositions.
at(z_side, bin1, binLeft))
or MIPT_seed > MIPT_W) &&
505 (((bin1 <
nBins1_ - 1) && vetoPositions.
at(z_side, bin1 + 1, binLeft))
or MIPT_seed > MIPT_SW) &&
506 (((bin1 > 0) && vetoPositions.
at(z_side, bin1 - 1, binLeft))
or MIPT_seed > MIPT_NW);
515 return seedPositionsEnergy;
519 std::vector<std::pair<GlobalPoint, double>>& seedPositionsEnergy) {
534 for (
int z_side : {-1, 1}) {
537 auto&
bin = smoothHistoCluster.
at(z_side,
x1,
x2);
562 return {{0., 0., 0., 0.}};
std::vector< std::pair< GlobalPoint, double > > computeInterpolatedMaxSeeds(const Histogram &histoClusters)
T getParameter(std::string const &) const
static constexpr unsigned neighbour_weights_size_
std::vector< unsigned > binsSumsHisto_
constexpr T reduceRange(T x)
Histogram fillSmoothPhiHistoClusters(const Histogram &histoClusters, const vector< unsigned > &binSums)
void setHome(int x1, int x2)
Histogram fillSmoothRPhiHistoClusters(const Histogram &histoClusters)
Sin< T >::type sin(const T &t)
Global3DPoint GlobalPoint
SeedingPosition seedingPosition_
std::vector< std::pair< GlobalPoint, double > > computeMaxSeeds(const Histogram &histoClusters)
HGCalTriggerTools triggerTools_
std::vector< std::pair< GlobalPoint, double > > computeSecondaryMaxSeeds(const Histogram &histoClusters)
SeedingSpace seedingSpace_
void findHistoSeeds(const std::vector< edm::Ptr< l1t::HGCalCluster >> &clustersPtr, std::vector< std::pair< GlobalPoint, double >> &seedPositionsEnergy)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
void setSeedEnergyAndPosition(std::vector< std::pair< GlobalPoint, double >> &seedPositionsEnergy, int z_side, unsigned bin_R, unsigned bin_phi, const Bin &histBin)
Cos< T >::type cos(const T &t)
Histogram fillSmoothHistoClusters(const Histogram &, const vector< double > &, Bin::Content)
std::array< int, 2 > move(int offset1, int offset2)
std::array< double, 4 > boundaries()
std::vector< double > smoothing_ecal_
std::vector< std::pair< GlobalPoint, double > > computeThresholdSeeds(const Histogram &histoClusters)
Log< level::Info, false > LogInfo
std::array< float, 3 > values
std::vector< double > neighbour_weights_
Histogram fillHistoClusters(const std::vector< edm::Ptr< l1t::HGCalCluster >> &clustersPtrs)
static constexpr double kXYMax_
std::string seedingAlgoType_
T & at(int zside, unsigned x1, unsigned x2)
std::vector< double > smoothing_hcal_
Power< A, B >::type pow(const A &a, const B &b)
static constexpr double area_per_triggercell_
HGCalHistoSeedingImpl(const edm::ParameterSet &conf)