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 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 setThreshPFClusterES (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 setUsePS (bool useit)
 
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 _useDynamicDPhi
 
bool applyCrackCorrections_
 
const EcalRecHitCollectionbarrelRecHits_
 
const reco::BeamSpotbeamSpot_
 
const ESChannelStatuschannelStatus_
 
bool doSatelliteClusterMerge_
 
const reco::PFCluster::EEtoPSAssociationEEtoPS_
 
const EcalRecHitCollectionendcapRecHits_
 
double etawidthSuperCluster_
 
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 phiwidthSuperCluster_
 
double phiwidthSuperClusterBarrel_
 
double phiwidthSuperClusterEndcap_
 
std::unique_ptr< SCEnergyCorrectorSemiParmregr_
 
double satelliteThreshold_
 
std::unique_ptr< reco::SuperClusterCollectionsuperClustersEB_
 
std::unique_ptr< reco::SuperClusterCollectionsuperClustersEE_
 
bool threshIsET_
 
double threshPFCluster_
 
double threshPFClusterBarrel_
 
double threshPFClusterEndcap_
 
double threshPFClusterES_
 
double threshPFClusterSeed_
 
double threshPFClusterSeedBarrel_
 
double threshPFClusterSeedEndcap_
 
double threshSuperClusterEt_
 
bool usePS
 
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 52 of file PFECALSuperClusterAlgo.h.

Member Typedef Documentation

Definition at line 72 of file PFECALSuperClusterAlgo.h.

Definition at line 73 of file PFECALSuperClusterAlgo.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

PFECALSuperClusterAlgo::PFECALSuperClusterAlgo ( )

constructor

Definition at line 175 of file PFECALSuperClusterAlgo.cc.

References setPFClusterCalibration().

175 : beamSpot_(0) { }
const reco::BeamSpot * beamSpot_

Member Function Documentation

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

Definition at line 318 of file PFECALSuperClusterAlgo.cc.

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

Referenced by run().

319  {
320  IsASeed seedable(seedthresh,threshIsET_);
321  // make sure only seeds appear at the front of the list of clusters
322  std::stable_partition(clusters.begin(),clusters.end(),seedable);
323  // in each iteration we are working on a list that is already sorted
324  // in the cluster energy and remains so through each iteration
325  // NB: since clusters is sorted in loadClusters any_of has O(1)
326  // timing until you run out of seeds!
327  while( std::any_of(clusters.cbegin(), clusters.cend(), seedable) ) {
329  }
330 }
void buildSuperCluster(CalibratedClusterPtr &, CalibratedClusterPtrVector &)
void PFECALSuperClusterAlgo::buildSuperCluster ( CalibratedClusterPtr ,
CalibratedClusterPtrVector  
)
private

Definition at line 333 of file PFECALSuperClusterAlgo.cc.

References _clustype, _eweight, _pfEnergyCalibration, _useDynamicDPhi, reco::SuperCluster::addCluster(), reco::CaloCluster::addHitAndFraction(), reco::SuperCluster::addPreshowerCluster(), applyCrackCorrections_, barrelRecHits_, beamSpot_, channelStatus_, TauDecayModes::dec, doSatelliteClusterMerge_, PFLayer::ECAL_BARREL, PFLayer::ECAL_ENDCAP, EEtoPS_, endcapRecHits_, reco::PFCluster::energy(), reco::CaloCluster::energy(), etawidthSuperClusterBarrel_, etawidthSuperClusterEndcap_, Exception, ESCondObjectContainer< T >::find(), spr::find(), edm::SortedCollection< T, SORT >::find(), fractionForMajority_, edm::Ptr< T >::get(), ESCondObjectContainer< T >::getMap(), PFLayer::HGCAL, 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_, useRegression_, and verbose_.

Referenced by buildAllSuperClusters().

334  {
335  IsClustered IsClusteredWithSeed(seed,_clustype,_useDynamicDPhi);
336  IsLinkedByRecHit MatchesSeedByRecHit(seed,satelliteThreshold_,
337  fractionForMajority_,0.1,0.2);
338  bool isEE = false;
339  SumPSEnergy sumps1(PFLayer::PS1), sumps2(PFLayer::PS2);
340  switch( seed->the_ptr()->layer() ) {
342  IsClusteredWithSeed.phiwidthSuperCluster_ = phiwidthSuperClusterBarrel_;
343  IsClusteredWithSeed.etawidthSuperCluster_ = etawidthSuperClusterBarrel_;
344  edm::LogInfo("PFClustering") << "Building SC number "
345  << superClustersEB_->size() + 1
346  << " in the ECAL barrel!";
347  break;
348  case PFLayer::HGCAL:
349  case PFLayer::ECAL_ENDCAP:
350 
351  IsClusteredWithSeed.phiwidthSuperCluster_ = phiwidthSuperClusterEndcap_;
352  IsClusteredWithSeed.etawidthSuperCluster_ = etawidthSuperClusterEndcap_;
353  edm::LogInfo("PFClustering") << "Building SC number "
354  << superClustersEE_->size() + 1
355  << " in the ECAL endcap!" << std::endl;
356  isEE = true;
357  break;
358  default:
359  break;
360  }
361 
362  // this function shuffles the list of clusters into a list
363  // where all clustered sub-clusters are at the front
364  // and returns a pointer to the first unclustered cluster.
365  // The relative ordering of clusters is preserved
366  // (i.e. both resulting sub-lists are sorted by energy).
367  auto not_clustered = std::stable_partition(clusters.begin(),clusters.end(),
368  IsClusteredWithSeed);
369  // satellite cluster merging
370  // it was found that large clusters can split!
371  if( doSatelliteClusterMerge_ ) {
372  not_clustered = std::stable_partition(not_clustered,clusters.end(),
373  MatchesSeedByRecHit);
374  }
375 
376  if(verbose_) {
377  edm::LogInfo("PFClustering") << "Dumping cluster detail";
378  edm::LogVerbatim("PFClustering")
379  << "\tPassed seed: e = " << seed->energy_nocalib()
380  << " eta = " << seed->eta() << " phi = " << seed->phi()
381  << std::endl;
382  for( auto clus = clusters.cbegin(); clus != not_clustered; ++clus ) {
383  edm::LogVerbatim("PFClustering")
384  << "\t\tClustered cluster: e = " << (*clus)->energy_nocalib()
385  << " eta = " << (*clus)->eta() << " phi = " << (*clus)->phi()
386  << std::endl;
387  }
388  for( auto clus = not_clustered; clus != clusters.end(); ++clus ) {
389  edm::LogVerbatim("PFClustering")
390  << "\tNon-Clustered cluster: e = " << (*clus)->energy_nocalib()
391  << " eta = " << (*clus)->eta() << " phi = " << (*clus)->phi()
392  << std::endl;
393  }
394  }
395  // move the clustered clusters out of available cluster list
396  // and into a temporary vector for building the SC
397  CalibratedClusterPtrVector clustered(clusters.begin(),not_clustered);
398  clusters.erase(clusters.begin(),not_clustered);
399  // need the vector of raw pointers for a PF width class
400  std::vector<const reco::PFCluster*> bare_ptrs;
401  // calculate necessary parameters and build the SC
402  double posX(0), posY(0), posZ(0),
403  corrSCEnergy(0), corrPS1Energy(0), corrPS2Energy(0),
404  ePS1(0), ePS2(0), energyweight(0), energyweighttot(0);
405  std::vector<double> ps1_energies, ps2_energies;
406  int condP1(1), condP2(1);
407  for( auto& clus : clustered ) {
408  ePS1 = ePS2 = 0;
409  energyweight = clus->energy_nocalib();
410  bare_ptrs.push_back(clus->the_ptr().get());
411  // update EE calibrated super cluster energies
412  if( isEE ) {
413  ePS1 = ePS2 = 0;
414  condP1 = condP2 = 1;
415  ps1_energies.clear();
416  ps2_energies.clear();
417  auto ee_key_val =
418  std::make_pair(clus->the_ptr().key(),edm::Ptr<reco::PFCluster>());
419  const auto clustops = std::equal_range(EEtoPS_->begin(),
420  EEtoPS_->end(),
421  ee_key_val,
422  sortByKey);
423  for( auto i_ps = clustops.first; i_ps != clustops.second; ++i_ps) {
424  edm::Ptr<reco::PFCluster> psclus(i_ps->second);
425 
426  auto const& recH_Frac = psclus->recHitFractions();
427 
428  switch( psclus->layer() ) {
429  case PFLayer::PS1:
430  ps1_energies.push_back(psclus->energy());
431  for (auto const& recH : recH_Frac){
432  ESDetId strip1 = recH.recHitRef()->detId();
433  if(strip1 != ESDetId(0)){
435  // getStatusCode() == 1 => dead channel
436  //apply correction if all recHits in dead region
437  if(status_p1->getStatusCode() == 0) condP1 = 0; //active
438  }
439  }
440  break;
441  case PFLayer::PS2:
442  ps2_energies.push_back(psclus->energy());
443  for (auto const& recH : recH_Frac){
444  ESDetId strip2 = recH.recHitRef()->detId();
445  if(strip2 != ESDetId(0)) {
447  if(status_p2->getStatusCode() == 0) condP2 = 0;
448  }
449  }
450  break;
451  default:
452  break;
453  }
454  }
455  if(condP1 == 1) ePS1 = -1.;
456  if(condP2 == 1) ePS2 = -1.;
457  _pfEnergyCalibration->energyEm(*(clus->the_ptr()),
458  ps1_energies,ps2_energies,
459  ePS1,ePS2,
461  }
462 
463  if(ePS1 == -1.) ePS1 = 0;
464  if(ePS2 == -1.) ePS2 = 0;
465 
466  switch( _eweight ) {
467  case kRaw: // energyweight is initialized to raw cluster energy
468  break;
469  case kCalibratedNoPS:
470  energyweight = clus->energy() - ePS1 - ePS2;
471  break;
472  case kCalibratedTotal:
473  energyweight = clus->energy();
474  break;
475  default:
476  break;
477  }
478  const math::XYZPoint& cluspos = clus->the_ptr()->position();
479  posX += energyweight * cluspos.X();
480  posY += energyweight * cluspos.Y();
481  posZ += energyweight * cluspos.Z();
482 
483  energyweighttot += energyweight;
484  corrSCEnergy += clus->energy();
485  corrPS1Energy += ePS1;
486  corrPS2Energy += ePS2;
487  }
488  posX /= energyweighttot;
489  posY /= energyweighttot;
490  posZ /= energyweighttot;
491 
492  // now build the supercluster
493  reco::SuperCluster new_sc(corrSCEnergy,math::XYZPoint(posX,posY,posZ));
494  new_sc.setCorrectedEnergy(corrSCEnergy);
495  new_sc.setSeed(clustered.front()->the_ptr());
496  new_sc.setPreshowerEnergy(corrPS1Energy+corrPS2Energy);
497  new_sc.setPreshowerEnergyPlane1(corrPS1Energy);
498  new_sc.setPreshowerEnergyPlane2(corrPS2Energy);
499  for( const auto& clus : clustered ) {
500  new_sc.addCluster(clus->the_ptr());
501 
502  auto& hits_and_fractions = clus->the_ptr()->hitsAndFractions();
503  for( auto& hit_and_fraction : hits_and_fractions ) {
504  new_sc.addHitAndFraction(hit_and_fraction.first,hit_and_fraction.second);
505  }
506  if( isEE ) {
507  auto ee_key_val =
508  std::make_pair(clus->the_ptr().key(),edm::Ptr<reco::PFCluster>());
509  const auto clustops = std::equal_range(EEtoPS_->begin(),
510  EEtoPS_->end(),
511  ee_key_val,
512  sortByKey);
513  // EE rechits should be uniquely matched to sets of pre-shower
514  // clusters at this point, so we throw an exception if otherwise
515  // now wrapped in EDM debug flags
516  for( auto i_ps = clustops.first; i_ps != clustops.second; ++i_ps) {
517  edm::Ptr<reco::PFCluster> psclus(i_ps->second);
518 #ifdef EDM_ML_DEBUG
519  auto found_pscluster = std::find(new_sc.preshowerClustersBegin(),
520  new_sc.preshowerClustersEnd(),
521  i_ps->second);
522  if( found_pscluster == new_sc.preshowerClustersEnd() ) {
523 #endif
524  new_sc.addPreshowerCluster(psclus);
525 #ifdef EDM_ML_DEBUG
526  } else {
527  throw cms::Exception("PFECALSuperClusterAlgo::buildSuperCluster")
528  << "Found a PS cluster matched to more than one EE cluster!"
529  << std::endl << std::hex << psclus.get() << " == "
530  << found_pscluster->get() << std::dec << std::endl;
531  }
532 #endif
533  }
534  }
535  }
536 
537  // calculate linearly weighted cluster widths
538  PFClusterWidthAlgo pfwidth(bare_ptrs);
539  new_sc.setEtaWidth(pfwidth.pflowEtaWidth());
540  new_sc.setPhiWidth(pfwidth.pflowPhiWidth());
541 
542  // cache the value of the raw energy
543  new_sc.rawEnergy();
544 
545  //apply regression energy corrections
546  if( useRegression_ ) {
547  regr_->modifyObject(new_sc);
548  }
549 
550  // save the super cluster to the appropriate list (if it passes the final
551  // Et threshold)
552  //Note that Et is computed here with respect to the beamspot position
553  //in order to be consistent with the cut applied in the
554  //ElectronSeedProducer
555  double scEtBS =
556  ptFast(new_sc.energy(),new_sc.position(),beamSpot_->position());
557 
558  if ( scEtBS > threshSuperClusterEt_ ) {
559  switch( seed->the_ptr()->layer() ) {
561  if(isOOTCollection_) {
562  DetId seedId = new_sc.seed()->seed();
564  if (!seedRecHit->checkFlag(EcalRecHit::kOutOfTime)) break;
565  }
566  superClustersEB_->push_back(new_sc);
567  break;
568  case PFLayer::HGCAL:
569  case PFLayer::ECAL_ENDCAP:
570  if(isOOTCollection_) {
571  DetId seedId = new_sc.seed()->seed();
573  if (!seedRecHit->checkFlag(EcalRecHit::kOutOfTime)) break;
574  }
575  superClustersEE_->push_back(new_sc);
576  break;
577  default:
578  break;
579  }
580  }
581 }
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_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
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:18
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:62
const EcalRecHitCollection * barrelRecHits_
const EcalRecHitCollection * endcapRecHits_
std::unique_ptr<reco::SuperClusterCollection>& PFECALSuperClusterAlgo::getEBOutputSCCollection ( )
inline

Definition at line 123 of file PFECALSuperClusterAlgo.h.

References superClustersEB_.

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

Definition at line 125 of file PFECALSuperClusterAlgo.h.

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

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

Definition at line 225 of file PFECALSuperClusterAlgo.cc.

References _clustersEB, _clustersEE, barrelRecHits_, beamSpot_, fastPrimaryVertexProducer_cfi::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(), and update().

225  {
226 
227  //load input collections
228  //Load the pfcluster collections
229  edm::Handle<edm::View<reco::PFCluster> > pfclustersHandle;
230  iEvent.getByToken( inputTagPFClusters_, pfclustersHandle );
231 
233  iEvent.getByToken( inputTagPFClustersES_, psAssociationHandle);
234 
235  const PFClusterView& clusters = *pfclustersHandle.product();
236  const reco::PFCluster::EEtoPSAssociation& psclusters = *psAssociationHandle.product();
237 
238  //load BeamSpot
240  iEvent.getByToken( inputTagBeamSpot_, bsHandle);
241  beamSpot_ = bsHandle.product();
242 
243  //initialize regression for this event
244  if (useRegression_) {
245  regr_->setEvent(iEvent);
246  }
247 
248  // reset the system for running
249  superClustersEB_ = std::make_unique<reco::SuperClusterCollection>();
250  _clustersEB.clear();
251  superClustersEE_ = std::make_unique<reco::SuperClusterCollection>();
252  _clustersEE.clear();
253  EEtoPS_ = &psclusters;
254 
255  //Select PF clusters available for the clustering
256  for ( size_t i = 0; i < clusters.size(); ++i ){
257  auto cluster = clusters.ptrAt(i);
258  LogDebug("PFClustering")
259  << "Loading PFCluster i="<<cluster.key()
260  <<" energy="<<cluster->energy()<<std::endl;
261 
262  // protection for sim clusters
263  if( cluster->caloID().detectors() == 0 &&
264  cluster->hitsAndFractions().size() == 0 ) continue;
265 
266  CalibratedClusterPtr calib_cluster(new CalibratedPFCluster(cluster));
267  switch( cluster->layer() ) {
269  if( calib_cluster->energy() > threshPFClusterBarrel_ ) {
270  _clustersEB.push_back(calib_cluster);
271  }
272  break;
273  case PFLayer::HGCAL:
274  case PFLayer::ECAL_ENDCAP:
275  if( calib_cluster->energy() > threshPFClusterEndcap_ ) {
276  _clustersEE.push_back(calib_cluster);
277  }
278  break;
279  default:
280  break;
281  }
282  }
283  // sort full cluster collections by their calibrated energy
284  // this will put all the seeds first by construction
285  GreaterByEt greater;
286  std::sort(_clustersEB.begin(), _clustersEB.end(), greater);
287  std::sort(_clustersEE.begin(), _clustersEE.end(), greater);
288 
289  // set recHit collections for OOT photons
290  if (isOOTCollection_)
291  {
292  edm::Handle<EcalRecHitCollection> barrelRecHitsHandle;
293  iEvent.getByToken(inputTagBarrelRecHits_, barrelRecHitsHandle);
294  if (!barrelRecHitsHandle.isValid()) {
295  throw cms::Exception("PFECALSuperClusterAlgo")
296  << "If you use OOT photons, need to specify proper barrel rec hit collection";
297  }
298  barrelRecHits_ = barrelRecHitsHandle.product();
299 
300  edm::Handle<EcalRecHitCollection> endcapRecHitsHandle;
301  iEvent.getByToken(inputTagEndcapRecHits_, endcapRecHitsHandle);
302  if (!endcapRecHitsHandle.isValid()) {
303  throw cms::Exception("PFECALSuperClusterAlgo")
304  << "If you use OOT photons, need to specify proper endcap rec hit collection";
305  }
306  endcapRecHits_ = endcapRecHitsHandle.product();
307  }
308 }
#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:230
std::vector< std::pair< CaloClusterPtr::key_type, edm::Ptr< PFCluster > > > EEtoPSAssociation
Definition: PFCluster.h:50
CalibratedClusterPtrVector _clustersEE
bool isValid() const
Definition: HandleBase.h:74
edm::EDGetTokenT< reco::PFCluster::EEtoPSAssociation > inputTagPFClustersES_
T const * product() const
Definition: Handle.h:81
edm::EDGetTokenT< reco::BeamSpot > inputTagBeamSpot_
const EcalRecHitCollection * barrelRecHits_
CalibratedClusterPtrVector _clustersEB
const EcalRecHitCollection * endcapRecHits_
void PFECALSuperClusterAlgo::run ( void  )

Definition at line 310 of file PFECALSuperClusterAlgo.cc.

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

Referenced by getEEOutputSCCollection().

310  {
311  // clusterize the EB
313  // clusterize the EE
315 }
void buildAllSuperClusters(CalibratedClusterPtrVector &, double seedthresh)
CalibratedClusterPtrVector _clustersEE
CalibratedClusterPtrVector _clustersEB
void PFECALSuperClusterAlgo::setClusteringType ( clustering_type  thetype)
inline

Definition at line 81 of file PFECALSuperClusterAlgo.h.

References _clustype.

81 { _clustype = thetype; }
void PFECALSuperClusterAlgo::setCrackCorrections ( bool  applyCrackCorrections)
inline
void PFECALSuperClusterAlgo::setEnergyWeighting ( energy_weight  thetype)
inline

Definition at line 83 of file PFECALSuperClusterAlgo.h.

References _eweight.

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

Definition at line 99 of file PFECALSuperClusterAlgo.h.

References etawidthSuperClusterBarrel_.

void PFECALSuperClusterAlgo::setEtawidthSuperClusterEndcap ( double  etawidth)
inline

Definition at line 101 of file PFECALSuperClusterAlgo.h.

References etawidthSuperClusterEndcap_.

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

Definition at line 110 of file PFECALSuperClusterAlgo.h.

References f, and fractionForMajority_.

110 { fractionForMajority_ = f; }
double f[11][100]
void PFECALSuperClusterAlgo::setPFClusterCalibration ( const std::shared_ptr< PFEnergyCalibration > &  calib)

Definition at line 178 of file PFECALSuperClusterAlgo.cc.

References _pfEnergyCalibration, and calib.

Referenced by PFECALSuperClusterAlgo(), and setUsePS().

178  {
180 }
MVATrainerComputer * calib
Definition: MVATrainer.cc:64
std::shared_ptr< PFEnergyCalibration > _pfEnergyCalibration
void PFECALSuperClusterAlgo::setPhiwidthSuperClusterBarrel ( double  phiwidth)
inline

Definition at line 98 of file PFECALSuperClusterAlgo.h.

References phiwidthSuperClusterBarrel_.

void PFECALSuperClusterAlgo::setPhiwidthSuperClusterEndcap ( double  phiwidth)
inline

Definition at line 100 of file PFECALSuperClusterAlgo.h.

References phiwidthSuperClusterEndcap_.

void PFECALSuperClusterAlgo::setSatelliteMerging ( const bool  doit)
inline

Definition at line 108 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::setThreshPFClusterES ( 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 182 of file PFECALSuperClusterAlgo.cc.

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

Referenced by setCrackCorrections().

182  {
183 
185  cc.consumes<edm::View<reco::PFCluster> >(iConfig.getParameter<edm::InputTag>("PFClusters"));
189  cc.consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("BeamSpot"));
190 
191  if (useRegression_) {
192  const edm::ParameterSet &regconf = iConfig.getParameter<edm::ParameterSet>("regressionConfig");
193 
194  regr_.reset(new SCEnergyCorrectorSemiParm());
195  regr_->setTokens(regconf, cc);
196  }
197 
198  if (isOOTCollection_) { // OOT photons only
200  cc.consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("barrelRecHits"));
202  cc.consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("endcapRecHits"));
203  }
204 }
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_
std::vector< std::pair< CaloClusterPtr::key_type, edm::Ptr< PFCluster > > > EEtoPSAssociation
Definition: PFCluster.h:50
edm::EDGetTokenT< reco::PFCluster::EEtoPSAssociation > inputTagPFClustersES_
edm::EDGetTokenT< reco::BeamSpot > inputTagBeamSpot_
void PFECALSuperClusterAlgo::setUseDynamicDPhi ( bool  useit)
inline

