CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ( const EcalRecHitCollection hits,
const CaloSubdetectorGeometry geometry 
)

Definition at line 14 of file SuperClusterShapeAlgo.cc.

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

Member Function Documentation

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

Definition at line 18 of file SuperClusterShapeAlgo.cc.

References cuy::denominator, dPhi(), edm::SortedCollection< T, SORT >::end(), reco::CaloCluster::energy(), PV3DBase< T, PVType, FrameType >::eta(), etaWidth_, edm::SortedCollection< T, SORT >::find(), geometry_, CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), reco::CaloCluster::hitsAndFractions(), PV3DBase< T, PVType, FrameType >::phi(), phiWidth_, Geom::pi(), reco::CaloCluster::position(), position, recHits_, mathSSE::sqrt(), and Geom::twoPi().

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

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

Member Data Documentation

double SuperClusterShapeAlgo::etaWidth_
private

Definition at line 44 of file SuperClusterShapeAlgo.h.

Referenced by Calculate_Covariances(), and etaWidth().

const CaloSubdetectorGeometry* SuperClusterShapeAlgo::geometry_
private

Definition at line 42 of file SuperClusterShapeAlgo.h.

Referenced by Calculate_Covariances().

double SuperClusterShapeAlgo::phiWidth_
private

Definition at line 44 of file SuperClusterShapeAlgo.h.

Referenced by Calculate_Covariances(), and phiWidth().

const EcalRecHitCollection* SuperClusterShapeAlgo::recHits_
private

Definition at line 41 of file SuperClusterShapeAlgo.h.

Referenced by Calculate_Covariances().