CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
SuperClusterHelper Class Reference

#include <SuperClusterHelper.h>

Public Member Functions

float clustersSize () const
 
float e2nd () const
 
float e2x5Bottom () const
 
float e2x5Left () const
 
float e2x5Max () const
 
float e2x5Right () const
 
float e2x5Top () const
 
float e3x3 () const
 
float e5x5 () const
 
float eBottom () const
 
float eESClusters () const
 
float eLeft () const
 
float eMax () const
 
float eRight () const
 
float esClusterEnergy (unsigned i) const
 
float esClusterEta (unsigned i) const
 
float esClusterPhi (unsigned i) const
 
float eSubClusters () const
 
float eta () const
 
float etaCrySeed ()
 
float etaWidth () const
 
float eTop () const
 
float hadronicOverEm () const
 
int ietaSeed ()
 
int iphiSeed ()
 
float nPreshowerClusters () const
 
float phi () const
 
float phiCrySeed ()
 
float phiTilt ()
 
float phiWidth () const
 
float preshowerEnergy () const
 
float preshowerEnergyOverRaw () const
 
float r9 () const
 
float rawEnergy () const
 
float seedEnergy () const
 
float seedEta () const
 
float seedPhi () const
 
float sep ()
 
float sigmaIetaIeta () const
 
float spp ()
 
float subClusterE3x3 (unsigned i) const
 
float subClusterEmax (unsigned i) const
 
float subClusterEnergy (unsigned i) const
 
float subClusterEta (unsigned i) const
 
float subClusterPhi (unsigned i) const
 
 SuperClusterHelper (const reco::GsfElectron *electron, const EcalRecHitCollection *rechits, const CaloTopology *, const CaloGeometry *)
 
 SuperClusterHelper (const pat::Electron *electron, const EcalRecHitCollection *rechits, const CaloTopology *, const CaloGeometry *)
 
float thetaTilt ()
 
 ~SuperClusterHelper ()
 

Private Member Functions

void computeLocalCovariances ()
 
void localCoordinates ()
 

Static Private Member Functions

static bool sortClusters (const reco::CaloCluster *c1, const reco::CaloCluster *c2)
 

Private Attributes

bool barrel_
 
bool covComputed_
 
float eESClusters_
 
float eSubClusters_
 
float etaCrySeed_
 
const CaloGeometrygeometry_
 
int ietaSeed_
 
int iphiSeed_
 
bool localCoordinatesComputed_
 local coordinates More...
 
unsigned nBasicClusters_
 
unsigned nESClusters_
 
float phiCrySeed_
 
float phiTilt_
 
const EcalRecHitCollectionrechits_
 
const reco::CaloClusterseedCluster_
 
float sep_
 
float spp_
 
std::vector< const reco::CaloCluster * > theBasicClusters_
 
const reco::GsfElectrontheElectron_
 
std::vector< const reco::CaloCluster * > theESClusters_
 
const reco::SuperClustertheSuperCluster_
 
float thetaTilt_
 
const CaloTopologytopology_
 

Detailed Description

Definition at line 12 of file SuperClusterHelper.h.

Constructor & Destructor Documentation

◆ SuperClusterHelper() [1/2]

SuperClusterHelper::SuperClusterHelper ( const reco::GsfElectron electron,
const EcalRecHitCollection rechits,
const CaloTopology topo,
const CaloGeometry geom 
)

Definition at line 6 of file SuperClusterHelper.cc.

References barrel_, reco::SuperCluster::clustersBegin(), reco::SuperCluster::clustersEnd(), covComputed_, eESClusters_, HPSPFTauProducerPuppi_cfi::electron, eSubClusters_, relativeConstraints::geom, geometry_, localCoordinatesComputed_, nBasicClusters_, nESClusters_, reco::SuperCluster::preshowerClustersBegin(), reco::SuperCluster::preshowerClustersEnd(), HI_PhotonSkim_cff::rechits, rechits_, seedCluster_, jetUpdater_cfi::sort, sortClusters(), theBasicClusters_, theElectron_, theESClusters_, theSuperCluster_, and topology_.

