CMS 3D CMS Logo

HGCalShowerShape.cc
Go to the documentation of this file.
5 
6 #include <unordered_map>
7 #include <numeric>
8 
10  : threshold_(conf.getParameter<double>("shape_threshold")),
11  distance_(conf.getParameter<double>("shape_distance")) {}
12 
13 //Compute energy-weighted mean of any variable X in the cluster
14 
15 float HGCalShowerShape::meanX(const std::vector<pair<float, float>>& energy_X_tc) const {
16  float Etot = 0;
17  float X_sum = 0;
18 
19  for (const auto& energy_X : energy_X_tc) {
20  X_sum += energy_X.first * energy_X.second;
21  Etot += energy_X.first;
22  }
23 
24  float X_mean = 0;
25  if (Etot > 0)
26  X_mean = X_sum / Etot;
27  return X_mean;
28 }
29 
31  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.constituents();
32 
33  int firstLayer = 999;
34 
35  for (const auto& id_clu : clustersPtrs) {
36  if (!pass(*id_clu.second, c3d))
37  continue;
38  int layer = triggerTools_.layerWithOffset(id_clu.second->detId());
39  if (layer < firstLayer)
40  firstLayer = layer;
41  }
42 
43  return firstLayer;
44 }
45 
47  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.constituents();
48  std::unordered_map<int, float> layers_pt;
49  float max_pt = 0.;
50  int max_layer = 0;
51  for (const auto& id_cluster : clustersPtrs) {
52  if (!pass(*id_cluster.second, c3d))
53  continue;
54  unsigned layer = triggerTools_.layerWithOffset(id_cluster.second->detId());
55  auto itr_insert = layers_pt.emplace(layer, 0.);
56  itr_insert.first->second += id_cluster.second->pt();
57  if (itr_insert.first->second > max_pt) {
58  max_pt = itr_insert.first->second;
59  max_layer = layer;
60  }
61  }
62  return max_layer;
63 }
64 
66  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.constituents();
67 
68  int lastLayer = -999;
69 
70  for (const auto& id_clu : clustersPtrs) {
71  if (!pass(*id_clu.second, c3d))
72  continue;
73  int layer = triggerTools_.layerWithOffset(id_clu.second->detId());
74  if (layer > lastLayer)
75  lastLayer = layer;
76  }
77 
78  return lastLayer;
79 }
80 
82  const HGCalTriggerGeometryBase& triggerGeometry) const {
83  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.constituents();
85  std::vector<bool> layers(nlayers);
86  for (const auto& id_cluster : clustersPtrs) {
87  if (!pass(*id_cluster.second, c3d))
88  continue;
89  unsigned layer = triggerGeometry.triggerLayer(id_cluster.second->detId());
90  if (triggerTools_.isNose(id_cluster.second->detId()))
92  else {
94  }
95  if (layer == 0 || layer > nlayers)
96  continue;
97  layers[layer - 1] = true; //layer 0 doesn't exist, so shift by -1
98  }
99  int length = 0;
100  int maxlength = 0;
101  for (bool layer : layers) {
102  if (layer)
103  length++;
104  else
105  length = 0;
106  if (length > maxlength)
107  maxlength = length;
108  }
109  return maxlength;
110 }
111 
113  const HGCalTriggerGeometryBase& triggerGeometry,
114  float quantile) const {
115  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.constituents();
117  std::vector<double> layers(nlayers, 0);
118  for (const auto& id_clu : clustersPtrs) {
119  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& triggerCells = id_clu.second->constituents();
120 
121  for (const auto& id_tc : triggerCells) {
122  if (!pass(*id_tc.second, c3d))
123  continue;
124  unsigned layer = triggerGeometry.triggerLayer(id_tc.second->detId());
125  if (triggerTools_.isNose(id_tc.second->detId()))
127  else {
129  }
130  if (layer == 0 || layer > nlayers)
131  continue;
132  layers[layer - 1] += id_tc.second->pt(); //layer 0 doesn't exist, so shift by -1
133  }
134  }
135  std::partial_sum(layers.begin(), layers.end(), layers.begin());
136  double pt_threshold = layers.back() * quantile;
137  unsigned percentile = 0;
138  for (double pt : layers) {
139  if (pt > pt_threshold) {
140  break;
141  }
142  percentile++;
143  }
144  // Linear interpolation of percentile value
145  double pt0 = (percentile > 0 ? layers[percentile - 1] : 0.);
146  double pt1 = (percentile < layers.size() ? layers[percentile] : layers.back());
147  return percentile + (pt1 - pt0 > 0. ? (pt_threshold - pt0) / (pt1 - pt0) : 0.);
148 }
149 
151  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.constituents();
152  std::set<double> ordered_tcs;
153  double pt_sum = 0.;
154  for (const auto& id_clu : clustersPtrs) {
155  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& triggerCells = id_clu.second->constituents();
156 
157  for (const auto& id_tc : triggerCells) {
158  if (!pass(*id_tc.second, c3d))
159  continue;
160  ordered_tcs.emplace(id_tc.second->pt());
161  pt_sum += id_tc.second->pt();
162  }
163  }
164  double pt_threshold = pt_sum * quantile;
165  double partial_sum = 0.;
166  double partial_sum_prev = 0.;
167  int ntc = 0;
168  for (auto itr = ordered_tcs.rbegin(); itr != ordered_tcs.rend(); ++itr) {
169  partial_sum_prev = partial_sum;
170  partial_sum += *itr;
171  ntc++;
172  if (partial_sum > pt_threshold) {
173  break;
174  }
175  }
176  // Linear interpolation of ntc
177  return ntc - 1 +
178  (partial_sum - partial_sum_prev > 0. ? (pt_threshold - partial_sum_prev) / (partial_sum - partial_sum_prev)
179  : 0.);
180 }
181 
183 
185  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.constituents();
186 
187  std::vector<std::pair<float, float>> tc_energy_eta;
188 
189  for (const auto& id_clu : clustersPtrs) {
190  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& triggerCells = id_clu.second->constituents();
191 
192  for (const auto& id_tc : triggerCells) {
193  if (!pass(*id_tc.second, c3d))
194  continue;
195  tc_energy_eta.emplace_back(std::make_pair(id_tc.second->energy(), id_tc.second->eta()));
196  }
197  }
198 
199  float varee = varXX(tc_energy_eta, c3d.eta());
200 
201  return varee;
202 }
203 
205 
207  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.constituents();
208 
209  std::vector<std::pair<float, float>> tc_energy_phi;
210 
211  for (const auto& id_clu : clustersPtrs) {
212  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& triggerCells = id_clu.second->constituents();
213 
214  for (const auto& id_tc : triggerCells) {
215  if (!pass(*id_tc.second, c3d))
216  continue;
217  tc_energy_phi.emplace_back(std::make_pair(id_tc.second->energy(), id_tc.second->phi()));
218  }
219  }
220 
221  float varphiphi = varPhiPhi(tc_energy_phi, c3d.phi());
222 
223  return varphiphi;
224 }
225 
226 float HGCalShowerShape::sigmaRRTot(const l1t::HGCalMulticluster& c3d) const { return sqrt(varRR(c3d)); }
227 
229  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.constituents();
230 
231  std::vector<std::pair<float, float>> tc_energy_r;
232 
233  for (const auto& id_clu : clustersPtrs) {
234  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& triggerCells = id_clu.second->constituents();
235 
236  for (const auto& id_tc : triggerCells) {
237  if (!pass(*id_tc.second, c3d))
238  continue;
239  float r = (id_tc.second->position().z() != 0.
240  ? std::sqrt(pow(id_tc.second->position().x(), 2) + pow(id_tc.second->position().y(), 2)) /
241  std::abs(id_tc.second->position().z())
242  : 0.);
243  tc_energy_r.emplace_back(std::make_pair(id_tc.second->energy(), r));
244  }
245  }
246 
247  float r_mean = meanX(tc_energy_r);
248  float vrr = varXX(tc_energy_r, r_mean);
249 
250  return vrr;
251 }
252 
254  std::unordered_map<int, std::vector<std::pair<float, float>>> tc_layer_energy_eta;
255  std::unordered_map<int, LorentzVector> layer_LV;
256 
257  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.constituents();
258 
259  for (const auto& id_clu : clustersPtrs) {
260  unsigned layer = triggerTools_.layerWithOffset(id_clu.second->detId());
261 
262  layer_LV[layer] += id_clu.second->p4();
263 
264  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& triggerCells = id_clu.second->constituents();
265 
266  for (const auto& id_tc : triggerCells) {
267  if (!pass(*id_tc.second, c3d))
268  continue;
269  tc_layer_energy_eta[layer].emplace_back(std::make_pair(id_tc.second->energy(), id_tc.second->eta()));
270  }
271  }
272 
273  float SigmaEtaEtaMax = 0;
274 
275  for (auto& tc_iter : tc_layer_energy_eta) {
276  const std::vector<std::pair<float, float>>& energy_eta_layer = tc_iter.second;
277  const LorentzVector& LV_layer = layer_LV[tc_iter.first];
278  float SigmaEtaEtaLayer = sigmaXX(energy_eta_layer, LV_layer.eta()); //RMS wrt layer eta, not wrt c3d eta
279  if (SigmaEtaEtaLayer > SigmaEtaEtaMax)
280  SigmaEtaEtaMax = SigmaEtaEtaLayer;
281  }
282 
283  return SigmaEtaEtaMax;
284 }
285 
287  std::unordered_map<int, std::vector<std::pair<float, float>>> tc_layer_energy_phi;
288  std::unordered_map<int, LorentzVector> layer_LV;
289 
290  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.constituents();
291 
292  for (const auto& id_clu : clustersPtrs) {
293  unsigned layer = triggerTools_.layerWithOffset(id_clu.second->detId());
294 
295  layer_LV[layer] += id_clu.second->p4();
296 
297  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& triggerCells = id_clu.second->constituents();
298 
299  for (const auto& id_tc : triggerCells) {
300  if (!pass(*id_tc.second, c3d))
301  continue;
302  tc_layer_energy_phi[layer].emplace_back(std::make_pair(id_tc.second->energy(), id_tc.second->phi()));
303  }
304  }
305 
306  float SigmaPhiPhiMax = 0;
307 
308  for (auto& tc_iter : tc_layer_energy_phi) {
309  const std::vector<std::pair<float, float>>& energy_phi_layer = tc_iter.second;
310  const LorentzVector& LV_layer = layer_LV[tc_iter.first];
311  float SigmaPhiPhiLayer = sigmaPhiPhi(energy_phi_layer, LV_layer.phi()); //RMS wrt layer phi, not wrt c3d phi
312  if (SigmaPhiPhiLayer > SigmaPhiPhiMax)
313  SigmaPhiPhiMax = SigmaPhiPhiLayer;
314  }
315 
316  return SigmaPhiPhiMax;
317 }
318 
320  std::unordered_map<int, std::vector<std::pair<float, float>>> tc_layer_energy_r;
321 
322  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.constituents();
323 
324  for (const auto& id_clu : clustersPtrs) {
325  unsigned layer = triggerTools_.layerWithOffset(id_clu.second->detId());
326 
327  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& triggerCells = id_clu.second->constituents();
328 
329  for (const auto& id_tc : triggerCells) {
330  if (!pass(*id_tc.second, c3d))
331  continue;
332  float r = (id_tc.second->position().z() != 0.
333  ? std::sqrt(pow(id_tc.second->position().x(), 2) + pow(id_tc.second->position().y(), 2)) /
334  std::abs(id_tc.second->position().z())
335  : 0.);
336  tc_layer_energy_r[layer].emplace_back(std::make_pair(id_tc.second->energy(), r));
337  }
338  }
339 
340  float SigmaRRMax = 0;
341 
342  for (auto& tc_iter : tc_layer_energy_r) {
343  const std::vector<std::pair<float, float>>& energy_r_layer = tc_iter.second;
344  float r_mean_layer = meanX(energy_r_layer);
345  float SigmaRRLayer = sigmaXX(energy_r_layer, r_mean_layer);
346  if (SigmaRRLayer > SigmaRRMax)
347  SigmaRRMax = SigmaRRLayer;
348  }
349 
350  return SigmaRRMax;
351 }
352 
354  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.constituents();
355  // group trigger cells by layer
356  std::unordered_map<int, std::vector<edm::Ptr<l1t::HGCalTriggerCell>>> layers_tcs;
357  for (const auto& id_clu : clustersPtrs) {
358  unsigned layer = triggerTools_.layerWithOffset(id_clu.second->detId());
359  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& triggerCells = id_clu.second->constituents();
360  for (const auto& id_tc : triggerCells) {
361  if (!pass(*id_tc.second, c3d))
362  continue;
363  layers_tcs[layer].emplace_back(id_tc.second);
364  }
365  }
366 
367  // Select trigger cells within X cm of the max TC in the layer
368  std::unordered_map<int, std::vector<std::pair<float, float>>> tc_layers_energy_r;
369  for (const auto& layer_tcs : layers_tcs) {
370  int layer = layer_tcs.first;
371  edm::Ptr<l1t::HGCalTriggerCell> max_tc = layer_tcs.second.front();
372  for (const auto& tc : layer_tcs.second) {
373  if (tc->energy() > max_tc->energy())
374  max_tc = tc;
375  }
376  for (const auto& tc : layer_tcs.second) {
377  double dx = tc->position().x() - max_tc->position().x();
378  double dy = tc->position().y() - max_tc->position().y();
379  double distance_to_max = std::sqrt(dx * dx + dy * dy);
380  if (distance_to_max < radius) {
381  float r = (tc->position().z() != 0.
382  ? std::sqrt(tc->position().x() * tc->position().x() + tc->position().y() * tc->position().y()) /
383  std::abs(tc->position().z())
384  : 0.);
385  tc_layers_energy_r[layer].emplace_back(std::make_pair(tc->energy(), r));
386  }
387  }
388  }
389 
390  // Compute srr layer by layer
391  std::vector<std::pair<float, float>> layers_energy_srr2;
392  for (const auto& layer_energy_r : tc_layers_energy_r) {
393  const auto& energies_r = layer_energy_r.second;
394  float r_mean_layer = meanX(energies_r);
395  float srr = sigmaXX(energies_r, r_mean_layer);
396  double energy_sum = 0.;
397  for (const auto& energy_r : energies_r) {
398  energy_sum += energy_r.first;
399  }
400  layers_energy_srr2.emplace_back(std::make_pair(energy_sum, srr * srr));
401  }
402  // Combine all layer srr
403  float srr2_mean = meanX(layers_energy_srr2);
404  return std::sqrt(srr2_mean);
405 }
406 
408  std::unordered_map<int, float> layer_energy;
409 
410  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.constituents();
411 
412  for (const auto& id_clu : clustersPtrs) {
413  if (!pass(*id_clu.second, c3d))
414  continue;
415  unsigned layer = triggerTools_.layerWithOffset(id_clu.second->detId());
416  layer_energy[layer] += id_clu.second->energy();
417  }
418 
419  float EMax = 0;
420 
421  for (const auto& layer : layer_energy) {
422  if (layer.second > EMax)
423  EMax = layer.second;
424  }
425 
426  return EMax;
427 }
428 
430  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.constituents();
431 
432  std::vector<std::pair<float, float>> tc_energy_z;
433 
434  for (const auto& id_clu : clustersPtrs) {
435  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& triggerCells = id_clu.second->constituents();
436 
437  for (const auto& id_tc : triggerCells) {
438  if (!pass(*id_tc.second, c3d))
439  continue;
440  tc_energy_z.emplace_back(id_tc.second->energy(), id_tc.second->position().z());
441  }
442  }
443 
444  return meanX(tc_energy_z);
445 }
446 
447 float HGCalShowerShape::sigmaZZ(const l1t::HGCalMulticluster& c3d) const { return sqrt(varZZ(c3d)); }
449  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.constituents();
450 
451  std::vector<std::pair<float, float>> tc_energy_z;
452 
453  for (const auto& id_clu : clustersPtrs) {
454  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& triggerCells = id_clu.second->constituents();
455 
456  for (const auto& id_tc : triggerCells) {
457  if (!pass(*id_tc.second, c3d))
458  continue;
459  tc_energy_z.emplace_back(std::make_pair(id_tc.second->energy(), id_tc.second->position().z()));
460  }
461  }
462 
463  float z_mean = meanX(tc_energy_z);
464  float varzz = varXX(tc_energy_z, z_mean);
465 
466  return varzz;
467 }
469  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& cellsPtrs = c2d.constituents();
470 
471  std::vector<std::pair<float, float>> tc_energy_eta;
472 
473  for (const auto& id_cell : cellsPtrs) {
474  if (!pass(*id_cell.second, c2d))
475  continue;
476  tc_energy_eta.emplace_back(std::make_pair(id_cell.second->energy(), id_cell.second->eta()));
477  }
478 
479  float See = sigmaXX(tc_energy_eta, c2d.eta());
480 
481  return See;
482 }
483 
485  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& cellsPtrs = c2d.constituents();
486 
487  std::vector<std::pair<float, float>> tc_energy_phi;
488 
489  for (const auto& id_cell : cellsPtrs) {
490  if (!pass(*id_cell.second, c2d))
491  continue;
492  tc_energy_phi.emplace_back(std::make_pair(id_cell.second->energy(), id_cell.second->phi()));
493  }
494 
495  float Spp = sigmaPhiPhi(tc_energy_phi, c2d.phi());
496 
497  return Spp;
498 }
499 
501  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& cellsPtrs = c2d.constituents();
502 
503  std::vector<std::pair<float, float>> tc_energy_r;
504 
505  for (const auto& id_cell : cellsPtrs) {
506  if (!pass(*id_cell.second, c2d))
507  continue;
508  float r = (id_cell.second->position().z() != 0.
509  ? std::sqrt(pow(id_cell.second->position().x(), 2) + pow(id_cell.second->position().y(), 2)) /
510  std::abs(id_cell.second->position().z())
511  : 0.);
512  tc_energy_r.emplace_back(std::make_pair(id_cell.second->energy(), r));
513  }
514 
515  float r_mean = meanX(tc_energy_r);
516  float Srr = sigmaXX(tc_energy_r, r_mean);
517 
518  return Srr;
519 }
520 
521 float HGCalShowerShape::sumLayers(const l1t::HGCalMulticluster& c3d, int start, int end) const {
522  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.constituents();
524  std::vector<double> layers(nlayers, 0);
525  for (const auto& id_clu : clustersPtrs) {
526  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& triggerCells = id_clu.second->constituents();
527 
528  for (const auto& id_tc : triggerCells) {
529  if (!pass(*id_tc.second, c3d))
530  continue;
531  unsigned layer = triggerTools_.triggerLayer(id_tc.second->detId());
532  if (layer == 0 || layer > nlayers)
533  continue;
534  layers[layer - 1] += id_tc.second->pt(); //shift by -1 because layer 0 doesn't exist
535  }
536  }
537  double sum_pt = 0;
538  for (int i = start - 1; i <= end - 1; i++) { //shift by -1 because layer 1 is layers[0]
539  sum_pt += layers[i];
540  }
541  double tot = 0;
542  for (unsigned i = 0; i < layers.size(); ++i) {
543  tot += layers[i];
544  }
545  float frac = 0;
546  if (tot > 0) {
547  frac = sum_pt / tot;
548  }
549  return frac;
550 }
551 
552 int HGCalShowerShape::bitmap(const l1t::HGCalMulticluster& c3d, int start, int end, float threshold) const {
553  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalCluster>>& clustersPtrs = c3d.constituents();
555  std::vector<double> layers(nlayers, 0);
556  for (const auto& id_clu : clustersPtrs) {
557  const std::unordered_map<uint32_t, edm::Ptr<l1t::HGCalTriggerCell>>& triggerCells = id_clu.second->constituents();
558 
559  for (const auto& id_tc : triggerCells) {
560  if (!pass(*id_tc.second, c3d))
561  continue;
562  unsigned layer = triggerTools_.triggerLayer(id_tc.second->detId());
563  if (layer == 0 || layer > nlayers)
564  continue;
565  layers[layer - 1] += id_tc.second->pt(); //shift by -1 because layer 0 doesn't exist
566  }
567  }
568  uint32_t bitmap = 0;
569  const int bitmap_size = 32;
570  if (start == 0) {
571  edm::LogWarning("DataNotFound") << "Trying to read layer 0 that doesn't exist, defaulted start to layer 1";
572  start = 1;
573  }
574  if ((end - start) + 1 > bitmap_size) {
575  edm::LogWarning("TooMuchData") << " Specified bounds cannot fit into bitmap size, defaulting to 0.";
576  } else {
577  for (int i = start; i <= end; i++) {
578  bitmap += (layers[i - 1] > threshold) << (end - (i));
579  }
580  }
581  return bitmap;
582 }
583 
585  unsigned hcal_offset = triggerTools_.layers(ForwardSubdetector::HGCEE) / 2;
586  unsigned lastlayer = triggerGeometry.lastTriggerLayer();
587  const unsigned showermaxlayer = 7;
588  c3d.setShowerLength(showerLength(c3d));
589  c3d.setCoreShowerLength(coreShowerLength(c3d, triggerGeometry));
590  c3d.setFirstLayer(firstLayer(c3d));
591  c3d.setMaxLayer(maxLayer(c3d));
594  c3d.setVarEtaEta(varEtaEta(c3d));
597  c3d.setVarPhiPhi(varPhiPhi(c3d));
598  c3d.setSigmaZZ(sigmaZZ(c3d));
599  c3d.setVarZZ(varZZ(c3d));
600  c3d.setSigmaRRTot(sigmaRRTot(c3d));
601  c3d.setVarRR(varRR(c3d));
602  c3d.setSigmaRRMax(sigmaRRMax(c3d));
603  c3d.setSigmaRRMean(sigmaRRMean(c3d));
604  c3d.setEMax(eMax(c3d));
605  c3d.setZBarycenter(meanZ(c3d));
606  c3d.setLayer10percent(percentileLayer(c3d, triggerGeometry, 0.10));
607  c3d.setLayer50percent(percentileLayer(c3d, triggerGeometry, 0.50));
608  c3d.setLayer90percent(percentileLayer(c3d, triggerGeometry, 0.90));
611  c3d.setFirst1layers(sumLayers(c3d, 1, 1));
612  c3d.setFirst3layers(sumLayers(c3d, 1, 3));
613  c3d.setFirst5layers(sumLayers(c3d, 1, 5));
614  c3d.setFirstHcal1layers(sumLayers(c3d, hcal_offset, hcal_offset));
615  c3d.setFirstHcal3layers(sumLayers(c3d, hcal_offset, hcal_offset + 2));
616  c3d.setFirstHcal5layers(sumLayers(c3d, hcal_offset, hcal_offset + 4));
617  c3d.setLast1layers(sumLayers(c3d, lastlayer, lastlayer));
618  c3d.setLast3layers(sumLayers(c3d, lastlayer - 2, lastlayer));
619  c3d.setLast5layers(sumLayers(c3d, lastlayer - 4, lastlayer));
620  c3d.setEmax1layers(sumLayers(c3d, showermaxlayer, showermaxlayer));
621  c3d.setEmax3layers(sumLayers(c3d, showermaxlayer - 1, showermaxlayer + 1));
622  c3d.setEmax5layers(sumLayers(c3d, showermaxlayer - 2, showermaxlayer + 2));
623  c3d.setEot(sumLayers(c3d, 1, hcal_offset));
624  c3d.setEbm0(bitmap(c3d, 1, hcal_offset, 0));
625  c3d.setEbm1(bitmap(c3d, 1, hcal_offset, 1));
626  c3d.setHbm(bitmap(c3d, hcal_offset, lastlayer, 0));
627 }
float meanX(const std::vector< pair< float, float >> &energy_X_tc) const
Definition: start.py:1
void setFirst1layers(float first1layers)
void setMaxLayer(int maxLayer)
void setSigmaPhiPhiTot(float sigmaPhiPhiTot)
float varZZ(const l1t::HGCalMulticluster &c3d) const
const std::unordered_map< uint32_t, edm::Ptr< C > > & constituents() const
Definition: HGCalClusterT.h:49
void setHbm(int hbm)
virtual unsigned lastTriggerLayer() const =0
virtual unsigned triggerLayer(const unsigned id) const =0
const HGCalTriggerGeometryBase * getTriggerGeometry() const
void setSigmaZZ(float sigmaZZ)
void setVarEtaEta(float varEtaEta)
HGCalTriggerTools triggerTools_
void setSigmaRRMean(float sigmaRRMean)
void setFirst5layers(float first5layers)
float percentileTriggerCells(const l1t::HGCalMulticluster &c3d, float quantile=0.5) const
void setSigmaRRTot(float sigmaRRTot)
int lastLayer(const l1t::HGCalMulticluster &c3d) const
float percentileLayer(const l1t::HGCalMulticluster &c3d, const HGCalTriggerGeometryBase &triggerGeometry, float quantile=0.5) const
int showerLength(const l1t::HGCalMulticluster &c3d) const
float varEtaEta(const l1t::HGCalMulticluster &c3d) const
float sigmaEtaEtaTot(const l1t::HGCalMulticluster &c3d) const
void setFirstHcal5layers(float firstHcal5layers)
void setCoreShowerLength(int coreShowerLength)
void setEmax5layers(float emax5layers)
void setLayer10percent(float layer10percent)
float sigmaZZ(const l1t::HGCalMulticluster &c3d) const
float eMax(const l1t::HGCalMulticluster &c3d) const
void setEbm1(int ebm1)
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
void setEbm0(int ebm0)
float sigmaXX(const std::vector< pair< float, float >> &energy_X_tc, const float X_cluster) const
float sigmaPhiPhiMax(const l1t::HGCalMulticluster &c3d) const
T sqrt(T t)
Definition: SSEVec.h:19
void setLast1layers(float last1layers)
void fillShapes(l1t::HGCalMulticluster &, const HGCalTriggerGeometryBase &) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int coreShowerLength(const l1t::HGCalMulticluster &c3d, const HGCalTriggerGeometryBase &triggerGeometry) const
void setVarPhiPhi(float varPhiPhi)
math::XYZTLorentzVector LorentzVector
void setFirst3layers(float first3layers)
bool isNose(const DetId &) const
void setEMax(float eMax)
void setLast5layers(float last5layers)
unsigned layerWithOffset(const DetId &) const
bool pass(const T &obj, const Tref &ref) const
void setEot(float eot)
const GlobalPoint & position() const
float varRR(const l1t::HGCalMulticluster &c3d) const
void setEmax1layers(float emax1layers)
void setLast3layers(float last3layers)
unsigned triggerLayer(const unsigned id) const
void setLayer50percent(float layer50percent)
unsigned layers(ForwardSubdetector type) const
int maxLayer(const l1t::HGCalMulticluster &c3d) const
void setTriggerCells67percent(float triggerCells67percent)
void setFirstLayer(int firstLayer)
void setTriggerCells90percent(float triggerCells90percent)
float sigmaRRMax(const l1t::HGCalMulticluster &c3d) const
void setLayer90percent(float layer90percent)
void setFirstHcal3layers(float firstHcal3layers)
void setSigmaEtaEtaTot(float sigmaEtaEtaTot)
void setSigmaEtaEtaMax(float sigmaEtaEtaMax)
float sigmaRRTot(const l1t::HGCalMulticluster &c3d) const
void setSigmaRRMax(float sigmaRRMax)
float varXX(const std::vector< pair< float, float >> &energy_X_tc, const float X_cluster) const
void setEmax3layers(float emax3layers)
float sigmaEtaEtaMax(const l1t::HGCalMulticluster &c3d) const
float sigmaPhiPhiTot(const l1t::HGCalMulticluster &c3d) const
Log< level::Warning, false > LogWarning
float varPhiPhi(const l1t::HGCalMulticluster &c3d) const
void setFirstHcal1layers(float firstHcal1layers)
void setSigmaPhiPhiMax(float sigmaPhiPhiMax)
float sumLayers(const l1t::HGCalMulticluster &c3d, int start=1, int end=0) const
double phi() const final
momentum azimuthal angle
int firstLayer(const l1t::HGCalMulticluster &c3d) const
void setVarZZ(float varZZ)
void setVarRR(float varRR)
float meanZ(const l1t::HGCalMulticluster &c3d) const
void setZBarycenter(float zBarycenter)
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
void setShowerLength(int showerLength)
float sigmaRRMean(const l1t::HGCalMulticluster &c3d, float radius=5.) const
int bitmap(const l1t::HGCalMulticluster &c3d, int start=1, int end=14, float threshold=0) const
float sigmaPhiPhi(const std::vector< pair< float, float >> &energy_phi_tc, const float phi_cluster) const
double energy() const final
energy
double eta() const final
momentum pseudorapidity