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_
 
std::vector< float > vCov_
 

Detailed Description

Definition at line 13 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 8 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(), TrackInfoProducer_cfi::rechits, rechits_, seedCluster_, sortClusters(), reco::GsfElectron::superCluster(), theBasicClusters_, theElectron_, theESClusters_, theSuperCluster_, and topology_.

8  {
10  rechits_ = rechits ;
11  seedCluster_ = & (*(electron->superCluster()->seed()));
12  theSuperCluster_ = &(*electron->superCluster());
13 
14  eSubClusters_ = 0.;
15  // Store subclusters
18  for(; itscl < itsclE ; ++itscl) {
19  if((*itscl)==electron->superCluster()->seed()) continue; // skip seed cluster
20  theBasicClusters_.push_back(&(**itscl));
21  eSubClusters_ += (*itscl)->energy();
22  }
23  // sort subclusters
25  // Add seed cluster at the beginning
27 
29 
30  // Store ES clusters
31  eESClusters_ = 0. ;
34  for( ; itscl < itsclE ; ++ itscl) {
35  theESClusters_.push_back(&(**itscl));
36  eESClusters_ += (*itscl)->energy();
37  }
38  // sort ES clusters
40 
42 
43  topology_ = topo;
44  geometry_ = geom;
45  barrel_ = electron->isEB();
46  covComputed_ = false;
48 }
static bool sortClusters(const reco::CaloCluster *c1, const reco::CaloCluster *c2)
CaloCluster_iterator preshowerClustersBegin() const
fist iterator over PreshowerCluster constituents
Definition: SuperCluster.h:81
std::vector< const reco::CaloCluster * > theESClusters_
std::vector< const reco::CaloCluster * > theBasicClusters_
bool isEB() const
Definition: GsfElectron.h:356
const CaloTopology * topology_
const reco::CaloCluster * seedCluster_
const reco::SuperCluster * theSuperCluster_
const EcalRecHitCollection * rechits_
const CaloGeometry * geometry_
bool localCoordinatesComputed_
local coordinates
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:185
CaloCluster_iterator clustersBegin() const
fist iterator over BasicCluster constituents
Definition: SuperCluster.h:75
const reco::GsfElectron * theElectron_
CaloCluster_iterator preshowerClustersEnd() const
last iterator over PreshowerCluster constituents
Definition: SuperCluster.h:84
CaloCluster_iterator clustersEnd() const
last iterator over BasicCluster constituents
Definition: SuperCluster.h:78
SuperClusterHelper::SuperClusterHelper ( const pat::Electron electron,
const EcalRecHitCollection rechits,
const CaloTopology topo,
const CaloGeometry geom 
)

Definition at line 50 of file SuperClusterHelper.cc.

References barrel_, pat::Electron::basicClusters(), covComputed_, MillePedeFileConverter_cfg::e, eESClusters_, randomXiThetaGunProducer_cfi::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(), TrackInfoProducer_cfi::rechits, rechits_, pat::Electron::seed(), seedCluster_, sortClusters(), pat::Electron::superCluster(), theBasicClusters_, theElectron_, theESClusters_, theSuperCluster_, and topology_.

50  {
51  theElectron_ = (const reco::GsfElectron*)electron;
52  rechits_ = rechits ;
53 // for(unsigned ir=0; ir<rechits_->size();++ir) {
54 // std::cout << "RecHit " << (*rechits_)[ir].id().rawId() << " " << (*rechits_)[ir] << std::endl;
55 // }
56  // Get the embedded objects
57  theSuperCluster_ = &(*electron->superCluster());
58  seedCluster_ = & (*(electron->seed()));
59  const std::vector<reco::CaloCluster>& basicClusters(electron->basicClusters());
60  nBasicClusters_ = basicClusters.size();
61  eSubClusters_ = 0. ;
62  // Store subclusters
63  for ( unsigned ib = 0; ib < nBasicClusters_ ; ++ib) {
64  if(fabs((basicClusters[ib].energy()-seedCluster_->energy())/seedCluster_->energy())<1.e-5 &&
65  fabs((basicClusters[ib].eta()-seedCluster_->eta())/seedCluster_->eta())<1.e-5 &&
66  fabs((basicClusters[ib].phi()-seedCluster_->phi())/seedCluster_->phi())<1.e-5
67  )
68  continue; // skip seed cluster
69  theBasicClusters_.push_back(&basicClusters[ib]);
70  eSubClusters_ += basicClusters[ib].energy();
71  }
72  // sort subclusters
74  // Add seed cluster at the beginning
76 
77  // Store ES clusters
78  const std::vector<reco::CaloCluster>& esClusters(electron->preshowerClusters());
79  nESClusters_ = esClusters.size();
80  eESClusters_ = 0. ;
81  for (unsigned ib = 0 ; ib < nESClusters_ ; ++ ib) {
82  theESClusters_.push_back(&esClusters[ib]);
83  eESClusters_ += esClusters[ib].energy();
84  }
85  // sort ES clusters
87 
88 // std::vector< std::pair<DetId, float> >::const_iterator it=seedCluster_->hitsAndFractions().begin();
89 // std::vector< std::pair<DetId, float> >::const_iterator itend=seedCluster_->hitsAndFractions().end();
90 // for( ; it!=itend ; ++it) {
91 // DetId id=it->first;
92 // std::cout << " Basic cluster " << id.rawId() << std::endl;
93 // }
94  topology_ = topo;
95  geometry_ = geom;
96  barrel_ = electron->isEB();
97  covComputed_ = false;
99 }
static bool sortClusters(const reco::CaloCluster *c1, const reco::CaloCluster *c2)
std::vector< const reco::CaloCluster * > theESClusters_
std::vector< const reco::CaloCluster * > theBasicClusters_
const std::vector< reco::CaloCluster > & basicClusters() const
Definition: Electron.h:89
bool isEB() const
Definition: GsfElectron.h:356
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:168
const CaloTopology * topology_
const reco::CaloCluster * seedCluster_
double energy() const
cluster energy
Definition: CaloCluster.h:126
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:91
double phi() const
azimuthal angle of cluster centroid
Definition: CaloCluster.h:171
reco::SuperClusterRef superCluster() const override
override the reco::GsfElectron::superCluster method, to access the internal storage of the superclust...
ib
Definition: cuy.py:662
SuperClusterHelper::~SuperClusterHelper ( )
inline