Definition at line 87 of file PFECALSuperClusterAlgo.h.

References _useDynamicDPhi.

void PFECALSuperClusterAlgo::setUseETForSeeding ( bool  useET)
inline

Definition at line 85 of file PFECALSuperClusterAlgo.h.

References threshIsET_.

void PFECALSuperClusterAlgo::setUsePS ( bool  useit)
inline

Definition at line 102 of file PFECALSuperClusterAlgo.h.

References setPFClusterCalibration(), and usePS.

102 { usePS = useit; }
void PFECALSuperClusterAlgo::setUseRegression ( bool  useRegression)
inline
void PFECALSuperClusterAlgo::setVerbosityLevel ( bool  verbose)
inline

Definition at line 79 of file PFECALSuperClusterAlgo.h.

References verbose, and verbose_.

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

Definition at line 206 of file PFECALSuperClusterAlgo.cc.

References _pfEnergyCalibration, channelStatus_, edm::EventSetup::get(), loadAndSortPFClusters(), 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().

206  {
207 
208  if (useRegression_) {
209  regr_->setEventSetup(setup);
210  }
211 
212  edm::ESHandle<ESEEIntercalibConstants> esEEInterCalibHandle_;
213  setup.get<ESEEIntercalibConstantsRcd>().get(esEEInterCalibHandle_);
214  _pfEnergyCalibration->initAlphaGamma_ESplanes_fromDB(esEEInterCalibHandle_.product());
215 
216  edm::ESHandle<ESChannelStatus> esChannelStatusHandle_;
217  setup.get<ESChannelStatusRcd>().get(esChannelStatusHandle_);
218  channelStatus_ = esChannelStatusHandle_.product();
219 
220 }
const ESChannelStatus * channelStatus_
std::unique_ptr< SCEnergyCorrectorSemiParm > regr_
std::shared_ptr< PFEnergyCalibration > _pfEnergyCalibration
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86