9  {
11  rechits_ = rechits;
12  seedCluster_ = &(*(electron->superCluster()->seed()));
13  theSuperCluster_ = &(*electron->superCluster());
14 
15  eSubClusters_ = 0.;
16  // Store subclusters
19  for (; itscl < itsclE; ++itscl) {
20  if ((*itscl) == electron->superCluster()->seed())
21  continue; // skip seed cluster
22  theBasicClusters_.push_back(&(**itscl));
23  eSubClusters_ += (*itscl)->energy();
24  }
25  // sort subclusters
27  // Add seed cluster at the beginning
29 
31 
32  // Store ES clusters
33  eESClusters_ = 0.;
36  for (; itscl < itsclE; ++itscl) {
37  theESClusters_.push_back(&(**itscl));
38  eESClusters_ += (*itscl)->energy();
39  }
40  // sort ES clusters
42 
44 
45  topology_ = topo;
46  geometry_ = geom;
47  barrel_ = electron->isEB();
48  covComputed_ = false;
50 }
static bool sortClusters(const reco::CaloCluster *c1, const reco::CaloCluster *c2)
std::vector< const reco::CaloCluster * > theESClusters_
std::vector< const reco::CaloCluster * > theBasicClusters_
CaloCluster_iterator clustersBegin() const
fist iterator over BasicCluster constituents
Definition: SuperCluster.h:86
CaloCluster_iterator preshowerClustersBegin() const
fist iterator over PreshowerCluster constituents
Definition: SuperCluster.h:92
CaloCluster_iterator clustersEnd() const
last iterator over BasicCluster constituents
Definition: SuperCluster.h:89
const CaloTopology * topology_
const reco::CaloCluster * seedCluster_
CaloCluster_iterator preshowerClustersEnd() const
last iterator over PreshowerCluster constituents
Definition: SuperCluster.h:95
const reco::SuperCluster * theSuperCluster_
const EcalRecHitCollection * rechits_
const CaloGeometry * geometry_
bool localCoordinatesComputed_
local coordinates
const reco::GsfElectron * theElectron_

◆ SuperClusterHelper() [2/2]

SuperClusterHelper::SuperClusterHelper ( const pat::Electron electron,
const EcalRecHitCollection rechits,
const CaloTopology topo,
const CaloGeometry geom 
)

Definition at line 52 of file SuperClusterHelper.cc.

References barrel_, covComputed_, MillePedeFileConverter_cfg::e, eESClusters_, HPSPFTauProducerPuppi_cfi::electron, HCALHighEnergyHPDFilter_cfi::energy, reco::CaloCluster::energy(), eSubClusters_, eta(), reco::CaloCluster::eta(), relativeConstraints::geom, geometry_, cuy::ib, localCoordinatesComputed_, nBasicClusters_, nESClusters_, phi(), reco::CaloCluster::phi(), HI_PhotonSkim_cff::rechits, rechits_, seedCluster_, jetUpdater_cfi::sort, sortClusters(), theBasicClusters_, theElectron_, theESClusters_, theSuperCluster_, and topology_.