Definition at line 17 of file SuperClusterHelper.h.

17 {};

Member Function Documentation

float SuperClusterHelper::clustersSize ( ) const
inline
void SuperClusterHelper::computeLocalCovariances ( )
private

Definition at line 101 of file SuperClusterHelper.cc.

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

Referenced by sep(), and spp().

101  {
102  if (!covComputed_) {
103  vCov_ = EcalClusterTools::localCovariances(*seedCluster_, rechits_, topology_, 4.7);
104  covComputed_ = true;
105 
106  spp_ = 0;
107  if (edm::isFinite(vCov_[2])) spp_ = sqrt (vCov_[2]);
108 
109  if (theElectron_->sigmaIetaIeta()*spp_ > 0) {
110  sep_ = vCov_[1] / (theElectron_->sigmaIetaIeta() * spp_);
111  } else if (vCov_[1] > 0) {
112  sep_ = 1.0;
113  } else {
114  sep_ = -1.0;
115  }
116  }
117 }
std::vector< float > vCov_
constexpr bool isFinite(T x)
const CaloTopology * topology_
float sigmaIetaIeta() const
Definition: GsfElectron.h:440
T sqrt(T t)
Definition: SSEVec.h:18
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 129 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().

129  {
130  if (localCoordinatesComputed_) return;
131 
132  if (barrel_) {
134  } else {
136  }
138 }
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
float SuperClusterHelper::phiWidth ( ) const
inline
float SuperClusterHelper::preshowerEnergy ( ) const
inline

Definition at line 27 of file SuperClusterHelper.h.

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

Referenced by RegressionEnergyPatElectronProducer::produce().

const reco::SuperCluster * theSuperCluster_
double preshowerEnergy() const
energy deposited in preshower
Definition: SuperCluster.h:50
float SuperClusterHelper::preshowerEnergyOverRaw ( ) const
inline

Definition at line 28 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:47
double preshowerEnergy() const
energy deposited in preshower
Definition: SuperCluster.h:50
float SuperClusterHelper::r9 ( ) const
inline

Definition at line 42 of file SuperClusterHelper.h.

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

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

42  { //std::cout << " E3x3 " << e3x3() << " raw " << theSuperCluster_->rawEnergy() << std::endl;
43  return e3x3()/theSuperCluster_->rawEnergy();}
const reco::SuperCluster * theSuperCluster_
double rawEnergy() const
raw uncorrected energy (sum of energies of component BasicClusters)
Definition: SuperCluster.h:47
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 107 of file SuperClusterHelper.h.

References reco::CaloCluster::energy().

Referenced by SuperClusterHelper().

108  {
109  return (c1->energy()>c2->energy());
110  }
double energy() const
cluster energy
Definition: CaloCluster.h:126
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 53 of file SuperClusterHelper.h.

References localCoordinates(), and thetaTilt_.

Member Data Documentation

bool SuperClusterHelper::barrel_
private

Definition at line 81 of file SuperClusterHelper.h.

Referenced by localCoordinates(), and SuperClusterHelper().

bool SuperClusterHelper::covComputed_
private

cached variables covariance matrix

Definition at line 86 of file SuperClusterHelper.h.

Referenced by computeLocalCovariances(), and SuperClusterHelper().

float SuperClusterHelper::eESClusters_
private

Definition at line 101 of file SuperClusterHelper.h.

Referenced by eESClusters(), and SuperClusterHelper().

float SuperClusterHelper::eSubClusters_
private

Definition at line 100 of file SuperClusterHelper.h.

Referenced by eSubClusters(), and SuperClusterHelper().

float SuperClusterHelper::etaCrySeed_
private

Definition at line 94 of file SuperClusterHelper.h.

Referenced by etaCrySeed(), and localCoordinates().

const CaloGeometry* SuperClusterHelper::geometry_
private

Definition at line 80 of file SuperClusterHelper.h.

Referenced by localCoordinates(), and SuperClusterHelper().

int SuperClusterHelper::ietaSeed_
private

Definition at line 92 of file SuperClusterHelper.h.

Referenced by ietaSeed(), and localCoordinates().

int SuperClusterHelper::iphiSeed_
private

Definition at line 93 of file SuperClusterHelper.h.

Referenced by iphiSeed(), and localCoordinates().

bool SuperClusterHelper::localCoordinatesComputed_
private

local coordinates

Definition at line 91 of file SuperClusterHelper.h.

Referenced by localCoordinates(), and SuperClusterHelper().

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

Definition at line 95 of file SuperClusterHelper.h.

Referenced by localCoordinates(), and phiCrySeed().

float SuperClusterHelper::phiTilt_
private

Definition at line 97 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 89 of file SuperClusterHelper.h.

Referenced by computeLocalCovariances(), and sep().

float SuperClusterHelper::spp_
private

Definition at line 88 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 96 of file SuperClusterHelper.h.

Referenced by localCoordinates(), and thetaTilt().

const CaloTopology* SuperClusterHelper::topology_
private
std::vector<float> SuperClusterHelper::vCov_
private

Definition at line 87 of file SuperClusterHelper.h.

Referenced by computeLocalCovariances().