Member Data Documentation

CalibratedClusterPtrVector PFECALSuperClusterAlgo::_clustersEB
private

Definition at line 140 of file PFECALSuperClusterAlgo.h.

Referenced by loadAndSortPFClusters(), and run().

CalibratedClusterPtrVector PFECALSuperClusterAlgo::_clustersEE
private

Definition at line 141 of file PFECALSuperClusterAlgo.h.

Referenced by loadAndSortPFClusters(), and run().

clustering_type PFECALSuperClusterAlgo::_clustype
private

Definition at line 146 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setClusteringType().

energy_weight PFECALSuperClusterAlgo::_eweight
private

Definition at line 147 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setEnergyWeighting().

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

Definition at line 145 of file PFECALSuperClusterAlgo.h.

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

bool PFECALSuperClusterAlgo::_useDynamicDPhi
private

Definition at line 180 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setUseDynamicDPhi().

bool PFECALSuperClusterAlgo::applyCrackCorrections_
private

Definition at line 182 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setCrackCorrections().

const EcalRecHitCollection* PFECALSuperClusterAlgo::barrelRecHits_
private

Definition at line 191 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and loadAndSortPFClusters().

const reco::BeamSpot* PFECALSuperClusterAlgo::beamSpot_
private

Definition at line 137 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and loadAndSortPFClusters().

