CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/DataFormats/EgammaReco/src/SuperCluster.cc

Go to the documentation of this file.
00001 // $Id: SuperCluster.cc,v 1.18 2012/10/22 20:23:27 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), preshowerEnergy1_(0), preshowerEnergy2_(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, double Epreshower1, double Epreshower2) :
00016   CaloCluster(energy,position), rawEnergy_(0)
00017 {
00018   phiWidth_ = phiWidth;
00019   etaWidth_ = etaWidth;
00020   seed_ = seed;
00021   preshowerEnergy_ = Epreshower;
00022   preshowerEnergy1_ = Epreshower1;
00023   preshowerEnergy2_ = Epreshower2;
00024 
00025   // set references to constituent basic clusters and update list of rechits
00026   for(CaloClusterPtrVector::const_iterator bcit  = clusters.begin();
00027                                             bcit != clusters.end();
00028                                           ++bcit) {
00029     clusters_.push_back( (*bcit) );
00030 
00031     // updated list of used hits
00032     const std::vector< std::pair<DetId, float> > & v1 = (*bcit)->hitsAndFractions();
00033     for( std::vector< std::pair<DetId, float> >::const_iterator diIt = v1.begin();
00034                                             diIt != v1.end();
00035                                            ++diIt ) {
00036       hitsAndFractions_.push_back( (*diIt) );
00037     } // loop over rechits
00038   } // loop over basic clusters
00039   
00040   computeRawEnergy();
00041 }
00042 
00043 
00044 
00045 SuperCluster::SuperCluster( double energy, const math::XYZPoint& position,
00046                             const CaloClusterPtr & seed,
00047                             const CaloClusterPtrVector& clusters,
00048                             const CaloClusterPtrVector& preshowerClusters,
00049                             double Epreshower, double phiWidth, double etaWidth, double Epreshower1, double Epreshower2) :
00050   CaloCluster(energy,position), rawEnergy_(-1.)
00051 {
00052   phiWidth_ = phiWidth;
00053   etaWidth_ = etaWidth;
00054   seed_ = seed;
00055   preshowerEnergy_ = Epreshower;
00056   preshowerEnergy1_ = Epreshower1;
00057   preshowerEnergy2_ = Epreshower2;
00058 
00059   // set references to constituent basic clusters and update list of rechits
00060   for(CaloClusterPtrVector::const_iterator bcit  = clusters.begin();
00061                                             bcit != clusters.end();
00062                                           ++bcit) {
00063     clusters_.push_back( (*bcit) );
00064 
00065     // updated list of used hits
00066     const std::vector< std::pair<DetId, float> > & v1 = (*bcit)->hitsAndFractions();
00067     for( std::vector< std::pair<DetId, float> >::const_iterator diIt = v1.begin();
00068                                             diIt != v1.end();
00069                                            ++diIt ) {
00070       hitsAndFractions_.push_back( (*diIt) );
00071     } // loop over rechits
00072   } // loop over basic clusters
00073 
00074   // set references to preshower clusters
00075   for(CaloClusterPtrVector::const_iterator pcit  = preshowerClusters.begin();
00076                                             pcit != preshowerClusters.end();
00077                                           ++pcit) {
00078     preshowerClusters_.push_back( (*pcit) );
00079   }
00080   computeRawEnergy();
00081 }
00082 
00083 
00084 
00085 void SuperCluster::computeRawEnergy() {
00086 
00087   rawEnergy_ = 0.;
00088   for(CaloClusterPtrVector::const_iterator bcItr = clustersBegin(); 
00089       bcItr != clustersEnd(); bcItr++){
00090       rawEnergy_ += (*bcItr)->energy();
00091   }
00092 }