CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
< CalibratedPFCluster
CalibratedClusterPtr
 
typedef std::vector
< CalibratedClusterPtr
CalibratedClusterPtrVector
 
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 &)
 
void updateSCParams (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_
 
edm::ESGetToken
< EcalMustacheSCParameters,
EcalMustacheSCParametersRcd
ecalMustacheSCParametersToken_
 
edm::ESGetToken
< EcalSCDynamicDPhiParameters,
EcalSCDynamicDPhiParametersRcd
ecalSCDynamicDPhiParametersToken_
 
const
reco::PFCluster::EEtoPSAssociation
EEtoPS_
 
const EcalRecHitCollectionendcapRecHits_
 
edm::ESGetToken
< ESChannelStatus,
ESChannelStatusRcd
esChannelStatusToken_
 
edm::ESGetToken
< ESEEIntercalibConstants,
ESEEIntercalibConstantsRcd
esEEInterCalibToken_
 
double etawidthSuperClusterBarrel_
 
double etawidthSuperClusterEndcap_
 
double fractionForMajority_
 
edm::EDGetTokenT
< EcalRecHitCollection
inputTagBarrelRecHits_
 
edm::EDGetTokenT< reco::BeamSpotinputTagBeamSpot_
 
edm::EDGetTokenT
< EcalRecHitCollection
inputTagEndcapRecHits_
 
edm::EDGetTokenT< edm::View
< reco::PFCluster > > 
inputTagPFClusters_
 
edm::EDGetTokenT
< reco::PFCluster::EEtoPSAssociation
inputTagPFClustersES_
 
bool isOOTCollection_
 
const EcalMustacheSCParametersmustacheSCParams_
 
double phiwidthSuperClusterBarrel_
 
double phiwidthSuperClusterEndcap_
 
std::unique_ptr
< SCEnergyCorrectorSemiParm
regr_
 
double satelliteThreshold_
 
const EcalSCDynamicDPhiParametersscDynamicDPhiParams_
 
std::unique_ptr
< reco::SuperClusterCollection
superClustersEB_
 
std::unique_ptr
< reco::SuperClusterCollection
superClustersEE_
 
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 51 of file PFECALSuperClusterAlgo.h.

Member Typedef Documentation

Definition at line 71 of file PFECALSuperClusterAlgo.h.

Definition at line 72 of file PFECALSuperClusterAlgo.h.

Member Enumeration Documentation

Enumerator
kBOX 
kMustache 

Definition at line 53 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 254 of file PFECALSuperClusterAlgo.cc.

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

Referenced by run().

254  {
255  auto seedable = std::bind(isSeed, _1, seedthresh, threshIsET_);
256  // make sure only seeds appear at the front of the list of clusters
257  std::stable_partition(clusters.begin(), clusters.end(), seedable);
258  // in each iteration we are working on a list that is already sorted
259  // in the cluster energy and remains so through each iteration
260  // NB: since clusters is sorted in loadClusters any_of has O(1)
261  // timing until you run out of seeds!
262  while (std::any_of(clusters.cbegin(), clusters.cend(), seedable)) {
264  }
265 }
void buildSuperCluster(CalibratedClusterPtr &, CalibratedClusterPtrVector &)
void PFECALSuperClusterAlgo::buildSuperCluster ( CalibratedClusterPtr ,
CalibratedClusterPtrVector  
)
private

Definition at line 267 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::CaloCluster::energy(), etawidthSuperClusterBarrel_, etawidthSuperClusterEndcap_, Exception, spr::find(), edm::SortedCollection< T, SORT >::find(), fractionForMajority_, edm::Ptr< T >::get(), PFLayer::HGCAL, isOOTCollection_, kCalibratedNoPS, kCalibratedTotal, EcalRecHit::kOutOfTime, kRaw, mustacheSCParams_, PFClusterWidthAlgo::pflowEtaWidth(), PFClusterWidthAlgo::pflowPhiWidth(), phiwidthSuperClusterBarrel_, phiwidthSuperClusterEndcap_, reco::BeamSpot::position(), reco::CaloCluster::position(), reco::SuperCluster::preshowerClustersBegin(), reco::SuperCluster::preshowerClustersEnd(), ptFast(), reco::SuperCluster::rawEnergy(), regr_, satelliteThreshold_, scDynamicDPhiParams_, 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().

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

References superClustersEB_.

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

Definition at line 117 of file PFECALSuperClusterAlgo.h.

References superClustersEE_.

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

Definition at line 167 of file PFECALSuperClusterAlgo.cc.

References _clustersEB, _clustersEE, barrelRecHits_, beamSpot_, HLT_FULL_cff::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_.

167  {
168  //load input collections
169  //Load the pfcluster collections
170  edm::Handle<edm::View<reco::PFCluster> > pfclustersHandle;
171  iEvent.getByToken(inputTagPFClusters_, pfclustersHandle);
172 
174  iEvent.getByToken(inputTagPFClustersES_, psAssociationHandle);
175 
176  const PFClusterView& clusters = *pfclustersHandle.product();
177  const reco::PFCluster::EEtoPSAssociation& psclusters = *psAssociationHandle.product();
178 
179  //load BeamSpot
181  iEvent.getByToken(inputTagBeamSpot_, bsHandle);
182  beamSpot_ = bsHandle.product();
183 
184  //initialize regression for this event
185  if (useRegression_) {
186  regr_->setEvent(iEvent);
187  }
188 
189  // reset the system for running
190  superClustersEB_ = std::make_unique<reco::SuperClusterCollection>();
191  _clustersEB.clear();
192  superClustersEE_ = std::make_unique<reco::SuperClusterCollection>();
193  _clustersEE.clear();
194  EEtoPS_ = &psclusters;
195 
196  //Select PF clusters available for the clustering
197  for (size_t i = 0; i < clusters.size(); ++i) {
198  auto cluster = clusters.ptrAt(i);
199  LogDebug("PFClustering") << "Loading PFCluster i=" << cluster.key() << " energy=" << cluster->energy() << std::endl;
200 
201  // protection for sim clusters
202  if (cluster->caloID().detectors() == 0 && cluster->hitsAndFractions().empty())
203  continue;
204 
205  CalibratedClusterPtr calib_cluster(new CalibratedPFCluster(cluster));
206  switch (cluster->layer()) {
208  if (calib_cluster->energy() > threshPFClusterBarrel_) {
209  _clustersEB.push_back(calib_cluster);
210  }
211  break;
212  case PFLayer::HGCAL:
214  if (calib_cluster->energy() > threshPFClusterEndcap_) {
215  _clustersEE.push_back(calib_cluster);
216  }
217  break;
218  default:
219  break;
220  }
221  }
222  // sort full cluster collections by their calibrated energy
223  // this will put all the seeds first by construction
224  std::sort(_clustersEB.begin(), _clustersEB.end(), greaterByEt);
225  std::sort(_clustersEE.begin(), _clustersEE.end(), greaterByEt);
226 
227  // set recHit collections for OOT photons
228  if (isOOTCollection_) {
229  edm::Handle<EcalRecHitCollection> barrelRecHitsHandle;
230  iEvent.getByToken(inputTagBarrelRecHits_, barrelRecHitsHandle);
231  if (!barrelRecHitsHandle.isValid()) {
232  throw cms::Exception("PFECALSuperClusterAlgo")
233  << "If you use OOT photons, need to specify proper barrel rec hit collection";
234  }
235  barrelRecHits_ = barrelRecHitsHandle.product();
236 
237  edm::Handle<EcalRecHitCollection> endcapRecHitsHandle;
238  iEvent.getByToken(inputTagEndcapRecHits_, endcapRecHitsHandle);
239  if (!endcapRecHitsHandle.isValid()) {
240  throw cms::Exception("PFECALSuperClusterAlgo")
241  << "If you use OOT photons, need to specify proper endcap rec hit collection";
242  }
243  endcapRecHits_ = endcapRecHitsHandle.product();
244  }
245 }
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:44
T const * product() const
Definition: Handle.h:70
edm::EDGetTokenT< reco::BeamSpot > inputTagBeamSpot_
const EcalRecHitCollection * barrelRecHits_
CalibratedClusterPtrVector _clustersEB
const EcalRecHitCollection * endcapRecHits_
#define LogDebug(id)
void PFECALSuperClusterAlgo::run ( )

Definition at line 247 of file PFECALSuperClusterAlgo.cc.

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

247  {
248  // clusterize the EB
250  // clusterize the EE
252 }
void buildAllSuperClusters(CalibratedClusterPtrVector &, double seedthresh)
CalibratedClusterPtrVector _clustersEE
CalibratedClusterPtrVector _clustersEB
void PFECALSuperClusterAlgo::setClusteringType ( clustering_type  thetype)
inline

Definition at line 79 of file PFECALSuperClusterAlgo.h.

References _clustype.

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

Definition at line 106 of file PFECALSuperClusterAlgo.h.

References ztail::d, and dropUnseedable_.

106 { dropUnseedable_ = d; }
tuple d
Definition: ztail.py:151
void PFECALSuperClusterAlgo::setEnergyWeighting ( energy_weight  thetype)
inline

Definition at line 81 of file PFECALSuperClusterAlgo.h.

References _eweight.

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

Definition at line 97 of file PFECALSuperClusterAlgo.h.

References etawidthSuperClusterBarrel_.

void PFECALSuperClusterAlgo::setEtawidthSuperClusterEndcap ( double  etawidth)
inline

Definition at line 99 of file PFECALSuperClusterAlgo.h.

References etawidthSuperClusterEndcap_.

void PFECALSuperClusterAlgo::setIsOOTCollection ( bool  isOOTCollection)
inline
void PFECALSuperClusterAlgo::setMajorityFraction ( const double  f)
inline
void PFECALSuperClusterAlgo::setPFClusterCalibration ( const std::shared_ptr< PFEnergyCalibration > &  calib)

Definition at line 112 of file PFECALSuperClusterAlgo.cc.

References _pfEnergyCalibration.

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

Definition at line 96 of file PFECALSuperClusterAlgo.h.

References phiwidthSuperClusterBarrel_.

void PFECALSuperClusterAlgo::setPhiwidthSuperClusterEndcap ( double  phiwidth)
inline

Definition at line 98 of file PFECALSuperClusterAlgo.h.

References phiwidthSuperClusterEndcap_.

void PFECALSuperClusterAlgo::setSatelliteMerging ( const bool  doit)
inline

Definition at line 103 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 _clustype, edm::BeginLuminosityBlock, ecalMustacheSCParametersToken_, ecalSCDynamicDPhiParametersToken_, esChannelStatusToken_, esEEInterCalibToken_, edm::ParameterSet::getParameter(), inputTagBarrelRecHits_, inputTagBeamSpot_, inputTagEndcapRecHits_, inputTagPFClusters_, inputTagPFClustersES_, isOOTCollection_, kMustache, regr_, useDynamicDPhi_, and useRegression_.

116  {
121 
125 
128  }
129  if (useDynamicDPhi_) {
131  }
132 
133  if (useRegression_) {
134  const edm::ParameterSet& regconf = iConfig.getParameter<edm::ParameterSet>("regressionConfig");
135 
136  regr_ = std::make_unique<SCEnergyCorrectorSemiParm>();
137  regr_->setTokens(regconf, cc);
138  }
139 
140  if (isOOTCollection_) { // OOT photons only
143  }
144 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< edm::View< reco::PFCluster > > inputTagPFClusters_
std::unique_ptr< SCEnergyCorrectorSemiParm > regr_
edm::EDGetTokenT< EcalRecHitCollection > inputTagBarrelRecHits_
edm::ESGetToken< ESEEIntercalibConstants, ESEEIntercalibConstantsRcd > esEEInterCalibToken_
edm::EDGetTokenT< EcalRecHitCollection > inputTagEndcapRecHits_
ESChannelStatusMap ESChannelStatus
edm::ESGetToken< ESChannelStatus, ESChannelStatusRcd > esChannelStatusToken_
edm::ESGetToken< EcalSCDynamicDPhiParameters, EcalSCDynamicDPhiParametersRcd > ecalSCDynamicDPhiParametersToken_
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_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESGetToken< EcalMustacheSCParameters, EcalMustacheSCParametersRcd > ecalMustacheSCParametersToken_
void PFECALSuperClusterAlgo::setUseDynamicDPhi ( bool  useit)
inline

Definition at line 85 of file PFECALSuperClusterAlgo.h.

References useDynamicDPhi_.

void PFECALSuperClusterAlgo::setUseETForSeeding ( bool  useET)
inline

Definition at line 83 of file PFECALSuperClusterAlgo.h.

References threshIsET_.

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

Definition at line 77 of file PFECALSuperClusterAlgo.h.

References verbose, and verbose_.

77 { verbose_ = verbose; }
static constexpr int verbose
void PFECALSuperClusterAlgo::update ( const edm::EventSetup setup)

Definition at line 146 of file PFECALSuperClusterAlgo.cc.

References _pfEnergyCalibration, channelStatus_, esChannelStatusToken_, esEEInterCalibToken_, edm::EventSetup::getHandle(), edm::ESHandle< class >::product(), regr_, and useRegression_.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

146  {
147  if (useRegression_) {
148  regr_->setEventSetup(setup);
149  }
150 
152  _pfEnergyCalibration->initAlphaGamma_ESplanes_fromDB(esEEInterCalibHandle_.product());
153 
154  edm::ESHandle<ESChannelStatus> esChannelStatusHandle_ = setup.getHandle(esChannelStatusToken_);
155  channelStatus_ = esChannelStatusHandle_.product();
156 }
const ESChannelStatus * channelStatus_
std::unique_ptr< SCEnergyCorrectorSemiParm > regr_
edm::ESGetToken< ESEEIntercalibConstants, ESEEIntercalibConstantsRcd > esEEInterCalibToken_
std::shared_ptr< PFEnergyCalibration > _pfEnergyCalibration
edm::ESGetToken< ESChannelStatus, ESChannelStatusRcd > esChannelStatusToken_
T const * product() const
Definition: ESHandle.h:86
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
void PFECALSuperClusterAlgo::updateSCParams ( const edm::EventSetup setup)

Definition at line 158 of file PFECALSuperClusterAlgo.cc.

References _clustype, ecalMustacheSCParametersToken_, ecalSCDynamicDPhiParametersToken_, edm::EventSetup::getData(), kMustache, mustacheSCParams_, scDynamicDPhiParams_, and useDynamicDPhi_.

158  {
161  }
162  if (useDynamicDPhi_) {
164  }
165 }
const EcalMustacheSCParameters * mustacheSCParams_
const EcalSCDynamicDPhiParameters * scDynamicDPhiParams_
bool getData(T &iHolder) const
Definition: EventSetup.h:122
edm::ESGetToken< EcalSCDynamicDPhiParameters, EcalSCDynamicDPhiParametersRcd > ecalSCDynamicDPhiParametersToken_
edm::ESGetToken< EcalMustacheSCParameters, EcalMustacheSCParametersRcd > ecalMustacheSCParametersToken_

