CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes
PFECALSuperClusterAlgo Class Reference

\ Algorithm for box particle flow super clustering in the ECAL More...

#include <PFECALSuperClusterAlgo.h>

Classes

class  CalibratedPFCluster
 

Public Types

typedef std::shared_ptr< CalibratedPFClusterCalibratedClusterPtr
 
typedef std::vector< CalibratedClusterPtrCalibratedClusterPtrVector
 
enum  clustering_type { kBOX = 1, kMustache = 2 }
 
enum  energy_weight { kRaw, kCalibratedNoPS, kCalibratedTotal }
 

Public Member Functions

std::unique_ptr< reco::SuperClusterCollection > & getEBOutputSCCollection ()
 
std::unique_ptr< reco::SuperClusterCollection > & getEEOutputSCCollection ()
 
void loadAndSortPFClusters (const edm::Event &evt)
 
 PFECALSuperClusterAlgo ()
 constructor More...
 
void run ()
 
void setClusteringType (clustering_type thetype)
 
void setCrackCorrections (bool applyCrackCorrections)
 
void setDropUnseedable (const bool d)
 
void setEnergyWeighting (energy_weight thetype)
 
void setEtawidthSuperClusterBarrel (double etawidth)
 
void setEtawidthSuperClusterEndcap (double etawidth)
 
void setIsOOTCollection (bool isOOTCollection)
 
void setMajorityFraction (const double f)
 
void setPFClusterCalibration (const std::shared_ptr< PFEnergyCalibration > &)
 
void setPhiwidthSuperClusterBarrel (double phiwidth)
 
void setPhiwidthSuperClusterEndcap (double phiwidth)
 
void setSatelliteMerging (const bool doit)
 
void setSatelliteThreshold (const double t)
 
void setThreshPFClusterBarrel (double thresh)
 
void setThreshPFClusterEndcap (double thresh)
 
void setThreshPFClusterSeedBarrel (double thresh)
 
void setThreshPFClusterSeedEndcap (double thresh)
 
void setThreshSuperClusterEt (double thresh)
 
void setTokens (const edm::ParameterSet &, edm::ConsumesCollector &&)
 
void setUseDynamicDPhi (bool useit)
 
void setUseETForSeeding (bool useET)
 
void setUseRegression (bool useRegression)
 
void setVerbosityLevel (bool verbose)
 
void update (const edm::EventSetup &)
 

Private Member Functions

void buildAllSuperClusters (CalibratedClusterPtrVector &, double seedthresh)
 
void buildSuperCluster (CalibratedClusterPtr &, CalibratedClusterPtrVector &)
 

Private Attributes

CalibratedClusterPtrVector _clustersEB
 
CalibratedClusterPtrVector _clustersEE
 
clustering_type _clustype
 
energy_weight _eweight
 
std::shared_ptr< PFEnergyCalibration_pfEnergyCalibration
 
bool applyCrackCorrections_
 
const EcalRecHitCollectionbarrelRecHits_
 
const reco::BeamSpotbeamSpot_
 
const ESChannelStatuschannelStatus_
 
bool doSatelliteClusterMerge_
 
bool dropUnseedable_
 
const reco::PFCluster::EEtoPSAssociationEEtoPS_
 
const EcalRecHitCollectionendcapRecHits_
 
double etawidthSuperClusterBarrel_
 
double etawidthSuperClusterEndcap_
 
double fractionForMajority_
 
edm::EDGetTokenT< EcalRecHitCollectioninputTagBarrelRecHits_
 
edm::EDGetTokenT< reco::BeamSpotinputTagBeamSpot_
 
edm::EDGetTokenT< EcalRecHitCollectioninputTagEndcapRecHits_
 
edm::EDGetTokenT< edm::View< reco::PFCluster > > inputTagPFClusters_
 
edm::EDGetTokenT< reco::PFCluster::EEtoPSAssociationinputTagPFClustersES_
 
bool isOOTCollection_
 
double phiwidthSuperClusterBarrel_
 
double phiwidthSuperClusterEndcap_
 
std::unique_ptr< SCEnergyCorrectorSemiParmregr_
 
double satelliteThreshold_
 
std::unique_ptr< reco::SuperClusterCollectionsuperClustersEB_
 
std::unique_ptr< reco::SuperClusterCollectionsuperClustersEE_
 
bool threshIsET_
 
double threshPFClusterBarrel_
 
double threshPFClusterEndcap_
 
double threshPFClusterSeedBarrel_
 
double threshPFClusterSeedEndcap_
 
double threshSuperClusterEt_
 
bool useDynamicDPhi_
 
bool useRegression_
 
bool verbose_
 

Detailed Description

\ Algorithm for box particle flow super clustering in the ECAL

Original Author: Nicolas Chanon Additional Authors (Mustache): Y. Gershtein, R. Patel, L. Gray

Date
July 2012

Definition at line 42 of file PFECALSuperClusterAlgo.h.

Member Typedef Documentation

Definition at line 62 of file PFECALSuperClusterAlgo.h.

Definition at line 63 of file PFECALSuperClusterAlgo.h.

Member Enumeration Documentation

Enumerator
kBOX 
kMustache 