55  {
57  rechits_ = rechits;
58  // for(unsigned ir=0; ir<rechits_->size();++ir) {
59  // std::cout << "RecHit " << (*rechits_)[ir].id().rawId() << " " << (*rechits_)[ir] << std::endl;
60  // }
61  // Get the embedded objects
62  theSuperCluster_ = &(*electron->superCluster());
63  seedCluster_ = &(*(electron->seed()));
64  const std::vector<reco::CaloCluster>& basicClusters(electron->basicClusters());
65  nBasicClusters_ = basicClusters.size();
66  eSubClusters_ = 0.;
67  // Store subclusters
68  for (unsigned ib = 0; ib < nBasicClusters_; ++ib) {
69  if (fabs((basicClusters[ib].energy() - seedCluster_->energy()) / seedCluster_->energy()) < 1.e-5 &&
70  fabs((basicClusters[ib].eta() - seedCluster_->eta()) / seedCluster_->eta()) < 1.e-5 &&
71  fabs((basicClusters[ib].phi() - seedCluster_->phi()) / seedCluster_->phi()) < 1.e-5)
72  continue; // skip seed cluster
73  theBasicClusters_.push_back(&basicClusters[ib]);
74  eSubClusters_ += basicClusters[ib].energy();
75  }
76  // sort subclusters
78  // Add seed cluster at the beginning
80 
81  // Store ES clusters
82  const std::vector<reco::CaloCluster>& esClusters(electron->preshowerClusters());
83  nESClusters_ = esClusters.size();
84  eESClusters_ = 0.;
85  for (unsigned ib = 0; ib < nESClusters_; ++ib) {
86  theESClusters_.push_back(&esClusters[ib]);
87  eESClusters_ += esClusters[ib].energy();
88  }
89  // sort ES clusters
91 
92  // std::vector< std::pair<DetId, float> >::const_iterator it=seedCluster_->hitsAndFractions().begin();
93  // std::vector< std::pair<DetId, float> >::const_iterator itend=seedCluster_->hitsAndFractions().end();
94  // for( ; it!=itend ; ++it) {
95  // DetId id=it->first;
96  // std::cout << " Basic cluster " << id.rawId() << std::endl;
97  // }
98  topology_ = topo;
99  geometry_ = geom;
100  barrel_ = electron->isEB();
101  covComputed_ = false;
103 }
static bool sortClusters(const reco::CaloCluster *c1, const reco::CaloCluster *c2)
std::vector< const reco::CaloCluster * > theESClusters_
std::vector< const reco::CaloCluster * > theBasicClusters_
double phi() const
azimuthal angle of cluster centroid
Definition: CaloCluster.h:184
const CaloTopology * topology_
const reco::CaloCluster * seedCluster_
const reco::SuperCluster * theSuperCluster_
const EcalRecHitCollection * rechits_
double energy() const
cluster energy
Definition: CaloCluster.h:149
const CaloGeometry * geometry_
bool localCoordinatesComputed_
local coordinates
const reco::GsfElectron * theElectron_
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:181
ib
Definition: cuy.py:661

◆ ~SuperClusterHelper()

SuperClusterHelper::~SuperClusterHelper ( )
inline

Definition at line 22 of file SuperClusterHelper.h.

22 {};

Member Function Documentation

◆ clustersSize()

float SuperClusterHelper::clustersSize ( ) const
inline

◆ computeLocalCovariances()

void SuperClusterHelper::computeLocalCovariances ( )
private

Definition at line 105 of file SuperClusterHelper.cc.

References covComputed_, edm::isFinite(), rechits_, seedCluster_, sep_, reco::GsfElectron::sigmaIetaIeta(), spp_, mathSSE::sqrt(), theElectron_, and topology_.

Referenced by sep(), and spp().

105  {
106  if (!covComputed_) {
107  const auto& vCov_ = EcalClusterTools::localCovariances(*seedCluster_, rechits_, topology_, 4.7);
108  covComputed_ = true;
109 
110  spp_ = 0;
111  if (edm::isFinite(vCov_[2]))
112  spp_ = sqrt(vCov_[2]);
113 
114  if (theElectron_->sigmaIetaIeta() * spp_ > 0) {
115  sep_ = vCov_[1] / (theElectron_->sigmaIetaIeta() * spp_);
116  } else if (vCov_[1] > 0) {
117  sep_ = 1.0;
118  } else {
119  sep_ = -1.0;
120  }
121  }
122 }
float sigmaIetaIeta() const
Definition: GsfElectron.h:419
constexpr bool isFinite(T x)
const CaloTopology * topology_
T sqrt(T t)
Definition: SSEVec.h:19
const reco::CaloCluster * seedCluster_
const EcalRecHitCollection * rechits_
const reco::GsfElectron * theElectron_

