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 28 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 RecoTauValidation_cfi::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  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> >::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  double energyHit = rHit->energy();
45 
46  //form differences
47  double dPhi = position.phi() - scPhi;
48  if (dPhi > + Geom::pi()) { dPhi = Geom::twoPi() - dPhi; }
49  if (dPhi < - Geom::pi()) { dPhi = Geom::twoPi() + dPhi; }
50 
51  double dEta = position.eta() - scEta;
52 
53  if ( energyHit > 0 ) {
54  numeratorEtaWidth += energyHit * dEta * dEta;
55  numeratorPhiWidth += energyHit * dPhi * dPhi;
56  }
57 
58  etaWidth_ = sqrt(numeratorEtaWidth / denominator);
59  phiWidth_ = sqrt(numeratorPhiWidth / denominator);
60  }
61 }
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:123
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
std::vector< EcalRecHit >::const_iterator const_iterator
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:189
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
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.
double dPhi(double phi1, double phi2)
Definition: JetUtil.h:30
T sqrt(T t)
Definition: SSEVec.h:46
double energy() const
cluster energy
Definition: CaloCluster.h:120
const_iterator end() const
const EcalRecHitCollection * recHits_
T eta() const
Definition: PV3DBase.h:75
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
double SuperClusterShapeAlgo::etaWidth ( )
inline
double SuperClusterShapeAlgo::phiWidth ( )
inline

Member Data Documentation

double SuperClusterShapeAlgo::etaWidth_
private

Definition at line 45 of file SuperClusterShapeAlgo.h.

Referenced by Calculate_Covariances(), and etaWidth().

const CaloSubdetectorGeometry* SuperClusterShapeAlgo::geometry_
private

Definition at line 43 of file SuperClusterShapeAlgo.h.

Referenced by Calculate_Covariances().

double SuperClusterShapeAlgo::phiWidth_
private

Definition at line 45 of file SuperClusterShapeAlgo.h.

Referenced by Calculate_Covariances(), and phiWidth().

const EcalRecHitCollection* SuperClusterShapeAlgo::recHits_
private

Definition at line 42 of file SuperClusterShapeAlgo.h.

Referenced by Calculate_Covariances().