Definition at line 44 of file PFECALSuperClusterAlgo.h.

Constructor & Destructor Documentation

PFECALSuperClusterAlgo::PFECALSuperClusterAlgo ( )

constructor

Definition at line 110 of file PFECALSuperClusterAlgo.cc.

110 : beamSpot_(nullptr) {}
const reco::BeamSpot * beamSpot_

Member Function Documentation

void PFECALSuperClusterAlgo::buildAllSuperClusters ( CalibratedClusterPtrVector ,
double  seedthresh 
)
private

Definition at line 236 of file PFECALSuperClusterAlgo.cc.

References buildSuperCluster(), bsc_activity_cfg::clusters, and threshIsET_.

Referenced by run().

236  {
237  auto seedable = std::bind(isSeed, _1, seedthresh, threshIsET_);
238  // make sure only seeds appear at the front of the list of clusters
239  std::stable_partition(clusters.begin(), clusters.end(), seedable);
240  // in each iteration we are working on a list that is already sorted
241  // in the cluster energy and remains so through each iteration
242  // NB: since clusters is sorted in loadClusters any_of has O(1)
243  // timing until you run out of seeds!
244  while (std::any_of(clusters.cbegin(), clusters.cend(), seedable)) {
246  }
247 }
void buildSuperCluster(CalibratedClusterPtr &, CalibratedClusterPtrVector &)
void PFECALSuperClusterAlgo::buildSuperCluster ( CalibratedClusterPtr ,
CalibratedClusterPtrVector  
)
private

Definition at line 249 of file PFECALSuperClusterAlgo.cc.

References _clustype, _eweight, _pfEnergyCalibration, reco::SuperCluster::addCluster(), reco::CaloCluster::addHitAndFraction(), reco::SuperCluster::addPreshowerCluster(), applyCrackCorrections_, barrelRecHits_, beamSpot_, channelStatus_, TauDecayModes::dec, doSatelliteClusterMerge_, dropUnseedable_, PFLayer::ECAL_BARREL, PFLayer::ECAL_ENDCAP, EEtoPS_, endcapRecHits_, reco::PFCluster::energy(), reco::CaloCluster::energy(), etawidthSuperClusterBarrel_, etawidthSuperClusterEndcap_, Exception, ESCondObjectContainer< T >::find(), edm::SortedCollection< T, SORT >::find(), fractionForMajority_, edm::Ptr< T >::get(), ESCondObjectContainer< T >::getMap(), PFLayer::HGCAL, mps_fire::i, isOOTCollection_, kCalibratedNoPS, kCalibratedTotal, EcalRecHit::kOutOfTime, kRaw, reco::PFCluster::layer(), PFClusterWidthAlgo::pflowEtaWidth(), PFClusterWidthAlgo::pflowPhiWidth(), phiwidthSuperClusterBarrel_, phiwidthSuperClusterEndcap_, reco::BeamSpot::position(), reco::CaloCluster::position(), RecoTauValidation_cfi::posX, RecoTauValidation_cfi::posY, reco::SuperCluster::preshowerClustersBegin(), reco::SuperCluster::preshowerClustersEnd(), PFLayer::PS1, PFLayer::PS2, ptFast(), reco::SuperCluster::rawEnergy(), reco::PFCluster::recHitFractions(), regr_, satelliteThreshold_, reco::SuperCluster::seed(), reco::CaloCluster::setCorrectedEnergy(), reco::SuperCluster::setEtaWidth(), reco::SuperCluster::setPhiWidth(), reco::SuperCluster::setPreshowerEnergy(), reco::SuperCluster::setPreshowerEnergyPlane1(), reco::SuperCluster::setPreshowerEnergyPlane2(), reco::SuperCluster::setSeed(), sortByKey(), superClustersEB_, superClustersEE_, threshSuperClusterEt_, useDynamicDPhi_, useRegression_, and verbose_.

Referenced by buildAllSuperClusters().

