CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/DataFormats/EgammaReco/src/SuperCluster.cc

Go to the documentation of this file.
00001 // $Id: SuperCluster.cc,v 1.16 2009/10/13 10:10:14 ferriff Exp $
00002 #include "DataFormats/EgammaReco/interface/BasicCluster.h"
00003 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
00004 using namespace reco;
00005 
00006 SuperCluster::SuperCluster( double energy, const math::XYZPoint& position ) :
00007   CaloCluster( energy, position ), preshowerEnergy_(0), rawEnergy_(-1.), phiWidth_(0), etaWidth_(0) {
00008 }
00009 
00010 
00011 
00012 SuperCluster::SuperCluster( double energy, const math::XYZPoint& position,
00013                             const CaloClusterPtr & seed,
00014                             const CaloClusterPtrVector& clusters,
00015                             double Epreshower, double phiWidth, double etaWidth) :
00016   CaloCluster(energy,position), rawEnergy_(-1.)
00017 {
00018   phiWidth_ = phiWidth;
00019   etaWidth_ = etaWidth;
00020   seed_ = seed;
00021   preshowerEnergy_ = Epreshower;
00022 
00023   // set references to constituent basic clusters and update list of rechits
00024   for(CaloClusterPtrVector::const_iterator bcit  = clusters.begin();
00025                                             bcit != clusters.end();
00026                                           ++bcit) {
00027     clusters_.push_back( (*bcit) );
00028 
00029     // updated list of used hits
00030     const std::vector< std::pair<DetId, float> > & v1 = (*bcit)->hitsAndFractions();
00031     for( std::vector< std::pair<DetId, float> >::const_iterator diIt = v1.begin();
00032                                             diIt != v1.end();
00033                                            ++diIt ) {
00034       hitsAndFractions_.push_back( (*diIt) );
00035     } // loop over rechits
00036   } // loop over basic clusters
00037 
00038 }
00039 
00040 
00041 
00042 SuperCluster::SuperCluster( double energy, const math::XYZPoint& position,
00043                             const CaloClusterPtr & seed,
00044                             const CaloClusterPtrVector& clusters,
00045                             const CaloClusterPtrVector& preshowerClusters,
00046                             double Epreshower, double phiWidth, double etaWidth) :
00047   CaloCluster(energy,position), rawEnergy_(-1.)
00048 {
00049   phiWidth_ = phiWidth;
00050   etaWidth_ = etaWidth;
00051   seed_ = seed;
00052   preshowerEnergy_ = Epreshower;
00053 
00054   // set references to constituent basic clusters and update list of rechits
00055   for(CaloClusterPtrVector::const_iterator bcit  = clusters.begin();
00056                                             bcit != clusters.end();
00057                                           ++bcit) {
00058     clusters_.push_back( (*bcit) );
00059 
00060     // updated list of used hits
00061     const std::vector< std::pair<DetId, float> > & v1 = (*bcit)->hitsAndFractions();
00062     for( std::vector< std::pair<DetId, float> >::const_iterator diIt = v1.begin();
00063                                             diIt != v1.end();
00064                                            ++diIt ) {
00065       hitsAndFractions_.push_back( (*diIt) );
00066     } // loop over rechits
00067   } // loop over basic clusters
00068 
00069   // set references to preshower clusters
00070   for(CaloClusterPtrVector::const_iterator pcit  = preshowerClusters.begin();
00071                                             pcit != preshowerClusters.end();
00072                                           ++pcit) {
00073     preshowerClusters_.push_back( (*pcit) );
00074   }
00075 }
00076 
00077 
00078 
00079 double SuperCluster::rawEnergy() const
00080 {
00081   if (rawEnergy_<0) {
00082     rawEnergy_ = 0.;
00083     for(CaloClusterPtrVector::const_iterator bcItr = clustersBegin(); bcItr != clustersEnd(); bcItr++)
00084       {
00085         rawEnergy_ += (*bcItr)->energy();
00086       }
00087   }
00088   return rawEnergy_;
00089 }