CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
SuperClusterShapeAlgo Class Reference

#include <SuperClusterShapeAlgo.h>

Public Member Functions

void Calculate_Covariances (const reco::SuperCluster &passedCluster)
 
double etaWidth ()
 
double phiWidth ()
 
 SuperClusterShapeAlgo (const EcalRecHitCollection *hits, const CaloSubdetectorGeometry *geometry)
 

Private Attributes

double etaWidth_
 
const CaloSubdetectorGeometrygeometry_
 
double phiWidth_
 
const EcalRecHitCollectionrecHits_
 

Detailed Description

Definition at line 27 of file SuperClusterShapeAlgo.h.

Constructor & Destructor Documentation

◆ SuperClusterShapeAlgo()

SuperClusterShapeAlgo::SuperClusterShapeAlgo ( const EcalRecHitCollection hits,
const CaloSubdetectorGeometry geometry 
)

Definition at line 14 of file SuperClusterShapeAlgo.cc.

15  : recHits_(hits), geometry_(geo) {}
const CaloSubdetectorGeometry * geometry_
const EcalRecHitCollection * recHits_

Member Function Documentation

◆ Calculate_Covariances()

void SuperClusterShapeAlgo::Calculate_Covariances ( const reco::SuperCluster passedCluster)

Definition at line 17 of file SuperClusterShapeAlgo.cc.

References bTagMiniDQMDeepCSV::denominator, HLT_2024v14_cff::dEta, hcalRecHitTable_cff::detId, HLT_2024v14_cff::dPhi, edm::SortedCollection< T, SORT >::end(), reco::CaloCluster::energy(), etaWidth_, edm::SortedCollection< T, SORT >::find(), geometry_, CaloSubdetectorGeometry::getGeometry(), reco::CaloCluster::hitsAndFractions(), phiWidth_, Geom::pi(), reco::CaloCluster::position(), position, recHits_, mathSSE::sqrt(), Geom::twoPi(), and trackerHitRTTI::vector.

Referenced by EopElecTreeWriter::analyze(), EgammaSCEnergyCorrectionAlgo::applyCorrection(), HiEgammaSCEnergyCorrectionAlgo::applyCorrection(), and EcalClusterPUCleaningTools::CleanedSuperCluster().

17  {
18  double numeratorEtaWidth = 0;
19  double numeratorPhiWidth = 0;
20 
21  double scEnergy = passedCluster.energy();
22  double denominator = scEnergy;
23 
24  double scEta = passedCluster.position().eta();
25  double scPhi = passedCluster.position().phi();
26 
27  const std::vector<std::pair<DetId, float> >& detId = passedCluster.hitsAndFractions();
28  // Loop over recHits associated with the given SuperCluster
29  for (std::vector<std::pair<DetId, float> >::const_iterator hit = detId.begin(); hit != detId.end(); ++hit) {
31  //FIXME: THIS IS JUST A WORKAROUND A FIX SHOULD BE APPLIED
32  if (rHit == recHits_->end()) {
33  continue;
34  }
35  auto this_cell = geometry_->getGeometry(rHit->id());
36  if (this_cell == nullptr) {
37  //edm::LogInfo("SuperClusterShapeAlgo") << "pointer to the cell in Calculate_Covariances is NULL!";
38  continue;
39  }
40  GlobalPoint position = this_cell->getPosition();
41  //take into account energy fractions
42  double energyHit = rHit->energy() * hit->second;
43 
44  //form differences
45  double dPhi = position.phi() - scPhi;
46  if (dPhi > +Geom::pi()) {
47  dPhi = Geom::twoPi() - dPhi;
48  }
49  if (dPhi < -Geom::pi()) {
50  dPhi = Geom::twoPi() + dPhi;
51  }
52 
53  double dEta = position.eta() - scEta;
54 
55  if (energyHit > 0) {
56  numeratorEtaWidth += energyHit * dEta * dEta;
57  numeratorPhiWidth += energyHit * dPhi * dPhi;
58  }
59 
60  etaWidth_ = sqrt(numeratorEtaWidth / denominator);
61  phiWidth_ = sqrt(numeratorPhiWidth / denominator);
62  }
63 }
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:154
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:210
std::vector< EcalRecHit >::const_iterator const_iterator
const CaloSubdetectorGeometry * geometry_
T sqrt(T t)
Definition: SSEVec.h:23
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
const_iterator end() const
double energy() const
cluster energy
Definition: CaloCluster.h:149
const EcalRecHitCollection * recHits_
iterator find(key_type k)
static int position[264][3]
Definition: ReadPGInfo.cc:289
constexpr double pi()
Definition: Pi.h:31
constexpr double twoPi()
Definition: Pi.h:32

◆ etaWidth()

double SuperClusterShapeAlgo::etaWidth ( )
inline

◆ phiWidth()

double SuperClusterShapeAlgo::phiWidth ( )
inline

Member Data Documentation

◆ etaWidth_

double SuperClusterShapeAlgo::etaWidth_
private

Definition at line 40 of file SuperClusterShapeAlgo.h.

Referenced by Calculate_Covariances(), and etaWidth().

◆ geometry_

const CaloSubdetectorGeometry* SuperClusterShapeAlgo::geometry_
private

Definition at line 38 of file SuperClusterShapeAlgo.h.

Referenced by Calculate_Covariances().

◆ phiWidth_

double SuperClusterShapeAlgo::phiWidth_
private

Definition at line 40 of file SuperClusterShapeAlgo.h.

Referenced by Calculate_Covariances(), and phiWidth().

◆ recHits_

const EcalRecHitCollection* SuperClusterShapeAlgo::recHits_
private

Definition at line 37 of file SuperClusterShapeAlgo.h.

Referenced by Calculate_Covariances().