CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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::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_, metsig::electron, eSubClusters_, relativeConstraints::geom, geometry_, reco::GsfElectron::isEB(), localCoordinatesComputed_, nBasicClusters_, nESClusters_, reco::SuperCluster::preshowerClustersBegin(), reco::SuperCluster::preshowerClustersEnd(), HI_PhotonSkim_cff::rechits, rechits_, seedCluster_, sortClusters(), reco::GsfElectron::superCluster(), 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)
CaloCluster_iterator preshowerClustersBegin() const
fist iterator over PreshowerCluster constituents
Definition: SuperCluster.h:92
std::vector< const reco::CaloCluster * > theESClusters_
std::vector< const reco::CaloCluster * > theBasicClusters_
bool isEB() const
Definition: GsfElectron.h:328
const CaloTopology * topology_
const reco::CaloCluster * seedCluster_
const reco::SuperCluster * theSuperCluster_
const EcalRecHitCollection * rechits_
const CaloGeometry * geometry_
bool localCoordinatesComputed_
local coordinates
CaloCluster_iterator clustersBegin() const
fist iterator over BasicCluster constituents
Definition: SuperCluster.h:86
const reco::GsfElectron * theElectron_
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:155
CaloCluster_iterator preshowerClustersEnd() const
last iterator over PreshowerCluster constituents
Definition: SuperCluster.h:95
CaloCluster_iterator clustersEnd() const
last iterator over BasicCluster constituents
Definition: SuperCluster.h:89
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_, pat::Electron::basicClusters(), covComputed_, alignCSCRings::e, eESClusters_, relval_parameters_module::energy, reco::CaloCluster::energy(), eSubClusters_, eta(), reco::CaloCluster::eta(), relativeConstraints::geom, geometry_, cuy::ib, reco::GsfElectron::isEB(), localCoordinatesComputed_, nBasicClusters_, nESClusters_, phi(), reco::CaloCluster::phi(), pat::Electron::preshowerClusters(), HI_PhotonSkim_cff::rechits, rechits_, pat::Electron::seed(), seedCluster_, sortClusters(), pat::Electron::superCluster(), theBasicClusters_, theElectron_, theESClusters_, theSuperCluster_, and topology_.

55  {
56  theElectron_ = (const reco::GsfElectron*)electron;
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_
int ib
Definition: cuy.py:661
std::vector< const reco::CaloCluster * > theBasicClusters_
const std::vector< reco::CaloCluster > & basicClusters() const
Definition: Electron.h:86
reco::SuperClusterRef superCluster() const override
override the reco::GsfElectron::superCluster method, to access the internal storage of the superclust...
bool isEB() const
Definition: GsfElectron.h:328
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:181
const CaloTopology * topology_
const reco::CaloCluster * seedCluster_
double energy() const
cluster energy
Definition: CaloCluster.h:149
const reco::SuperCluster * theSuperCluster_
const EcalRecHitCollection * rechits_
const CaloGeometry * geometry_
bool localCoordinatesComputed_
local coordinates
const reco::GsfElectron * theElectron_
reco::CaloClusterPtr seed() const
direct access to the seed cluster
const std::vector< reco::CaloCluster > & preshowerClusters() const
Definition: Electron.h:88
double phi() const
azimuthal angle of cluster centroid
Definition: CaloCluster.h:184
SuperClusterHelper::~SuperClusterHelper ( )
inline

Definition at line 22 of file SuperClusterHelper.h.

22 {};

Member Function Documentation

float SuperClusterHelper::clustersSize ( ) const
inline
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 }
constexpr bool isFinite(T x)
const CaloTopology * topology_
float sigmaIetaIeta() const
Definition: GsfElectron.h:419
T sqrt(T t)
Definition: SSEVec.h:19
const reco::CaloCluster * seedCluster_
const EcalRecHitCollection * rechits_
const reco::GsfElectron * theElectron_
float SuperClusterHelper::e2nd ( ) const
inline
float SuperClusterHelper::e2x5Bottom ( ) const
inline
float SuperClusterHelper::e2x5Left ( ) const
inline
float SuperClusterHelper::e2x5Max ( ) const
inline
float SuperClusterHelper::e2x5Right ( ) const
inline
float SuperClusterHelper::e2x5Top ( ) const
inline
float SuperClusterHelper::e3x3 ( ) const
inline
float SuperClusterHelper::e5x5 ( ) const
inline
float SuperClusterHelper::eBottom ( ) const
inline
float SuperClusterHelper::eESClusters ( ) const
inline
float SuperClusterHelper::eLeft ( ) const
inline
float SuperClusterHelper::eMax ( ) const
inline
float SuperClusterHelper::eRight ( ) const
inline
float SuperClusterHelper::esClusterEnergy ( unsigned  i) const
float SuperClusterHelper::esClusterEta ( unsigned  i) const
float SuperClusterHelper::esClusterPhi ( unsigned  i) const
float SuperClusterHelper::eSubClusters ( ) const
inline
float SuperClusterHelper::eta ( ) const
inline
float SuperClusterHelper::etaCrySeed ( )
inline
float SuperClusterHelper::etaWidth ( ) const
inline
float SuperClusterHelper::eTop ( ) const
inline
float SuperClusterHelper::hadronicOverEm ( ) const
inline
int SuperClusterHelper::ietaSeed ( )
inline
int SuperClusterHelper::iphiSeed ( )
inline
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
float SuperClusterHelper::nPreshowerClusters ( ) const
inline
float SuperClusterHelper::phi ( void  ) const
inline
float SuperClusterHelper::phiCrySeed ( )
inline
float SuperClusterHelper::phiTilt ( )
inline