Member Data Documentation

CalibratedClusterPtrVector PFECALSuperClusterAlgo::_clustersEB
private

Definition at line 138 of file PFECALSuperClusterAlgo.h.

Referenced by loadAndSortPFClusters(), and run().

CalibratedClusterPtrVector PFECALSuperClusterAlgo::_clustersEE
private

Definition at line 139 of file PFECALSuperClusterAlgo.h.

Referenced by loadAndSortPFClusters(), and run().

clustering_type PFECALSuperClusterAlgo::_clustype
private
energy_weight PFECALSuperClusterAlgo::_eweight
private

Definition at line 145 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setEnergyWeighting().

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

Definition at line 143 of file PFECALSuperClusterAlgo.h.

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

bool PFECALSuperClusterAlgo::applyCrackCorrections_
private

Definition at line 173 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setCrackCorrections().

const EcalRecHitCollection* PFECALSuperClusterAlgo::barrelRecHits_
private

Definition at line 180 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and loadAndSortPFClusters().

const reco::BeamSpot* PFECALSuperClusterAlgo::beamSpot_
private

Definition at line 133 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and loadAndSortPFClusters().

const ESChannelStatus* PFECALSuperClusterAlgo::channelStatus_
private

Definition at line 134 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and update().

bool PFECALSuperClusterAlgo::doSatelliteClusterMerge_
private

