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 seeds_norm_by_area_(conf.getParameter<
bool>(
"seeds_norm_by_area")),
17 kROverZMin_(conf.getParameter<double>(
"kROverZMin")),
18 kROverZMax_(conf.getParameter<double>(
"kROverZMax")) {
51 <<
"\nMulticluster number of X1-bins for the histo algorithm: " <<
nBins1_ 52 <<
"\nMulticluster number of X2-bins for the histo algorithm: " <<
nBins2_ 53 <<
"\nMulticluster MIPT threshold for histo threshold algorithm: " <<
histoThreshold_ 59 <<
"Inconsistent nBins_X1_histo_multicluster ( " <<
nBins1_ <<
" ) and binSumsHisto ( " <<
binsSumsHisto_.size()
60 <<
" ) size in HGCalMulticlustering\n";
65 <<
"Inconsistent size of neighbour weights vector in HGCalMulticlustering ( " <<
neighbour_weights_.size()
85 double minx1 = std::get<0>(
bounds);
86 double maxx1 = std::get<1>(
bounds);
87 double minx2 = std::get<2>(
bounds);
88 double maxx2 = std::get<3>(
bounds);
90 for (
auto& clu : clustersPtrs) {
91 float x1 = 0.,
x2 = 0;
94 x1 =
sqrt(
pow(clu->centreProj().x(), 2) +
pow(clu->centreProj().y(), 2));
98 x1 = clu->centreProj().x();
99 x2 = clu->centreProj().y();
102 if (x1 < minx1 || x1 >= maxx1) {
103 throw cms::Exception(
"OutOfBound") <<
"TC X1 = " <<
x1 <<
" out of the seeding histogram bounds " << minx1
106 if (x2 < minx2 || x2 >= maxx2) {
107 throw cms::Exception(
"OutOfBound") <<
"TC X2 = " <<
x2 <<
" out of the seeding histogram bounds " << minx2
110 unsigned bin1 = unsigned((
x1 - minx1) *
nBins1_ / (maxx1 - minx1));
111 unsigned bin2 = unsigned((
x2 - minx2) *
nBins2_ / (maxx2 - minx2));
116 bin.values[Bin::Content::Ecal] += clu->mipPt();
118 bin.values[Bin::Content::Hcal] += clu->mipPt();
120 bin.weighted_x += (clu->centreProj().x()) * clu->mipPt();
121 bin.weighted_y += (clu->centreProj().y()) * clu->mipPt();
124 for (
auto&
bin : histoClusters) {
129 return histoClusters;
133 const vector<double>& kernel,
137 unsigned kernel_size =
std::sqrt(kernel.size());
138 if (kernel_size * kernel_size != kernel.size()) {
139 throw cms::Exception(
"HGCTriggerParameterError") <<
"Only square kernels can be used.";
141 if (kernel_size % 2 != 1) {
142 throw cms::Exception(
"HGCTriggerParameterError") <<
"The kernel size must be an odd value.";
144 int shift_max = (kernel_size - 1) / 2;
145 double normalization = std::accumulate(kernel.begin(), kernel.end(), 0.);
146 for (
int z_side : {-1, 1}) {
149 const auto& bin_orig = histoClusters.
at(z_side,
x1,
x2);
152 for (
int x1_shift = -shift_max; x1_shift <= shift_max; x1_shift++) {
153 int index1 = x1_shift + shift_max;
154 for (
int x2_shift = -shift_max; x2_shift <= shift_max; x2_shift++) {
156 int index2 = x2_shift + shift_max;
157 double kernel_value = kernel.at(index1 * kernel_size + index2);
158 bool out = shifted[0] == -1 || shifted[1] == -1;
159 double content = (
out ? 0. : histoClusters.
at(z_side, shifted[0], shifted[1]).values[binContent]);
160 smooth +=
content * kernel_value;
163 auto&
bin = histoSmooth.
at(z_side,
x1,
x2);
165 bin.weighted_x = bin_orig.weighted_x;
166 bin.weighted_y = bin_orig.weighted_y;
175 const vector<unsigned>&
binSums) {
178 for (
int z_side : {-1, 1}) {
179 for (
unsigned bin1 = 0; bin1 <
nBins1_; bin1++) {
180 int nBinsSide = (
binSums[bin1] - 1) / 2;
182 double area = (1 + 2.0 * (1 -
pow(0.5, nBinsSide)));
192 for (
unsigned bin2 = 0; bin2 <
nBins2_; bin2++) {
193 const auto& bin_orig = histoClusters.
at(z_side, bin1, bin2);
196 for (
int bin22 = 1; bin22 <= nBinsSide; bin22++) {
197 int binToSumLeft = bin2 - bin22;
198 if (binToSumLeft < 0)
200 unsigned binToSumRight = bin2 + bin22;
211 auto&
bin = histoSumPhiClusters.
at(z_side, bin1, bin2);
213 bin.weighted_x = bin_orig.weighted_x;
214 bin.weighted_y = bin_orig.weighted_y;
219 return histoSumPhiClusters;
225 for (
int z_side : {-1, 1}) {
226 for (
unsigned bin1 = 0; bin1 <
nBins1_; bin1++) {
228 (bin1 == 0 || bin1 ==
nBins1_ - 1) ? 1.5 : 2.;
230 for (
unsigned bin2 = 0; bin2 <
nBins2_; bin2++) {
231 const auto& bin_orig = histoClusters.
at(z_side, bin1, bin2);
233 float contentDown = bin1 > 0 ? histoClusters.
at(z_side, bin1 - 1, bin2).values[
Bin::Content::Sum] : 0;
236 auto&
bin = histoSumRPhiClusters.
at(z_side, bin1, bin2);
238 bin.weighted_x = bin_orig.weighted_x;
239 bin.weighted_y = bin_orig.weighted_y;
244 return histoSumRPhiClusters;
251 const Bin& histBin) {
255 double minx1 = std::get<0>(
bounds);
256 double maxx1 = std::get<1>(
bounds);
257 double minx2 = std::get<2>(
bounds);
258 double maxx2 = std::get<3>(
bounds);
261 float x1_seed = minx1 + (bin1 + 0.5) * (maxx1 - minx1) /
nBins1_;
262 float x2_seed = minx2 + (bin2 + 0.5) * (maxx2 - minx2) /
nBins2_;
265 x_seed = x1_seed *
cos(x2_seed);
266 y_seed = x1_seed *
sin(x2_seed);
281 std::vector<std::pair<GlobalPoint, double>> seedPositionsEnergy;
283 for (
int z_side : {-1, 1}) {
284 for (
unsigned bin1 = 0; bin1 <
nBins1_; bin1++) {
285 for (
unsigned bin2 = 0; bin2 <
nBins2_; bin2++) {
301 float MIPT_N = (pos_N[0] != -1 && pos_N[1] != -1)
304 float MIPT_S = (pos_S[0] != -1 && pos_S[1] != -1)
307 float MIPT_W = (pos_W[0] != -1 && pos_W[1] != -1)
310 float MIPT_E = (pos_E[0] != -1 && pos_E[1] != -1)
313 float MIPT_NW = (pos_NW[0] != -1 && pos_NW[1] != -1)
316 float MIPT_NE = (pos_NE[0] != -1 && pos_NE[1] != -1)
319 float MIPT_SW = (pos_SW[0] != -1 && pos_SW[1] != -1)
322 float MIPT_SE = (pos_SE[0] != -1 && pos_SE[1] != -1)
326 isMax &= MIPT_seed >= MIPT_S && MIPT_seed > MIPT_N && MIPT_seed >= MIPT_E && MIPT_seed >= MIPT_SE &&
327 MIPT_seed >= MIPT_NE && MIPT_seed > MIPT_W && MIPT_seed > MIPT_SW && MIPT_seed > MIPT_NW;
336 return seedPositionsEnergy;
341 std::vector<std::pair<GlobalPoint, double>> seedPositionsEnergy;
343 for (
int z_side : {-1, 1}) {
344 for (
unsigned bin1 = 0; bin1 <
nBins1_; bin1++) {
345 for (
unsigned bin2 = 0; bin2 <
nBins2_; bin2++) {
358 float MIPT_N = (pos_N[0] != -1 && pos_N[1] != -1)
361 float MIPT_S = (pos_S[0] != -1 && pos_S[1] != -1)
364 float MIPT_W = (pos_W[0] != -1 && pos_W[1] != -1)
367 float MIPT_E = (pos_E[0] != -1 && pos_E[1] != -1)
370 float MIPT_NW = (pos_NW[0] != -1 && pos_NW[1] != -1)
373 float MIPT_NE = (pos_NE[0] != -1 && pos_NE[1] != -1)
376 float MIPT_SW = (pos_SW[0] != -1 && pos_SW[1] != -1)
379 float MIPT_SE = (pos_SE[0] != -1 && pos_SE[1] != -1)
397 return seedPositionsEnergy;
402 std::vector<std::pair<GlobalPoint, double>> seedPositionsEnergy;
404 for (
int z_side : {-1, 1}) {
405 for (
unsigned bin1 = 0; bin1 <
nBins1_; bin1++) {
406 for (
unsigned bin2 = 0; bin2 <
nBins2_; bin2++) {
417 return seedPositionsEnergy;
422 std::vector<std::pair<GlobalPoint, double>> seedPositionsEnergy;
428 for (
int z_side : {-1, 1}) {
429 for (
unsigned bin1 = 0; bin1 <
nBins1_; bin1++) {
430 for (
unsigned bin2 = 0; bin2 <
nBins2_; bin2++) {
438 float MIPT_N = bin1 > 0 ? histoClusters.
at(z_side, bin1 - 1, bin2).values[
Bin::Content::Sum] : 0;
440 int binLeft = bin2 - 1;
443 unsigned binRight = bin2 + 1;
449 float MIPT_NW = bin1 > 0 ? histoClusters.
at(z_side, bin1 - 1, binLeft).values[
Bin::Content::Sum] : 0;
450 float MIPT_NE = bin1 > 0 ? histoClusters.
at(z_side, bin1 - 1, binRight).values[
Bin::Content::Sum] : 0;
456 isMax &= MIPT_seed >= MIPT_S && MIPT_seed > MIPT_N && MIPT_seed >= MIPT_E && MIPT_seed >= MIPT_SE &&
457 MIPT_seed >= MIPT_NE && MIPT_seed > MIPT_W && MIPT_seed > MIPT_SW && MIPT_seed > MIPT_NW;
462 primarySeedPositions.
at(z_side, bin1, bin2) =
true;
464 vetoPositions.
at(z_side, bin1, binLeft) =
true;
465 vetoPositions.
at(z_side, bin1, binRight) =
true;
467 vetoPositions.
at(z_side, bin1 - 1, bin2) =
true;
468 vetoPositions.
at(z_side, bin1 - 1, binRight) =
true;
469 vetoPositions.
at(z_side, bin1 - 1, binLeft) =
true;
472 vetoPositions.
at(z_side, bin1 + 1, bin2) =
true;
473 vetoPositions.
at(z_side, bin1 + 1, binRight) =
true;
474 vetoPositions.
at(z_side, bin1 + 1, binLeft) =
true;
483 for (
int z_side : {-1, 1}) {
484 for (
unsigned bin1 = 0; bin1 <
nBins1_; bin1++) {
485 for (
unsigned bin2 = 0; bin2 <
nBins2_; bin2++) {
487 if (primarySeedPositions.
at(z_side, bin1, bin2) || vetoPositions.
at(z_side, bin1, bin2))
494 float MIPT_N = bin1 > 0 ? histoClusters.
at(z_side, bin1 - 1, bin2).values[
Bin::Content::Sum] : 0;
496 int binLeft = bin2 - 1;
499 unsigned binRight = bin2 + 1;
505 float MIPT_NW = bin1 > 0 ? histoClusters.
at(z_side, bin1 - 1, binLeft).values[
Bin::Content::Sum] : 0;
506 float MIPT_NE = bin1 > 0 ? histoClusters.
at(z_side, bin1 - 1, binRight).values[
Bin::Content::Sum] : 0;
512 isMax &= (((bin1 <
nBins1_ - 1) && vetoPositions.
at(z_side, bin1 + 1, bin2))
or MIPT_seed >= MIPT_S) &&
513 (((bin1 > 0) && vetoPositions.
at(z_side, bin1 - 1, bin2))
or MIPT_seed > MIPT_N) &&
514 ((vetoPositions.
at(z_side, bin1, binRight))
or MIPT_seed >= MIPT_E) &&
515 (((bin1 <
nBins1_ - 1) && vetoPositions.
at(z_side, bin1 + 1, binRight))
or MIPT_seed >= MIPT_SE) &&
516 (((bin1 > 0) && vetoPositions.
at(z_side, bin1 - 1, binRight))
or MIPT_seed >= MIPT_NE) &&
517 ((vetoPositions.
at(z_side, bin1, binLeft))
or MIPT_seed > MIPT_W) &&
518 (((bin1 <
nBins1_ - 1) && vetoPositions.
at(z_side, bin1 + 1, binLeft))
or MIPT_seed > MIPT_SW) &&
519 (((bin1 > 0) && vetoPositions.
at(z_side, bin1 - 1, binLeft))
or MIPT_seed > MIPT_NW);
528 return seedPositionsEnergy;
532 std::vector<std::pair<GlobalPoint, double>>& seedPositionsEnergy) {
547 for (
int z_side : {-1, 1}) {
550 auto&
bin = smoothHistoCluster.
at(z_side,
x1,
x2);
575 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)