CMS 3D CMS Logo

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

Go to the documentation of this file.
00001 // $Id: SuperCluster.cc,v 1.17 2011/02/17 22:42:03 argiro 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_(0), 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_(0)
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   computeRawEnergy();
00039 }
00040 
00041 
00042 
00043 SuperCluster::SuperCluster( double energy, const math::XYZPoint& position,
00044                             const CaloClusterPtr & seed,
00045                             const CaloClusterPtrVector& clusters,
00046                             const CaloClusterPtrVector& preshowerClusters,
00047                             double Epreshower, double phiWidth, double etaWidth) :
00048   CaloCluster(energy,position), rawEnergy_(-1.)
00049 {
00050   phiWidth_ = phiWidth;
00051   etaWidth_ = etaWidth;
00052   seed_ = seed;
00053   preshowerEnergy_ = Epreshower;
00054 
00055   // set references to constituent basic clusters and update list of rechits
00056   for(CaloClusterPtrVector::const_iterator bcit  = clusters.begin();
00057                                             bcit != clusters.end();
00058                                           ++bcit) {
00059     clusters_.push_back( (*bcit) );
00060 
00061     // updated list of used hits
00062     const std::vector< std::pair<DetId, float> > & v1 = (*bcit)->hitsAndFractions();
00063     for( std::vector< std::pair<DetId, float> >::const_iterator diIt = v1.begin();
00064                                             diIt != v1.end();
00065                                            ++diIt ) {
00066       hitsAndFractions_.push_back( (*diIt) );
00067     } // loop over rechits
00068   } // loop over basic clusters
00069 
00070   // set references to preshower clusters
00071   for(CaloClusterPtrVector::const_iterator pcit  = preshowerClusters.begin();
00072                                             pcit != preshowerClusters.end();
00073                                           ++pcit) {
00074     preshowerClusters_.push_back( (*pcit) );
00075   }
00076   computeRawEnergy();
00077 }
00078 
00079 
00080 
00081 void SuperCluster::computeRawEnergy() {
00082 
00083   rawEnergy_ = 0.;
00084   for(CaloClusterPtrVector::const_iterator bcItr = clustersBegin(); 
00085       bcItr != clustersEnd(); bcItr++){
00086       rawEnergy_ += (*bcItr)->energy();
00087   }
00088 }