Definition at line 167 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setSatelliteMerging().

bool PFECALSuperClusterAlgo::dropUnseedable_
private

Definition at line 169 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setDropUnseedable().

edm::ESGetToken<EcalMustacheSCParameters, EcalMustacheSCParametersRcd> PFECALSuperClusterAlgo::ecalMustacheSCParametersToken_
private

Definition at line 130 of file PFECALSuperClusterAlgo.h.

Referenced by setTokens(), and updateSCParams().

edm::ESGetToken<EcalSCDynamicDPhiParameters, EcalSCDynamicDPhiParametersRcd> PFECALSuperClusterAlgo::ecalSCDynamicDPhiParametersToken_
private

Definition at line 131 of file PFECALSuperClusterAlgo.h.

Referenced by setTokens(), and updateSCParams().

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

Definition at line 142 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and loadAndSortPFClusters().

const EcalRecHitCollection* PFECALSuperClusterAlgo::endcapRecHits_
private

Definition at line 181 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and loadAndSortPFClusters().

edm::ESGetToken<ESChannelStatus, ESChannelStatusRcd> PFECALSuperClusterAlgo::esChannelStatusToken_
private

Definition at line 129 of file PFECALSuperClusterAlgo.h.

Referenced by setTokens(), and update().

edm::ESGetToken<ESEEIntercalibConstants, ESEEIntercalibConstantsRcd> PFECALSuperClusterAlgo::esEEInterCalibToken_
private

