Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
#include "DataFormats/EgammaReco/interface/BasicCluster.h"
#include "DataFormats/EgammaReco/interface/SuperCluster.h"
#include <algorithm>
using namespace reco;

SuperCluster::SuperCluster(double energy, const math::XYZPoint& position)
    : CaloCluster(energy, position),
      preshowerEnergy_(0),
      rawEnergy_(0),
      phiWidth_(0),
      etaWidth_(0),
      preshowerEnergy1_(0),
      preshowerEnergy2_(0) {}

SuperCluster::SuperCluster(double energy,
                           const math::XYZPoint& position,
                           const CaloClusterPtr& seed,
                           const CaloClusterPtrVector& clusters,
                           double Epreshower,
                           double phiWidth,
                           double etaWidth,
                           double Epreshower1,
                           double Epreshower2)
    : CaloCluster(energy, position), rawEnergy_(0) {
  phiWidth_ = phiWidth;
  etaWidth_ = etaWidth;
  seed_ = seed;
  preshowerEnergy_ = Epreshower;
  preshowerEnergy1_ = Epreshower1;
  preshowerEnergy2_ = Epreshower2;

  // set references to constituent basic clusters and update list of rechits
  for (CaloClusterPtrVector::const_iterator bcit = clusters.begin(); bcit != clusters.end(); ++bcit) {
    clusters_.push_back((*bcit));

    // updated list of used hits
    const std::vector<std::pair<DetId, float> >& v1 = (*bcit)->hitsAndFractions();
    for (std::vector<std::pair<DetId, float> >::const_iterator diIt = v1.begin(); diIt != v1.end(); ++diIt) {
      hitsAndFractions_.push_back((*diIt));
    }  // loop over rechits
  }  // loop over basic clusters

  computeRawEnergy();
}

SuperCluster::SuperCluster(double energy,
                           const math::XYZPoint& position,
                           const CaloClusterPtr& seed,
                           const CaloClusterPtrVector& clusters,
                           const CaloClusterPtrVector& preshowerClusters,
                           double Epreshower,
                           double phiWidth,
                           double etaWidth,
                           double Epreshower1,
                           double Epreshower2)
    : CaloCluster(energy, position), rawEnergy_(-1.) {
  phiWidth_ = phiWidth;
  etaWidth_ = etaWidth;
  seed_ = seed;
  preshowerEnergy_ = Epreshower;
  preshowerEnergy1_ = Epreshower1;
  preshowerEnergy2_ = Epreshower2;

  // set references to constituent basic clusters and update list of rechits
  for (CaloClusterPtrVector::const_iterator bcit = clusters.begin(); bcit != clusters.end(); ++bcit) {
    clusters_.push_back((*bcit));

    // updated list of used hits
    const std::vector<std::pair<DetId, float> >& v1 = (*bcit)->hitsAndFractions();
    for (std::vector<std::pair<DetId, float> >::const_iterator diIt = v1.begin(); diIt != v1.end(); ++diIt) {
      hitsAndFractions_.push_back((*diIt));
    }  // loop over rechits
  }  // loop over basic clusters

  // set references to preshower clusters
  for (CaloClusterPtrVector::const_iterator pcit = preshowerClusters.begin(); pcit != preshowerClusters.end(); ++pcit) {
    preshowerClusters_.push_back((*pcit));
  }
  computeRawEnergy();
}

void SuperCluster::computeRawEnergy() {
  rawEnergy_ = 0.;
  for (CaloClusterPtrVector::const_iterator bcItr = clustersBegin(); bcItr != clustersEnd(); bcItr++) {
    rawEnergy_ += (*bcItr)->energy();
  }
}