Definition at line 75 of file SuperClusterHelper.h.

References localCoordinates(), and phiTilt_.

75  {
77  return phiTilt_;
78  }
float SuperClusterHelper::phiWidth ( ) const
inline
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
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().

const reco::SuperCluster * theSuperCluster_
double rawEnergy() const
raw uncorrected energy (sum of energies of component BasicClusters)
Definition: SuperCluster.h:58
double preshowerEnergy() const
energy deposited in preshower
Definition: SuperCluster.h:61
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  }
const reco::SuperCluster * theSuperCluster_
double rawEnergy() const
raw uncorrected energy (sum of energies of component BasicClusters)
Definition: SuperCluster.h:58
float SuperClusterHelper::rawEnergy ( ) const
inline
float SuperClusterHelper::seedEnergy ( ) const
inline
float SuperClusterHelper::seedEta ( ) const
inline
float SuperClusterHelper::seedPhi ( ) const
inline
float SuperClusterHelper::sep ( )
float SuperClusterHelper::sigmaIetaIeta ( ) const
inline
static bool SuperClusterHelper::sortClusters ( const reco::CaloCluster c1,
const reco::CaloCluster c2 
)
inlinestaticprivate

Definition at line 129 of file SuperClusterHelper.h.

References reco::CaloCluster::energy().

Referenced by SuperClusterHelper().

129  {
130  return (c1->energy() > c2->energy());
131  }
double energy() const
cluster energy
Definition: CaloCluster.h:149
float SuperClusterHelper::spp ( )
float SuperClusterHelper::subClusterE3x3 ( unsigned  i) const
float SuperClusterHelper::subClusterEmax ( unsigned  i) const
float SuperClusterHelper::subClusterEnergy ( unsigned  i) const
float SuperClusterHelper::subClusterEta ( unsigned  i) const
float SuperClusterHelper::subClusterPhi ( unsigned  i) const
float SuperClusterHelper::thetaTilt ( )
inline

Definition at line 71 of file SuperClusterHelper.h.

References localCoordinates(), and thetaTilt_.

71  {
73  return thetaTilt_;
74  }

Member Data Documentation

bool SuperClusterHelper::barrel_
private

Definition at line 105 of file SuperClusterHelper.h.

Referenced by localCoordinates(), and SuperClusterHelper().

bool SuperClusterHelper::covComputed_
private

cached variables covariance matrix

Definition at line 109 of file SuperClusterHelper.h.

Referenced by computeLocalCovariances(), and SuperClusterHelper().

float SuperClusterHelper::eESClusters_
private

Definition at line 123 of file SuperClusterHelper.h.

Referenced by eESClusters(), and SuperClusterHelper().

float SuperClusterHelper::eSubClusters_
private

Definition at line 122 of file SuperClusterHelper.h.

Referenced by eSubClusters(), and SuperClusterHelper().

float SuperClusterHelper::etaCrySeed_
private

Definition at line 116 of file SuperClusterHelper.h.

Referenced by etaCrySeed(), and localCoordinates().

const CaloGeometry* SuperClusterHelper::geometry_
private

Definition at line 104 of file SuperClusterHelper.h.

Referenced by localCoordinates(), and SuperClusterHelper().

int SuperClusterHelper::ietaSeed_
private

Definition at line 114 of file SuperClusterHelper.h.

Referenced by ietaSeed(), and localCoordinates().

int SuperClusterHelper::iphiSeed_
private

Definition at line 115 of file SuperClusterHelper.h.

Referenced by iphiSeed(), and localCoordinates().

bool SuperClusterHelper::localCoordinatesComputed_
private

local coordinates

Definition at line 113 of file SuperClusterHelper.h.

Referenced by localCoordinates(), and SuperClusterHelper().

unsigned SuperClusterHelper::nBasicClusters_
private
unsigned SuperClusterHelper::nESClusters_
private
float SuperClusterHelper::phiCrySeed_
private

Definition at line 117 of file SuperClusterHelper.h.

Referenced by localCoordinates(), and phiCrySeed().

float SuperClusterHelper::phiTilt_
private

Definition at line 119 of file SuperClusterHelper.h.

Referenced by localCoordinates(), and phiTilt().

const EcalRecHitCollection* SuperClusterHelper::rechits_
private
const reco::CaloCluster* SuperClusterHelper::seedCluster_
private
float SuperClusterHelper::sep_
private

Definition at line 111 of file SuperClusterHelper.h.

Referenced by computeLocalCovariances(), and sep().

float SuperClusterHelper::spp_
private

Definition at line 110 of file SuperClusterHelper.h.

Referenced by computeLocalCovariances(), and spp().

std::vector<const reco::CaloCluster*> SuperClusterHelper::theBasicClusters_
private
const reco::GsfElectron* SuperClusterHelper::theElectron_
private
std::vector<const reco::CaloCluster*> SuperClusterHelper::theESClusters_
private
const reco::SuperCluster* SuperClusterHelper::theSuperCluster_
private
float SuperClusterHelper::thetaTilt_
private

Definition at line 118 of file SuperClusterHelper.h.

Referenced by localCoordinates(), and thetaTilt().

const CaloTopology* SuperClusterHelper::topology_
private