const ESChannelStatus* PFECALSuperClusterAlgo::channelStatus_
private

Definition at line 138 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and update().

bool PFECALSuperClusterAlgo::doSatelliteClusterMerge_
private

Definition at line 177 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setSatelliteMerging().

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

Definition at line 144 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and loadAndSortPFClusters().

const EcalRecHitCollection* PFECALSuperClusterAlgo::endcapRecHits_
private

Definition at line 192 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and loadAndSortPFClusters().

double PFECALSuperClusterAlgo::etawidthSuperCluster_
private

Definition at line 163 of file PFECALSuperClusterAlgo.h.

double PFECALSuperClusterAlgo::etawidthSuperClusterBarrel_
private

Definition at line 173 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setEtawidthSuperClusterBarrel().

double PFECALSuperClusterAlgo::etawidthSuperClusterEndcap_
private

Definition at line 175 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setEtawidthSuperClusterEndcap().

double PFECALSuperClusterAlgo::fractionForMajority_
private

Definition at line 178 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setMajorityFraction().

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

Definition at line 189 of file PFECALSuperClusterAlgo.h.

Referenced by loadAndSortPFClusters(), and setTokens().

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

Definition at line 135 of file PFECALSuperClusterAlgo.h.

Referenced by loadAndSortPFClusters(), and setTokens().

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

