CMS 3D CMS Logo

Public Member Functions | Private Attributes

SuperClusterShapeAlgo Class Reference

#include <SuperClusterShapeAlgo.h>

List of all members.

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.

                                                                                 : 
  recHits_(hits), geometry_(geo) { }

Member Function Documentation

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

Definition at line 18 of file SuperClusterShapeAlgo.cc.

References ExpressReco_HICollisions_FallBack::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 HiEgammaSCEnergyCorrectionAlgo::applyCorrection(), and EgammaSCEnergyCorrectionAlgo::applyCorrection().

{
  double numeratorEtaWidth = 0;
  double numeratorPhiWidth = 0;

  double scEnergy = passedCluster.energy();
  double denominator = scEnergy;

  double scEta    = passedCluster.position().eta();
  double scPhi    = passedCluster.position().phi();

  std::vector<std::pair<DetId,float> > detId = passedCluster.hitsAndFractions();
  // Loop over recHits associated with the given SuperCluster
  for(std::vector<std::pair<DetId,float> >::iterator hit = detId.begin();
      hit != detId.end(); ++hit) {
    EcalRecHitCollection::const_iterator rHit = recHits_->find((*hit).first);
 //FIXME: THIS IS JUST A WORKAROUND A FIX SHOULD BE APPLIED  
 if(rHit == recHits_->end()) {
    continue; 
   }
    const CaloCellGeometry *this_cell = geometry_->getGeometry(rHit->id());
    if ( this_cell == 0 ) {
      //edm::LogInfo("SuperClusterShapeAlgo") << "pointer to the cell in Calculate_Covariances is NULL!";
      continue;
    }
    GlobalPoint position = this_cell->getPosition();
    double energyHit = rHit->energy();
    
    //form differences
    double dPhi = position.phi() - scPhi;
    if (dPhi > + Geom::pi()) { dPhi = Geom::twoPi() - dPhi; }
    if (dPhi < - Geom::pi()) { dPhi = Geom::twoPi() + dPhi; }

    double dEta = position.eta() - scEta;

    if ( energyHit > 0 ) {
      numeratorEtaWidth += energyHit * dEta * dEta;
      numeratorPhiWidth += energyHit * dPhi * dPhi;
    }
      
    etaWidth_ = sqrt(numeratorEtaWidth / denominator);
    phiWidth_ = sqrt(numeratorPhiWidth / denominator);
  }
}
double SuperClusterShapeAlgo::etaWidth ( ) [inline]
double SuperClusterShapeAlgo::phiWidth ( ) [inline]

Member Data Documentation

Definition at line 45 of file SuperClusterShapeAlgo.h.

Referenced by Calculate_Covariances(), and etaWidth().

Definition at line 43 of file SuperClusterShapeAlgo.h.

Referenced by Calculate_Covariances().

Definition at line 45 of file SuperClusterShapeAlgo.h.

Referenced by Calculate_Covariances(), and phiWidth().

Definition at line 42 of file SuperClusterShapeAlgo.h.

Referenced by Calculate_Covariances().