249  {
250  double etawidthSuperCluster = 0.0;
251  double phiwidthSuperCluster = 0.0;
252  bool isEE = false;
253  switch (seed->the_ptr()->layer()) {
255  phiwidthSuperCluster = phiwidthSuperClusterBarrel_;
256  etawidthSuperCluster = etawidthSuperClusterBarrel_;
257  edm::LogInfo("PFClustering") << "Building SC number " << superClustersEB_->size() + 1 << " in the ECAL barrel!";
258  break;
259  case PFLayer::HGCAL:
261 
262  phiwidthSuperCluster = phiwidthSuperClusterEndcap_;
263  etawidthSuperCluster = etawidthSuperClusterEndcap_;
264  edm::LogInfo("PFClustering") << "Building SC number " << superClustersEE_->size() + 1 << " in the ECAL endcap!"
265  << std::endl;
266  isEE = true;
267  break;
268  default:
269  break;
270  }
271  auto isClusteredWithSeed =
272  std::bind(isClustered, _1, seed, _clustype, useDynamicDPhi_, etawidthSuperCluster, phiwidthSuperCluster);
273  auto matchesSeedByRecHit = std::bind(isLinkedByRecHit, _1, seed, satelliteThreshold_, fractionForMajority_, 0.1, 0.2);
274 
275  // this function shuffles the list of clusters into a list
276  // where all clustered sub-clusters are at the front
277  // and returns a pointer to the first unclustered cluster.
278  // The relative ordering of clusters is preserved
279  // (i.e. both resulting sub-lists are sorted by energy).
280  auto not_clustered = std::stable_partition(clusters.begin(), clusters.end(), isClusteredWithSeed);
281  // satellite cluster merging
282  // it was found that large clusters can split!
284  not_clustered = std::stable_partition(not_clustered, clusters.end(), matchesSeedByRecHit);
285  }
286 
287  if (verbose_) {
288  edm::LogInfo("PFClustering") << "Dumping cluster detail";
289  edm::LogVerbatim("PFClustering") << "\tPassed seed: e = " << seed->energy_nocalib() << " eta = " << seed->eta()
290  << " phi = " << seed->phi() << std::endl;
291  for (auto clus = clusters.cbegin(); clus != not_clustered; ++clus) {
292  edm::LogVerbatim("PFClustering") << "\t\tClustered cluster: e = " << (*clus)->energy_nocalib()
293  << " eta = " << (*clus)->eta() << " phi = " << (*clus)->phi() << std::endl;
294  }
295  for (auto clus = not_clustered; clus != clusters.end(); ++clus) {
296  edm::LogVerbatim("PFClustering") << "\tNon-Clustered cluster: e = " << (*clus)->energy_nocalib()
297  << " eta = " << (*clus)->eta() << " phi = " << (*clus)->phi() << std::endl;
298  }
299  }
300 
301  if (not_clustered == clusters.begin()) {
302  if (dropUnseedable_) {
303  clusters.erase(clusters.begin());
304  return;
305  } else {
306  throw cms::Exception("PFECALSuperClusterAlgo::buildSuperCluster")
307  << "Cluster is not seedable!" << std::endl
308  << "\tNon-Clustered cluster: e = " << (*not_clustered)->energy_nocalib()
309  << " eta = " << (*not_clustered)->eta() << " phi = " << (*not_clustered)->phi() << std::endl;
310  }
311  }
312 
313  // move the clustered clusters out of available cluster list
314  // and into a temporary vector for building the SC
315  CalibratedClusterPtrVector clustered(clusters.begin(), not_clustered);
316  clusters.erase(clusters.begin(), not_clustered);
317  // need the vector of raw pointers for a PF width class
318  std::vector<const reco::PFCluster*> bare_ptrs;
319  // calculate necessary parameters and build the SC
320  double posX(0), posY(0), posZ(0), corrSCEnergy(0), corrPS1Energy(0), corrPS2Energy(0), ePS1(0), ePS2(0),
321  energyweight(0), energyweighttot(0);
322  std::vector<double> ps1_energies, ps2_energies;
323  int condP1(1), condP2(1);
324  for (auto& clus : clustered) {
325  ePS1 = ePS2 = 0;
326  energyweight = clus->energy_nocalib();
327  bare_ptrs.push_back(clus->the_ptr().get());
328  // update EE calibrated super cluster energies
329  if (isEE) {
330  ePS1 = ePS2 = 0;
331  condP1 = condP2 = 1;
332  ps1_energies.clear();
333  ps2_energies.clear();
334  auto ee_key_val = std::make_pair(clus->the_ptr().key(), edm::Ptr<reco::PFCluster>());
335  const auto clustops = std::equal_range(EEtoPS_->begin(), EEtoPS_->end(), ee_key_val, sortByKey);
336  for (auto i_ps = clustops.first; i_ps != clustops.second; ++i_ps) {
337  edm::Ptr<reco::PFCluster> psclus(i_ps->second);
338 
339  auto const& recH_Frac = psclus->recHitFractions();
340 
341  switch (psclus->layer()) {
342  case PFLayer::PS1:
343  ps1_energies.push_back(psclus->energy());
344  for (auto const& recH : recH_Frac) {
345  ESDetId strip1 = recH.recHitRef()->detId();
346  if (strip1 != ESDetId(0)) {
348  // getStatusCode() == 1 => dead channel
349  //apply correction if all recHits in dead region
350  if (status_p1->getStatusCode() == 0)
351  condP1 = 0; //active
352  }
353  }
354  break;
355  case PFLayer::PS2:
356  ps2_energies.push_back(psclus->energy());
357  for (auto const& recH : recH_Frac) {
358  ESDetId strip2 = recH.recHitRef()->detId();
359  if (strip2 != ESDetId(0)) {
361  if (status_p2->getStatusCode() == 0)
362  condP2 = 0;
363  }
364  }
365  break;
366  default:
367  break;
368  }
369  }
370  if (condP1 == 1)
371  ePS1 = -1.;
372  if (condP2 == 1)
373  ePS2 = -1.;
374  _pfEnergyCalibration->energyEm(
375  *(clus->the_ptr()), ps1_energies, ps2_energies, ePS1, ePS2, applyCrackCorrections_);
376  }
377 
378  if (ePS1 == -1.)
379  ePS1 = 0;
380  if (ePS2 == -1.)
381  ePS2 = 0;
382 
383  switch (_eweight) {
384  case kRaw: // energyweight is initialized to raw cluster energy
385  break;
386  case kCalibratedNoPS:
387  energyweight = clus->energy() - ePS1 - ePS2;
388  break;
389  case kCalibratedTotal:
390  energyweight = clus->energy();
391  break;
392  default:
393  break;
394  }
395  const math::XYZPoint& cluspos = clus->the_ptr()->position();
396  posX += energyweight * cluspos.X();
397  posY += energyweight * cluspos.Y();
398  posZ += energyweight * cluspos.Z();
399 
400  energyweighttot += energyweight;
401  corrSCEnergy += clus->energy();
402  corrPS1Energy += ePS1;
403  corrPS2Energy += ePS2;
404  }
405  posX /= energyweighttot;
406  posY /= energyweighttot;
407  posZ /= energyweighttot;
408 
409  // now build the supercluster
410  reco::SuperCluster new_sc(corrSCEnergy, math::XYZPoint(posX, posY, posZ));
411  new_sc.setCorrectedEnergy(corrSCEnergy);
412  new_sc.setSeed(clustered.front()->the_ptr());
413  new_sc.setPreshowerEnergy(corrPS1Energy + corrPS2Energy);
414  new_sc.setPreshowerEnergyPlane1(corrPS1Energy);
415  new_sc.setPreshowerEnergyPlane2(corrPS2Energy);
416  for (const auto& clus : clustered) {
417  new_sc.addCluster(clus->the_ptr());
418 
419  auto& hits_and_fractions = clus->the_ptr()->hitsAndFractions();
420  for (auto& hit_and_fraction : hits_and_fractions) {
421  new_sc.addHitAndFraction(hit_and_fraction.first, hit_and_fraction.second);
422  }
423  if (isEE) {
424  auto ee_key_val = std::make_pair(clus->the_ptr().key(), edm::Ptr<reco::PFCluster>());
425  const auto clustops = std::equal_range(EEtoPS_->begin(), EEtoPS_->end(), ee_key_val, sortByKey);
426  // EE rechits should be uniquely matched to sets of pre-shower
427  // clusters at this point, so we throw an exception if otherwise
428  // now wrapped in EDM debug flags
429  for (auto i_ps = clustops.first; i_ps != clustops.second; ++i_ps) {
430  edm::Ptr<reco::PFCluster> psclus(i_ps->second);
431 #ifdef EDM_ML_DEBUG
432  auto found_pscluster = std::find_if(new_sc.preshowerClustersBegin(),
433  new_sc.preshowerClustersEnd(),
434  [&i_ps](const auto& i) { return i.key() == i_ps->first; });
435  if (found_pscluster == new_sc.preshowerClustersEnd()) {
436 #endif
437  new_sc.addPreshowerCluster(psclus);
438 #ifdef EDM_ML_DEBUG
439  } else {
440  throw cms::Exception("PFECALSuperClusterAlgo::buildSuperCluster")
441  << "Found a PS cluster matched to more than one EE cluster!" << std::endl
442  << std::hex << psclus.get() << " == " << found_pscluster->get() << std::dec << std::endl;
443  }
444 #endif
445  }
446  }
447  }
448 
449  // calculate linearly weighted cluster widths
450  PFClusterWidthAlgo pfwidth(bare_ptrs);
451  new_sc.setEtaWidth(pfwidth.pflowEtaWidth());
452  new_sc.setPhiWidth(pfwidth.pflowPhiWidth());
453 
454  // cache the value of the raw energy
455  new_sc.rawEnergy();
456 
457  //apply regression energy corrections
458  if (useRegression_) {
459  regr_->modifyObject(new_sc);
460  }
461 
462  // save the super cluster to the appropriate list (if it passes the final
463  // Et threshold)
464  //Note that Et is computed here with respect to the beamspot position
465  //in order to be consistent with the cut applied in the
466  //ElectronSeedProducer
467  double scEtBS = ptFast(new_sc.energy(), new_sc.position(), beamSpot_->position());
468 
469  if (scEtBS > threshSuperClusterEt_) {
470  switch (seed->the_ptr()->layer()) {
472  if (isOOTCollection_) {
473  DetId seedId = new_sc.seed()->seed();
475  if (!seedRecHit->checkFlag(EcalRecHit::kOutOfTime))
476  break;
477  }
478  superClustersEB_->push_back(new_sc);
479  break;
480  case PFLayer::HGCAL:
482  if (isOOTCollection_) {
483  DetId seedId = new_sc.seed()->seed();
485  if (!seedRecHit->checkFlag(EcalRecHit::kOutOfTime))
486  break;
487  }
488  superClustersEE_->push_back(new_sc);
489  break;
490  default:
491  break;
492  }
493  }
494 }
const ESChannelStatus * channelStatus_
std::unique_ptr< SCEnergyCorrectorSemiParm > regr_
std::unique_ptr< reco::SuperClusterCollection > superClustersEB_
const self & getMap() const
std::vector< EcalRecHit >::const_iterator const_iterator
const reco::BeamSpot * beamSpot_
const reco::PFCluster::EEtoPSAssociation * EEtoPS_
double ptFast(const double energy, const math::XYZPoint &position, const math::XYZPoint &origin)
std::unique_ptr< reco::SuperClusterCollection > superClustersEE_
std::vector< CalibratedClusterPtr > CalibratedClusterPtrVector
std::shared_ptr< PFEnergyCalibration > _pfEnergyCalibration
const_iterator find(uint32_t rawId) const
Definition: DetId.h:17
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
bool sortByKey(const EEPSPair &a, const EEPSPair &b)
std::vector< Item >::const_iterator const_iterator
iterator find(key_type k)
const Point & position() const
position
Definition: BeamSpot.h:59
const EcalRecHitCollection * barrelRecHits_
const EcalRecHitCollection * endcapRecHits_
std::unique_ptr<reco::SuperClusterCollection>& PFECALSuperClusterAlgo::getEBOutputSCCollection ( )
inline