◆ e2nd()

float SuperClusterHelper::e2nd ( ) const
inline

◆ e2x5Bottom()

float SuperClusterHelper::e2x5Bottom ( ) const
inline

◆ e2x5Left()

float SuperClusterHelper::e2x5Left ( ) const
inline

◆ e2x5Max()

float SuperClusterHelper::e2x5Max ( ) const
inline

◆ e2x5Right()

float SuperClusterHelper::e2x5Right ( ) const
inline

◆ e2x5Top()

float SuperClusterHelper::e2x5Top ( ) const
inline

◆ e3x3()

float SuperClusterHelper::e3x3 ( ) const
inline

◆ e5x5()

float SuperClusterHelper::e5x5 ( ) const
inline

◆ eBottom()

float SuperClusterHelper::eBottom ( ) const
inline

◆ eESClusters()

float SuperClusterHelper::eESClusters ( ) const
inline

◆ eLeft()

float SuperClusterHelper::eLeft ( ) const
inline

◆ eMax()

float SuperClusterHelper::eMax ( ) const
inline

◆ eRight()

float SuperClusterHelper::eRight ( ) const
inline

◆ esClusterEnergy()

float SuperClusterHelper::esClusterEnergy ( unsigned  i) const

◆ esClusterEta()

float SuperClusterHelper::esClusterEta ( unsigned  i) const

◆ esClusterPhi()

float SuperClusterHelper::esClusterPhi ( unsigned  i) const

◆ eSubClusters()

float SuperClusterHelper::eSubClusters ( ) const
inline

◆ eta()

float SuperClusterHelper::eta ( ) const
inline

◆ etaCrySeed()

float SuperClusterHelper::etaCrySeed ( )
inline

◆ etaWidth()

float SuperClusterHelper::etaWidth ( ) const
inline

◆ eTop()

float SuperClusterHelper::eTop ( ) const
inline

◆ hadronicOverEm()

float SuperClusterHelper::hadronicOverEm ( ) const
inline

◆ ietaSeed()

int SuperClusterHelper::ietaSeed ( )
inline

◆ iphiSeed()

int SuperClusterHelper::iphiSeed ( )
inline

◆ localCoordinates()

void SuperClusterHelper::localCoordinates ( )
private

Definition at line 134 of file SuperClusterHelper.cc.

References barrel_, etaCrySeed_, geometry_, ietaSeed_, iphiSeed_, localCoordinatesComputed_, egammaTools::localEcalClusterCoordsEB(), egammaTools::localEcalClusterCoordsEE(), phiCrySeed_, phiTilt_, seedCluster_, and thetaTilt_.

Referenced by etaCrySeed(), ietaSeed(), iphiSeed(), phiCrySeed(), phiTilt(), and thetaTilt().

134  {
136  return;
137 
138  if (barrel_) {
141  } else {
144  }
146 }
void localEcalClusterCoordsEB(const reco::CaloCluster &bclus, const CaloGeometry &geom, float &etacry, float &phicry, int &ieta, int &iphi, float &thetatilt, float &phitilt)
const reco::CaloCluster * seedCluster_
void localEcalClusterCoordsEE(const reco::CaloCluster &bclus, const CaloGeometry &geom, float &xcry, float &ycry, int &ix, int &iy, float &thetatilt, float &phitilt)
const CaloGeometry * geometry_
bool localCoordinatesComputed_
local coordinates

◆ nPreshowerClusters()

float SuperClusterHelper::nPreshowerClusters ( ) const
inline

◆ phi()

float SuperClusterHelper::phi ( void  ) const
inline

◆ phiCrySeed()

float SuperClusterHelper::phiCrySeed ( )
inline

◆ phiTilt()

float SuperClusterHelper::phiTilt ( )
inline

Definition at line 75 of file SuperClusterHelper.h.

