Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-07 04:35:52

0001 #include "DataFormats/EgammaReco/interface/BasicCluster.h"
0002 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
0003 #include <algorithm>
0004 using namespace reco;
0005 
0006 SuperCluster::SuperCluster(double energy, const math::XYZPoint& position)
0007     : CaloCluster(energy, position),
0008       preshowerEnergy_(0),
0009       rawEnergy_(0),
0010       phiWidth_(0),
0011       etaWidth_(0),
0012       preshowerEnergy1_(0),
0013       preshowerEnergy2_(0) {}
0014 
0015 SuperCluster::SuperCluster(double energy,
0016                            const math::XYZPoint& position,
0017                            const CaloClusterPtr& seed,
0018                            const CaloClusterPtrVector& clusters,
0019                            double Epreshower,
0020                            double phiWidth,
0021                            double etaWidth,
0022                            double Epreshower1,
0023                            double Epreshower2)
0024     : CaloCluster(energy, position), rawEnergy_(0) {
0025   phiWidth_ = phiWidth;
0026   etaWidth_ = etaWidth;
0027   seed_ = seed;
0028   preshowerEnergy_ = Epreshower;
0029   preshowerEnergy1_ = Epreshower1;
0030   preshowerEnergy2_ = Epreshower2;
0031 
0032   // set references to constituent basic clusters and update list of rechits
0033   for (CaloClusterPtrVector::const_iterator bcit = clusters.begin(); bcit != clusters.end(); ++bcit) {
0034     clusters_.push_back((*bcit));
0035 
0036     // updated list of used hits
0037     const std::vector<std::pair<DetId, float> >& v1 = (*bcit)->hitsAndFractions();
0038     for (std::vector<std::pair<DetId, float> >::const_iterator diIt = v1.begin(); diIt != v1.end(); ++diIt) {
0039       hitsAndFractions_.push_back((*diIt));
0040     }  // loop over rechits
0041   }  // loop over basic clusters
0042 
0043   computeRawEnergy();
0044 }
0045 
0046 SuperCluster::SuperCluster(double energy,
0047                            const math::XYZPoint& position,
0048                            const CaloClusterPtr& seed,
0049                            const CaloClusterPtrVector& clusters,
0050                            const CaloClusterPtrVector& preshowerClusters,
0051                            double Epreshower,
0052                            double phiWidth,
0053                            double etaWidth,
0054                            double Epreshower1,
0055                            double Epreshower2)
0056     : CaloCluster(energy, position), rawEnergy_(-1.) {
0057   phiWidth_ = phiWidth;
0058   etaWidth_ = etaWidth;
0059   seed_ = seed;
0060   preshowerEnergy_ = Epreshower;
0061   preshowerEnergy1_ = Epreshower1;
0062   preshowerEnergy2_ = Epreshower2;
0063 
0064   // set references to constituent basic clusters and update list of rechits
0065   for (CaloClusterPtrVector::const_iterator bcit = clusters.begin(); bcit != clusters.end(); ++bcit) {
0066     clusters_.push_back((*bcit));
0067 
0068     // updated list of used hits
0069     const std::vector<std::pair<DetId, float> >& v1 = (*bcit)->hitsAndFractions();
0070     for (std::vector<std::pair<DetId, float> >::const_iterator diIt = v1.begin(); diIt != v1.end(); ++diIt) {
0071       hitsAndFractions_.push_back((*diIt));
0072     }  // loop over rechits
0073   }  // loop over basic clusters
0074 
0075   // set references to preshower clusters
0076   for (CaloClusterPtrVector::const_iterator pcit = preshowerClusters.begin(); pcit != preshowerClusters.end(); ++pcit) {
0077     preshowerClusters_.push_back((*pcit));
0078   }
0079   computeRawEnergy();
0080 }
0081 
0082 void SuperCluster::computeRawEnergy() {
0083   rawEnergy_ = 0.;
0084   for (CaloClusterPtrVector::const_iterator bcItr = clustersBegin(); bcItr != clustersEnd(); bcItr++) {
0085     rawEnergy_ += (*bcItr)->energy();
0086   }
0087 }