Definition at line 128 of file PFECALSuperClusterAlgo.h.

Referenced by setTokens(), and update().

double PFECALSuperClusterAlgo::etawidthSuperClusterBarrel_
private

Definition at line 163 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setEtawidthSuperClusterBarrel().

double PFECALSuperClusterAlgo::etawidthSuperClusterEndcap_
private

Definition at line 165 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setEtawidthSuperClusterEndcap().

double PFECALSuperClusterAlgo::fractionForMajority_
private

Definition at line 168 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setMajorityFraction().

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

Definition at line 178 of file PFECALSuperClusterAlgo.h.

Referenced by loadAndSortPFClusters(), and setTokens().

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

Definition at line 126 of file PFECALSuperClusterAlgo.h.

Referenced by loadAndSortPFClusters(), and setTokens().

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

Definition at line 179 of file PFECALSuperClusterAlgo.h.

Referenced by loadAndSortPFClusters(), and setTokens().

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

Definition at line 124 of file PFECALSuperClusterAlgo.h.

Referenced by loadAndSortPFClusters(), and setTokens().

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

Definition at line 125 of file PFECALSuperClusterAlgo.h.

Referenced by loadAndSortPFClusters(), and setTokens().

bool PFECALSuperClusterAlgo::isOOTCollection_
private
const EcalMustacheSCParameters* PFECALSuperClusterAlgo::mustacheSCParams_
private