References localCoordinates(), and phiTilt_.

75  {
77  return phiTilt_;
78  }

◆ phiWidth()

float SuperClusterHelper::phiWidth ( ) const
inline

◆ preshowerEnergy()

float SuperClusterHelper::preshowerEnergy ( ) const
inline

Definition at line 32 of file SuperClusterHelper.h.

References reco::SuperCluster::preshowerEnergy(), and theSuperCluster_.

Referenced by RegressionEnergyPatElectronProducer::produce().

32 { return theSuperCluster_->preshowerEnergy(); }
const reco::SuperCluster * theSuperCluster_
double preshowerEnergy() const
energy deposited in preshower
Definition: SuperCluster.h:61

◆ preshowerEnergyOverRaw()

float SuperClusterHelper::preshowerEnergyOverRaw ( ) const
inline

Definition at line 33 of file SuperClusterHelper.h.

References reco::SuperCluster::preshowerEnergy(), reco::SuperCluster::rawEnergy(), and theSuperCluster_.

Referenced by ElectronEnergyRegressionEvaluate::calculateRegressionEnergy(), ElectronEnergyRegressionEvaluate::calculateRegressionEnergyUncertainty(), and RegressionEnergyPatElectronProducer::produce().

double rawEnergy() const
raw uncorrected energy (sum of energies of component BasicClusters)
Definition: SuperCluster.h:58
const reco::SuperCluster * theSuperCluster_
double preshowerEnergy() const
energy deposited in preshower
Definition: SuperCluster.h:61

◆ r9()

float SuperClusterHelper::r9 ( ) const
inline

Definition at line 47 of file SuperClusterHelper.h.

References e3x3(), reco::SuperCluster::rawEnergy(), and theSuperCluster_.

Referenced by ElectronEnergyRegressionEvaluate::calculateRegressionEnergy(), ElectronEnergyRegressionEvaluate::calculateRegressionEnergyUncertainty(), and RegressionEnergyPatElectronProducer::produce().

47  { //std::cout << " E3x3 " << e3x3() << " raw " << theSuperCluster_->rawEnergy() << std::endl;
48  return e3x3() / theSuperCluster_->rawEnergy();
49  }
double rawEnergy() const
raw uncorrected energy (sum of energies of component BasicClusters)
Definition: SuperCluster.h:58
const reco::SuperCluster * theSuperCluster_

◆ rawEnergy()

float SuperClusterHelper::rawEnergy ( ) const
inline

◆ seedEnergy()

float SuperClusterHelper::seedEnergy ( ) const
inline

◆ seedEta()

float SuperClusterHelper::seedEta ( ) const
inline

◆ seedPhi()

float SuperClusterHelper::seedPhi ( ) const
inline

◆ sep()

float SuperClusterHelper::sep ( )

◆ sigmaIetaIeta()

float SuperClusterHelper::sigmaIetaIeta ( ) const
inline

◆ sortClusters()

static bool SuperClusterHelper::sortClusters ( const reco::CaloCluster c1,
const reco::CaloCluster c2 
)
inlinestaticprivate

Definition at line 129 of file SuperClusterHelper.h.

References alignmentValidation::c1, and reco::CaloCluster::energy().

Referenced by SuperClusterHelper().

129  {
130  return (c1->energy() > c2->energy());
131  }
double energy() const
cluster energy
Definition: CaloCluster.h:149

◆ spp()

float SuperClusterHelper::spp ( )

◆ subClusterE3x3()

float SuperClusterHelper::subClusterE3x3 ( unsigned  i) const

◆ subClusterEmax()

float SuperClusterHelper::subClusterEmax ( unsigned  i) const

◆ subClusterEnergy()

float SuperClusterHelper::subClusterEnergy ( unsigned  i) const

◆ subClusterEta()

float SuperClusterHelper::subClusterEta ( unsigned  i) const

◆ subClusterPhi()

float SuperClusterHelper::subClusterPhi ( unsigned  i) const