Definition at line 190 of file PFECALSuperClusterAlgo.h.

Referenced by loadAndSortPFClusters(), and setTokens().

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

Definition at line 133 of file PFECALSuperClusterAlgo.h.

Referenced by loadAndSortPFClusters(), and setTokens().

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

Definition at line 134 of file PFECALSuperClusterAlgo.h.

Referenced by loadAndSortPFClusters(), and setTokens().

bool PFECALSuperClusterAlgo::isOOTCollection_
private
double PFECALSuperClusterAlgo::phiwidthSuperCluster_
private

Definition at line 164 of file PFECALSuperClusterAlgo.h.

double PFECALSuperClusterAlgo::phiwidthSuperClusterBarrel_
private

Definition at line 172 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setPhiwidthSuperClusterBarrel().

double PFECALSuperClusterAlgo::phiwidthSuperClusterEndcap_
private

Definition at line 174 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setPhiwidthSuperClusterEndcap().

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

Definition at line 178 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 183 of file PFECALSuperClusterAlgo.h.

Referenced by buildAllSuperClusters(), and setUseETForSeeding().

double PFECALSuperClusterAlgo::threshPFCluster_
private

Definition at line 162 of file PFECALSuperClusterAlgo.h.

double PFECALSuperClusterAlgo::threshPFClusterBarrel_
private