Definition at line 135 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and updateSCParams().

double PFECALSuperClusterAlgo::phiwidthSuperClusterBarrel_
private

Definition at line 162 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setPhiwidthSuperClusterBarrel().

double PFECALSuperClusterAlgo::phiwidthSuperClusterEndcap_
private

Definition at line 164 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setPhiwidthSuperClusterEndcap().

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

Definition at line 168 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setSatelliteThreshold().

const EcalSCDynamicDPhiParameters* PFECALSuperClusterAlgo::scDynamicDPhiParams_
private

Definition at line 136 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and updateSCParams().

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

Definition at line 174 of file PFECALSuperClusterAlgo.h.

Referenced by buildAllSuperClusters(), and setUseETForSeeding().

double PFECALSuperClusterAlgo::threshPFClusterBarrel_
private

Definition at line 158 of file PFECALSuperClusterAlgo.h.

Referenced by loadAndSortPFClusters(), and setThreshPFClusterBarrel().

double PFECALSuperClusterAlgo::threshPFClusterEndcap_
private

Definition at line 160 of file PFECALSuperClusterAlgo.h.

Referenced by loadAndSortPFClusters(), and setThreshPFClusterEndcap().

double PFECALSuperClusterAlgo::threshPFClusterSeedBarrel_
private

Definition at line 157 of file PFECALSuperClusterAlgo.h.

Referenced by run(), and setThreshPFClusterSeedBarrel().

double PFECALSuperClusterAlgo::threshPFClusterSeedEndcap_
private

Definition at line 159 of file PFECALSuperClusterAlgo.h.

Referenced by run(), and setThreshPFClusterSeedEndcap().

double PFECALSuperClusterAlgo::threshSuperClusterEt_
private

Definition at line 155 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setThreshSuperClusterEt().

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

Definition at line 149 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setVerbosityLevel().