CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes
HGCalHistoSeedingImpl Class Reference

#include <HGCalHistoSeedingImpl.h>

Public Member Functions

float dR (const l1t::HGCalCluster &clu, const GlobalPoint &seed) const
 
void eventSetup (const edm::EventSetup &es)
 
void findHistoSeeds (const std::vector< edm::Ptr< l1t::HGCalCluster >> &clustersPtr, std::vector< std::pair< GlobalPoint, double >> &seedPositionsEnergy)
 
 HGCalHistoSeedingImpl (const edm::ParameterSet &conf)
 

Private Types

typedef std::map< std::array< int, 3 >, float > Histogram
 
enum  SeedingType { HistoMaxC3d, HistoSecondaryMaxC3d, HistoThresholdC3d, HistoInterpolatedMaxC3d }
 

Private Member Functions

std::vector< std::pair< GlobalPoint, double > > computeInterpolatedMaxSeeds (const Histogram &histoClusters)
 
std::vector< std::pair< GlobalPoint, double > > computeMaxSeeds (const Histogram &histoClusters)
 
std::vector< std::pair< GlobalPoint, double > > computeSecondaryMaxSeeds (const Histogram &histoClusters)
 
std::vector< std::pair< GlobalPoint, double > > computeThresholdSeeds (const Histogram &histoClusters)
 
Histogram fillHistoClusters (const std::vector< edm::Ptr< l1t::HGCalCluster >> &clustersPtrs)
 
Histogram fillSmoothPhiHistoClusters (const Histogram &histoClusters, const vector< unsigned > &binSums)
 
Histogram fillSmoothRPhiHistoClusters (const Histogram &histoClusters)
 

Private Attributes

std::vector< unsigned > binsSumsHisto_
 
double histoThreshold_ = 20.
 
unsigned nBinsPhiHisto_ = 216
 
unsigned nBinsRHisto_ = 36
 
std::vector< double > neighbour_weights_
 
std::string seedingAlgoType_
 
SeedingType seedingType_
 
HGCalTriggerTools triggerTools_
 

Static Private Attributes

static double kROverZMax_ = 0.52
 
static double kROverZMin_ = 0.09
 
static unsigned neighbour_weights_size_ = 9
 

Detailed Description

Definition at line 14 of file HGCalHistoSeedingImpl.h.

Member Typedef Documentation

typedef std::map<std::array<int, 3>, float> HGCalHistoSeedingImpl::Histogram
private

Definition at line 28 of file HGCalHistoSeedingImpl.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

HGCalHistoSeedingImpl::HGCalHistoSeedingImpl ( const edm::ParameterSet conf)

Definition at line 6 of file HGCalHistoSeedingImpl.cc.

References binsSumsHisto_, Exception, HistoInterpolatedMaxC3d, HistoMaxC3d, HistoSecondaryMaxC3d, histoThreshold_, HistoThresholdC3d, nBinsPhiHisto_, nBinsRHisto_, neighbour_weights_, neighbour_weights_size_, seedingAlgoType_, and seedingType_.

7  : seedingAlgoType_(conf.getParameter<string>("type_multicluster")),
8  nBinsRHisto_(conf.getParameter<unsigned>("nBins_R_histo_multicluster")),
9  nBinsPhiHisto_(conf.getParameter<unsigned>("nBins_Phi_histo_multicluster")),
10  binsSumsHisto_(conf.getParameter<std::vector<unsigned>>("binSumsHisto")),
11  histoThreshold_(conf.getParameter<double>("threshold_histo_multicluster")),
12  neighbour_weights_(conf.getParameter<std::vector<double>>("neighbour_weights")) {
13  if (seedingAlgoType_ == "HistoMaxC3d") {
15  } else if (seedingAlgoType_ == "HistoSecondaryMaxC3d") {
17  } else if (seedingAlgoType_ == "HistoThresholdC3d") {
19  } else if (seedingAlgoType_ == "HistoInterpolatedMaxC3d") {
21  } else {
22  throw cms::Exception("HGCTriggerParameterError") << "Unknown Multiclustering type '" << seedingAlgoType_;
23  }
24 
25  edm::LogInfo("HGCalMulticlusterParameters")
26  << "\nMulticluster number of R-bins for the histo algorithm: " << nBinsRHisto_
27  << "\nMulticluster number of Phi-bins for the histo algorithm: " << nBinsPhiHisto_
28  << "\nMulticluster MIPT threshold for histo threshold algorithm: " << histoThreshold_
29  << "\nMulticluster type of multiclustering algortihm: " << seedingAlgoType_;
30 
31  if (seedingAlgoType_.find("Histo") != std::string::npos && nBinsRHisto_ != binsSumsHisto_.size()) {
32  throw cms::Exception("Inconsistent bin size")
33  << "Inconsistent nBins_R_histo_multicluster ( " << nBinsRHisto_ << " ) and binSumsHisto ( "
34  << binsSumsHisto_.size() << " ) size in HGCalMulticlustering\n";
35  }
36 
38  throw cms::Exception("Inconsistent vector size")
39  << "Inconsistent size of neighbour weights vector in HGCalMulticlustering ( " << neighbour_weights_.size()
40  << " ). Should be " << neighbour_weights_size_ << "\n";
41  }
42 }
T getParameter(std::string const &) const
std::vector< unsigned > binsSumsHisto_
static unsigned neighbour_weights_size_
std::vector< double > neighbour_weights_

