CMS 3D CMS Logo

PFECALSuperClusterAlgo.cc
Go to the documentation of this file.
12 #include "Math/GenVector/VectorUtil.h"
13 #include "TVector2.h"
14 
16 
17 #include <memory>
18 
19 #include <cmath>
20 #include <functional>
21 #include <sstream>
22 #include <stdexcept>
23 #include <string>
24 
25 using namespace std;
26 using namespace std::placeholders; // for _1, _2, _3...
27 
28 namespace {
29  typedef edm::View<reco::PFCluster> PFClusterView;
30  typedef edm::Ptr<reco::PFCluster> PFClusterPtr;
31  typedef edm::PtrVector<reco::PFCluster> PFClusterPtrVector;
32  typedef std::pair<reco::CaloClusterPtr::key_type, reco::CaloClusterPtr> EEPSPair;
33 
34  bool sortByKey(const EEPSPair& a, const EEPSPair& b) { return a.first < b.first; }
35 
36  inline double ptFast(const double energy, const math::XYZPoint& position, const math::XYZPoint& origin) {
37  const auto v = position - origin;
38  return energy * std::sqrt(v.perp2() / v.mag2());
39  }
40 
41  bool greaterByEt(const CalibratedPFCluster& x, const CalibratedPFCluster& y) {
42  const math::XYZPoint zero(0, 0, 0);
43  const double xpt = ptFast(x.energy(), x.ptr()->position(), zero);
44  const double ypt = ptFast(y.energy(), y.ptr()->position(), zero);
45  return xpt > ypt;
46  }
47 
48  bool isSeed(const CalibratedPFCluster& x, double threshold, bool useETcut) {
49  const math::XYZPoint zero(0, 0, 0);
50  double e_or_et = x.energy();
51  if (useETcut)
52  e_or_et = ptFast(e_or_et, x.ptr()->position(), zero);
53  return e_or_et > threshold;
54  }
55 
56  bool isLinkedByRecHit(const CalibratedPFCluster& x,
58  const double threshold,
59  const double majority,
60  const double maxDEta,
61  const double maxDPhi) {
62  if (seed.energy_nocalib() < threshold) {
63  return false;
64  }
65  const double dEta = std::abs(seed.eta() - x.eta());
66  const double dPhi = std::abs(TVector2::Phi_mpi_pi(seed.phi() - x.phi()));
67  if (maxDEta < dEta || maxDPhi < dPhi) {
68  return false;
69  }
70  // now see if the clusters overlap in rechits
71  const auto& seedHitsAndFractions = seed.ptr()->hitsAndFractions();
72  const auto& xHitsAndFractions = x.ptr()->hitsAndFractions();
73  double x_rechits_tot = xHitsAndFractions.size();
74  double x_rechits_match = 0.0;
75  for (const std::pair<DetId, float>& seedHit : seedHitsAndFractions) {
76  for (const std::pair<DetId, float>& xHit : xHitsAndFractions) {
77  if (seedHit.first == xHit.first) {
78  x_rechits_match += 1.0;
79  }
80  }
81  }
82  return x_rechits_match / x_rechits_tot > majority;
83  }
84 
85  bool isClustered(const CalibratedPFCluster& x,
88  const EcalMustacheSCParameters* mustache_params,
89  const EcalSCDynamicDPhiParameters* dynamic_dphi_params,
90  const bool dyn_dphi,
91  const double etawidthSuperCluster,
92  const double phiwidthSuperCluster) {
93  const double dphi = std::abs(TVector2::Phi_mpi_pi(seed.phi() - x.phi()));
94  const bool passes_dphi =
95  ((!dyn_dphi && dphi < phiwidthSuperCluster) ||
97  dynamic_dphi_params, seed.eta(), seed.phi(), x.energy_nocalib(), x.eta(), x.phi())));
98 
100  return (std::abs(seed.eta() - x.eta()) < etawidthSuperCluster && passes_dphi);
101  }
103  return (passes_dphi && reco::MustacheKernel::inMustache(
104  mustache_params, seed.eta(), seed.phi(), x.energy_nocalib(), x.eta(), x.phi()));
105  }
106  return false;
107  }
108 
109 } // namespace
110 
112  : beamSpot_(nullptr), SCProducerCache_(cache) {}
113 
114 void PFECALSuperClusterAlgo::setPFClusterCalibration(const std::shared_ptr<PFEnergyCalibration>& calib) {
116 }
117 
119  inputTagPFClusters_ = cc.consumes<edm::View<reco::PFCluster>>(iConfig.getParameter<edm::InputTag>("PFClusters"));
121  cc.consumes<reco::PFCluster::EEtoPSAssociation>(iConfig.getParameter<edm::InputTag>("ESAssociation"));
122  inputTagBeamSpot_ = cc.consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("BeamSpot"));
123 
127 
130  }
131  if (useDynamicDPhi_) {
133  }
134 
135  if (useRegression_) {
136  const edm::ParameterSet& regconf = iConfig.getParameter<edm::ParameterSet>("regressionConfig");
137 
138  regr_ = std::make_unique<SCEnergyCorrectorSemiParm>();
139  regr_->setTokens(regconf, cc);
140  }
141 
142  if (isOOTCollection_ || _clustype == PFECALSuperClusterAlgo::kDeepSC) { // OOT photons and DeepSC uses rechits
143  inputTagBarrelRecHits_ = cc.consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("barrelRecHits"));
144  inputTagEndcapRecHits_ = cc.consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("endcapRecHits"));
145  }
146  if (_clustype == PFECALSuperClusterAlgo::kDeepSC) { // DeepSC uses geometry also
149  }
150 }
151 
153  if (useRegression_) {
154  regr_->setEventSetup(setup);
155  }
156 
157  edm::ESHandle<ESEEIntercalibConstants> esEEInterCalibHandle_ = setup.getHandle(esEEInterCalibToken_);
158  _pfEnergyCalibration->initAlphaGamma_ESplanes_fromDB(esEEInterCalibHandle_.product());
159 
160  edm::ESHandle<ESChannelStatus> esChannelStatusHandle_ = setup.getHandle(esChannelStatusToken_);
161  channelStatus_ = esChannelStatusHandle_.product();
162 
163  if (_clustype == PFECALSuperClusterAlgo::kDeepSC) { // DeepSC uses geometry
164  edm::ESHandle<CaloGeometry> caloGeometryHandle_ = setup.getHandle(caloGeometryToken_);
165  geometry_ = caloGeometryHandle_.product();
166  ebGeom_ = caloGeometryHandle_->getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
167  eeGeom_ = caloGeometryHandle_->getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
168  esGeom_ = caloGeometryHandle_->getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
169 
170  edm::ESHandle<CaloTopology> caloTopologyHandle_ = setup.getHandle(caloTopologyToken_);
171  topology_ = caloTopologyHandle_.product();
172  }
173 }
174 
178  }
179  if (useDynamicDPhi_) {
181  }
182 }
183 
185  //load input collections
186  //Load the pfcluster collections
187  edm::Handle<edm::View<reco::PFCluster>> pfclustersHandle;
188  iEvent.getByToken(inputTagPFClusters_, pfclustersHandle);
189 
191  iEvent.getByToken(inputTagPFClustersES_, psAssociationHandle);
192 
193  const PFClusterView& clusters = *pfclustersHandle.product();
194  const reco::PFCluster::EEtoPSAssociation& psclusters = *psAssociationHandle.product();
195 
196  //load BeamSpot
198  iEvent.getByToken(inputTagBeamSpot_, bsHandle);
199  beamSpot_ = bsHandle.product();
200 
201  //initialize regression for this event
202  if (useRegression_) {
203  regr_->setEvent(iEvent);
204  }
205 
206  // reset the system for running
207  superClustersEB_ = std::make_unique<reco::SuperClusterCollection>();
208  _clustersEB.clear();
209  superClustersEE_ = std::make_unique<reco::SuperClusterCollection>();
210  _clustersEE.clear();
211  EEtoPS_ = &psclusters;
212 
213  //Select PF clusters available for the clustering
214  for (size_t i = 0; i < clusters.size(); ++i) {
215  auto cluster = clusters.ptrAt(i);
216  LogDebug("PFClustering") << "Loading PFCluster i=" << cluster.key() << " energy=" << cluster->energy();
217 
218  // protection for sim clusters
219  if (cluster->caloID().detectors() == 0 && cluster->hitsAndFractions().empty())
220  continue;
221 
222  CalibratedPFCluster calib_cluster(cluster);
223  switch (cluster->layer()) {
225  if (calib_cluster.energy() > threshPFClusterBarrel_) {
226  _clustersEB.push_back(calib_cluster);
227  }
228  break;
229  case PFLayer::HGCAL:
231  if (calib_cluster.energy() > threshPFClusterEndcap_) {
232  _clustersEE.push_back(calib_cluster);
233  }
234  break;
235  default:
236  break;
237  }
238  }
239  // sort full cluster collections by their calibrated energy
240  // this will put all the seeds first by construction
241  std::sort(_clustersEB.begin(), _clustersEB.end(), greaterByEt);
242  std::sort(_clustersEE.begin(), _clustersEE.end(), greaterByEt);
243 
244  // set recHit collections for OOT photons and DeepSC
246  edm::Handle<EcalRecHitCollection> barrelRecHitsHandle;
247  iEvent.getByToken(inputTagBarrelRecHits_, barrelRecHitsHandle);
248  if (!barrelRecHitsHandle.isValid()) {
249  throw cms::Exception("PFECALSuperClusterAlgo")
250  << "If you use OOT photons or DeepSC, need to specify proper barrel rec hit collection";
251  }
252  barrelRecHits_ = barrelRecHitsHandle.product();
253 
254  edm::Handle<EcalRecHitCollection> endcapRecHitsHandle;
255  iEvent.getByToken(inputTagEndcapRecHits_, endcapRecHitsHandle);
256  if (!endcapRecHitsHandle.isValid()) {
257  throw cms::Exception("PFECALSuperClusterAlgo")
258  << "If you use OOT photons or DeepSC, need to specify proper endcap rec hit collection";
259  }
260  endcapRecHits_ = endcapRecHitsHandle.product();
261  }
262 }
263 
265  // clusterize the EB
267  // clusterize the EE
269 }
270 
276 }
277 
279  double seedthresh) {
280  auto seedable = std::bind(isSeed, _1, seedthresh, threshIsET_);
281 
282  // make sure only seeds appear at the front of the list of clusters
283  std::stable_partition(clusters.begin(), clusters.end(), seedable);
284 
285  // in each iteration we are working on a list that is already sorted
286  // in the cluster energy and remains so through each iteration
287  // NB: since clusters is sorted in loadClusters any_of has O(1)
288  // timing until you run out of seeds!
289  while (std::any_of(clusters.cbegin(), clusters.cend(), seedable)) {
291  }
292 }
293 
295  auto seedable = std::bind(isSeed, _1, seedthresh, threshIsET_);
296  // EcalClustersGraph utility class for DeepSC algorithm application
297  // make sure only seeds appear at the front of the list of clusters
298  auto last_seed = std::stable_partition(clusters.begin(), clusters.end(), seedable);
299 
300  reco::EcalClustersGraph ecalClusterGraph_{clusters,
301  static_cast<int>(std::distance(clusters.begin(), last_seed)),
302  topology_,
303  ebGeom_,
304  eeGeom_,
308  // Build sub-regions of the detector where the DeepSC algo will be run
309  ecalClusterGraph_.initWindows();
310  // For each sub-region, prepare the DeepSC input tensors
311  ecalClusterGraph_.fillVariables();
312  // Evaluate the DeepSC algorithm and save the scores
313  ecalClusterGraph_.evaluateScores();
314  // Select the final SuperCluster using the CollectionStrategy defined in the cfi
315  ecalClusterGraph_.setThresholds();
316  ecalClusterGraph_.selectClusters();
317  // Extract the final SuperCluster collection
318  reco::EcalClustersGraph::EcalGraphOutput windows = ecalClusterGraph_.getGraphOutput();
319  for (auto& [seed, clustered] : windows) {
320  bool isEE = false;
321  if (seed.ptr()->layer() == PFLayer::ECAL_ENDCAP)
322  isEE = true;
323  finalizeSuperCluster(seed, clustered, isEE);
324  }
325 }
326 
329  CalibratedPFClusterVector clustered;
330 
331  double etawidthSuperCluster = 0.0;
332  double phiwidthSuperCluster = 0.0;
333  bool isEE = false;
334  switch (seed.ptr()->layer()) {
336  phiwidthSuperCluster = phiwidthSuperClusterBarrel_;
337  etawidthSuperCluster = etawidthSuperClusterBarrel_;
338  edm::LogInfo("PFClustering") << "Building SC number " << superClustersEB_->size() + 1 << " in the ECAL barrel!";
339  break;
340  case PFLayer::HGCAL:
342 
343  phiwidthSuperCluster = phiwidthSuperClusterEndcap_;
344  etawidthSuperCluster = etawidthSuperClusterEndcap_;
345  edm::LogInfo("PFClustering") << "Building SC number " << superClustersEE_->size() + 1 << " in the ECAL endcap!"
346  << std::endl;
347  isEE = true;
348  break;
349  default:
350  break;
351  }
352 
353  auto isClusteredWithSeed = std::bind(isClustered,
354  _1,
355  seed,
356  _clustype,
360  etawidthSuperCluster,
361  phiwidthSuperCluster);
362 
363  auto matchesSeedByRecHit = std::bind(isLinkedByRecHit, _1, seed, satelliteThreshold_, fractionForMajority_, 0.1, 0.2);
364 
365  // this function shuffles the list of clusters into a list
366  // where all clustered sub-clusters are at the front
367  // and returns a pointer to the first unclustered cluster.
368  // The relative ordering of clusters is preserved
369  // (i.e. both resulting sub-lists are sorted by energy).
370  auto not_clustered = std::stable_partition(clusters.begin(), clusters.end(), isClusteredWithSeed);
371  // satellite cluster merging
372  // it was found that large clusters can split!
374  not_clustered = std::stable_partition(not_clustered, clusters.end(), matchesSeedByRecHit);
375  }
376 
377  if (verbose_) {
378  edm::LogInfo("PFClustering") << "Dumping cluster detail";
379  edm::LogVerbatim("PFClustering") << "\tPassed seed: e = " << seed.energy_nocalib() << " eta = " << seed.eta()
380  << " phi = " << seed.phi() << std::endl;
381  for (auto clus = clusters.cbegin(); clus != not_clustered; ++clus) {
382  edm::LogVerbatim("PFClustering") << "\t\tClustered cluster: e = " << (*clus).energy_nocalib()
383  << " eta = " << (*clus).eta() << " phi = " << (*clus).phi() << std::endl;
384  }
385  for (auto clus = not_clustered; clus != clusters.end(); ++clus) {
386  edm::LogVerbatim("PFClustering") << "\tNon-Clustered cluster: e = " << (*clus).energy_nocalib()
387  << " eta = " << (*clus).eta() << " phi = " << (*clus).phi() << std::endl;
388  }
389  }
390 
391  if (not_clustered == clusters.begin()) {
392  if (dropUnseedable_) {
393  clusters.erase(clusters.begin());
394  return;
395  } else {
396  throw cms::Exception("PFECALSuperClusterAlgo::buildSuperCluster")
397  << "Cluster is not seedable!" << std::endl
398  << "\tNon-Clustered cluster: e = " << (*not_clustered).energy_nocalib() << " eta = " << (*not_clustered).eta()
399  << " phi = " << (*not_clustered).phi() << std::endl;
400  }
401  }
402 
403  // move the clustered clusters out of available cluster list
404  // and into a temporary vector for building the SC
405  CalibratedPFClusterVector clustered_tmp(clusters.begin(), not_clustered);
406  clustered = clustered_tmp;
407  clusters.erase(clusters.begin(), not_clustered);
408 
409  // Finalize the SuperCluster passing the list of clustered clusters
410  finalizeSuperCluster(seed, clustered, isEE);
411 }
412 
414  CalibratedPFClusterVector& clustered,
415  bool isEE) {
416  // need the vector of raw pointers for a PF width class
417  std::vector<const reco::PFCluster*> bare_ptrs;
418  // calculate necessary parameters and build the SC
419  double posX(0), posY(0), posZ(0), corrSCEnergy(0), corrPS1Energy(0), corrPS2Energy(0), energyweight(0),
420  energyweighttot(0);
421  for (const auto& clus : clustered) {
422  double ePS1 = 0.0;
423  double ePS2 = 0.0;
424  energyweight = clus.energy_nocalib();
425  bare_ptrs.push_back(clus.ptr().get());
426  // update EE calibrated super cluster energies
427  if (isEE) {
428  auto ee_key_val = std::make_pair(clus.ptr().key(), edm::Ptr<reco::PFCluster>());
429  const auto clustops = std::equal_range(EEtoPS_->begin(), EEtoPS_->end(), ee_key_val, sortByKey);
430  std::vector<reco::PFCluster const*> psClusterPointers;
431  for (auto i_ps = clustops.first; i_ps != clustops.second; ++i_ps) {
432  psClusterPointers.push_back(i_ps->second.get());
433  }
434  auto calibratedEnergies = _pfEnergyCalibration->calibrateEndcapClusterEnergies(
435  *(clus.ptr()), psClusterPointers, *channelStatus_, applyCrackCorrections_);
436  ePS1 = calibratedEnergies.ps1Energy;
437  ePS2 = calibratedEnergies.ps2Energy;
438  }
439 
440  if (ePS1 == -1.)
441  ePS1 = 0;
442  if (ePS2 == -1.)
443  ePS2 = 0;
444 
445  switch (_eweight) {
446  case kRaw: // energyweight is initialized to raw cluster energy
447  break;
448  case kCalibratedNoPS:
449  energyweight = clus.energy() - ePS1 - ePS2;
450  break;
451  case kCalibratedTotal:
452  energyweight = clus.energy();
453  break;
454  default:
455  break;
456  }
457  const math::XYZPoint& cluspos = clus.ptr()->position();
458  posX += energyweight * cluspos.X();
459  posY += energyweight * cluspos.Y();
460  posZ += energyweight * cluspos.Z();
461 
462  energyweighttot += energyweight;
463  corrSCEnergy += clus.energy();
464  corrPS1Energy += ePS1;
465  corrPS2Energy += ePS2;
466  }
467  posX /= energyweighttot;
468  posY /= energyweighttot;
469  posZ /= energyweighttot;
470 
471  // now build the supercluster
472  reco::SuperCluster new_sc(corrSCEnergy, math::XYZPoint(posX, posY, posZ));
473  new_sc.setCorrectedEnergy(corrSCEnergy);
474  new_sc.setSeed(clustered.front().ptr());
475  new_sc.setPreshowerEnergy(corrPS1Energy + corrPS2Energy);
476  new_sc.setPreshowerEnergyPlane1(corrPS1Energy);
477  new_sc.setPreshowerEnergyPlane2(corrPS2Energy);
478  for (const auto& clus : clustered) {
479  new_sc.addCluster(clus.ptr());
480 
481  auto& hits_and_fractions = clus.ptr()->hitsAndFractions();
482  for (auto& hit_and_fraction : hits_and_fractions) {
483  new_sc.addHitAndFraction(hit_and_fraction.first, hit_and_fraction.second);
484  }
485  if (isEE) {
486  auto ee_key_val = std::make_pair(clus.ptr().key(), edm::Ptr<reco::PFCluster>());
487  const auto clustops = std::equal_range(EEtoPS_->begin(), EEtoPS_->end(), ee_key_val, sortByKey);
488  // EE rechits should be uniquely matched to sets of pre-shower
489  // clusters at this point, so we throw an exception if otherwise
490  // now wrapped in EDM debug flags
491  for (auto i_ps = clustops.first; i_ps != clustops.second; ++i_ps) {
492  edm::Ptr<reco::PFCluster> psclus(i_ps->second);
493 #ifdef EDM_ML_DEBUG
494 
495  auto found_pscluster =
497 
498  if (found_pscluster == new_sc.preshowerClustersEnd()) {
499 #endif
500  new_sc.addPreshowerCluster(psclus);
501 #ifdef EDM_ML_DEBUG
502  } else {
503  throw cms::Exception("PFECALSuperClusterAlgo::buildSuperCluster")
504  << "Found a PS cluster matched to more than one EE cluster!" << std::endl
505  << std::hex << psclus.get() << " == " << found_pscluster->get() << std::dec << std::endl;
506  }
507 #endif
508  }
509  }
510  }
511 
512  // calculate linearly weighted cluster widths
513  PFClusterWidthAlgo pfwidth(bare_ptrs);
514  new_sc.setEtaWidth(pfwidth.pflowEtaWidth());
515  new_sc.setPhiWidth(pfwidth.pflowPhiWidth());
516 
517  // cache the value of the raw energy
518  new_sc.rawEnergy();
519 
520  //apply regression energy corrections
521  if (useRegression_) {
522  regr_->modifyObject(new_sc);
523  }
524 
525  // save the super cluster to the appropriate list (if it passes the final
526  // Et threshold)
527  //Note that Et is computed here with respect to the beamspot position
528  //in order to be consistent with the cut applied in the
529  //ElectronSeedProducer
530  double scEtBS = ptFast(new_sc.energy(), new_sc.position(), beamSpot_->position());
531 
532  if (scEtBS > threshSuperClusterEt_) {
533  switch (seed.ptr()->layer()) {
535  if (isOOTCollection_) {
536  DetId seedId = new_sc.seed()->seed();
538  if (!seedRecHit->checkFlag(EcalRecHit::kOutOfTime))
539  break;
540  }
541  superClustersEB_->push_back(new_sc);
542  break;
543  case PFLayer::HGCAL:
545  if (isOOTCollection_) {
546  DetId seedId = new_sc.seed()->seed();
548  if (!seedRecHit->checkFlag(EcalRecHit::kOutOfTime))
549  break;
550  }
551  superClustersEE_->push_back(new_sc);
552  break;
553  default:
554  break;
555  }
556  }
557 }
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:154
Log< level::Info, true > LogVerbatim
void buildAllSuperClusters(CalibratedPFClusterVector &, double seedthresh)
const ESChannelStatus * channelStatus_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
void addHitAndFraction(DetId id, float fraction)
Definition: CaloCluster.h:203
edm::EDGetTokenT< edm::View< reco::PFCluster > > inputTagPFClusters_
CalibratedPFClusterVector _clustersEB
const Point & position() const
position
Definition: BeamSpot.h:59
std::unique_ptr< SCEnergyCorrectorSemiParm > regr_
double pflowPhiWidth() const
std::unique_ptr< reco::SuperClusterCollection > superClustersEB_
void setPreshowerEnergyPlane2(double preshowerEnergy2)
Definition: SuperCluster.h:74
edm::EDGetTokenT< EcalRecHitCollection > inputTagBarrelRecHits_
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
double rawEnergy() const
raw uncorrected energy (sum of energies of component BasicClusters)
Definition: SuperCluster.h:60
T const * product() const
Definition: Handle.h:70
std::vector< EcalRecHit >::const_iterator const_iterator
double pflowEtaWidth() const
const reco::BeamSpot * beamSpot_
const EcalMustacheSCParameters * mustacheSCParams_
const reco::PFCluster::EEtoPSAssociation * EEtoPS_
CaloCluster_iterator preshowerClustersBegin() const
fist iterator over PreshowerCluster constituents
Definition: SuperCluster.h:94
bool inMustache(const EcalMustacheSCParameters *params, const float maxEta, const float maxPhi, const float ClustE, const float ClusEta, const float ClusPhi)
Definition: Mustache.cc:8
void setSeed(const CaloClusterPtr &r)
list of used xtals by DetId // now inherited by CaloCluster
Definition: SuperCluster.h:109
edm::Ptr< CaloCluster > CaloClusterPtr
const reco::SCProducerCache * SCProducerCache_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
void setPhiWidth(double pw)
Definition: SuperCluster.h:75
edm::ESGetToken< ESEEIntercalibConstants, ESEEIntercalibConstantsRcd > esEEInterCalibToken_
double ptFast(const double energy, const math::XYZPoint &position, const math::XYZPoint &origin)
std::unique_ptr< reco::SuperClusterCollection > superClustersEE_
const EcalSCDynamicDPhiParameters * scDynamicDPhiParams_
edm::EDGetTokenT< EcalRecHitCollection > inputTagEndcapRecHits_
ESChannelStatusMap ESChannelStatus
void loadAndSortPFClusters(const edm::Event &evt)
void update(const edm::EventSetup &)
void setEtaWidth(double ew)
Definition: SuperCluster.h:76
int iEvent
Definition: GenABIO.cc:224
T const * product() const
Definition: ESHandle.h:86
std::shared_ptr< PFEnergyCalibration > _pfEnergyCalibration
void setTokens(const edm::ParameterSet &, edm::ConsumesCollector &&)
void setCorrectedEnergy(double cenergy)
Definition: CaloCluster.h:137
T sqrt(T t)
Definition: SSEVec.h:23
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
edm::ESGetToken< ESChannelStatus, ESChannelStatusRcd > esChannelStatusToken_
CalibratedPFClusterVector _clustersEE
CaloCluster_iterator preshowerClustersEnd() const
last iterator over PreshowerCluster constituents
Definition: SuperCluster.h:97
edm::ESGetToken< EcalSCDynamicDPhiParameters, EcalSCDynamicDPhiParametersRcd > ecalSCDynamicDPhiParametersToken_
T const * get() const
Returns C++ pointer to the item.
Definition: Ptr.h:141
const CaloSubdetectorGeometry * eeGeom_
double energy() const
cluster energy
Definition: CaloCluster.h:149
Log< level::Info, false > LogInfo
const CaloSubdetectorGeometry * esGeom_
Definition: DetId.h:17
edm::ESGetToken< CaloTopology, CaloTopologyRecord > caloTopologyToken_
edm::EDGetTokenT< reco::PFCluster::EEtoPSAssociation > inputTagPFClustersES_
std::vector< std::pair< CaloClusterPtr::key_type, edm::Ptr< PFCluster > > > EEtoPSAssociation
Definition: PFCluster.h:44
edm::EDGetTokenT< reco::BeamSpot > inputTagBeamSpot_
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
reco::PFCluster::EEtoPSAssociation::value_type EEPSPair
void addPreshowerCluster(const CaloClusterPtr &r)
add reference to constituent BasicCluster
Definition: SuperCluster.h:130
bool sortByKey(const EEPSPair &a, const EEPSPair &b)
double b
Definition: hdecay.h:120
edm::ESGetToken< EcalMustacheSCParameters, EcalMustacheSCParametersRcd > ecalMustacheSCParametersToken_
const CaloTopology * topology_
bool isValid() const
Definition: HandleBase.h:70
const CaloGeometry * geometry_
PFECALSuperClusterAlgo(const reco::SCProducerCache *cache)
constructor
void addCluster(const CaloClusterPtr &r)
add reference to constituent BasicCluster
Definition: SuperCluster.h:124
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:79
iterator find(key_type k)
void buildSuperClusterMustacheOrBox(CalibratedPFCluster &, CalibratedPFClusterVector &)
bool inDynamicDPhiWindow(const EcalSCDynamicDPhiParameters *params, const float seedEta, const float seedPhi, const float ClustE, const float ClusEta, const float clusPhi)
Definition: Mustache.cc:64
double a
Definition: hdecay.h:121
static int position[264][3]
Definition: ReadPGInfo.cc:289
def cache(function)
Definition: utilities.py:3
void updateSCParams(const edm::EventSetup &)
float x
void finalizeSuperCluster(CalibratedPFCluster &seed, CalibratedPFClusterVector &clustered, bool isEE)
const EcalRecHitCollection * barrelRecHits_
std::vector< std::pair< CalibratedPFCluster, CalibratedPFClusterVector > > EcalGraphOutput
std::vector< CalibratedPFCluster > CalibratedPFClusterVector
\ Algorithm for box particle flow super clustering in the ECAL
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
void setPreshowerEnergyPlane1(double preshowerEnergy1)
Definition: SuperCluster.h:73
void setPFClusterCalibration(const std::shared_ptr< PFEnergyCalibration > &)
const CaloSubdetectorGeometry * ebGeom_
const EcalRecHitCollection * endcapRecHits_
void buildAllSuperClustersMustacheOrBox(CalibratedPFClusterVector &, double seedthresh)
void buildAllSuperClustersDeepSC(CalibratedPFClusterVector &, double seedthresh)
void setPreshowerEnergy(double preshowerEnergy)
Definition: SuperCluster.h:72
#define LogDebug(id)