Definition at line 106 of file PFECALSuperClusterAlgo.h.

References superClustersEB_.

106 { return superClustersEB_; }
std::unique_ptr< reco::SuperClusterCollection > superClustersEB_
std::unique_ptr<reco::SuperClusterCollection>& PFECALSuperClusterAlgo::getEEOutputSCCollection ( )
inline

Definition at line 107 of file PFECALSuperClusterAlgo.h.

References loadAndSortPFClusters(), run(), and superClustersEE_.

107 { return superClustersEE_; }
std::unique_ptr< reco::SuperClusterCollection > superClustersEE_
void PFECALSuperClusterAlgo::loadAndSortPFClusters ( const edm::Event evt)

Definition at line 149 of file PFECALSuperClusterAlgo.cc.

References _clustersEB, _clustersEE, barrelRecHits_, beamSpot_, bsc_activity_cfg::clusters, PFLayer::ECAL_BARREL, PFLayer::ECAL_ENDCAP, EEtoPS_, endcapRecHits_, Exception, edm::Event::getByToken(), PFLayer::HGCAL, mps_fire::i, inputTagBarrelRecHits_, inputTagBeamSpot_, inputTagEndcapRecHits_, inputTagPFClusters_, inputTagPFClustersES_, isOOTCollection_, edm::HandleBase::isValid(), LogDebug, edm::Handle< T >::product(), regr_, superClustersEB_, superClustersEE_, threshPFClusterBarrel_, threshPFClusterEndcap_, and useRegression_.