Definition at line 167 of file PFECALSuperClusterAlgo.h.

Referenced by loadAndSortPFClusters(), and setThreshPFClusterBarrel().

double PFECALSuperClusterAlgo::threshPFClusterEndcap_
private

Definition at line 169 of file PFECALSuperClusterAlgo.h.

Referenced by loadAndSortPFClusters(), and setThreshPFClusterEndcap().

double PFECALSuperClusterAlgo::threshPFClusterES_
private

Definition at line 170 of file PFECALSuperClusterAlgo.h.

Referenced by setThreshPFClusterES().

double PFECALSuperClusterAlgo::threshPFClusterSeed_
private

Definition at line 161 of file PFECALSuperClusterAlgo.h.

double PFECALSuperClusterAlgo::threshPFClusterSeedBarrel_
private

Definition at line 166 of file PFECALSuperClusterAlgo.h.

Referenced by run(), and setThreshPFClusterSeedBarrel().

double PFECALSuperClusterAlgo::threshPFClusterSeedEndcap_
private

Definition at line 168 of file PFECALSuperClusterAlgo.h.

Referenced by run(), and setThreshPFClusterSeedEndcap().

double PFECALSuperClusterAlgo::threshSuperClusterEt_
private

Definition at line 159 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setThreshSuperClusterEt().

bool PFECALSuperClusterAlgo::usePS
private

Definition at line 185 of file PFECALSuperClusterAlgo.h.

Referenced by setUsePS().

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

Definition at line 153 of file PFECALSuperClusterAlgo.h.

Referenced by buildSuperCluster(), and setVerbosityLevel().