◆ thetaTilt()

float SuperClusterHelper::thetaTilt ( )
inline

Definition at line 71 of file SuperClusterHelper.h.

References localCoordinates(), and thetaTilt_.

71  {
73  return thetaTilt_;
74  }

Member Data Documentation

◆ barrel_

bool SuperClusterHelper::barrel_
private

Definition at line 105 of file SuperClusterHelper.h.

Referenced by localCoordinates(), and SuperClusterHelper().

◆ covComputed_

bool SuperClusterHelper::covComputed_
private

cached variables covariance matrix

Definition at line 109 of file SuperClusterHelper.h.

Referenced by computeLocalCovariances(), and SuperClusterHelper().

◆ eESClusters_

float SuperClusterHelper::eESClusters_
private

Definition at line 123 of file SuperClusterHelper.h.

Referenced by eESClusters(), and SuperClusterHelper().

◆ eSubClusters_

float SuperClusterHelper::eSubClusters_
private

Definition at line 122 of file SuperClusterHelper.h.

Referenced by eSubClusters(), and SuperClusterHelper().

◆ etaCrySeed_

float SuperClusterHelper::etaCrySeed_
private

Definition at line 116 of file SuperClusterHelper.h.

Referenced by etaCrySeed(), and localCoordinates().

◆ geometry_

const CaloGeometry* SuperClusterHelper::geometry_
private

Definition at line 104 of file SuperClusterHelper.h.

Referenced by localCoordinates(), and SuperClusterHelper().

◆ ietaSeed_

int SuperClusterHelper::ietaSeed_
private

Definition at line 114 of file SuperClusterHelper.h.

Referenced by ietaSeed(), and localCoordinates().

◆ iphiSeed_

int SuperClusterHelper::iphiSeed_
private

Definition at line 115 of file SuperClusterHelper.h.

Referenced by iphiSeed(), and localCoordinates().

◆ localCoordinatesComputed_

bool SuperClusterHelper::localCoordinatesComputed_
private

local coordinates

Definition at line 113 of file SuperClusterHelper.h.

Referenced by localCoordinates(), and SuperClusterHelper().

◆ nBasicClusters_

unsigned SuperClusterHelper::nBasicClusters_
private

◆ nESClusters_

unsigned SuperClusterHelper::nESClusters_
private

◆ phiCrySeed_

float SuperClusterHelper::phiCrySeed_
private

Definition at line 117 of file SuperClusterHelper.h.

Referenced by localCoordinates(), and phiCrySeed().

◆ phiTilt_

float SuperClusterHelper::phiTilt_
private

Definition at line 119 of file SuperClusterHelper.h.

Referenced by localCoordinates(), and phiTilt().

◆ rechits_

const EcalRecHitCollection* SuperClusterHelper::rechits_
private

◆ seedCluster_

const reco::CaloCluster* SuperClusterHelper::seedCluster_
private

◆ sep_

float SuperClusterHelper::sep_
private

Definition at line 111 of file SuperClusterHelper.h.

Referenced by computeLocalCovariances(), and sep().

◆ spp_

float SuperClusterHelper::spp_
private

Definition at line 110 of file SuperClusterHelper.h.

Referenced by computeLocalCovariances(), and spp().

◆ theBasicClusters_

std::vector<const reco::CaloCluster*> SuperClusterHelper::theBasicClusters_
private

◆ theElectron_

const reco::GsfElectron* SuperClusterHelper::theElectron_
private

◆ theESClusters_

std::vector<const reco::CaloCluster*> SuperClusterHelper::theESClusters_
private

◆ theSuperCluster_

const reco::SuperCluster* SuperClusterHelper::theSuperCluster_
private

◆ thetaTilt_

float SuperClusterHelper::thetaTilt_
private

Definition at line 118 of file SuperClusterHelper.h.

Referenced by localCoordinates(), and thetaTilt().

◆ topology_

const CaloTopology* SuperClusterHelper::topology_
private