Referenced by getEEOutputSCCollection().

149  {
150  //load input collections
151  //Load the pfcluster collections
152  edm::Handle<edm::View<reco::PFCluster> > pfclustersHandle;
153  iEvent.getByToken(inputTagPFClusters_, pfclustersHandle);
154 
156  iEvent.getByToken(inputTagPFClustersES_, psAssociationHandle);
157 
158  const PFClusterView& clusters = *pfclustersHandle.product();
159  const reco::PFCluster::EEtoPSAssociation& psclusters = *psAssociationHandle.product();
160 
161  //load BeamSpot
163  iEvent.getByToken(inputTagBeamSpot_, bsHandle);
164  beamSpot_ = bsHandle.product();
165 
166  //initialize regression for this event
167  if (useRegression_) {
168  regr_->setEvent(iEvent);
169  }
170 
171  // reset the system for running
172  superClustersEB_ = std::make_unique<reco::SuperClusterCollection>();
173  _clustersEB.clear();
174  superClustersEE_ = std::make_unique<reco::SuperClusterCollection>();
175  _clustersEE.clear();
176  EEtoPS_ = &psclusters;
177 
178  //Select PF clusters available for the clustering
179  for (size_t i = 0; i < clusters.size(); ++i) {
180  auto cluster = clusters.ptrAt(i);
181  LogDebug("PFClustering") << "Loading PFCluster i=" << cluster.key() << " energy=" << cluster->energy() << std::endl;
182 
183  // protection for sim clusters
184  if (cluster->caloID().detectors() == 0 && cluster->hitsAndFractions().empty())
185  continue;
186 
187  CalibratedClusterPtr calib_cluster(new CalibratedPFCluster(cluster));
188  switch (cluster->layer()) {
190  if (calib_cluster->energy() > threshPFClusterBarrel_) {
191  _clustersEB.push_back(calib_cluster);
192  }
193  break;
194  case PFLayer::HGCAL:
196  if (calib_cluster->energy() > threshPFClusterEndcap_) {
197  _clustersEE.push_back(calib_cluster);
198  }
199  break;
200  default:
201  break;
202  }
203  }
204  // sort full cluster collections by their calibrated energy
205  // this will put all the seeds first by construction
206  std::sort(_clustersEB.begin(), _clustersEB.end(), greaterByEt);
207  std::sort(_clustersEE.begin(), _clustersEE.end(), greaterByEt);
208 
209  // set recHit collections for OOT photons
210  if (isOOTCollection_) {
211  edm::Handle<EcalRecHitCollection> barrelRecHitsHandle;
212  iEvent.getByToken(inputTagBarrelRecHits_, barrelRecHitsHandle);
213  if (!barrelRecHitsHandle.isValid()) {
214  throw cms::Exception("PFECALSuperClusterAlgo")
215  << "If you use OOT photons, need to specify proper barrel rec hit collection";
216  }
217  barrelRecHits_ = barrelRecHitsHandle.product();
218 
219  edm::Handle<EcalRecHitCollection> endcapRecHitsHandle;
220  iEvent.getByToken(inputTagEndcapRecHits_, endcapRecHitsHandle);
221  if (!endcapRecHitsHandle.isValid()) {
222  throw cms::Exception("PFECALSuperClusterAlgo")
223  << "If you use OOT photons, need to specify proper endcap rec hit collection";
224  }
225  endcapRecHits_ = endcapRecHitsHandle.product();
226  }
227 }
#define LogDebug(id)
edm::EDGetTokenT< edm::View< reco::PFCluster > > inputTagPFClusters_
std::unique_ptr< SCEnergyCorrectorSemiParm > regr_
std::unique_ptr< reco::SuperClusterCollection > superClustersEB_
edm::EDGetTokenT< EcalRecHitCollection > inputTagBarrelRecHits_
const reco::BeamSpot * beamSpot_
const reco::PFCluster::EEtoPSAssociation * EEtoPS_
std::unique_ptr< reco::SuperClusterCollection > superClustersEE_
edm::EDGetTokenT< EcalRecHitCollection > inputTagEndcapRecHits_
std::shared_ptr< CalibratedPFCluster > CalibratedClusterPtr
int iEvent
Definition: GenABIO.cc:224
CalibratedClusterPtrVector _clustersEE
bool isValid() const
Definition: HandleBase.h:70
edm::EDGetTokenT< reco::PFCluster::EEtoPSAssociation > inputTagPFClustersES_
std::vector< std::pair< CaloClusterPtr::key_type, edm::Ptr< PFCluster > > > EEtoPSAssociation
Definition: PFCluster.h:48
T const * product() const
Definition: Handle.h:69
edm::EDGetTokenT< reco::BeamSpot > inputTagBeamSpot_
const EcalRecHitCollection * barrelRecHits_
CalibratedClusterPtrVector _clustersEB
const EcalRecHitCollection * endcapRecHits_
void PFECALSuperClusterAlgo::run ( )