Member Function Documentation

std::vector< std::pair< GlobalPoint, double > > HGCalHistoSeedingImpl::computeInterpolatedMaxSeeds ( const Histogram histoClusters)
private

Definition at line 174 of file HGCalHistoSeedingImpl.cc.

References funct::cos(), histoThreshold_, createfilelist::int, kROverZMax_, kROverZMin_, M_PI, nBinsPhiHisto_, nBinsRHisto_, neighbour_weights_, and funct::sin().

Referenced by findHistoSeeds().

175  {
176  std::vector<std::pair<GlobalPoint, double>> seedPositionsEnergy;
177 
178  for (int z_side : {-1, 1}) {
179  for (int bin_R = 0; bin_R < int(nBinsRHisto_); bin_R++) {
180  for (int bin_phi = 0; bin_phi < int(nBinsPhiHisto_); bin_phi++) {
181  float MIPT_seed = histoClusters.at({{z_side, bin_R, bin_phi}});
182  float MIPT_S = bin_R < (int(nBinsRHisto_) - 1) ? histoClusters.at({{z_side, bin_R + 1, bin_phi}}) : 0;
183  float MIPT_N = bin_R > 0 ? histoClusters.at({{z_side, bin_R - 1, bin_phi}}) : 0;
184 
185  int binLeft = bin_phi - 1;
186  if (binLeft < 0)
187  binLeft += nBinsPhiHisto_;
188  int binRight = bin_phi + 1;
189  if (binRight >= int(nBinsPhiHisto_))
190  binRight -= nBinsPhiHisto_;
191 
192  float MIPT_W = histoClusters.at({{z_side, bin_R, binLeft}});
193  float MIPT_E = histoClusters.at({{z_side, bin_R, binRight}});
194 
195  float MIPT_NW = bin_R > 0 ? histoClusters.at({{z_side, bin_R - 1, binLeft}}) : 0;
196  float MIPT_NE = bin_R > 0 ? histoClusters.at({{z_side, bin_R - 1, binRight}}) : 0;
197  float MIPT_SW = bin_R < (int(nBinsRHisto_) - 1) ? histoClusters.at({{z_side, bin_R + 1, binLeft}}) : 0;
198  float MIPT_SE = bin_R < (int(nBinsRHisto_) - 1) ? histoClusters.at({{z_side, bin_R + 1, binRight}}) : 0;
199 
200  float MIPT_pred = neighbour_weights_.at(0) * MIPT_NW + neighbour_weights_.at(1) * MIPT_N +
201  neighbour_weights_.at(2) * MIPT_NE + neighbour_weights_.at(3) * MIPT_W +
202  neighbour_weights_.at(5) * MIPT_E + neighbour_weights_.at(6) * MIPT_SW +
203  neighbour_weights_.at(7) * MIPT_S + neighbour_weights_.at(8) * MIPT_SE;
204 
205  bool isMax = MIPT_seed >= (MIPT_pred + histoThreshold_);
206 
207  if (isMax) {
208  float ROverZ_seed = kROverZMin_ + (bin_R + 0.5) * (kROverZMax_ - kROverZMin_) / nBinsRHisto_;
209  float phi_seed = -M_PI + (bin_phi + 0.5) * 2 * M_PI / nBinsPhiHisto_;
210  float x_seed = ROverZ_seed * cos(phi_seed);
211  float y_seed = ROverZ_seed * sin(phi_seed);
212  seedPositionsEnergy.emplace_back(GlobalPoint(x_seed, y_seed, z_side), MIPT_seed);
213  }
214  }
215  }
216  }
217 
218  return seedPositionsEnergy;
219 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
#define M_PI
std::vector< double > neighbour_weights_
std::vector< std::pair< GlobalPoint, double > > HGCalHistoSeedingImpl::computeMaxSeeds ( const Histogram histoClusters)
private

Definition at line 129 of file HGCalHistoSeedingImpl.cc.

References funct::cos(), histoThreshold_, createfilelist::int, kROverZMax_, kROverZMin_, M_PI, nBinsPhiHisto_, nBinsRHisto_, and funct::sin().

Referenced by findHistoSeeds().

129  {
130  std::vector<std::pair<GlobalPoint, double>> seedPositionsEnergy;
131 
132  for (int z_side : {-1, 1}) {
133  for (int bin_R = 0; bin_R < int(nBinsRHisto_); bin_R++) {
134  for (int bin_phi = 0; bin_phi < int(nBinsPhiHisto_); bin_phi++) {
135  float MIPT_seed = histoClusters.at({{z_side, bin_R, bin_phi}});
136  bool isMax = MIPT_seed > histoThreshold_;
137  if (!isMax)
138  continue;
139 
140  float MIPT_S = bin_R < (int(nBinsRHisto_) - 1) ? histoClusters.at({{z_side, bin_R + 1, bin_phi}}) : 0;
141  float MIPT_N = bin_R > 0 ? histoClusters.at({{z_side, bin_R - 1, bin_phi}}) : 0;
142 
143  int binLeft = bin_phi - 1;
144  if (binLeft < 0)
145  binLeft += nBinsPhiHisto_;
146  int binRight = bin_phi + 1;
147  if (binRight >= int(nBinsPhiHisto_))
148  binRight -= nBinsPhiHisto_;
149 
150  float MIPT_W = histoClusters.at({{z_side, bin_R, binLeft}});
151  float MIPT_E = histoClusters.at({{z_side, bin_R, binRight}});
152  float MIPT_NW = bin_R > 0 ? histoClusters.at({{z_side, bin_R - 1, binLeft}}) : 0;
153  float MIPT_NE = bin_R > 0 ? histoClusters.at({{z_side, bin_R - 1, binRight}}) : 0;
154  float MIPT_SW = bin_R < (int(nBinsRHisto_) - 1) ? histoClusters.at({{z_side, bin_R + 1, binLeft}}) : 0;
155  float MIPT_SE = bin_R < (int(nBinsRHisto_) - 1) ? histoClusters.at({{z_side, bin_R + 1, binRight}}) : 0;
156 
157  isMax &= MIPT_seed >= MIPT_S && MIPT_seed > MIPT_N && MIPT_seed >= MIPT_E && MIPT_seed >= MIPT_SE &&
158  MIPT_seed >= MIPT_NE && MIPT_seed > MIPT_W && MIPT_seed > MIPT_SW && MIPT_seed > MIPT_NW;
159 
160  if (isMax) {
161  float ROverZ_seed = kROverZMin_ + (bin_R + 0.5) * (kROverZMax_ - kROverZMin_) / nBinsRHisto_;
162  float phi_seed = -M_PI + (bin_phi + 0.5) * 2 * M_PI / nBinsPhiHisto_;
163  float x_seed = ROverZ_seed * cos(phi_seed);
164  float y_seed = ROverZ_seed * sin(phi_seed);
165  seedPositionsEnergy.emplace_back(GlobalPoint(x_seed, y_seed, z_side), MIPT_seed);
166  }
167  }
168  }
169  }
170 
171  return seedPositionsEnergy;
172 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
#define M_PI
std::vector< std::pair< GlobalPoint, double > > HGCalHistoSeedingImpl::computeSecondaryMaxSeeds ( const Histogram histoClusters)
private

Definition at line 245 of file HGCalHistoSeedingImpl.cc.

References funct::cos(), histoThreshold_, createfilelist::int, kROverZMax_, kROverZMin_, M_PI, nBinsPhiHisto_, nBinsRHisto_, or, and funct::sin().

Referenced by findHistoSeeds().

246  {
247  std::vector<std::pair<GlobalPoint, double>> seedPositionsEnergy;
248 
249  std::map<std::tuple<int, int, int>, bool> primarySeedPositions;
250  std::map<std::tuple<int, int, int>, bool> secondarySeedPositions;
251  std::map<std::tuple<int, int, int>, bool> vetoPositions;
252 
253  //Search for primary seeds
254  for (int z_side : {-1, 1}) {
255  for (int bin_R = 0; bin_R < int(nBinsRHisto_); bin_R++) {
256  for (int bin_phi = 0; bin_phi < int(nBinsPhiHisto_); bin_phi++) {
257  float MIPT_seed = histoClusters.at({{z_side, bin_R, bin_phi}});
258  bool isMax = MIPT_seed > histoThreshold_;
259 
260  if (!isMax)
261  continue;
262 
263  float MIPT_S = bin_R < (int(nBinsRHisto_) - 1) ? histoClusters.at({{z_side, bin_R + 1, bin_phi}}) : 0;
264  float MIPT_N = bin_R > 0 ? histoClusters.at({{z_side, bin_R - 1, bin_phi}}) : 0;
265 
266  int binLeft = bin_phi - 1;
267  if (binLeft < 0)
268  binLeft += nBinsPhiHisto_;
269  int binRight = bin_phi + 1;
270  if (binRight >= int(nBinsPhiHisto_))
271  binRight -= nBinsPhiHisto_;
272 
273  float MIPT_W = histoClusters.at({{z_side, bin_R, binLeft}});
274  float MIPT_E = histoClusters.at({{z_side, bin_R, binRight}});
275  float MIPT_NW = bin_R > 0 ? histoClusters.at({{z_side, bin_R - 1, binLeft}}) : 0;
276  float MIPT_NE = bin_R > 0 ? histoClusters.at({{z_side, bin_R - 1, binRight}}) : 0;
277  float MIPT_SW = bin_R < (int(nBinsRHisto_) - 1) ? histoClusters.at({{z_side, bin_R + 1, binLeft}}) : 0;
278  float MIPT_SE = bin_R < (int(nBinsRHisto_) - 1) ? histoClusters.at({{z_side, bin_R + 1, binRight}}) : 0;
279 
280  isMax &= MIPT_seed >= MIPT_S && MIPT_seed > MIPT_N && MIPT_seed >= MIPT_E && MIPT_seed >= MIPT_SE &&
281  MIPT_seed >= MIPT_NE && MIPT_seed > MIPT_W && MIPT_seed > MIPT_SW && MIPT_seed > MIPT_NW;
282 
283  if (isMax) {
284  float ROverZ_seed = kROverZMin_ + (bin_R + 0.5) * (kROverZMax_ - kROverZMin_) / nBinsRHisto_;
285  float phi_seed = -M_PI + (bin_phi + 0.5) * 2 * M_PI / nBinsPhiHisto_;
286  float x_seed = ROverZ_seed * cos(phi_seed);
287  float y_seed = ROverZ_seed * sin(phi_seed);
288 
289  seedPositionsEnergy.emplace_back(GlobalPoint(x_seed, y_seed, z_side), MIPT_seed);
290  primarySeedPositions[std::make_tuple(bin_R, bin_phi, z_side)] = true;
291 
292  vetoPositions[std::make_tuple(bin_R, binLeft, z_side)] = true;
293  vetoPositions[std::make_tuple(bin_R, binRight, z_side)] = true;
294  if (bin_R > 0) {
295  vetoPositions[std::make_tuple(bin_R - 1, bin_phi, z_side)] = true;
296  vetoPositions[std::make_tuple(bin_R - 1, binRight, z_side)] = true;
297  vetoPositions[std::make_tuple(bin_R - 1, binLeft, z_side)] = true;
298  }
299  if (bin_R < (int(nBinsRHisto_) - 1)) {
300  vetoPositions[std::make_tuple(bin_R + 1, bin_phi, z_side)] = true;
301  vetoPositions[std::make_tuple(bin_R + 1, binRight, z_side)] = true;
302  vetoPositions[std::make_tuple(bin_R + 1, binLeft, z_side)] = true;
303  }
304  }
305  }
306  }
307  }
308 
309  //Search for secondary seeds
310 
311  for (int z_side : {-1, 1}) {
312  for (int bin_R = 0; bin_R < int(nBinsRHisto_); bin_R++) {
313  for (int bin_phi = 0; bin_phi < int(nBinsPhiHisto_); bin_phi++) {
314  //Cannot be a secondary seed if already a primary seed, or adjacent to primary seed
315  if (primarySeedPositions[std::make_tuple(bin_R, bin_phi, z_side)] ||
316  vetoPositions[std::make_tuple(bin_R, bin_phi, z_side)])
317  continue;
318 
319  float MIPT_seed = histoClusters.at({{z_side, bin_R, bin_phi}});
320  bool isMax = MIPT_seed > histoThreshold_;
321 
322  float MIPT_S = bin_R < (int(nBinsRHisto_) - 1) ? histoClusters.at({{z_side, bin_R + 1, bin_phi}}) : 0;
323  float MIPT_N = bin_R > 0 ? histoClusters.at({{z_side, bin_R - 1, bin_phi}}) : 0;
324 
325  int binLeft = bin_phi - 1;
326  if (binLeft < 0)
327  binLeft += nBinsPhiHisto_;
328  int binRight = bin_phi + 1;
329  if (binRight >= int(nBinsPhiHisto_))
330  binRight -= nBinsPhiHisto_;
331 
332  float MIPT_W = histoClusters.at({{z_side, bin_R, binLeft}});
333  float MIPT_E = histoClusters.at({{z_side, bin_R, binRight}});
334  float MIPT_NW = bin_R > 0 ? histoClusters.at({{z_side, bin_R - 1, binLeft}}) : 0;
335  float MIPT_NE = bin_R > 0 ? histoClusters.at({{z_side, bin_R - 1, binRight}}) : 0;
336  float MIPT_SW = bin_R < (int(nBinsRHisto_) - 1) ? histoClusters.at({{z_side, bin_R + 1, binLeft}}) : 0;
337  float MIPT_SE = bin_R < (int(nBinsRHisto_) - 1) ? histoClusters.at({{z_side, bin_R + 1, binRight}}) : 0;
338 
339  isMax &= (vetoPositions[std::make_tuple(bin_R + 1, bin_phi, z_side)] or MIPT_seed >= MIPT_S) &&
340  (vetoPositions[std::make_tuple(bin_R - 1, bin_phi, z_side)] or MIPT_seed > MIPT_N) &&
341  (vetoPositions[std::make_tuple(bin_R, binRight, z_side)] or MIPT_seed >= MIPT_E) &&
342  (vetoPositions[std::make_tuple(bin_R + 1, binRight, z_side)] or MIPT_seed >= MIPT_SE) &&
343  (vetoPositions[std::make_tuple(bin_R - 1, binRight, z_side)] or MIPT_seed >= MIPT_NE) &&
344  (vetoPositions[std::make_tuple(bin_R, binLeft, z_side)] or MIPT_seed > MIPT_W) &&
345  (vetoPositions[std::make_tuple(bin_R + 1, binLeft, z_side)] or MIPT_seed > MIPT_SW) &&
346  (vetoPositions[std::make_tuple(bin_R - 1, binLeft, z_side)] or MIPT_seed > MIPT_NW);
347 
348  if (isMax) {
349  float ROverZ_seed = kROverZMin_ + (bin_R + 0.5) * (kROverZMax_ - kROverZMin_) / nBinsRHisto_;
350  float phi_seed = -M_PI + (bin_phi + 0.5) * 2 * M_PI / nBinsPhiHisto_;
351  float x_seed = ROverZ_seed * cos(phi_seed);
352  float y_seed = ROverZ_seed * sin(phi_seed);
353  seedPositionsEnergy.emplace_back(GlobalPoint(x_seed, y_seed, z_side), MIPT_seed);
354  secondarySeedPositions[std::make_tuple(bin_R, bin_phi, z_side)] = true;
355  }
356  }
357  }
358  }
359 
360  return seedPositionsEnergy;
361 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
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
Definition: Activities.doc:12
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
#define M_PI
std::vector< std::pair< GlobalPoint, double > > HGCalHistoSeedingImpl::computeThresholdSeeds ( const Histogram histoClusters)
private

Definition at line 221 of file HGCalHistoSeedingImpl.cc.

References funct::cos(), histoThreshold_, createfilelist::int, kROverZMax_, kROverZMin_, M_PI, nBinsPhiHisto_, nBinsRHisto_, and funct::sin().

Referenced by findHistoSeeds().

222  {
223  std::vector<std::pair<GlobalPoint, double>> seedPositionsEnergy;
224 
225  for (int z_side : {-1, 1}) {
226  for (int bin_R = 0; bin_R < int(nBinsRHisto_); bin_R++) {
227  for (int bin_phi = 0; bin_phi < int(nBinsPhiHisto_); bin_phi++) {
228  float MIPT_seed = histoClusters.at({{z_side, bin_R, bin_phi}});
229  bool isSeed = MIPT_seed > histoThreshold_;
230 
231  if (isSeed) {
232  float ROverZ_seed = kROverZMin_ + (bin_R + 0.5) * (kROverZMax_ - kROverZMin_) / nBinsRHisto_;
233  float phi_seed = -M_PI + (bin_phi + 0.5) * 2 * M_PI / nBinsPhiHisto_;
234  float x_seed = ROverZ_seed * cos(phi_seed);
235  float y_seed = ROverZ_seed * sin(phi_seed);
236  seedPositionsEnergy.emplace_back(GlobalPoint(x_seed, y_seed, z_side), MIPT_seed);
237  }
238  }
239  }
240  }
241 
242  return seedPositionsEnergy;
243 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
#define M_PI
float HGCalHistoSeedingImpl::dR ( const l1t::HGCalCluster clu,
const GlobalPoint seed 
) const

Referenced by eventSetup().

void HGCalHistoSeedingImpl::eventSetup ( const edm::EventSetup es)
inline
HGCalHistoSeedingImpl::Histogram HGCalHistoSeedingImpl::fillHistoClusters ( const std::vector< edm::Ptr< l1t::HGCalCluster >> &  clustersPtrs)
private

Definition at line 44 of file HGCalHistoSeedingImpl.cc.

References createfilelist::int, kROverZMax_, kROverZMin_, M_PI, nBinsPhiHisto_, nBinsRHisto_, funct::pow(), reco::reduceRange(), mathSSE::sqrt(), triggerTools_, and HGCalTriggerTools::zside().

Referenced by findHistoSeeds().

45  {
46  Histogram histoClusters; //key[0] = z.side(), key[1] = bin_R, key[2] = bin_phi
47 
48  for (int z_side : {-1, 1}) {
49  for (int bin_R = 0; bin_R < int(nBinsRHisto_); bin_R++) {
50  for (int bin_phi = 0; bin_phi < int(nBinsPhiHisto_); bin_phi++) {
51  histoClusters[{{z_side, bin_R, bin_phi}}] = 0;
52  }
53  }
54  }
55 
56  for (auto& clu : clustersPtrs) {
57  float ROverZ = sqrt(pow(clu->centreProj().x(), 2) + pow(clu->centreProj().y(), 2));
58  int bin_R = int((ROverZ - kROverZMin_) * nBinsRHisto_ / (kROverZMax_ - kROverZMin_));
59  int bin_phi = int((reco::reduceRange(clu->phi()) + M_PI) * nBinsPhiHisto_ / (2 * M_PI));
60 
61  histoClusters[{{triggerTools_.zside(clu->detId()), bin_R, bin_phi}}] += clu->mipPt();
62  }
63 
64  return histoClusters;
65 }
constexpr T reduceRange(T x)
Definition: deltaPhi.h:15
std::map< std::array< int, 3 >, float > Histogram
HGCalTriggerTools triggerTools_
int zside(const DetId &) const
T sqrt(T t)
Definition: SSEVec.h:18
#define M_PI
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
HGCalHistoSeedingImpl::Histogram HGCalHistoSeedingImpl::fillSmoothPhiHistoClusters ( const Histogram histoClusters,
const vector< unsigned > &  binSums 
)
private

Definition at line 67 of file HGCalHistoSeedingImpl.cc.

References jets_cff::area, ws_sso_content_reader::content, createfilelist::int, kROverZMax_, kROverZMin_, nBinsPhiHisto_, nBinsRHisto_, and funct::pow().

Referenced by findHistoSeeds().

68  {
69  Histogram histoSumPhiClusters; //key[0] = z.side(), key[1] = bin_R, key[2] = bin_phi
70 
71  for (int z_side : {-1, 1}) {
72  for (int bin_R = 0; bin_R < int(nBinsRHisto_); bin_R++) {
73  int nBinsSide = (binSums[bin_R] - 1) / 2;
74  float R1 = kROverZMin_ + bin_R * (kROverZMax_ - kROverZMin_);
75  float R2 = R1 + (kROverZMax_ - kROverZMin_);
76  double area =
77  0.5 * (pow(R2, 2) - pow(R1, 2)) *
78  (1 +
79  0.5 *
80  (1 -
81  pow(0.5,
82  nBinsSide))); // Takes into account different area of bins in different R-rings + sum of quadratic weights used
83 
84  for (int bin_phi = 0; bin_phi < int(nBinsPhiHisto_); bin_phi++) {
85  float content = histoClusters.at({{z_side, bin_R, bin_phi}});
86 
87  for (int bin_phi2 = 1; bin_phi2 <= nBinsSide; bin_phi2++) {
88  int binToSumLeft = bin_phi - bin_phi2;
89  if (binToSumLeft < 0)
90  binToSumLeft += nBinsPhiHisto_;
91  int binToSumRight = bin_phi + bin_phi2;
92  if (binToSumRight >= int(nBinsPhiHisto_))
93  binToSumRight -= nBinsPhiHisto_;
94 
95  content += histoClusters.at({{z_side, bin_R, binToSumLeft}}) / pow(2, bin_phi2); // quadratic kernel
96  content += histoClusters.at({{z_side, bin_R, binToSumRight}}) / pow(2, bin_phi2); // quadratic kernel
97  }
98 
99  histoSumPhiClusters[{{z_side, bin_R, bin_phi}}] = content / area;
100  }
101  }
102  }
103 
104  return histoSumPhiClusters;
105 }
std::map< std::array< int, 3 >, float > Histogram
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
HGCalHistoSeedingImpl::Histogram HGCalHistoSeedingImpl::fillSmoothRPhiHistoClusters ( const Histogram histoClusters)
private

Definition at line 107 of file HGCalHistoSeedingImpl.cc.

References ws_sso_content_reader::content, createfilelist::int, nBinsPhiHisto_, and nBinsRHisto_.

Referenced by findHistoSeeds().

107  {
108  Histogram histoSumRPhiClusters; //key[0] = z.side(), key[1] = bin_R, key[2] = bin_phi
109 
110  for (int z_side : {-1, 1}) {
111  for (int bin_R = 0; bin_R < int(nBinsRHisto_); bin_R++) {
112  float weight = (bin_R == 0 || bin_R == int(nBinsRHisto_) - 1)
113  ? 1.5
114  : 2.; //Take into account edges with only one side up or down
115 
116  for (int bin_phi = 0; bin_phi < int(nBinsPhiHisto_); bin_phi++) {
117  float content = histoClusters.at({{z_side, bin_R, bin_phi}});
118  float contentDown = bin_R > 0 ? histoClusters.at({{z_side, bin_R - 1, bin_phi}}) : 0;
119  float contentUp = bin_R < (int(nBinsRHisto_) - 1) ? histoClusters.at({{z_side, bin_R + 1, bin_phi}}) : 0;
120 
121  histoSumRPhiClusters[{{z_side, bin_R, bin_phi}}] = (content + 0.5 * contentDown + 0.5 * contentUp) / weight;
122  }
123  }
124  }
125 
126  return histoSumRPhiClusters;
127 }
std::map< std::array< int, 3 >, float > Histogram
Definition: weight.py:1
void HGCalHistoSeedingImpl::findHistoSeeds ( const std::vector< edm::Ptr< l1t::HGCalCluster >> &  clustersPtr,
std::vector< std::pair< GlobalPoint, double >> &  seedPositionsEnergy 
)

Definition at line 363 of file HGCalHistoSeedingImpl.cc.

References binsSumsHisto_, computeInterpolatedMaxSeeds(), computeMaxSeeds(), computeSecondaryMaxSeeds(), computeThresholdSeeds(), fillHistoClusters(), fillSmoothPhiHistoClusters(), fillSmoothRPhiHistoClusters(), HistoInterpolatedMaxC3d, HistoMaxC3d, HistoSecondaryMaxC3d, HistoThresholdC3d, and seedingType_.

Referenced by eventSetup().

364  {
365  /* put clusters into an r/z x phi histogram */
366  Histogram histoCluster = fillHistoClusters(
367  clustersPtrs); //key[0] = z.side(), key[1] = bin_R, key[2] = bin_phi, content = MIPTs summed along depth
368 
369  /* smoothen along the phi direction + normalize each bin to same area */
370  Histogram smoothPhiHistoCluster = fillSmoothPhiHistoClusters(histoCluster, binsSumsHisto_);
371 
372  /* smoothen along the r/z direction */
373  Histogram smoothRPhiHistoCluster = fillSmoothRPhiHistoClusters(histoCluster);
374 
375  /* seeds determined with local maximum criteria */
376  if (seedingType_ == HistoMaxC3d)
377  seedPositionsEnergy = computeMaxSeeds(smoothRPhiHistoCluster);
378  else if (seedingType_ == HistoThresholdC3d)
379  seedPositionsEnergy = computeThresholdSeeds(smoothRPhiHistoCluster);
381  seedPositionsEnergy = computeInterpolatedMaxSeeds(smoothRPhiHistoCluster);
383  seedPositionsEnergy = computeSecondaryMaxSeeds(smoothRPhiHistoCluster);
384 }
std::vector< std::pair< GlobalPoint, double > > computeInterpolatedMaxSeeds(const Histogram &histoClusters)
std::vector< unsigned > binsSumsHisto_
Histogram fillSmoothPhiHistoClusters(const Histogram &histoClusters, const vector< unsigned > &binSums)
Histogram fillSmoothRPhiHistoClusters(const Histogram &histoClusters)
std::map< std::array< int, 3 >, float > Histogram
std::vector< std::pair< GlobalPoint, double > > computeMaxSeeds(const Histogram &histoClusters)
std::vector< std::pair< GlobalPoint, double > > computeSecondaryMaxSeeds(const Histogram &histoClusters)
std::vector< std::pair< GlobalPoint, double > > computeThresholdSeeds(const Histogram &histoClusters)
Histogram fillHistoClusters(const std::vector< edm::Ptr< l1t::HGCalCluster >> &clustersPtrs)

Member Data Documentation

std::vector<unsigned> HGCalHistoSeedingImpl::binsSumsHisto_
private

Definition at line 49 of file HGCalHistoSeedingImpl.h.

Referenced by findHistoSeeds(), and HGCalHistoSeedingImpl().

double HGCalHistoSeedingImpl::histoThreshold_ = 20.
private
double HGCalHistoSeedingImpl::kROverZMax_ = 0.52
staticprivate
double HGCalHistoSeedingImpl::kROverZMin_ = 0.09
staticprivate
unsigned HGCalHistoSeedingImpl::nBinsPhiHisto_ = 216
private
unsigned HGCalHistoSeedingImpl::nBinsRHisto_ = 36
private
std::vector<double> HGCalHistoSeedingImpl::neighbour_weights_
private

Definition at line 51 of file HGCalHistoSeedingImpl.h.

Referenced by computeInterpolatedMaxSeeds(), and HGCalHistoSeedingImpl().

unsigned HGCalHistoSeedingImpl::neighbour_weights_size_ = 9
staticprivate

Definition at line 55 of file HGCalHistoSeedingImpl.h.

Referenced by HGCalHistoSeedingImpl().

std::string HGCalHistoSeedingImpl::seedingAlgoType_
private

Definition at line 44 of file HGCalHistoSeedingImpl.h.

Referenced by HGCalHistoSeedingImpl().

SeedingType HGCalHistoSeedingImpl::seedingType_
private

Definition at line 45 of file HGCalHistoSeedingImpl.h.

Referenced by findHistoSeeds(), and HGCalHistoSeedingImpl().

HGCalTriggerTools HGCalHistoSeedingImpl::triggerTools_
private

Definition at line 53 of file HGCalHistoSeedingImpl.h.

Referenced by eventSetup(), and fillHistoClusters().