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_
 
EcalClusterLocal local_
 
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 14 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 7 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_.

7  {
9  rechits_ = rechits ;
10  seedCluster_ = & (*(electron->superCluster()->seed()));
11  theSuperCluster_ = &(*electron->superCluster());
12 
13  eSubClusters_ = 0.;
14  // Store subclusters
17  for(; itscl < itsclE ; ++itscl) {
18  if((*itscl)==electron->superCluster()->seed()) continue; // skip seed cluster
19  theBasicClusters_.push_back(&(**itscl));
20  eSubClusters_ += (*itscl)->energy();
21  }
22  // sort subclusters
24  // Add seed cluster at the beginning
26 
28 
29  // Store ES clusters
30  eESClusters_ = 0. ;
33  for( ; itscl < itsclE ; ++ itscl) {
34  theESClusters_.push_back(&(**itscl));
35  eESClusters_ += (*itscl)->energy();
36  }
37  // sort ES clusters
39 
41 
42  topology_ = topo;
43  geometry_ = geom;
44  barrel_ = electron->isEB();
45  covComputed_ = false;
47 }
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:352
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:184
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 49 of file SuperClusterHelper.cc.

References barrel_, pat::Electron::basicClusters(), covComputed_, MillePedeFileConverter_cfg::e, eESClusters_, 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_.

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

Definition at line 18 of file SuperClusterHelper.h.

18 {};

Member Function Documentation

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

Definition at line 100 of file SuperClusterHelper.cc.

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

Referenced by sep(), and spp().

100  {
101  if (!covComputed_) {
102  vCov_ = EcalClusterTools::localCovariances(*seedCluster_, rechits_, topology_, 4.7);
103  covComputed_ = true;
104 
105  spp_ = 0;
106  if (!isnan(vCov_[2])) spp_ = sqrt (vCov_[2]);
107 
108  if (theElectron_->sigmaIetaIeta()*spp_ > 0) {
109  sep_ = vCov_[1] / (theElectron_->sigmaIetaIeta() * spp_);
110  } else if (vCov_[1] > 0) {
111  sep_ = 1.0;
112  } else {
113  sep_ = -1.0;
114  }
115  }
116 }
std::vector< float > vCov_
const CaloTopology * topology_
float sigmaIetaIeta() const
Definition: GsfElectron.h:434
bool isnan(float x)
Definition: math.h:13
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 128 of file SuperClusterHelper.cc.

References barrel_, etaCrySeed_, geometry_, ietaSeed_, iphiSeed_, local_, localCoordinatesComputed_, EcalClusterLocal::localCoordsEB(), EcalClusterLocal::localCoordsEE(), phiCrySeed_, phiTilt_, seedCluster_, and thetaTilt_.

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

128  {
129  if (localCoordinatesComputed_) return;
130 
131  if (barrel_) {
133  } else {
135  }
137 }
const reco::CaloCluster * seedCluster_
const CaloGeometry * geometry_
bool localCoordinatesComputed_
local coordinates
void localCoordsEB(const reco::CaloCluster &bclus, const edm::EventSetup &es, float &etacry, float &phicry, int &ieta, int &iphi, float &thetatilt, float &phitilt) const
void localCoordsEE(const reco::CaloCluster &bclus, const edm::EventSetup &es, float &xcry, float &ycry, int &ix, int &iy, float &thetatilt, float &phitilt) const
EcalClusterLocal local_
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 28 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 29 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 43 of file SuperClusterHelper.h.

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

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

43  { //std::cout << " E3x3 " << e3x3() << " raw " << theSuperCluster_->rawEnergy() << std::endl;
44  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 109 of file SuperClusterHelper.h.

References reco::CaloCluster::energy().

Referenced by SuperClusterHelper().

110  {
111  return (c1->energy()>c2->energy());
112  }
double energy() const
cluster energy
Definition: CaloCluster.h:124
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 54 of file SuperClusterHelper.h.

References localCoordinates(), and thetaTilt_.

Member Data Documentation

bool SuperClusterHelper::barrel_
private

Definition at line 83 of file SuperClusterHelper.h.

Referenced by localCoordinates(), and SuperClusterHelper().

bool SuperClusterHelper::covComputed_
private

cached variables covariance matrix

Definition at line 88 of file SuperClusterHelper.h.

Referenced by computeLocalCovariances(), and SuperClusterHelper().

float SuperClusterHelper::eESClusters_
private

Definition at line 103 of file SuperClusterHelper.h.

Referenced by eESClusters(), and SuperClusterHelper().

float SuperClusterHelper::eSubClusters_
private

Definition at line 102 of file SuperClusterHelper.h.

Referenced by eSubClusters(), and SuperClusterHelper().

float SuperClusterHelper::etaCrySeed_
private

Definition at line 96 of file SuperClusterHelper.h.

Referenced by etaCrySeed(), and localCoordinates().

const CaloGeometry* SuperClusterHelper::geometry_
private

Definition at line 81 of file SuperClusterHelper.h.

Referenced by localCoordinates(), and SuperClusterHelper().

int SuperClusterHelper::ietaSeed_
private

Definition at line 94 of file SuperClusterHelper.h.

Referenced by ietaSeed(), and localCoordinates().

int SuperClusterHelper::iphiSeed_
private

Definition at line 95 of file SuperClusterHelper.h.

Referenced by iphiSeed(), and localCoordinates().

EcalClusterLocal SuperClusterHelper::local_
private

Definition at line 82 of file SuperClusterHelper.h.

Referenced by localCoordinates().

bool SuperClusterHelper::localCoordinatesComputed_
private

local coordinates

Definition at line 93 of file SuperClusterHelper.h.

Referenced by localCoordinates(), and SuperClusterHelper().

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

Definition at line 97 of file SuperClusterHelper.h.

Referenced by localCoordinates(), and phiCrySeed().

float SuperClusterHelper::phiTilt_
private

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

Referenced by computeLocalCovariances(), and sep().

float SuperClusterHelper::spp_
private

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

Referenced by localCoordinates(), and thetaTilt().

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

Definition at line 89 of file SuperClusterHelper.h.

Referenced by computeLocalCovariances().