Definition at line 229 of file PFECALSuperClusterAlgo.cc.

References _clustersEB, _clustersEE, buildAllSuperClusters(), threshPFClusterSeedBarrel_, and threshPFClusterSeedEndcap_.

Referenced by getEEOutputSCCollection().

229  {
230  // clusterize the EB
232  // clusterize the EE
234 }
void buildAllSuperClusters(CalibratedClusterPtrVector &, double seedthresh)
CalibratedClusterPtrVector _clustersEE
CalibratedClusterPtrVector _clustersEB
void PFECALSuperClusterAlgo::setClusteringType ( clustering_type  thetype)
inline

Definition at line 70 of file PFECALSuperClusterAlgo.h.

References _clustype.

70 { _clustype = thetype; }
void PFECALSuperClusterAlgo::setCrackCorrections ( bool  applyCrackCorrections)
inline
void PFECALSuperClusterAlgo::setDropUnseedable ( const bool  d)
inline

Definition at line 97 of file PFECALSuperClusterAlgo.h.

References ztail::d, and dropUnseedable_.

void PFECALSuperClusterAlgo::setEnergyWeighting ( energy_weight  thetype)
inline

Definition at line 72 of file PFECALSuperClusterAlgo.h.

References _eweight.

72 { _eweight = thetype; }
void PFECALSuperClusterAlgo::setEtawidthSuperClusterBarrel ( double  etawidth)
inline

Definition at line 88 of file PFECALSuperClusterAlgo.h.

References etawidthSuperClusterBarrel_.

void PFECALSuperClusterAlgo::setEtawidthSuperClusterEndcap ( double  etawidth)
inline
void PFECALSuperClusterAlgo::setIsOOTCollection ( bool  isOOTCollection)
inline
void PFECALSuperClusterAlgo::setMajorityFraction ( const double  f)
inline

Definition at line 96 of file PFECALSuperClusterAlgo.h.

References f, and fractionForMajority_.

double f[11][100]
void PFECALSuperClusterAlgo::setPFClusterCalibration ( const std::shared_ptr< PFEnergyCalibration > &  calib)

Definition at line 112 of file PFECALSuperClusterAlgo.cc.

References _pfEnergyCalibration.

Referenced by setEtawidthSuperClusterEndcap().

112  {
114 }
std::shared_ptr< PFEnergyCalibration > _pfEnergyCalibration
void PFECALSuperClusterAlgo::setPhiwidthSuperClusterBarrel ( double  phiwidth)
inline

Definition at line 87 of file PFECALSuperClusterAlgo.h.

References phiwidthSuperClusterBarrel_.

void PFECALSuperClusterAlgo::setPhiwidthSuperClusterEndcap ( double  phiwidth)
inline

Definition at line 89 of file PFECALSuperClusterAlgo.h.

References phiwidthSuperClusterEndcap_.

void PFECALSuperClusterAlgo::setSatelliteMerging ( const bool  doit)
inline

Definition at line 94 of file PFECALSuperClusterAlgo.h.

References doSatelliteClusterMerge_.

void PFECALSuperClusterAlgo::setSatelliteThreshold ( const double  t)
inline
void PFECALSuperClusterAlgo::setThreshPFClusterBarrel ( double  thresh)
inline
void PFECALSuperClusterAlgo::setThreshPFClusterEndcap ( double  thresh)
inline
void PFECALSuperClusterAlgo::setThreshPFClusterSeedBarrel ( double  thresh)
inline
void PFECALSuperClusterAlgo::setThreshPFClusterSeedEndcap ( double  thresh)
inline
void PFECALSuperClusterAlgo::setThreshSuperClusterEt ( double  thresh)
inline
void PFECALSuperClusterAlgo::setTokens ( const edm::ParameterSet iConfig,
edm::ConsumesCollector &&  cc 
)

Definition at line 116 of file PFECALSuperClusterAlgo.cc.

References edm::ParameterSet::getParameter(), inputTagBarrelRecHits_, inputTagBeamSpot_, inputTagEndcapRecHits_, inputTagPFClusters_, inputTagPFClustersES_, isOOTCollection_, regr_, and useRegression_.

Referenced by setCrackCorrections().

116  {
121 
122  if (useRegression_) {
123  const edm::ParameterSet& regconf = iConfig.getParameter<edm::ParameterSet>("regressionConfig");
124 
125  regr_.reset(new SCEnergyCorrectorSemiParm());
126  regr_->setTokens(regconf, cc);
127  }
128 
129  if (isOOTCollection_) { // OOT photons only
132  }
133 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::View< reco::PFCluster > > inputTagPFClusters_
std::unique_ptr< SCEnergyCorrectorSemiParm > regr_
edm::EDGetTokenT< EcalRecHitCollection > inputTagBarrelRecHits_
edm::EDGetTokenT< EcalRecHitCollection > inputTagEndcapRecHits_
edm::EDGetTokenT< reco::PFCluster::EEtoPSAssociation > inputTagPFClustersES_
std::vector< std::pair< CaloClusterPtr::key_type, edm::Ptr< PFCluster > > > EEtoPSAssociation
Definition: PFCluster.h:48
edm::EDGetTokenT< reco::BeamSpot > inputTagBeamSpot_
void PFECALSuperClusterAlgo::setUseDynamicDPhi ( bool  useit)
inline

Definition at line 76 of file PFECALSuperClusterAlgo.h.

References useDynamicDPhi_.

void PFECALSuperClusterAlgo::setUseETForSeeding ( bool  useET)
inline

Definition at line 74 of file PFECALSuperClusterAlgo.h.

References threshIsET_.

void PFECALSuperClusterAlgo::setUseRegression ( bool  useRegression)
inline
void PFECALSuperClusterAlgo::setVerbosityLevel ( bool  verbose)
inline

Definition at line 68 of file PFECALSuperClusterAlgo.h.

References verbose, and verbose_.

void PFECALSuperClusterAlgo::update ( const edm::EventSetup setup)

Definition at line 135 of file PFECALSuperClusterAlgo.cc.

References _pfEnergyCalibration, channelStatus_, edm::EventSetup::get(), edm::ESHandle< T >::product(), regr_, and useRegression_.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), setCrackCorrections(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

135  {
136  if (useRegression_) {
137  regr_->setEventSetup(setup);
138  }
139 
140  edm::ESHandle<ESEEIntercalibConstants> esEEInterCalibHandle_;
141  setup.get<ESEEIntercalibConstantsRcd>().get(esEEInterCalibHandle_);
142  _pfEnergyCalibration->initAlphaGamma_ESplanes_fromDB(esEEInterCalibHandle_.product());
143 
144  edm::ESHandle<ESChannelStatus> esChannelStatusHandle_;
145  setup.get<ESChannelStatusRcd>().get(esChannelStatusHandle_);
146  channelStatus_ = esChannelStatusHandle_.product();
147 }
const ESChannelStatus * channelStatus_
std::unique_ptr< SCEnergyCorrectorSemiParm > regr_
std::shared_ptr< PFEnergyCalibration > _pfEnergyCalibration
T get() const
Definition: EventSetup.h:73
T const * product() const
Definition: ESHandle.h:86

Member Data Documentation

CalibratedClusterPtrVector PFECALSuperClusterAlgo::_clustersEB
private

Definition at line 121 of file PFECALSuperClusterAlgo.h.

Referenced by loadAndSortPFClusters(), and run().

CalibratedClusterPtrVector PFECALSuperClusterAlgo::_clustersEE
private

Definition at line 122 of file PFECALSuperClusterAlgo.h.

Referenced by loadAndSortPFClusters(), and run().

clustering_type PFECALSuperClusterAlgo::_clustype
private

Definition at line 127 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setClusteringType().

energy_weight PFECALSuperClusterAlgo::_eweight
private

Definition at line 128 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setEnergyWeighting().

std::shared_ptr<PFEnergyCalibration> PFECALSuperClusterAlgo::_pfEnergyCalibration
private

Definition at line 126 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), setPFClusterCalibration(), and update().

bool PFECALSuperClusterAlgo::applyCrackCorrections_
private

Definition at line 156 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setCrackCorrections().

const EcalRecHitCollection* PFECALSuperClusterAlgo::barrelRecHits_
private

Definition at line 163 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and loadAndSortPFClusters().

const reco::BeamSpot* PFECALSuperClusterAlgo::beamSpot_
private

Definition at line 118 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and loadAndSortPFClusters().

const ESChannelStatus* PFECALSuperClusterAlgo::channelStatus_
private

Definition at line 119 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and update().

bool PFECALSuperClusterAlgo::doSatelliteClusterMerge_
private

Definition at line 150 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setSatelliteMerging().

bool PFECALSuperClusterAlgo::dropUnseedable_
private

Definition at line 152 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setDropUnseedable().

const reco::PFCluster::EEtoPSAssociation* PFECALSuperClusterAlgo::EEtoPS_
private

Definition at line 125 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and loadAndSortPFClusters().

const EcalRecHitCollection* PFECALSuperClusterAlgo::endcapRecHits_
private

Definition at line 164 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and loadAndSortPFClusters().

double PFECALSuperClusterAlgo::etawidthSuperClusterBarrel_
private

Definition at line 146 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setEtawidthSuperClusterBarrel().

double PFECALSuperClusterAlgo::etawidthSuperClusterEndcap_
private

Definition at line 148 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setEtawidthSuperClusterEndcap().

double PFECALSuperClusterAlgo::fractionForMajority_
private

Definition at line 151 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setMajorityFraction().

edm::EDGetTokenT<EcalRecHitCollection> PFECALSuperClusterAlgo::inputTagBarrelRecHits_
private

Definition at line 161 of file PFECALSuperClusterAlgo.h.

Referenced by loadAndSortPFClusters(), and setTokens().

edm::EDGetTokenT<reco::BeamSpot> PFECALSuperClusterAlgo::inputTagBeamSpot_
private

Definition at line 116 of file PFECALSuperClusterAlgo.h.

Referenced by loadAndSortPFClusters(), and setTokens().

edm::EDGetTokenT<EcalRecHitCollection> PFECALSuperClusterAlgo::inputTagEndcapRecHits_
private

Definition at line 162 of file PFECALSuperClusterAlgo.h.

Referenced by loadAndSortPFClusters(), and setTokens().

edm::EDGetTokenT<edm::View<reco::PFCluster> > PFECALSuperClusterAlgo::inputTagPFClusters_
private

Definition at line 114 of file PFECALSuperClusterAlgo.h.

Referenced by loadAndSortPFClusters(), and setTokens().

edm::EDGetTokenT<reco::PFCluster::EEtoPSAssociation> PFECALSuperClusterAlgo::inputTagPFClustersES_
private

Definition at line 115 of file PFECALSuperClusterAlgo.h.

Referenced by loadAndSortPFClusters(), and setTokens().

bool PFECALSuperClusterAlgo::isOOTCollection_
private
double PFECALSuperClusterAlgo::phiwidthSuperClusterBarrel_
private

Definition at line 145 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setPhiwidthSuperClusterBarrel().

double PFECALSuperClusterAlgo::phiwidthSuperClusterEndcap_
private

Definition at line 147 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setPhiwidthSuperClusterEndcap().

std::unique_ptr<SCEnergyCorrectorSemiParm> PFECALSuperClusterAlgo::regr_
private
double PFECALSuperClusterAlgo::satelliteThreshold_
private

Definition at line 151 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setSatelliteThreshold().

std::unique_ptr<reco::SuperClusterCollection> PFECALSuperClusterAlgo::superClustersEB_
private
std::unique_ptr<reco::SuperClusterCollection> PFECALSuperClusterAlgo::superClustersEE_
private
bool PFECALSuperClusterAlgo::threshIsET_
private

Definition at line 157 of file PFECALSuperClusterAlgo.h.

Referenced by buildAllSuperClusters(), and setUseETForSeeding().

double PFECALSuperClusterAlgo::threshPFClusterBarrel_
private

Definition at line 141 of file PFECALSuperClusterAlgo.h.

Referenced by loadAndSortPFClusters(), and setThreshPFClusterBarrel().

double PFECALSuperClusterAlgo::threshPFClusterEndcap_
private

Definition at line 143 of file PFECALSuperClusterAlgo.h.

Referenced by loadAndSortPFClusters(), and setThreshPFClusterEndcap().

double PFECALSuperClusterAlgo::threshPFClusterSeedBarrel_
private

Definition at line 140 of file PFECALSuperClusterAlgo.h.

Referenced by run(), and setThreshPFClusterSeedBarrel().

double PFECALSuperClusterAlgo::threshPFClusterSeedEndcap_
private

Definition at line 142 of file PFECALSuperClusterAlgo.h.

Referenced by run(), and setThreshPFClusterSeedEndcap().

double PFECALSuperClusterAlgo::threshSuperClusterEt_
private

Definition at line 138 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setThreshSuperClusterEt().

bool PFECALSuperClusterAlgo::useDynamicDPhi_
private

Definition at line 154 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setUseDynamicDPhi().

bool PFECALSuperClusterAlgo::useRegression_
private
bool PFECALSuperClusterAlgo::verbose_
private

Definition at line 132 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setVerbosityLevel().