CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Static Public Member Functions | Static Private Member Functions
EcalClusterTools Class Reference

#include <EcalClusterTools.h>

Classes

struct  EcalClusterEnergyDeposition
 

Public Member Functions

 EcalClusterTools ()
 
 ~EcalClusterTools ()
 

Static Public Member Functions

static Cluster2ndMoments cluster2ndMoments (const reco::BasicCluster &basicCluster, const EcalRecHitCollection &recHits, double phiCorrectionFactor=0.8, double w0=4.7, bool useLogWeights=true)
 
static Cluster2ndMoments cluster2ndMoments (const reco::SuperCluster &superCluster, const EcalRecHitCollection &recHits, double phiCorrectionFactor=0.8, double w0=4.7, bool useLogWeights=true)
 
static Cluster2ndMoments cluster2ndMoments (std::vector< const EcalRecHit * > RH_ptrs, double phiCorrectionFactor=0.8, double w0=4.7, bool useLogWeights=true)
 
static std::vector< float > covariances (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, const CaloGeometry *geometry, float w0=4.7)
 
static std::vector< float > covariances (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, const CaloGeometry *geometry, std::vector< int > flagsexcl, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv, float w0=4.7)
 
static float e1x3 (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float e1x3 (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, std::vector< int > flagsexcl, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv)
 
static float e1x5 (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float e1x5 (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, std::vector< int > flagsexcl, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv)
 
static float e2nd (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
 
static float e2nd (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, std::vector< int > flagsexcl, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv)
 
static float e2x2 (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float e2x2 (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, std::vector< int > flagsexcl, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv)
 
static float e2x5Bottom (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float e2x5Bottom (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, std::vector< int > flagsexcl, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv)
 
static float e2x5Left (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float e2x5Left (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, std::vector< int > flagsexcl, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv)
 
static float e2x5Max (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float e2x5Max (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, std::vector< int > flagsexcl, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv)
 
static float e2x5Right (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float e2x5Right (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, std::vector< int > flagsexcl, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv)
 
static float e2x5Top (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float e2x5Top (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, std::vector< int > flagsexcl, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv)
 
static float e3x1 (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float e3x1 (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, std::vector< int > flagsexcl, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv)
 
static float e3x2 (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float e3x2 (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, std::vector< int > flagsexcl, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv)
 
static float e3x3 (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float e3x3 (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, std::vector< int > flagsexcl, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv)
 
static float e4x4 (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float e4x4 (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, std::vector< int > flagsexcl, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv)
 
static float e5x1 (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float e5x1 (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, std::vector< int > flagsexcl, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv)
 
static float e5x5 (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float e5x5 (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, std::vector< int > flagsexcl, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv)
 
static float eBottom (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float eBottom (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, std::vector< int > flagsexcl, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv)
 
static float eLeft (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float eLeft (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, std::vector< int > flagsexcl, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv)
 
static float eMax (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
 
static float eMax (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, std::vector< int > flagsexcl, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv)
 
static std::vector< float > energyBasketFractionEta (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
 
static std::vector< float > energyBasketFractionEta (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, std::vector< int > flagsexcl, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv)
 
static std::vector< float > energyBasketFractionPhi (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
 
static std::vector< float > energyBasketFractionPhi (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, std::vector< int > flagsexcl, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv)
 
static float eRight (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float eRight (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, std::vector< int > flagsexcl, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv)
 
static float eTop (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static float eTop (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, std::vector< int > flagsexcl, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv)
 
static float getFraction (const std::vector< std::pair< DetId, float > > &v_id, DetId id)
 
static std::pair< DetId, float > getMaximum (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
 
static std::pair< DetId, float > getMaximum (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, std::vector< int > flagsexcl, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv)
 
static std::pair< DetId, float > getMaximum (const std::vector< std::pair< DetId, float > > &v_id, const EcalRecHitCollection *recHits)
 
static std::pair< DetId, float > getMaximum (const std::vector< std::pair< DetId, float > > &v_id, const EcalRecHitCollection *recHits, std::vector< int > flagsexcl, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv)
 
static std::vector< float > lat (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloGeometry *geometry, bool logW=true, float w0=4.7)
 
static std::vector< float > lat (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloGeometry *geometry, std::vector< int > flagsexcl, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv, bool logW=true, float w0=4.7)
 
static std::vector< float > localCovariances (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, float w0=4.7)
 
static std::vector< float > localCovariances (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, std::vector< int > flagsexcl, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv, float w0=4.7)
 
static std::vector< DetIdmatrixDetId (const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
 
static std::vector< DetIdmatrixDetId (const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv)
 
static float matrixEnergy (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
 
static float matrixEnergy (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax, std::vector< int > flagsexcl, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv)
 
static float recHitEnergy (DetId id, const EcalRecHitCollection *recHits)
 
static float recHitEnergy (DetId id, const EcalRecHitCollection *recHits, std::vector< int > flagsexcl, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv)
 
static std::vector< float > roundnessBarrelSuperClusters (const reco::SuperCluster &superCluster, const EcalRecHitCollection &recHits, int weightedPositionMethod=0, float energyThreshold=0.0)
 
static std::vector< float > roundnessBarrelSuperClustersUserExtended (const reco::SuperCluster &superCluster, const EcalRecHitCollection &recHits, int ieta_delta=0, int iphi_delta=0, float energyRHThresh=0.00000, int weightedPositionMethod=0)
 
static std::vector< float > roundnessSelectedBarrelRecHits (std::vector< const EcalRecHit * >rhVector, int weightedPositionMethod=0)
 
static std::vector< float > scLocalCovariances (const reco::SuperCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, float w0=4.7)
 
static std::vector< float > scLocalCovariances (const reco::SuperCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, std::vector< int > flagsexcl, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv, float w0=4.7)
 
static double zernike20 (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloGeometry *geometry, double R0=6.6, bool logW=true, float w0=4.7)
 
static double zernike42 (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloGeometry *geometry, double R0=6.6, bool logW=true, float w0=4.7)
 

Static Private Member Functions

static double absZernikeMoment (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloGeometry *geometry, int n, int m, double R0, bool logW, float w0)
 
static double calc_AbsZernikeMoment (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloGeometry *geometry, int n, int m, double R0, bool logW, float w0)
 
static float computeWeight (float eRH, float energyTotal, int weightedPositionMethod)
 
static int deltaIEta (int seed_ieta, int rh_ieta)
 
static int deltaIPhi (int seed_iphi, int rh_iphi)
 
static double f00 (double r)
 
static double f11 (double r)
 
static double f20 (double r)
 
static double f22 (double r)
 
static double f31 (double r)
 
static double f33 (double r)
 
static double f40 (double r)
 
static double f42 (double r)
 
static double f44 (double r)
 
static double f51 (double r)
 
static double f53 (double r)
 
static double f55 (double r)
 
static double factorial (int n)
 
static double fast_AbsZernikeMoment (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloGeometry *geometry, int n, int m, double R0, bool logW, float w0)
 
static float getDPhiEndcap (const DetId &crysId, float meanX, float meanY)
 
static std::vector
< EcalClusterEnergyDeposition
getEnergyDepTopology (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloGeometry *geometry, bool logW, float w0)
 
static float getIEta (const DetId &id)
 
static float getIPhi (const DetId &id)
 
static float getNormedIX (const DetId &id)
 
static float getNormedIY (const DetId &id)
 
static float getNrCrysDiffInEta (const DetId &crysId, const DetId &orginId)
 
static float getNrCrysDiffInPhi (const DetId &crysId, const DetId &orginId)
 
static std::vector< int > getSeedPosition (std::vector< const EcalRecHit * >RH_ptrs)
 
static float getSumEnergy (std::vector< const EcalRecHit * >RH_ptrs)
 
static std::pair< float, float > mean5x5PositionInLocalCrysCoord (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static std::pair< float, float > mean5x5PositionInLocalCrysCoord (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, std::vector< int > flagsexcl, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv)
 
static std::pair< float, float > mean5x5PositionInXY (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
 
static std::pair< float, float > mean5x5PositionInXY (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, std::vector< int > flagsexcl, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv)
 
static math::XYZVector meanClusterPosition (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, const CaloGeometry *geometry)
 
static math::XYZVector meanClusterPosition (const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, const CaloGeometry *geometry, std::vector< int > flagsexcl, std::vector< int > severitiesexcl, const EcalSeverityLevelAlgo *sevLv)
 

Detailed Description

various cluster tools (e.g. cluster shapes)

Author
Federico Ferri

editing author: M.B. Anderson

Version
$Id:

Definition at line 46 of file EcalClusterTools.h.

Constructor & Destructor Documentation

EcalClusterTools::EcalClusterTools ( )
inline

Definition at line 48 of file EcalClusterTools.h.

48 {};
EcalClusterTools::~EcalClusterTools ( )
inline

Definition at line 49 of file EcalClusterTools.h.

49 {};

Member Function Documentation

double EcalClusterTools::absZernikeMoment ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloGeometry geometry,
int  n,
int  m,
double  R0,
bool  logW,
float  w0 
)
staticprivate

Definition at line 1160 of file EcalClusterTools.cc.

References calc_AbsZernikeMoment(), and fast_AbsZernikeMoment().

Referenced by zernike20(), and zernike42().

1161 {
1162  // 1. Check if n,m are correctly
1163  if ((m>n) || ((n-m)%2 != 0) || (n<0) || (m<0)) return -1;
1164 
1165  // 2. Check if n,R0 are within validity Range :
1166  // n>20 or R0<2.19cm just makes no sense !
1167  if ((n>20) || (R0<=2.19)) return -1;
1168  if (n<=5) return fast_AbsZernikeMoment(cluster, recHits, geometry, n, m, R0, logW, w0 );
1169  else return calc_AbsZernikeMoment(cluster, recHits, geometry, n, m, R0, logW, w0 );
1170 }
static double fast_AbsZernikeMoment(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloGeometry *geometry, int n, int m, double R0, bool logW, float w0)
static double calc_AbsZernikeMoment(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloGeometry *geometry, int n, int m, double R0, bool logW, float w0)
double EcalClusterTools::calc_AbsZernikeMoment ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloGeometry geometry,
int  n,
int  m,
double  R0,
bool  logW,
float  w0 
)
staticprivate

Definition at line 1210 of file EcalClusterTools.cc.

References funct::cos(), alignCSCRings::e, factorial(), getEnergyDepTopology(), i, m, funct::pow(), alignCSCRings::r, alignCSCRings::s, funct::sin(), and mathSSE::sqrt().

Referenced by absZernikeMoment().

1211 {
1212  double r, ph, e, Re=0, Im=0, f_nm;
1213  double TotalEnergy = cluster.energy();
1214  std::vector<EcalClusterEnergyDeposition> energyDistribution = getEnergyDepTopology( cluster, recHits, geometry, logW, w0 );
1215  int clusterSize=energyDistribution.size();
1216  if(clusterSize<3) return 0.0;
1217 
1218  for (int i = 0; i < clusterSize; ++i)
1219  {
1220  r = energyDistribution[i].r / R0;
1221  if (r < 1) {
1222  ph = energyDistribution[i].phi;
1223  e = energyDistribution[i].deposited_energy;
1224  f_nm = 0;
1225  for (int s=0; s<=(n-m)/2; s++) {
1226  if (s%2==0) {
1227  f_nm = f_nm + factorial(n-s)*pow(r,(double) (n-2*s))/(factorial(s)*factorial((n+m)/2-s)*factorial((n-m)/2-s));
1228  } else {
1229  f_nm = f_nm - factorial(n-s)*pow(r,(double) (n-2*s))/(factorial(s)*factorial((n+m)/2-s)*factorial((n-m)/2-s));
1230  }
1231  }
1232  Re = Re + e/TotalEnergy * f_nm * cos( (double) m*ph);
1233  Im = Im - e/TotalEnergy * f_nm * sin( (double) m*ph);
1234  }
1235  }
1236  return sqrt(Re*Re+Im*Im);
1237 }
int i
Definition: DBlmapReader.cc:9
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
static std::vector< EcalClusterEnergyDeposition > getEnergyDepTopology(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloGeometry *geometry, bool logW, float w0)
T sqrt(T t)
Definition: SSEVec.h:46
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
static double factorial(int n)
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
Cluster2ndMoments EcalClusterTools::cluster2ndMoments ( const reco::BasicCluster basicCluster,
const EcalRecHitCollection recHits,
double  phiCorrectionFactor = 0.8,
double  w0 = 4.7,
bool  useLogWeights = true 
)
static

Definition at line 1514 of file EcalClusterTools.cc.

References Cluster2ndMoments::alpha, edm::SortedCollection< T, SORT >::find(), first, i, Cluster2ndMoments::sMaj, and Cluster2ndMoments::sMin.

Referenced by cluster2ndMoments(), and HLTDisplacedEgammaFilter::hltFilter().

1514  {
1515 
1516  Cluster2ndMoments returnMoments;
1517  returnMoments.sMaj = -1.;
1518  returnMoments.sMin = -1.;
1519  returnMoments.alpha = 0.;
1520 
1521  // for now implemented only for EB:
1522  // if( fabs( basicCluster.eta() ) < 1.479 ) {
1523 
1524  std::vector<const EcalRecHit*> RH_ptrs;
1525 
1526  std::vector< std::pair<DetId, float> > myHitsPair = basicCluster.hitsAndFractions();
1527  std::vector<DetId> usedCrystals;
1528  for(unsigned int i=0; i< myHitsPair.size(); i++){
1529  usedCrystals.push_back(myHitsPair[i].first);
1530  }
1531 
1532  for(unsigned int i=0; i<usedCrystals.size(); i++){
1533  //get pointer to recHit object
1534  EcalRecHitCollection::const_iterator myRH = recHits.find(usedCrystals[i]);
1535  RH_ptrs.push_back( &(*myRH) );
1536  }
1537 
1538  returnMoments = EcalClusterTools::cluster2ndMoments(RH_ptrs, phiCorrectionFactor, w0, useLogWeights);
1539 
1540  // }
1541 
1542  return returnMoments;
1543 
1544 }
int i
Definition: DBlmapReader.cc:9
std::vector< EcalRecHit >::const_iterator const_iterator
static Cluster2ndMoments cluster2ndMoments(const reco::BasicCluster &basicCluster, const EcalRecHitCollection &recHits, double phiCorrectionFactor=0.8, double w0=4.7, bool useLogWeights=true)
bool first
Definition: L1TdeRCT.cc:94
iterator find(key_type k)
Cluster2ndMoments EcalClusterTools::cluster2ndMoments ( const reco::SuperCluster superCluster,
const EcalRecHitCollection recHits,
double  phiCorrectionFactor = 0.8,
double  w0 = 4.7,
bool  useLogWeights = true 
)
static

Definition at line 1547 of file EcalClusterTools.cc.

References Cluster2ndMoments::alpha, cluster2ndMoments(), reco::SuperCluster::seed(), Cluster2ndMoments::sMaj, and Cluster2ndMoments::sMin.

1547  {
1548 
1549  // for now returns second moments of supercluster seed cluster:
1550  Cluster2ndMoments returnMoments;
1551  returnMoments.sMaj = -1.;
1552  returnMoments.sMin = -1.;
1553  returnMoments.alpha = 0.;
1554 
1555  // for now implemented only for EB:
1556  // if( fabs( superCluster.eta() ) < 1.479 ) {
1557  returnMoments = EcalClusterTools::cluster2ndMoments( *(superCluster.seed()), recHits, phiCorrectionFactor, w0, useLogWeights);
1558  // }
1559 
1560  return returnMoments;
1561 
1562 }
static Cluster2ndMoments cluster2ndMoments(const reco::BasicCluster &basicCluster, const EcalRecHitCollection &recHits, double phiCorrectionFactor=0.8, double w0=4.7, bool useLogWeights=true)
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:62
Cluster2ndMoments EcalClusterTools::cluster2ndMoments ( std::vector< const EcalRecHit * >  RH_ptrs,
double  phiCorrectionFactor = 0.8,
double  w0 = 4.7,
bool  useLogWeights = true 
)
static

Definition at line 1565 of file EcalClusterTools.cc.

References Cluster2ndMoments::alpha, RecoTauValidation_cfi::denominator, EcalBarrel, getIEta(), getIPhi(), getNormedIX(), getNormedIY(), getSumEnergy(), i, create_public_lumi_plots::log, max(), phi, Cluster2ndMoments::sMaj, Cluster2ndMoments::sMin, and mathSSE::sqrt().

1565  {
1566 
1567  double mid_eta(0),mid_phi(0),mid_x(0),mid_y(0);
1568 
1569  double Etot = EcalClusterTools::getSumEnergy( RH_ptrs );
1570 
1571  double max_phi=-10.;
1572  double min_phi=100.;
1573 
1574 
1575  std::vector<double> etaDetId;
1576  std::vector<double> phiDetId;
1577  std::vector<double> xDetId;
1578  std::vector<double> yDetId;
1579  std::vector<double> wiDetId;
1580 
1581  unsigned int nCry=0;
1582  double denominator=0.;
1583  bool isBarrel(1);
1584 
1585  // loop over rechits and compute weights:
1586  for(std::vector<const EcalRecHit*>::const_iterator rh_ptr = RH_ptrs.begin(); rh_ptr != RH_ptrs.end(); rh_ptr++){
1587 
1588  //get iEta, iPhi
1589  double temp_eta(0),temp_phi(0),temp_x(0),temp_y(0);
1590  isBarrel = (*rh_ptr)->detid().subdetId()==EcalBarrel;
1591 
1592  if(isBarrel) {
1593  temp_eta = (getIEta((*rh_ptr)->detid()) > 0. ? getIEta((*rh_ptr)->detid()) + 84.5 : getIEta((*rh_ptr)->detid()) + 85.5);
1594  temp_phi= getIPhi((*rh_ptr)->detid()) - 0.5;
1595  }
1596  else {
1597  temp_eta = getIEta((*rh_ptr)->detid());
1598  temp_x = getNormedIX((*rh_ptr)->detid());
1599  temp_y = getNormedIY((*rh_ptr)->detid());
1600  }
1601 
1602  double temp_ene=(*rh_ptr)->energy();
1603 
1604  double temp_wi=((useLogWeights) ?
1605  std::max(0., w0 + log( fabs(temp_ene)/Etot ))
1606  : temp_ene);
1607 
1608 
1609  if(temp_phi>max_phi) max_phi=temp_phi;
1610  if(temp_phi<min_phi) min_phi=temp_phi;
1611  etaDetId.push_back(temp_eta);
1612  phiDetId.push_back(temp_phi);
1613  xDetId.push_back(temp_x);
1614  yDetId.push_back(temp_y);
1615  wiDetId.push_back(temp_wi);
1616  denominator+=temp_wi;
1617  nCry++;
1618  }
1619 
1620  if(isBarrel){
1621  // correct phi wrap-around:
1622  if(max_phi==359.5 && min_phi==0.5){
1623  for(unsigned int i=0; i<nCry; i++){
1624  if(phiDetId[i] - 179. > 0.) phiDetId[i]-=360.;
1625  mid_phi+=phiDetId[i]*wiDetId[i];
1626  mid_eta+=etaDetId[i]*wiDetId[i];
1627  }
1628  } else{
1629  for(unsigned int i=0; i<nCry; i++){
1630  mid_phi+=phiDetId[i]*wiDetId[i];
1631  mid_eta+=etaDetId[i]*wiDetId[i];
1632  }
1633  }
1634  }else{
1635  for(unsigned int i=0; i<nCry; i++){
1636  mid_eta+=etaDetId[i]*wiDetId[i];
1637  mid_x+=xDetId[i]*wiDetId[i];
1638  mid_y+=yDetId[i]*wiDetId[i];
1639  }
1640  }
1641 
1642  mid_eta/=denominator;
1643  mid_phi/=denominator;
1644  mid_x/=denominator;
1645  mid_y/=denominator;
1646 
1647 
1648  // See = sigma eta eta
1649  // Spp = (B field corrected) sigma phi phi
1650  // See = (B field corrected) sigma eta phi
1651  double See=0.;
1652  double Spp=0.;
1653  double Sep=0.;
1654  double deta(0),dphi(0);
1655  // compute (phi-corrected) covariance matrix:
1656  for(unsigned int i=0; i<nCry; i++) {
1657  if(isBarrel) {
1658  deta = etaDetId[i]-mid_eta;
1659  dphi = phiDetId[i]-mid_phi;
1660  } else {
1661  deta = etaDetId[i]-mid_eta;
1662  float hitLocalR2 = (xDetId[i]-mid_x)*(xDetId[i]-mid_x)+(yDetId[i]-mid_y)*(yDetId[i]-mid_y);
1663  float hitR2 = xDetId[i]*xDetId[i]+yDetId[i]*yDetId[i];
1664  float meanR2 = mid_x*mid_x+mid_y*mid_y;
1665  float hitR = sqrt(hitR2);
1666  float meanR = sqrt(meanR2);
1667  float phi = acos((hitR2+meanR2-hitLocalR2)/(2*hitR*meanR));
1668  dphi = hitR*phi;
1669 
1670  }
1671  See += (wiDetId[i]* deta * deta) / denominator;
1672  Spp += phiCorrectionFactor*(wiDetId[i]* dphi * dphi) / denominator;
1673  Sep += sqrt(phiCorrectionFactor)*(wiDetId[i]*deta*dphi) / denominator;
1674  }
1675 
1676  Cluster2ndMoments returnMoments;
1677 
1678  // compute matrix eigenvalues:
1679  returnMoments.sMaj = ((See + Spp) + sqrt((See - Spp)*(See - Spp) + 4.*Sep*Sep)) / 2.;
1680  returnMoments.sMin = ((See + Spp) - sqrt((See - Spp)*(See - Spp) + 4.*Sep*Sep)) / 2.;
1681 
1682  returnMoments.alpha = atan( (See - Spp + sqrt( (Spp - See)*(Spp - See) + 4.*Sep*Sep )) / (2.*Sep));
1683 
1684  return returnMoments;
1685 
1686 }
int i
Definition: DBlmapReader.cc:9
static float getNormedIX(const DetId &id)
const T & max(const T &a, const T &b)
static float getNormedIY(const DetId &id)
static float getSumEnergy(std::vector< const EcalRecHit * >RH_ptrs)
T sqrt(T t)
Definition: SSEVec.h:46
static float getIPhi(const DetId &id)
static float getIEta(const DetId &id)
Definition: DDAxes.h:10
static float EcalClusterTools::computeWeight ( float  eRH,
float  energyTotal,
int  weightedPositionMethod 
)
staticprivate
std::vector< float > EcalClusterTools::covariances ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
const CaloGeometry geometry,
float  w0 = 4.7 
)
static

Definition at line 841 of file EcalClusterTools.cc.

References RecoTauValidation_cfi::denominator, dPhi(), e5x5(), relval_parameters_module::energy, PV3DBase< T, PVType, FrameType >::eta(), CaloSubdetectorGeometry::getGeometry(), getMaximum(), CaloCellGeometry::getPosition(), CaloGeometry::getSubdetectorGeometry(), CaloTopology::getSubdetectorTopology(), CaloNavigator< T >::home(), i, errorMatrix2Lands_multiChannel::id, j, create_public_lumi_plots::log, max(), meanClusterPosition(), CaloNavigator< T >::offsetBy(), PV3DBase< T, PVType, FrameType >::phi(), Geom::pi(), position, recHitEnergy(), Geom::twoPi(), v, and w().

Referenced by GsfElectronAlgo::calculateShowerShape(), EcalClusterLazyTools::covariances(), egHLT::OffHelper::fillClusShapeData(), PhotonProducer::fillPhotonCollection(), and PiZeroDiscriminatorProducer::produce().

842 {
843  float e_5x5 = e5x5( cluster, recHits, topology );
844  float covEtaEta, covEtaPhi, covPhiPhi;
845  if (e_5x5 >= 0.) {
846  //double w0_ = parameterMap_.find("W0")->second;
847  std::vector< std::pair<DetId, float> > v_id = cluster.hitsAndFractions();
848  math::XYZVector meanPosition = meanClusterPosition( cluster, recHits, topology, geometry );
849 
850  // now we can calculate the covariances
851  double numeratorEtaEta = 0;
852  double numeratorEtaPhi = 0;
853  double numeratorPhiPhi = 0;
854  double denominator = 0;
855 
856  DetId id = getMaximum( v_id, recHits ).first;
858  for ( int i = -2; i <= 2; ++i ) {
859  for ( int j = -2; j <= 2; ++j ) {
860  cursor.home();
861  cursor.offsetBy( i, j );
862  float energy = recHitEnergy( *cursor, recHits );
863 
864  if ( energy <= 0 ) continue;
865 
866  GlobalPoint position = geometry->getSubdetectorGeometry(*cursor)->getGeometry(*cursor)->getPosition();
867 
868  double dPhi = position.phi() - meanPosition.phi();
869  if (dPhi > + Geom::pi()) { dPhi = Geom::twoPi() - dPhi; }
870  if (dPhi < - Geom::pi()) { dPhi = Geom::twoPi() + dPhi; }
871 
872  double dEta = position.eta() - meanPosition.eta();
873  double w = 0.;
874  w = std::max(0.0, w0 + log( energy / e_5x5 ));
875 
876  denominator += w;
877  numeratorEtaEta += w * dEta * dEta;
878  numeratorEtaPhi += w * dEta * dPhi;
879  numeratorPhiPhi += w * dPhi * dPhi;
880  }
881  }
882 
883  if (denominator != 0.0) {
884  covEtaEta = numeratorEtaEta / denominator;
885  covEtaPhi = numeratorEtaPhi / denominator;
886  covPhiPhi = numeratorPhiPhi / denominator;
887  } else {
888  covEtaEta = 999.9;
889  covEtaPhi = 999.9;
890  covPhiPhi = 999.9;
891  }
892 
893  } else {
894  // Warn the user if there was no energy in the cells and return zeroes.
895  // std::cout << "\ClusterShapeAlgo::Calculate_Covariances: no energy in supplied cells.\n";
896  covEtaEta = 0;
897  covEtaPhi = 0;
898  covPhiPhi = 0;
899  }
900  std::vector<float> v;
901  v.push_back( covEtaEta );
902  v.push_back( covEtaPhi );
903  v.push_back( covPhiPhi );
904  return v;
905 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:43
int i
Definition: DBlmapReader.cc:9
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)
void home() const
move the navigator back to the starting point
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
double dPhi(double phi1, double phi2)
Definition: JetUtil.h:30
const T & max(const T &a, const T &b)
virtual T offsetBy(int deltaX, int deltaY) const
Free movement of arbitray steps.
int j
Definition: DBlmapReader.cc:9
Definition: DetId.h:20
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:26
T eta() const
Definition: PV3DBase.h:75
double pi()
Definition: Pi.h:31
static int position[264][3]
Definition: ReadPGInfo.cc:509
double twoPi()
Definition: Pi.h:32
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
static float e5x5(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
mathSSE::Vec4< T > v
T w() const
static math::XYZVector meanClusterPosition(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, const CaloGeometry *geometry)
std::vector< float > EcalClusterTools::covariances ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
const CaloGeometry geometry,
std::vector< int >  flagsexcl,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv,
float  w0 = 4.7 
)
static

Definition at line 909 of file EcalClusterTools.cc.

References RecoTauValidation_cfi::denominator, dPhi(), e5x5(), relval_parameters_module::energy, PV3DBase< T, PVType, FrameType >::eta(), CaloSubdetectorGeometry::getGeometry(), getMaximum(), CaloCellGeometry::getPosition(), CaloGeometry::getSubdetectorGeometry(), CaloTopology::getSubdetectorTopology(), CaloNavigator< T >::home(), i, errorMatrix2Lands_multiChannel::id, j, create_public_lumi_plots::log, max(), meanClusterPosition(), CaloNavigator< T >::offsetBy(), PV3DBase< T, PVType, FrameType >::phi(), Geom::pi(), position, recHitEnergy(), Geom::twoPi(), v, and w().

910 {
911  float e_5x5 = e5x5( cluster, recHits, topology,flagsexcl, severitiesexcl, sevLv );
912  float covEtaEta, covEtaPhi, covPhiPhi;
913  if (e_5x5 >= 0.) {
914  //double w0_ = parameterMap_.find("W0")->second;
915  std::vector< std::pair<DetId, float> > v_id = cluster.hitsAndFractions();
916  math::XYZVector meanPosition = meanClusterPosition( cluster, recHits, topology, geometry,flagsexcl, severitiesexcl, sevLv );
917 
918  // now we can calculate the covariances
919  double numeratorEtaEta = 0;
920  double numeratorEtaPhi = 0;
921  double numeratorPhiPhi = 0;
922  double denominator = 0;
923 
924  DetId id = getMaximum( v_id, recHits ).first;
926  for ( int i = -2; i <= 2; ++i ) {
927  for ( int j = -2; j <= 2; ++j ) {
928  cursor.home();
929  cursor.offsetBy( i, j );
930  float energy = recHitEnergy( *cursor, recHits,flagsexcl, severitiesexcl, sevLv );
931 
932  if ( energy <= 0 ) continue;
933 
934  GlobalPoint position = geometry->getSubdetectorGeometry(*cursor)->getGeometry(*cursor)->getPosition();
935 
936  double dPhi = position.phi() - meanPosition.phi();
937  if (dPhi > + Geom::pi()) { dPhi = Geom::twoPi() - dPhi; }
938  if (dPhi < - Geom::pi()) { dPhi = Geom::twoPi() + dPhi; }
939 
940  double dEta = position.eta() - meanPosition.eta();
941  double w = 0.;
942  w = std::max(0.0, w0 + log( energy / e_5x5 ));
943 
944  denominator += w;
945  numeratorEtaEta += w * dEta * dEta;
946  numeratorEtaPhi += w * dEta * dPhi;
947  numeratorPhiPhi += w * dPhi * dPhi;
948  }
949  }
950 
951  if (denominator != 0.0) {
952  covEtaEta = numeratorEtaEta / denominator;
953  covEtaPhi = numeratorEtaPhi / denominator;
954  covPhiPhi = numeratorPhiPhi / denominator;
955  } else {
956  covEtaEta = 999.9;
957  covEtaPhi = 999.9;
958  covPhiPhi = 999.9;
959  }
960 
961  } else {
962  // Warn the user if there was no energy in the cells and return zeroes.
963  // std::cout << "\ClusterShapeAlgo::Calculate_Covariances: no energy in supplied cells.\n";
964  covEtaEta = 0;
965  covEtaPhi = 0;
966  covPhiPhi = 0;
967  }
968  std::vector<float> v;
969  v.push_back( covEtaEta );
970  v.push_back( covEtaPhi );
971  v.push_back( covPhiPhi );
972  return v;
973 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:43
int i
Definition: DBlmapReader.cc:9
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)
void home() const
move the navigator back to the starting point
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
double dPhi(double phi1, double phi2)
Definition: JetUtil.h:30
const T & max(const T &a, const T &b)
virtual T offsetBy(int deltaX, int deltaY) const
Free movement of arbitray steps.
int j
Definition: DBlmapReader.cc:9
Definition: DetId.h:20
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:26
T eta() const
Definition: PV3DBase.h:75
double pi()
Definition: Pi.h:31
static int position[264][3]
Definition: ReadPGInfo.cc:509
double twoPi()
Definition: Pi.h:32
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
static float e5x5(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
mathSSE::Vec4< T > v
T w() const
static math::XYZVector meanClusterPosition(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, const CaloGeometry *geometry)
int EcalClusterTools::deltaIEta ( int  seed_ieta,
int  rh_ieta 
)
staticprivate

Definition at line 1909 of file EcalClusterTools.cc.

Referenced by roundnessBarrelSuperClustersUserExtended(), and roundnessSelectedBarrelRecHits().

1909  {
1910  // get rid of the fact that there is no ieta=0
1911  if(seed_ieta < 0) seed_ieta++;
1912  if(rh_ieta < 0) rh_ieta++;
1913  int rel_ieta = rh_ieta - seed_ieta;
1914  return rel_ieta;
1915 }
int EcalClusterTools::deltaIPhi ( int  seed_iphi,
int  rh_iphi 
)
staticprivate

Definition at line 1898 of file EcalClusterTools.cc.

Referenced by roundnessBarrelSuperClustersUserExtended(), and roundnessSelectedBarrelRecHits().

1898  {
1899  int rel_iphi = rh_iphi - seed_iphi;
1900  // take care of cyclic variable iphi [1,360]
1901  if(rel_iphi > 180) rel_iphi = rel_iphi - 360;
1902  if(rel_iphi < -180) rel_iphi = rel_iphi + 360;
1903  return rel_iphi;
1904 }
float EcalClusterTools::e1x3 ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 445 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

Referenced by EcalClusterLazyTools::e1x3().

446 {
447  DetId id = getMaximum( cluster.hitsAndFractions(), recHits ).first;
448  return matrixEnergy( cluster, recHits, topology, id, 0, 0, -1, 1 );
449 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::e1x3 ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
std::vector< int >  flagsexcl,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv 
)
static

Definition at line 451 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

452 {
453  DetId id = getMaximum( cluster.hitsAndFractions(), recHits ).first;
454  return matrixEnergy( cluster, recHits, topology, id, 0, 0, -1, 1,flagsexcl, severitiesexcl, sevLv );
455 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::e1x5 ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 417 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

Referenced by GsfElectronAlgo::calculateShowerShape(), EcalClusterLazyTools::e1x5(), and PhotonProducer::fillPhotonCollection().

418 {
419  DetId id = getMaximum( cluster.hitsAndFractions(), recHits ).first;
420  return matrixEnergy( cluster, recHits, topology, id, 0, 0, -2, 2 );
421 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::e1x5 ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
std::vector< int >  flagsexcl,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv 
)
static

Definition at line 423 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

424 {
425  DetId id = getMaximum( cluster.hitsAndFractions(), recHits ).first;
426  return matrixEnergy( cluster, recHits, topology, id, 0, 0, -2, 2 ,
427  flagsexcl, severitiesexcl, sevLv);
428 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::e2nd ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits 
)
static

Definition at line 301 of file EcalClusterTools.cc.

References first, i, recHitEnergy(), and edm::second().

Referenced by SuperClusterHelper::e2nd(), EcalClusterLazyTools::e2nd(), and PiZeroDiscriminatorProducer::produce().

302 {
303  std::list<float> energies;
304  std::vector< std::pair<DetId, float> > v_id = cluster.hitsAndFractions();
305  if ( v_id.size() < 2 ) return 0;
306  for ( size_t i = 0; i < v_id.size(); ++i ) {
307  energies.push_back( recHitEnergy( v_id[i].first, recHits ) * v_id[i].second );
308  }
309  energies.sort();
310  return *--(--energies.end());
311 
312 
313 }
int i
Definition: DBlmapReader.cc:9
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)
U second(std::pair< T, U > const &p)
bool first
Definition: L1TdeRCT.cc:94
float EcalClusterTools::e2nd ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
std::vector< int >  flagsexcl,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv 
)
static

Definition at line 315 of file EcalClusterTools.cc.

References first, i, recHitEnergy(), and edm::second().

316 {
317  std::list<float> energies;
318  std::vector< std::pair<DetId, float> > v_id = cluster.hitsAndFractions();
319  if ( v_id.size() < 2 ) return 0;
320  for ( size_t i = 0; i < v_id.size(); ++i ) {
321  energies.push_back( recHitEnergy( v_id[i].first, recHits,flagsexcl, severitiesexcl, sevLv ) * v_id[i].second );
322  }
323  energies.sort();
324  return *--(--energies.end());
325 
326 
327 }
int i
Definition: DBlmapReader.cc:9
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)
U second(std::pair< T, U > const &p)
bool first
Definition: L1TdeRCT.cc:94
float EcalClusterTools::e2x2 ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 188 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

Referenced by EBClusterTask::analyze(), EEClusterTask::analyze(), EcalClusterLazyTools::e2x2(), and PiZeroDiscriminatorProducer::produce().

189 {
190  DetId id = getMaximum( cluster.hitsAndFractions(), recHits ).first;
191  std::list<float> energies;
192  energies.push_back( matrixEnergy( cluster, recHits, topology, id, -1, 0, -1, 0 ) );
193  energies.push_back( matrixEnergy( cluster, recHits, topology, id, -1, 0, 0, 1 ) );
194  energies.push_back( matrixEnergy( cluster, recHits, topology, id, 0, 1, 0, 1 ) );
195  energies.push_back( matrixEnergy( cluster, recHits, topology, id, 0, 1, -1, 0 ) );
196 
197 
198  return *std::max_element(energies.begin(),energies.end());
199 
200 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::e2x2 ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
std::vector< int >  flagsexcl,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv 
)
static

Definition at line 203 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

204 {
205  DetId id = getMaximum( cluster.hitsAndFractions(), recHits ).first;
206  std::list<float> energies;
207  energies.push_back( matrixEnergy( cluster, recHits, topology, id, -1, 0, -1, 0,flagsexcl, severitiesexcl, sevLv ) );
208  energies.push_back( matrixEnergy( cluster, recHits, topology, id, -1, 0, 0, 1,flagsexcl, severitiesexcl, sevLv ) );
209  energies.push_back( matrixEnergy( cluster, recHits, topology, id, 0, 1, 0, 1,flagsexcl, severitiesexcl, sevLv ) );
210  energies.push_back( matrixEnergy( cluster, recHits, topology, id, 0, 1, -1, 0,flagsexcl, severitiesexcl, sevLv ) );
211 
212 
213  return *std::max_element(energies.begin(),energies.end());
214 
215 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::e2x5Bottom ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 372 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

Referenced by SuperClusterHelper::e2x5Bottom(), EcalClusterLazyTools::e2x5Bottom(), and PiZeroDiscriminatorProducer::produce().

373 {
374  DetId id = getMaximum( cluster.hitsAndFractions(), recHits ).first;
375  return matrixEnergy( cluster, recHits, topology, id, -2, 2, -2, -1 );
376 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::e2x5Bottom ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
std::vector< int >  flagsexcl,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv 
)
static

Definition at line 378 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

379 {
380  DetId id = getMaximum( cluster.hitsAndFractions(), recHits,flagsexcl, severitiesexcl, sevLv ).first;
381  return matrixEnergy( cluster, recHits, topology, id, -2, 2, -2, -1,flagsexcl, severitiesexcl, sevLv );
382 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::e2x5Left ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 345 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

Referenced by SuperClusterHelper::e2x5Left(), EcalClusterLazyTools::e2x5Left(), and PiZeroDiscriminatorProducer::produce().

346 {
347  DetId id = getMaximum( cluster.hitsAndFractions(), recHits ).first;
348  return matrixEnergy( cluster, recHits, topology, id, -2, -1, -2, 2 );
349 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::e2x5Left ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
std::vector< int >  flagsexcl,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv 
)
static

Definition at line 351 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

352 {
353  DetId id = getMaximum( cluster.hitsAndFractions(), recHits,flagsexcl, severitiesexcl, sevLv ).first;
354  return matrixEnergy( cluster, recHits, topology, id, -2, -1, -2, 2,flagsexcl, severitiesexcl, sevLv );
355 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::e2x5Max ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 386 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

Referenced by GsfElectronAlgo::calculateShowerShape(), SuperClusterHelper::e2x5Max(), EcalClusterLazyTools::e2x5Max(), and PhotonProducer::fillPhotonCollection().

387 {
388  DetId id = getMaximum( cluster.hitsAndFractions(), recHits ).first;
389 
390  // 1x5 strip left of seed
391  float left = matrixEnergy( cluster, recHits, topology, id, -1, -1, -2, 2 );
392  // 1x5 strip right of seed
393  float right = matrixEnergy( cluster, recHits, topology, id, 1, 1, -2, 2 );
394  // 1x5 strip containing seed
395  float centre = matrixEnergy( cluster, recHits, topology, id, 0, 0, -2, 2 );
396 
397  // Return the maximum of (left+center) or (right+center) strip
398  return left > right ? left+centre : right+centre;
399 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::e2x5Max ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
std::vector< int >  flagsexcl,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv 
)
static

Definition at line 401 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

402 {
403  DetId id = getMaximum( cluster.hitsAndFractions(), recHits,flagsexcl, severitiesexcl, sevLv ).first;
404 
405  // 1x5 strip left of seed
406  float left = matrixEnergy( cluster, recHits, topology, id, -1, -1, -2, 2,flagsexcl, severitiesexcl, sevLv );
407  // 1x5 strip right of seed
408  float right = matrixEnergy( cluster, recHits, topology, id, 1, 1, -2, 2,flagsexcl, severitiesexcl, sevLv );
409  // 1x5 strip containing seed
410  float centre = matrixEnergy( cluster, recHits, topology, id, 0, 0, -2, 2,flagsexcl, severitiesexcl, sevLv );
411 
412  // Return the maximum of (left+center) or (right+center) strip
413  return left > right ? left+centre : right+centre;
414 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::e2x5Right ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 331 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

Referenced by SuperClusterHelper::e2x5Right(), and EcalClusterLazyTools::e2x5Right().

332 {
333  DetId id = getMaximum( cluster.hitsAndFractions(), recHits ).first;
334  return matrixEnergy( cluster, recHits, topology, id, 1, 2, -2, 2 );
335 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::e2x5Right ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
std::vector< int >  flagsexcl,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv 
)
static

Definition at line 338 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

339 {
340  DetId id = getMaximum( cluster.hitsAndFractions(), recHits,flagsexcl, severitiesexcl, sevLv ).first;
341  return matrixEnergy( cluster, recHits, topology, id, 1, 2, -2, 2,flagsexcl, severitiesexcl, sevLv );
342 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::e2x5Top ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 359 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

Referenced by SuperClusterHelper::e2x5Top(), EcalClusterLazyTools::e2x5Top(), and PiZeroDiscriminatorProducer::produce().

360 {
361  DetId id = getMaximum( cluster.hitsAndFractions(), recHits ).first;
362  return matrixEnergy( cluster, recHits, topology, id, -2, 2, 1, 2 );
363 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::e2x5Top ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
std::vector< int >  flagsexcl,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv 
)
static

Definition at line 365 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

366 {
367  DetId id = getMaximum( cluster.hitsAndFractions(), recHits,flagsexcl, severitiesexcl, sevLv ).first;
368  return matrixEnergy( cluster, recHits, topology, id, -2, 2, 1, 2,flagsexcl, severitiesexcl, sevLv );
369 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::e3x1 ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 458 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

Referenced by EcalClusterLazyTools::e3x1().

459 {
460  DetId id = getMaximum( cluster.hitsAndFractions(), recHits ).first;
461  return matrixEnergy( cluster, recHits, topology, id, -1, 1, 0, 0 );
462 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::e3x1 ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
std::vector< int >  flagsexcl,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv 
)
static

Definition at line 464 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

465 {
466  DetId id = getMaximum( cluster.hitsAndFractions(), recHits ).first;
467  return matrixEnergy( cluster, recHits, topology, id, -1, 1, 0, 0,flagsexcl, severitiesexcl, sevLv );
468 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::e3x2 ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 218 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

Referenced by EcalClusterLazyTools::e3x2(), and PiZeroDiscriminatorProducer::produce().

219 {
220  DetId id = getMaximum( cluster.hitsAndFractions(), recHits ).first;
221  std::list<float> energies;
222  energies.push_back( matrixEnergy( cluster, recHits, topology, id, -1, 1, -1, 0 ) );
223  energies.push_back( matrixEnergy( cluster, recHits, topology, id, 0, 1, -1, 1 ) );
224  energies.push_back( matrixEnergy( cluster, recHits, topology, id, -1, 1, 0, 1 ) );
225  energies.push_back( matrixEnergy( cluster, recHits, topology, id, -1, 0, -1, 1 ) );
226  return *std::max_element(energies.begin(),energies.end());
227 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::e3x2 ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
std::vector< int >  flagsexcl,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv 
)
static

Definition at line 229 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

230 {
231  DetId id = getMaximum( cluster.hitsAndFractions(), recHits ).first;
232  std::list<float> energies;
233  energies.push_back( matrixEnergy( cluster, recHits, topology, id, -1, 1, -1, 0,flagsexcl, severitiesexcl, sevLv ) );
234  energies.push_back( matrixEnergy( cluster, recHits, topology, id, 0, 1, -1, 1,flagsexcl, severitiesexcl, sevLv ) );
235  energies.push_back( matrixEnergy( cluster, recHits, topology, id, -1, 1, 0, 1,flagsexcl, severitiesexcl, sevLv ) );
236  energies.push_back( matrixEnergy( cluster, recHits, topology, id, -1, 0, -1, 1,flagsexcl, severitiesexcl, sevLv ) );
237  return *std::max_element(energies.begin(),energies.end());
238 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::e3x3 ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 240 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

Referenced by EBClusterTask::analyze(), EEClusterTask::analyze(), ContainmentCorrectionAnalyzer::analyze(), HiEgammaSCEnergyCorrectionAlgo::applyCorrection(), GsfElectronAlgo::calculateShowerShape(), SuperClusterHelper::e3x3(), EcalClusterLazyTools::e3x3(), egHLT::OffHelper::fillClusShapeData(), PhotonProducer::fillPhotonCollection(), PiZeroDiscriminatorProducer::produce(), ecaldqm::ClusterTask::runOnSuperClusters(), and SuperClusterHelper::subClusterE3x3().

241 {
242  DetId id = getMaximum( cluster.hitsAndFractions(), recHits ).first;
243  return matrixEnergy( cluster, recHits, topology, id, -1, 1, -1, 1 );
244 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::e3x3 ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
std::vector< int >  flagsexcl,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv 
)
static

Definition at line 247 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

248 {
249  DetId id = getMaximum( cluster.hitsAndFractions(), recHits ).first;
250  return matrixEnergy( cluster, recHits, topology, id, -1, 1, -1, 1,flagsexcl, severitiesexcl, sevLv );
251 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::e4x4 ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 254 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

Referenced by EcalClusterLazyTools::e4x4().

255 {
256  DetId id = getMaximum( cluster.hitsAndFractions(), recHits ).first;
257  std::list<float> energies;
258  energies.push_back( matrixEnergy( cluster, recHits, topology, id, -1, 2, -2, 1 ) );
259  energies.push_back( matrixEnergy( cluster, recHits, topology, id, -2, 1, -2, 1 ) );
260  energies.push_back( matrixEnergy( cluster, recHits, topology, id, -2, 1, -1, 2 ) );
261  energies.push_back( matrixEnergy( cluster, recHits, topology, id, -1, 2, -1, 2 ) );
262  return *std::max_element(energies.begin(),energies.end());
263 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::e4x4 ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
std::vector< int >  flagsexcl,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv 
)
static

Definition at line 265 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

266 {
267  DetId id = getMaximum( cluster.hitsAndFractions(), recHits ).first;
268  std::list<float> energies;
269  energies.push_back( matrixEnergy( cluster, recHits, topology, id, -1, 2, -2, 1,flagsexcl, severitiesexcl, sevLv ) );
270  energies.push_back( matrixEnergy( cluster, recHits, topology, id, -2, 1, -2, 1,flagsexcl, severitiesexcl, sevLv ) );
271  energies.push_back( matrixEnergy( cluster, recHits, topology, id, -2, 1, -1, 2,flagsexcl, severitiesexcl, sevLv ) );
272  energies.push_back( matrixEnergy( cluster, recHits, topology, id, -1, 2, -1, 2,flagsexcl, severitiesexcl, sevLv ) );
273  return *std::max_element(energies.begin(),energies.end());
274 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::e5x1 ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 432 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

Referenced by EcalClusterLazyTools::e5x1().

433 {
434  DetId id = getMaximum( cluster.hitsAndFractions(), recHits ).first;
435  return matrixEnergy( cluster, recHits, topology, id, -2, 2, 0, 0 );
436 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::e5x1 ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
std::vector< int >  flagsexcl,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv 
)
static

Definition at line 438 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

439 {
440  DetId id = getMaximum( cluster.hitsAndFractions(), recHits).first;
441  return matrixEnergy( cluster, recHits, topology, id, -2, 2, 0, 0,flagsexcl, severitiesexcl, sevLv );
442 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::e5x5 ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 278 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

Referenced by EBClusterTask::analyze(), EEClusterTask::analyze(), ContainmentCorrectionAnalyzer::analyze(), HiEgammaSCEnergyCorrectionAlgo::applyCorrection(), GsfElectronAlgo::calculateShowerShape(), covariances(), SuperClusterHelper::e5x5(), EcalClusterLazyTools::e5x5(), PhotonProducer::fillPhotonCollection(), localCovariances(), meanClusterPosition(), PiZeroDiscriminatorProducer::produce(), and scLocalCovariances().

279 {
280  DetId id = getMaximum( cluster.hitsAndFractions(), recHits ).first;
281  return matrixEnergy( cluster, recHits, topology, id, -2, 2, -2, 2 );
282 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::e5x5 ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
std::vector< int >  flagsexcl,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv 
)
static

Definition at line 284 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

285 {
286  DetId id = getMaximum( cluster.hitsAndFractions(), recHits,flagsexcl, severitiesexcl, sevLv ).first;
287  return matrixEnergy( cluster, recHits, topology, id, -2, 2, -2, 2,flagsexcl, severitiesexcl, sevLv );
288 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::eBottom ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 511 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

Referenced by EBRecoSummary::analyze(), SuperClusterHelper::eBottom(), EcalClusterLazyTools::eBottom(), and PiZeroDiscriminatorProducer::produce().

512 {
513  DetId id = getMaximum( cluster.hitsAndFractions(), recHits ).first;
514  return matrixEnergy( cluster, recHits, topology, id, 0, 0, -1, -1 );
515 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::eBottom ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
std::vector< int >  flagsexcl,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv 
)
static

Definition at line 517 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

518 {
519  DetId id = getMaximum( cluster.hitsAndFractions(), recHits ).first;
520  return matrixEnergy( cluster, recHits, topology, id, 0, 0, -1, -1,flagsexcl, severitiesexcl, sevLv );
521 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::eLeft ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 471 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

Referenced by EBRecoSummary::analyze(), SuperClusterHelper::eLeft(), EcalClusterLazyTools::eLeft(), and PiZeroDiscriminatorProducer::produce().

472 {
473  DetId id = getMaximum( cluster.hitsAndFractions(), recHits ).first;
474  return matrixEnergy( cluster, recHits, topology, id, -1, -1, 0, 0 );
475 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::eLeft ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
std::vector< int >  flagsexcl,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv 
)
static

Definition at line 477 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

478 {
479  DetId id = getMaximum( cluster.hitsAndFractions(), recHits ).first;
480  return matrixEnergy( cluster, recHits, topology, id, -1, -1, 0, 0,flagsexcl, severitiesexcl, sevLv );
481 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::eMax ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits 
)
static

Definition at line 290 of file EcalClusterTools.cc.

References getMaximum(), and edm::second().

Referenced by EBRecoSummary::analyze(), ContainmentCorrectionAnalyzer::analyze(), SuperClusterHelper::eMax(), EcalClusterLazyTools::eMax(), PhotonProducer::fillPhotonCollection(), PiZeroDiscriminatorProducer::produce(), and SuperClusterHelper::subClusterEmax().

291 {
292  return getMaximum( cluster.hitsAndFractions(), recHits ).second;
293 }
U second(std::pair< T, U > const &p)
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::eMax ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
std::vector< int >  flagsexcl,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv 
)
static

Definition at line 295 of file EcalClusterTools.cc.

References getMaximum(), and edm::second().

296 {
297  return getMaximum( cluster.hitsAndFractions(), recHits,flagsexcl, severitiesexcl, sevLv ).second;
298 }
U second(std::pair< T, U > const &p)
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
std::vector< float > EcalClusterTools::energyBasketFractionEta ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits 
)
static

Definition at line 523 of file EcalClusterTools.cc.

References EcalBarrel, first, i, EBDetId::im(), EBDetId::kModulesPerSM, EBDetId::positiveZ(), recHitEnergy(), and python.multivaluedict::sort().

Referenced by EcalClusterLazyTools::energyBasketFractionEta().

524 {
525  std::vector<float> basketFraction( 2 * EBDetId::kModulesPerSM );
526  float clusterEnergy = cluster.energy();
527  std::vector< std::pair<DetId, float> > v_id = cluster.hitsAndFractions();
528  if ( v_id[0].first.subdetId() != EcalBarrel ) {
529  edm::LogWarning("EcalClusterTools::energyBasketFractionEta") << "Trying to get basket fraction for endcap basic-clusters. Basket fractions can be obtained ONLY for barrel basic-clusters. Returning empty vector.";
530  return basketFraction;
531  }
532  for ( size_t i = 0; i < v_id.size(); ++i ) {
533  basketFraction[ EBDetId(v_id[i].first).im()-1 + EBDetId(v_id[i].first).positiveZ()*EBDetId::kModulesPerSM ] += recHitEnergy( v_id[i].first, recHits ) * v_id[i].second / clusterEnergy;
534  }
535  std::sort( basketFraction.rbegin(), basketFraction.rend() );
536  return basketFraction;
537 }
int i
Definition: DBlmapReader.cc:9
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)
int im() const
get the number of module inside the SM (1-4)
Definition: EBDetId.cc:85
static const int kModulesPerSM
Definition: EBDetId.h:126
bool first
Definition: L1TdeRCT.cc:94
bool positiveZ() const
Definition: EBDetId.h:65
std::vector< float > EcalClusterTools::energyBasketFractionEta ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
std::vector< int >  flagsexcl,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv 
)
static

Definition at line 540 of file EcalClusterTools.cc.

References EcalBarrel, first, i, EBDetId::im(), EBDetId::kModulesPerSM, EBDetId::positiveZ(), recHitEnergy(), and python.multivaluedict::sort().

541 {
542  std::vector<float> basketFraction( 2 * EBDetId::kModulesPerSM );
543  float clusterEnergy = cluster.energy();
544  std::vector< std::pair<DetId, float> > v_id = cluster.hitsAndFractions();
545  if ( v_id[0].first.subdetId() != EcalBarrel ) {
546  edm::LogWarning("EcalClusterTools::energyBasketFractionEta") << "Trying to get basket fraction for endcap basic-clusters. Basket fractions can be obtained ONLY for barrel basic-clusters. Returning empty vector.";
547  return basketFraction;
548  }
549  for ( size_t i = 0; i < v_id.size(); ++i ) {
550  basketFraction[ EBDetId(v_id[i].first).im()-1 + EBDetId(v_id[i].first).positiveZ()*EBDetId::kModulesPerSM ] += recHitEnergy( v_id[i].first, recHits,flagsexcl, severitiesexcl, sevLv ) * v_id[i].second / clusterEnergy;
551  }
552  std::sort( basketFraction.rbegin(), basketFraction.rend() );
553  return basketFraction;
554 }
int i
Definition: DBlmapReader.cc:9
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)
int im() const
get the number of module inside the SM (1-4)
Definition: EBDetId.cc:85
static const int kModulesPerSM
Definition: EBDetId.h:126
bool first
Definition: L1TdeRCT.cc:94
bool positiveZ() const
Definition: EBDetId.h:65
std::vector< float > EcalClusterTools::energyBasketFractionPhi ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits 
)
static

Definition at line 556 of file EcalClusterTools.cc.

References EcalBarrel, first, i, EBDetId::iphi(), EBDetId::kCrystalsInPhi, EBDetId::kTowersInPhi, EBDetId::MAX_IPHI, EBDetId::positiveZ(), recHitEnergy(), and python.multivaluedict::sort().

Referenced by EcalClusterLazyTools::energyBasketFractionPhi().

557 {
558  std::vector<float> basketFraction( 2 * (EBDetId::MAX_IPHI / EBDetId::kCrystalsInPhi) );
559  float clusterEnergy = cluster.energy();
560  std::vector< std::pair<DetId, float> > v_id = cluster.hitsAndFractions();
561  if ( v_id[0].first.subdetId() != EcalBarrel ) {
562  edm::LogWarning("EcalClusterTools::energyBasketFractionPhi") << "Trying to get basket fraction for endcap basic-clusters. Basket fractions can be obtained ONLY for barrel basic-clusters. Returning empty vector.";
563  return basketFraction;
564  }
565  for ( size_t i = 0; i < v_id.size(); ++i ) {
566  basketFraction[ (EBDetId(v_id[i].first).iphi()-1)/EBDetId::kCrystalsInPhi + EBDetId(v_id[i].first).positiveZ()*EBDetId::kTowersInPhi] += recHitEnergy( v_id[i].first, recHits ) * v_id[i].second / clusterEnergy;
567  }
568  std::sort( basketFraction.rbegin(), basketFraction.rend() );
569  return basketFraction;
570 }
int i
Definition: DBlmapReader.cc:9
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)
static const int kTowersInPhi
Definition: EBDetId.h:125
int iphi() const
get the crystal iphi
Definition: EBDetId.h:46
static const int kCrystalsInPhi
Definition: EBDetId.h:128
bool first
Definition: L1TdeRCT.cc:94
bool positiveZ() const
Definition: EBDetId.h:65
static const int MAX_IPHI
Definition: EBDetId.h:123
std::vector< float > EcalClusterTools::energyBasketFractionPhi ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
std::vector< int >  flagsexcl,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv 
)
static

Definition at line 573 of file EcalClusterTools.cc.

References EcalBarrel, first, i, EBDetId::iphi(), EBDetId::kCrystalsInPhi, EBDetId::kTowersInPhi, EBDetId::MAX_IPHI, EBDetId::positiveZ(), recHitEnergy(), and python.multivaluedict::sort().

574 {
575  std::vector<float> basketFraction( 2 * (EBDetId::MAX_IPHI / EBDetId::kCrystalsInPhi) );
576  float clusterEnergy = cluster.energy();
577  std::vector< std::pair<DetId, float> > v_id = cluster.hitsAndFractions();
578  if ( v_id[0].first.subdetId() != EcalBarrel ) {
579  edm::LogWarning("EcalClusterTools::energyBasketFractionPhi") << "Trying to get basket fraction for endcap basic-clusters. Basket fractions can be obtained ONLY for barrel basic-clusters. Returning empty vector.";
580  return basketFraction;
581  }
582  for ( size_t i = 0; i < v_id.size(); ++i ) {
583  basketFraction[ (EBDetId(v_id[i].first).iphi()-1)/EBDetId::kCrystalsInPhi + EBDetId(v_id[i].first).positiveZ()*EBDetId::kTowersInPhi] += recHitEnergy( v_id[i].first, recHits,flagsexcl, severitiesexcl, sevLv ) * v_id[i].second / clusterEnergy;
584  }
585  std::sort( basketFraction.rbegin(), basketFraction.rend() );
586  return basketFraction;
587 }
int i
Definition: DBlmapReader.cc:9
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)
static const int kTowersInPhi
Definition: EBDetId.h:125
int iphi() const
get the crystal iphi
Definition: EBDetId.h:46
static const int kCrystalsInPhi
Definition: EBDetId.h:128
bool first
Definition: L1TdeRCT.cc:94
bool positiveZ() const
Definition: EBDetId.h:65
static const int MAX_IPHI
Definition: EBDetId.h:123
float EcalClusterTools::eRight ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 484 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

Referenced by EBRecoSummary::analyze(), SuperClusterHelper::eRight(), EcalClusterLazyTools::eRight(), and PiZeroDiscriminatorProducer::produce().

485 {
486  DetId id = getMaximum( cluster.hitsAndFractions(), recHits ).first;
487  return matrixEnergy( cluster, recHits, topology, id, 1, 1, 0, 0 );
488 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::eRight ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
std::vector< int >  flagsexcl,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv 
)
static

Definition at line 490 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

491 {
492  DetId id = getMaximum( cluster.hitsAndFractions(), recHits ).first;
493  return matrixEnergy( cluster, recHits, topology, id, 1, 1, 0, 0,flagsexcl, severitiesexcl, sevLv );
494 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::eTop ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
static

Definition at line 497 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

Referenced by EBRecoSummary::analyze(), SuperClusterHelper::eTop(), EcalClusterLazyTools::eTop(), and PiZeroDiscriminatorProducer::produce().

498 {
499  DetId id = getMaximum( cluster.hitsAndFractions(), recHits ).first;
500  return matrixEnergy( cluster, recHits, topology, id, 0, 0, 1, 1 );
501 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
float EcalClusterTools::eTop ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
std::vector< int >  flagsexcl,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv 
)
static

Definition at line 503 of file EcalClusterTools.cc.

References first, getMaximum(), and matrixEnergy().

504 {
505  DetId id = getMaximum( cluster.hitsAndFractions(), recHits ).first;
506  return matrixEnergy( cluster, recHits, topology, id, 0, 0, 1, 1,flagsexcl, severitiesexcl, sevLv );
507 }
static float matrixEnergy(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
static double EcalClusterTools::f00 ( double  r)
inlinestaticprivate

Definition at line 217 of file EcalClusterTools.h.

Referenced by fast_AbsZernikeMoment().

217 { return 1; }
static double EcalClusterTools::f11 ( double  r)
inlinestaticprivate

Definition at line 218 of file EcalClusterTools.h.

References alignCSCRings::r.

Referenced by fast_AbsZernikeMoment().

218 { return r; }
static double EcalClusterTools::f20 ( double  r)
inlinestaticprivate

Definition at line 219 of file EcalClusterTools.h.

Referenced by fast_AbsZernikeMoment().

219 { return 2.0*r*r-1.0; }
static double EcalClusterTools::f22 ( double  r)
inlinestaticprivate

Definition at line 220 of file EcalClusterTools.h.

References alignCSCRings::r.

Referenced by fast_AbsZernikeMoment().

220 { return r*r; }
static double EcalClusterTools::f31 ( double  r)
inlinestaticprivate

Definition at line 221 of file EcalClusterTools.h.

References alignCSCRings::r.

Referenced by fast_AbsZernikeMoment().

221 { return 3.0*r*r*r - 2.0*r; }
static double EcalClusterTools::f33 ( double  r)
inlinestaticprivate

Definition at line 222 of file EcalClusterTools.h.

References alignCSCRings::r.

Referenced by fast_AbsZernikeMoment().

222 { return r*r*r; }
static double EcalClusterTools::f40 ( double  r)
inlinestaticprivate

Definition at line 223 of file EcalClusterTools.h.

Referenced by fast_AbsZernikeMoment().

223 { return 6.0*r*r*r*r-6.0*r*r+1.0; }
static double EcalClusterTools::f42 ( double  r)
inlinestaticprivate

Definition at line 224 of file EcalClusterTools.h.

References alignCSCRings::r.

Referenced by fast_AbsZernikeMoment().

224 { return 4.0*r*r*r*r-3.0*r*r; }
static double EcalClusterTools::f44 ( double  r)
inlinestaticprivate

Definition at line 225 of file EcalClusterTools.h.

References alignCSCRings::r.

Referenced by fast_AbsZernikeMoment().

225 { return r*r*r*r; }
static double EcalClusterTools::f51 ( double  r)
inlinestaticprivate

Definition at line 226 of file EcalClusterTools.h.

References funct::pow(), and alignCSCRings::r.

Referenced by fast_AbsZernikeMoment().

226 { return 10.0*pow(r,5)-12.0*pow(r,3)+3.0*r; }
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
static double EcalClusterTools::f53 ( double  r)
inlinestaticprivate

Definition at line 227 of file EcalClusterTools.h.

References funct::pow().

Referenced by fast_AbsZernikeMoment().

227 { return 5.0*pow(r,5) - 4.0*pow(r,3); }
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
static double EcalClusterTools::f55 ( double  r)
inlinestaticprivate

Definition at line 228 of file EcalClusterTools.h.

References funct::pow().

Referenced by fast_AbsZernikeMoment().

228 { return pow(r,5); }
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
static double EcalClusterTools::factorial ( int  n)
inlinestaticprivate

Definition at line 234 of file EcalClusterTools.h.

References i, and n.

Referenced by calc_AbsZernikeMoment().

234  {
235  double res = 1.;
236  for (int i = 2; i <= n; ++i) res *= i;
237  return res;
238  }
int i
Definition: DBlmapReader.cc:9
double EcalClusterTools::fast_AbsZernikeMoment ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloGeometry geometry,
int  n,
int  m,
double  R0,
bool  logW,
float  w0 
)
staticprivate

Definition at line 1173 of file EcalClusterTools.cc.

References funct::cos(), alignCSCRings::e, f00(), f11(), f20(), f22(), f31(), f33(), f40(), f42(), f44(), f51(), f53(), f55(), getEnergyDepTopology(), i, getHLTprescales::index, phi, alignCSCRings::r, funct::sin(), and mathSSE::sqrt().

Referenced by absZernikeMoment().

1174 {
1175  double r,ph,e,Re=0,Im=0;
1176  double TotalEnergy = cluster.energy();
1177  int index = (n/2)*(n/2)+(n/2)+m;
1178  std::vector<EcalClusterEnergyDeposition> energyDistribution = getEnergyDepTopology( cluster, recHits, geometry, logW, w0 );
1179  int clusterSize = energyDistribution.size();
1180  if(clusterSize < 3) return 0.0;
1181 
1182  for (int i=0; i<clusterSize; i++)
1183  {
1184  r = energyDistribution[i].r / R0;
1185  if (r<1) {
1186  std::vector<double> pol;
1187  pol.push_back( f00(r) );
1188  pol.push_back( f11(r) );
1189  pol.push_back( f20(r) );
1190  pol.push_back( f22(r) );
1191  pol.push_back( f31(r) );
1192  pol.push_back( f33(r) );
1193  pol.push_back( f40(r) );
1194  pol.push_back( f42(r) );
1195  pol.push_back( f44(r) );
1196  pol.push_back( f51(r) );
1197  pol.push_back( f53(r) );
1198  pol.push_back( f55(r) );
1199  ph = (energyDistribution[i]).phi;
1200  e = energyDistribution[i].deposited_energy;
1201  Re = Re + e/TotalEnergy * pol[index] * cos( (double) m * ph);
1202  Im = Im - e/TotalEnergy * pol[index] * sin( (double) m * ph);
1203  }
1204  }
1205  return sqrt(Re*Re+Im*Im);
1206 }
int i
Definition: DBlmapReader.cc:9
static double f42(double r)
static double f53(double r)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
static double f51(double r)
static std::vector< EcalClusterEnergyDeposition > getEnergyDepTopology(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloGeometry *geometry, bool logW, float w0)
static double f00(double r)
T sqrt(T t)
Definition: SSEVec.h:46
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
static double f44(double r)
static double f55(double r)
static double f40(double r)
static double f31(double r)
static double f20(double r)
static double f33(double r)
static double f22(double r)
static double f11(double r)
Definition: DDAxes.h:10
float EcalClusterTools::getDPhiEndcap ( const DetId crysId,
float  meanX,
float  meanY 
)
staticprivate

Definition at line 1336 of file EcalClusterTools.cc.

References dPhi(), getNormedIX(), getNormedIY(), phi, mathSSE::sqrt(), and tmp.

Referenced by localCovariances(), and scLocalCovariances().

1337 {
1338  float iXNorm = getNormedIX(crysId);
1339  float iYNorm = getNormedIY(crysId);
1340 
1341  float hitLocalR2 = (iXNorm-meanX)*(iXNorm-meanX)+(iYNorm-meanY)*(iYNorm-meanY);
1342  float hitR2 = iXNorm*iXNorm+iYNorm*iYNorm;
1343  float meanR2 = meanX*meanX+meanY*meanY;
1344  float hitR = sqrt(hitR2);
1345  float meanR = sqrt(meanR2);
1346 
1347  float tmp = (hitR2+meanR2-hitLocalR2)/(2*hitR*meanR);
1348  if (tmp<-1) tmp =-1;
1349  if (tmp>1) tmp=1;
1350  float phi = acos(tmp);
1351  float dPhi = hitR*phi;
1352 
1353  return dPhi;
1354 }
static float getNormedIX(const DetId &id)
double dPhi(double phi1, double phi2)
Definition: JetUtil.h:30
static float getNormedIY(const DetId &id)
T sqrt(T t)
Definition: SSEVec.h:46
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
Definition: DDAxes.h:10
std::vector< EcalClusterTools::EcalClusterEnergyDeposition > EcalClusterTools::getEnergyDepTopology ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloGeometry geometry,
bool  logW,
float  w0 
)
staticprivate

Definition at line 590 of file EcalClusterTools.cc.

References EcalClusterTools::EcalClusterEnergyDeposition::deposited_energy, diffTreeTool::diff, edm::SortedCollection< T, SORT >::end(), CaloRecHit::energy(), edm::SortedCollection< T, SORT >::find(), CaloSubdetectorGeometry::getGeometry(), CaloCellGeometry::getPosition(), CaloGeometry::getSubdetectorGeometry(), create_public_lumi_plots::log, LogDebug, M_PI, max(), EcalClusterTools::EcalClusterEnergyDeposition::phi, EcalClusterTools::EcalClusterEnergyDeposition::r, CommonMethods::weight(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by calc_AbsZernikeMoment(), fast_AbsZernikeMoment(), and lat().

591 {
592  std::vector<EcalClusterTools::EcalClusterEnergyDeposition> energyDistribution;
593  // init a map of the energy deposition centered on the
594  // cluster centroid. This is for momenta calculation only.
595  CLHEP::Hep3Vector clVect(cluster.position().x(), cluster.position().y(), cluster.position().z());
596  CLHEP::Hep3Vector clDir(clVect);
597  clDir*=1.0/clDir.mag();
598  // in the transverse plane, axis perpendicular to clusterDir
599  CLHEP::Hep3Vector theta_axis(clDir.y(),-clDir.x(),0.0);
600  theta_axis *= 1.0/theta_axis.mag();
601  CLHEP::Hep3Vector phi_axis = theta_axis.cross(clDir);
602 
603  std::vector< std::pair<DetId, float> > clusterDetIds = cluster.hitsAndFractions();
604 
606  EcalRecHit testEcalRecHit;
607  std::vector< std::pair<DetId, float> >::iterator posCurrent;
608  // loop over crystals
609  for(posCurrent=clusterDetIds.begin(); posCurrent!=clusterDetIds.end(); ++posCurrent) {
610  EcalRecHitCollection::const_iterator itt = recHits->find( (*posCurrent).first );
611  testEcalRecHit=*itt;
612 
613  if(( (*posCurrent).first != DetId(0)) && (recHits->find( (*posCurrent).first ) != recHits->end())) {
614  clEdep.deposited_energy = testEcalRecHit.energy() * (*posCurrent).second;
615  // if logarithmic weight is requested, apply cut on minimum energy of the recHit
616  if(logW) {
617  //double w0 = parameterMap_.find("W0")->second;
618 
619  double weight = std::max(0.0, w0 + log(fabs(clEdep.deposited_energy)/cluster.energy()) );
620  if(weight==0) {
621  LogDebug("ClusterShapeAlgo") << "Crystal has insufficient energy: E = "
622  << clEdep.deposited_energy << " GeV; skipping... ";
623  continue;
624  }
625  else LogDebug("ClusterShapeAlgo") << "===> got crystal. Energy = " << clEdep.deposited_energy << " GeV. ";
626  }
627  DetId id_ = (*posCurrent).first;
628  const CaloCellGeometry *this_cell = geometry->getSubdetectorGeometry(id_)->getGeometry(id_);
629  GlobalPoint cellPos = this_cell->getPosition();
630  CLHEP::Hep3Vector gblPos (cellPos.x(),cellPos.y(),cellPos.z()); //surface position?
631  // Evaluate the distance from the cluster centroid
632  CLHEP::Hep3Vector diff = gblPos - clVect;
633  // Important: for the moment calculation, only the "lateral distance" is important
634  // "lateral distance" r_i = distance of the digi position from the axis Origin-Cluster Center
635  // ---> subtract the projection on clDir
636  CLHEP::Hep3Vector DigiVect = diff - diff.dot(clDir)*clDir;
637  clEdep.r = DigiVect.mag();
638  LogDebug("ClusterShapeAlgo") << "E = " << clEdep.deposited_energy
639  << "\tdiff = " << diff.mag()
640  << "\tr = " << clEdep.r;
641  clEdep.phi = DigiVect.angle(theta_axis);
642  if(DigiVect.dot(phi_axis)<0) clEdep.phi = 2 * M_PI - clEdep.phi;
643  energyDistribution.push_back(clEdep);
644  }
645  }
646  return energyDistribution;
647 }
#define LogDebug(id)
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:43
std::vector< EcalRecHit >::const_iterator const_iterator
T y() const
Definition: PV3DBase.h:62
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
const T & max(const T &a, const T &b)
float energy() const
Definition: CaloRecHit.h:19
T z() const
Definition: PV3DBase.h:63
const_iterator end() const
Definition: DetId.h:20
#define M_PI
Definition: BFit3D.cc:3
iterator find(key_type k)
T x() const
Definition: PV3DBase.h:61
float EcalClusterTools::getFraction ( const std::vector< std::pair< DetId, float > > &  v_id,
DetId  id 
)
static

Definition at line 18 of file EcalClusterTools.cc.

References first, cropTnPTrees::frac, and i.

Referenced by matrixEnergy().

19  {
20  float frac = 1.0;
21  for ( size_t i = 0; i < v_id.size(); ++i ) {
22  if(v_id[i].first.rawId()==id.rawId()){
23  frac=v_id[i].second;
24  }
25  }
26  return frac;
27 }
int i
Definition: DBlmapReader.cc:9
bool first
Definition: L1TdeRCT.cc:94
float EcalClusterTools::getIEta ( const DetId id)
staticprivate

Definition at line 1243 of file EcalClusterTools.cc.

References DetId::Ecal, EcalBarrel, EcalEndcap, getNormedIX(), getNormedIY(), EBDetId::ieta(), and mathSSE::sqrt().

Referenced by cluster2ndMoments(), and getNrCrysDiffInEta().

1244 {
1245  if(id.det()==DetId::Ecal){
1246  if(id.subdetId()==EcalBarrel){
1247  EBDetId ebId(id);
1248  return ebId.ieta();
1249  }else if(id.subdetId()==EcalEndcap){
1250  float iXNorm = getNormedIX(id);
1251  float iYNorm = getNormedIY(id);
1252 
1253  return std::sqrt(iXNorm*iXNorm+iYNorm*iYNorm);
1254  }
1255  }
1256  return 0.;
1257 }
static float getNormedIX(const DetId &id)
static float getNormedIY(const DetId &id)
T sqrt(T t)
Definition: SSEVec.h:46
float EcalClusterTools::getIPhi ( const DetId id)
staticprivate

Definition at line 1264 of file EcalClusterTools.cc.

References DetId::Ecal, EcalBarrel, and EBDetId::iphi().

Referenced by cluster2ndMoments(), and getNrCrysDiffInPhi().

1265 {
1266  if(id.det()==DetId::Ecal){
1267  if(id.subdetId()==EcalBarrel){
1268  EBDetId ebId(id);
1269  return ebId.iphi();
1270  }
1271  }
1272  return 0.;
1273 }
std::pair< DetId, float > EcalClusterTools::getMaximum ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits 
)
static
std::pair< DetId, float > EcalClusterTools::getMaximum ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
std::vector< int >  flagsexcl,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv 
)
static

Definition at line 64 of file EcalClusterTools.cc.

References getMaximum().

65 {
66  return getMaximum( cluster.hitsAndFractions(), recHits, flagsexcl, severitiesexcl, sevLv );
67 }
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
std::pair< DetId, float > EcalClusterTools::getMaximum ( const std::vector< std::pair< DetId, float > > &  v_id,
const EcalRecHitCollection recHits 
)
static

Definition at line 30 of file EcalClusterTools.cc.

References relval_parameters_module::energy, first, i, errorMatrix2Lands_multiChannel::id, max(), and recHitEnergy().

31 {
32  float max = 0;
33  DetId id(0);
34  for ( size_t i = 0; i < v_id.size(); ++i ) {
35  float energy = recHitEnergy( v_id[i].first, recHits ) * v_id[i].second;
36  if ( energy > max ) {
37  max = energy;
38  id = v_id[i].first;
39  }
40  }
41  return std::pair<DetId, float>(id, max);
42 }
int i
Definition: DBlmapReader.cc:9
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)
const T & max(const T &a, const T &b)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
std::pair< DetId, float > EcalClusterTools::getMaximum ( const std::vector< std::pair< DetId, float > > &  v_id,
const EcalRecHitCollection recHits,
std::vector< int >  flagsexcl,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv 
)
static

Definition at line 44 of file EcalClusterTools.cc.

References relval_parameters_module::energy, first, i, errorMatrix2Lands_multiChannel::id, max(), and recHitEnergy().

45 {
46  float max = 0;
47  DetId id(0);
48  for ( size_t i = 0; i < v_id.size(); ++i ) {
49  float energy = recHitEnergy( v_id[i].first, recHits,flagsexcl, severitiesexcl, sevLv ) * v_id[i].second;
50  if ( energy > max ) {
51  max = energy;
52  id = v_id[i].first;
53  }
54  }
55  return std::pair<DetId, float>(id, max);
56 }
int i
Definition: DBlmapReader.cc:9
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)
const T & max(const T &a, const T &b)
bool first
Definition: L1TdeRCT.cc:94
Definition: DetId.h:20
float EcalClusterTools::getNormedIX ( const DetId id)
staticprivate

Definition at line 1276 of file EcalClusterTools.cc.

References DetId::Ecal, EcalEndcap, and EEDetId::ix().

Referenced by cluster2ndMoments(), getDPhiEndcap(), getIEta(), and mean5x5PositionInXY().

1277 {
1278  if(id.det()==DetId::Ecal && id.subdetId()==EcalEndcap){
1279  EEDetId eeId(id);
1280  int iXNorm = eeId.ix()-50;
1281  if(iXNorm<=0) iXNorm--;
1282  return iXNorm;
1283  }
1284  return 0;
1285 }
float EcalClusterTools::getNormedIY ( const DetId id)
staticprivate

Definition at line 1288 of file EcalClusterTools.cc.

References DetId::Ecal, EcalEndcap, and EEDetId::iy().

Referenced by cluster2ndMoments(), getDPhiEndcap(), getIEta(), and mean5x5PositionInXY().

1289 {
1290  if(id.det()==DetId::Ecal && id.subdetId()==EcalEndcap){
1291  EEDetId eeId(id);
1292  int iYNorm = eeId.iy()-50;
1293  if(iYNorm<=0) iYNorm--;
1294  return iYNorm;
1295  }
1296  return 0;
1297 }
float EcalClusterTools::getNrCrysDiffInEta ( const DetId crysId,
const DetId orginId 
)
staticprivate

Definition at line 1300 of file EcalClusterTools.cc.

References EcalBarrel, getIEta(), and DetId::subdetId().

Referenced by localCovariances(), mean5x5PositionInLocalCrysCoord(), and scLocalCovariances().

1301 {
1302  float crysIEta = getIEta(crysId);
1303  float orginIEta = getIEta(orginId);
1304  bool isBarrel = orginId.subdetId()==EcalBarrel;
1305 
1306  float nrCrysDiff = crysIEta-orginIEta;
1307 
1308  //no iEta=0 in barrel, so if go from positive to negative
1309  //need to reduce abs(detEta) by 1
1310  if(isBarrel){
1311  if(crysIEta*orginIEta<0){ // -1 to 1 transition
1312  if(crysIEta>0) nrCrysDiff--;
1313  else nrCrysDiff++;
1314  }
1315  }
1316  return nrCrysDiff;
1317 }
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
static float getIEta(const DetId &id)
float EcalClusterTools::getNrCrysDiffInPhi ( const DetId crysId,
const DetId orginId 
)
staticprivate

Definition at line 1320 of file EcalClusterTools.cc.

References EcalBarrel, getIPhi(), and DetId::subdetId().

Referenced by localCovariances(), mean5x5PositionInLocalCrysCoord(), and scLocalCovariances().

1321 {
1322  float crysIPhi = getIPhi(crysId);
1323  float orginIPhi = getIPhi(orginId);
1324  bool isBarrel = orginId.subdetId()==EcalBarrel;
1325 
1326  float nrCrysDiff = crysIPhi-orginIPhi;
1327 
1328  if(isBarrel){ //if barrel, need to map into 0-180
1329  if (nrCrysDiff > + 180) { nrCrysDiff = nrCrysDiff - 360; }
1330  if (nrCrysDiff < - 180) { nrCrysDiff = nrCrysDiff + 360; }
1331  }
1332  return nrCrysDiff;
1333 }
static float getIPhi(const DetId &id)
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
std::vector< int > EcalClusterTools::getSeedPosition ( std::vector< const EcalRecHit * >  RH_ptrs)
staticprivate

Definition at line 1918 of file EcalClusterTools.cc.

References EBDetId::ieta().

Referenced by roundnessBarrelSuperClustersUserExtended(), and roundnessSelectedBarrelRecHits().

1918  {
1919  std::vector<int> seedPosition;
1920  float eSeedRH = 0;
1921  int iEtaSeedRH = 0;
1922  int iPhiSeedRH = 0;
1923 
1924  for(std::vector<const EcalRecHit*>::const_iterator rh_ptr = RH_ptrs.begin(); rh_ptr != RH_ptrs.end(); rh_ptr++){
1925 
1926  //get iEta, iPhi
1927  EBDetId EBdetIdi( (*rh_ptr)->detid() );
1928 
1929  if(eSeedRH < (*rh_ptr)->energy()){
1930  eSeedRH = (*rh_ptr)->energy();
1931  iEtaSeedRH = EBdetIdi.ieta();
1932  iPhiSeedRH = EBdetIdi.iphi();
1933  }
1934 
1935  }// for loop
1936 
1937  seedPosition.push_back(iEtaSeedRH);
1938  seedPosition.push_back(iPhiSeedRH);
1939  return seedPosition;
1940 }
int ieta() const
get the crystal ieta
Definition: EBDetId.h:44
float EcalClusterTools::getSumEnergy ( std::vector< const EcalRecHit * >  RH_ptrs)
staticprivate

Definition at line 1943 of file EcalClusterTools.cc.

Referenced by cluster2ndMoments(), and roundnessSelectedBarrelRecHits().

1943  {
1944 
1945  float sumE = 0.;
1946 
1947  for(std::vector<const EcalRecHit*>::const_iterator rh_ptr = RH_ptrs.begin(); rh_ptr != RH_ptrs.end(); rh_ptr++){
1948  sumE += (*rh_ptr)->energy();
1949  }// for loop
1950 
1951  return sumE;
1952 }
std::vector< float > EcalClusterTools::lat ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloGeometry geometry,
bool  logW = true,
float  w0 = 4.7 
)
static

Definition at line 651 of file EcalClusterTools.cc.

References funct::cos(), getEnergyDepTopology(), i, n, phi, alignCSCRings::r, funct::sin(), and tmp.

Referenced by EcalClusterLazyTools::lat().

652 {
653  std::vector<EcalClusterTools::EcalClusterEnergyDeposition> energyDistribution = getEnergyDepTopology( cluster, recHits, geometry, logW, w0 );
654 
655  std::vector<float> lat;
656  double r, redmoment=0;
657  double phiRedmoment = 0 ;
658  double etaRedmoment = 0 ;
659  int n,n1,n2,tmp;
660  int clusterSize=energyDistribution.size();
661  float etaLat_, phiLat_, lat_;
662  if (clusterSize<3) {
663  etaLat_ = 0.0 ;
664  lat_ = 0.0;
665  lat.push_back(0.);
666  lat.push_back(0.);
667  lat.push_back(0.);
668  return lat;
669  }
670 
671  n1=0; n2=1;
672  if (energyDistribution[1].deposited_energy >
673  energyDistribution[0].deposited_energy)
674  {
675  tmp=n2; n2=n1; n1=tmp;
676  }
677  for (int i=2; i<clusterSize; i++) {
678  n=i;
679  if (energyDistribution[i].deposited_energy >
680  energyDistribution[n1].deposited_energy)
681  {
682  tmp = n2;
683  n2 = n1; n1 = i; n=tmp;
684  } else {
685  if (energyDistribution[i].deposited_energy >
686  energyDistribution[n2].deposited_energy)
687  {
688  tmp=n2; n2=i; n=tmp;
689  }
690  }
691 
692  r = energyDistribution[n].r;
693  redmoment += r*r* energyDistribution[n].deposited_energy;
694  double rphi = r * cos (energyDistribution[n].phi) ;
695  phiRedmoment += rphi * rphi * energyDistribution[n].deposited_energy;
696  double reta = r * sin (energyDistribution[n].phi) ;
697  etaRedmoment += reta * reta * energyDistribution[n].deposited_energy;
698  }
699  double e1 = energyDistribution[n1].deposited_energy;
700  double e2 = energyDistribution[n2].deposited_energy;
701 
702  lat_ = redmoment/(redmoment+2.19*2.19*(e1+e2));
703  phiLat_ = phiRedmoment/(phiRedmoment+2.19*2.19*(e1+e2));
704  etaLat_ = etaRedmoment/(etaRedmoment+2.19*2.19*(e1+e2));
705 
706  lat.push_back(etaLat_);
707  lat.push_back(phiLat_);
708  lat.push_back(lat_);
709  return lat;
710 }
int i
Definition: DBlmapReader.cc:9
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
static std::vector< EcalClusterEnergyDeposition > getEnergyDepTopology(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloGeometry *geometry, bool logW, float w0)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
static std::vector< float > lat(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloGeometry *geometry, bool logW=true, float w0=4.7)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
Definition: DDAxes.h:10
static std::vector<float> EcalClusterTools::lat ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloGeometry geometry,
std::vector< int >  flagsexcl,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv,
bool  logW = true,
float  w0 = 4.7 
)
static
std::vector< float > EcalClusterTools::localCovariances ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
float  w0 = 4.7 
)
static

Definition at line 983 of file EcalClusterTools.cc.

References RecoTauValidation_cfi::denominator, dPhi(), e5x5(), EcalBarrel, relval_parameters_module::energy, getDPhiEndcap(), getMaximum(), getNrCrysDiffInEta(), getNrCrysDiffInPhi(), CaloTopology::getSubdetectorTopology(), CaloNavigator< T >::home(), create_public_lumi_plots::log, max(), mean5x5PositionInLocalCrysCoord(), mean5x5PositionInXY(), CaloNavigator< T >::offsetBy(), recHitEnergy(), DetId::subdetId(), v, and w().

Referenced by GsfElectronAlgo::calculateShowerShape(), SuperClusterHelper::computeLocalCovariances(), egHLT::OffHelper::fillClusShapeData(), PhotonProducer::fillPhotonCollection(), and EcalClusterLazyTools::localCovariances().

984 {
985 
986  float e_5x5 = e5x5( cluster, recHits, topology );
987  float covEtaEta, covEtaPhi, covPhiPhi;
988 
989  if (e_5x5 >= 0.) {
990  //double w0_ = parameterMap_.find("W0")->second;
991  std::vector< std::pair<DetId, float> > v_id = cluster.hitsAndFractions();
992  std::pair<float,float> mean5x5PosInNrCrysFromSeed = mean5x5PositionInLocalCrysCoord( cluster, recHits, topology );
993  std::pair<float,float> mean5x5XYPos = mean5x5PositionInXY(cluster,recHits,topology);
994 
995  // now we can calculate the covariances
996  double numeratorEtaEta = 0;
997  double numeratorEtaPhi = 0;
998  double numeratorPhiPhi = 0;
999  double denominator = 0;
1000 
1001  //these allow us to scale the localCov by the crystal size
1002  //so that the localCovs have the same average value as the normal covs
1003  const double barrelCrysSize = 0.01745; //approximate size of crystal in eta,phi in barrel
1004  const double endcapCrysSize = 0.0447; //the approximate crystal size sigmaEtaEta was corrected to in the endcap
1005 
1006  DetId seedId = getMaximum( v_id, recHits ).first;
1007 
1008  bool isBarrel=seedId.subdetId()==EcalBarrel;
1009  const double crysSize = isBarrel ? barrelCrysSize : endcapCrysSize;
1010 
1011  CaloNavigator<DetId> cursor = CaloNavigator<DetId>( seedId, topology->getSubdetectorTopology( seedId ) );
1012 
1013  for ( int eastNr = -2; eastNr <= 2; ++eastNr ) { //east is eta in barrel
1014  for ( int northNr = -2; northNr <= 2; ++northNr ) { //north is phi in barrel
1015  cursor.home();
1016  cursor.offsetBy( eastNr, northNr);
1017  float energy = recHitEnergy( *cursor, recHits );
1018  if ( energy <= 0 ) continue;
1019 
1020  float dEta = getNrCrysDiffInEta(*cursor,seedId) - mean5x5PosInNrCrysFromSeed.first;
1021  float dPhi = 0;
1022 
1023  if(isBarrel) dPhi = getNrCrysDiffInPhi(*cursor,seedId) - mean5x5PosInNrCrysFromSeed.second;
1024  else dPhi = getDPhiEndcap(*cursor,mean5x5XYPos.first,mean5x5XYPos.second);
1025 
1026 
1027  double w = std::max(0.0, w0 + log( energy / e_5x5 ));
1028 
1029  denominator += w;
1030  numeratorEtaEta += w * dEta * dEta;
1031  numeratorEtaPhi += w * dEta * dPhi;
1032  numeratorPhiPhi += w * dPhi * dPhi;
1033  } //end east loop
1034  }//end north loop
1035 
1036 
1037  //multiplying by crysSize to make the values compariable to normal covariances
1038  if (denominator != 0.0) {
1039  covEtaEta = crysSize*crysSize* numeratorEtaEta / denominator;
1040  covEtaPhi = crysSize*crysSize* numeratorEtaPhi / denominator;
1041  covPhiPhi = crysSize*crysSize* numeratorPhiPhi / denominator;
1042  } else {
1043  covEtaEta = 999.9;
1044  covEtaPhi = 999.9;
1045  covPhiPhi = 999.9;
1046  }
1047 
1048 
1049  } else {
1050  // Warn the user if there was no energy in the cells and return zeroes.
1051  // std::cout << "\ClusterShapeAlgo::Calculate_Covariances: no energy in supplied cells.\n";
1052  covEtaEta = 0;
1053  covEtaPhi = 0;
1054  covPhiPhi = 0;
1055  }
1056  std::vector<float> v;
1057  v.push_back( covEtaEta );
1058  v.push_back( covEtaPhi );
1059  v.push_back( covPhiPhi );
1060  return v;
1061 }
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)
void home() const
move the navigator back to the starting point
static std::pair< float, float > mean5x5PositionInLocalCrysCoord(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
double dPhi(double phi1, double phi2)
Definition: JetUtil.h:30
const T & max(const T &a, const T &b)
virtual T offsetBy(int deltaX, int deltaY) const
Free movement of arbitray steps.
static std::pair< float, float > mean5x5PositionInXY(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
static float getNrCrysDiffInPhi(const DetId &crysId, const DetId &orginId)
static float getDPhiEndcap(const DetId &crysId, float meanX, float meanY)
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
Definition: DetId.h:20
static float getNrCrysDiffInEta(const DetId &crysId, const DetId &orginId)
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:26
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
static float e5x5(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
mathSSE::Vec4< T > v
T w() const
std::vector< float > EcalClusterTools::localCovariances ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
std::vector< int >  flagsexcl,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv,
float  w0 = 4.7 
)
static

Definition at line 1065 of file EcalClusterTools.cc.

References RecoTauValidation_cfi::denominator, dPhi(), e5x5(), EcalBarrel, relval_parameters_module::energy, getDPhiEndcap(), getMaximum(), getNrCrysDiffInEta(), getNrCrysDiffInPhi(), CaloTopology::getSubdetectorTopology(), CaloNavigator< T >::home(), create_public_lumi_plots::log, max(), mean5x5PositionInLocalCrysCoord(), mean5x5PositionInXY(), CaloNavigator< T >::offsetBy(), recHitEnergy(), DetId::subdetId(), v, and w().

1066 {
1067 
1068  float e_5x5 = e5x5( cluster, recHits, topology,flagsexcl, severitiesexcl, sevLv );
1069  float covEtaEta, covEtaPhi, covPhiPhi;
1070 
1071  if (e_5x5 >= 0.) {
1072  //double w0_ = parameterMap_.find("W0")->second;
1073  std::vector< std::pair<DetId, float> > v_id = cluster.hitsAndFractions();
1074  std::pair<float,float> mean5x5PosInNrCrysFromSeed = mean5x5PositionInLocalCrysCoord( cluster, recHits, topology,flagsexcl, severitiesexcl, sevLv );
1075  std::pair<float,float> mean5x5XYPos = mean5x5PositionInXY(cluster,recHits,topology,flagsexcl, severitiesexcl, sevLv);
1076 
1077  // now we can calculate the covariances
1078  double numeratorEtaEta = 0;
1079  double numeratorEtaPhi = 0;
1080  double numeratorPhiPhi = 0;
1081  double denominator = 0;
1082 
1083  //these allow us to scale the localCov by the crystal size
1084  //so that the localCovs have the same average value as the normal covs
1085  const double barrelCrysSize = 0.01745; //approximate size of crystal in eta,phi in barrel
1086  const double endcapCrysSize = 0.0447; //the approximate crystal size sigmaEtaEta was corrected to in the endcap
1087 
1088  DetId seedId = getMaximum( v_id, recHits ).first;
1089 
1090  bool isBarrel=seedId.subdetId()==EcalBarrel;
1091  const double crysSize = isBarrel ? barrelCrysSize : endcapCrysSize;
1092 
1093  CaloNavigator<DetId> cursor = CaloNavigator<DetId>( seedId, topology->getSubdetectorTopology( seedId ) );
1094 
1095  for ( int eastNr = -2; eastNr <= 2; ++eastNr ) { //east is eta in barrel
1096  for ( int northNr = -2; northNr <= 2; ++northNr ) { //north is phi in barrel
1097  cursor.home();
1098  cursor.offsetBy( eastNr, northNr);
1099  float energy = recHitEnergy( *cursor, recHits,flagsexcl, severitiesexcl, sevLv);
1100  if ( energy <= 0 ) continue;
1101 
1102  float dEta = getNrCrysDiffInEta(*cursor,seedId) - mean5x5PosInNrCrysFromSeed.first;
1103  float dPhi = 0;
1104 
1105  if(isBarrel) dPhi = getNrCrysDiffInPhi(*cursor,seedId) - mean5x5PosInNrCrysFromSeed.second;
1106  else dPhi = getDPhiEndcap(*cursor,mean5x5XYPos.first,mean5x5XYPos.second);
1107 
1108 
1109  double w = std::max(0.0, w0 + log( energy / e_5x5 ));
1110 
1111  denominator += w;
1112  numeratorEtaEta += w * dEta * dEta;
1113  numeratorEtaPhi += w * dEta * dPhi;
1114  numeratorPhiPhi += w * dPhi * dPhi;
1115  } //end east loop
1116  }//end north loop
1117 
1118 
1119  //multiplying by crysSize to make the values compariable to normal covariances
1120  if (denominator != 0.0) {
1121  covEtaEta = crysSize*crysSize* numeratorEtaEta / denominator;
1122  covEtaPhi = crysSize*crysSize* numeratorEtaPhi / denominator;
1123  covPhiPhi = crysSize*crysSize* numeratorPhiPhi / denominator;
1124  } else {
1125  covEtaEta = 999.9;
1126  covEtaPhi = 999.9;
1127  covPhiPhi = 999.9;
1128  }
1129 
1130 
1131  } else {
1132  // Warn the user if there was no energy in the cells and return zeroes.
1133  // std::cout << "\ClusterShapeAlgo::Calculate_Covariances: no energy in supplied cells.\n";
1134  covEtaEta = 0;
1135  covEtaPhi = 0;
1136  covPhiPhi = 0;
1137  }
1138  std::vector<float> v;
1139  v.push_back( covEtaEta );
1140  v.push_back( covEtaPhi );
1141  v.push_back( covPhiPhi );
1142  return v;
1143 }
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)
void home() const
move the navigator back to the starting point
static std::pair< float, float > mean5x5PositionInLocalCrysCoord(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
double dPhi(double phi1, double phi2)
Definition: JetUtil.h:30
const T & max(const T &a, const T &b)
virtual T offsetBy(int deltaX, int deltaY) const
Free movement of arbitray steps.
static std::pair< float, float > mean5x5PositionInXY(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
static float getNrCrysDiffInPhi(const DetId &crysId, const DetId &orginId)
static float getDPhiEndcap(const DetId &crysId, float meanX, float meanY)
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
Definition: DetId.h:20
static float getNrCrysDiffInEta(const DetId &crysId, const DetId &orginId)
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:26
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
static float e5x5(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
mathSSE::Vec4< T > v
T w() const
std::vector< DetId > EcalClusterTools::matrixDetId ( const CaloTopology topology,
DetId  id,
int  ixMin,
int  ixMax,
int  iyMin,
int  iyMax 
)
static

Definition at line 172 of file EcalClusterTools.cc.

References CaloTopology::getSubdetectorTopology(), CaloNavigator< T >::home(), i, errorMatrix2Lands_multiChannel::id, j, CaloNavigator< T >::offsetBy(), and v.

Referenced by EcalClusterLazyTools::matrixDetId(), mean5x5PositionInLocalCrysCoord(), mean5x5PositionInXY(), and meanClusterPosition().

173 {
175  std::vector<DetId> v;
176  for ( int i = ixMin; i <= ixMax; ++i ) {
177  for ( int j = iyMin; j <= iyMax; ++j ) {
178  cursor.home();
179  cursor.offsetBy( i, j );
180  if ( *cursor != DetId(0) ) v.push_back( *cursor );
181  }
182  }
183  return v;
184 }
int i
Definition: DBlmapReader.cc:9
void home() const
move the navigator back to the starting point
virtual T offsetBy(int deltaX, int deltaY) const
Free movement of arbitray steps.
int j
Definition: DBlmapReader.cc:9
Definition: DetId.h:20
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:26
mathSSE::Vec4< T > v
static std::vector<DetId> EcalClusterTools::matrixDetId ( const CaloTopology topology,
DetId  id,
int  ixMin,
int  ixMax,
int  iyMin,
int  iyMax,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv 
)
static
float EcalClusterTools::matrixEnergy ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
DetId  id,
int  ixMin,
int  ixMax,
int  iyMin,
int  iyMax 
)
static

Definition at line 131 of file EcalClusterTools.cc.

References relval_parameters_module::energy, cropTnPTrees::frac, getFraction(), CaloTopology::getSubdetectorTopology(), CaloNavigator< T >::home(), i, errorMatrix2Lands_multiChannel::id, j, CaloNavigator< T >::offsetBy(), and recHitEnergy().

Referenced by e1x3(), e1x5(), e2x2(), e2x5Bottom(), e2x5Left(), e2x5Max(), e2x5Right(), e2x5Top(), e3x1(), e3x2(), e3x3(), e4x4(), e5x1(), e5x5(), eBottom(), eLeft(), eRight(), eTop(), and EcalClusterLazyTools::matrixEnergy().

132 {
133  //take into account fractions
134  // fast version
136  float energy = 0;
137  std::vector< std::pair<DetId, float> > v_id = cluster.hitsAndFractions();
138  for ( int i = ixMin; i <= ixMax; ++i ) {
139  for ( int j = iyMin; j <= iyMax; ++j ) {
140  cursor.home();
141  cursor.offsetBy( i, j );
142  float frac=getFraction(v_id,*cursor);
143  energy += recHitEnergy( *cursor, recHits )*frac;
144  }
145  }
146  // slow elegant version
147  //float energy = 0;
148  //std::vector<DetId> v_id = matrixDetId( topology, id, ixMin, ixMax, iyMin, iyMax );
149  //for ( std::vector<DetId>::const_iterator it = v_id.begin(); it != v_id.end(); ++it ) {
150  // energy += recHitEnergy( *it, recHits );
151  //}
152  return energy;
153 }
int i
Definition: DBlmapReader.cc:9
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)
void home() const
move the navigator back to the starting point
static float getFraction(const std::vector< std::pair< DetId, float > > &v_id, DetId id)
virtual T offsetBy(int deltaX, int deltaY) const
Free movement of arbitray steps.
int j
Definition: DBlmapReader.cc:9
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:26
float EcalClusterTools::matrixEnergy ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
DetId  id,
int  ixMin,
int  ixMax,
int  iyMin,
int  iyMax,
std::vector< int >  flagsexcl,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv 
)
static

Definition at line 155 of file EcalClusterTools.cc.

References relval_parameters_module::energy, CaloTopology::getSubdetectorTopology(), CaloNavigator< T >::home(), i, errorMatrix2Lands_multiChannel::id, j, CaloNavigator< T >::offsetBy(), and recHitEnergy().

156 {
157  // fast version
159  float energy = 0;
160  for ( int i = ixMin; i <= ixMax; ++i ) {
161  for ( int j = iyMin; j <= iyMax; ++j ) {
162  cursor.home();
163  cursor.offsetBy( i, j );
164  energy += recHitEnergy( *cursor, recHits, flagsexcl, severitiesexcl, sevLv );
165  }
166  }
167  return energy;
168 }
int i
Definition: DBlmapReader.cc:9
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)
void home() const
move the navigator back to the starting point
virtual T offsetBy(int deltaX, int deltaY) const
Free movement of arbitray steps.
int j
Definition: DBlmapReader.cc:9
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:26
std::pair< float, float > EcalClusterTools::mean5x5PositionInLocalCrysCoord ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
staticprivate

Definition at line 750 of file EcalClusterTools.cc.

References relval_parameters_module::energy, CastorDataFrameFilter_impl::energySum(), getMaximum(), getNrCrysDiffInEta(), getNrCrysDiffInPhi(), matrixDetId(), and recHitEnergy().

Referenced by localCovariances(), and scLocalCovariances().

751 {
752  DetId seedId = getMaximum( cluster, recHits ).first;
753  float meanDEta=0.;
754  float meanDPhi=0.;
755  float energySum=0.;
756 
757  std::vector<DetId> v_id = matrixDetId( topology,seedId, -2, 2, -2, 2 );
758  for ( std::vector<DetId>::const_iterator it = v_id.begin(); it != v_id.end(); ++it ) {
759  float energy = recHitEnergy(*it,recHits);
760  if(energy<0.) continue;//skipping negative energy crystals
761  meanDEta += energy * getNrCrysDiffInEta(*it,seedId);
762  meanDPhi += energy * getNrCrysDiffInPhi(*it,seedId);
763  energySum +=energy;
764  }
765  meanDEta /=energySum;
766  meanDPhi /=energySum;
767  return std::pair<float,float>(meanDEta,meanDPhi);
768 }
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)
static std::vector< DetId > matrixDetId(const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
static float getNrCrysDiffInPhi(const DetId &crysId, const DetId &orginId)
Definition: DetId.h:20
static float getNrCrysDiffInEta(const DetId &crysId, const DetId &orginId)
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
double energySum(const DataFrame &df, int fs, int ls)
std::pair< float, float > EcalClusterTools::mean5x5PositionInLocalCrysCoord ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
std::vector< int >  flagsexcl,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv 
)
staticprivate

Definition at line 770 of file EcalClusterTools.cc.

References relval_parameters_module::energy, CastorDataFrameFilter_impl::energySum(), getMaximum(), getNrCrysDiffInEta(), getNrCrysDiffInPhi(), matrixDetId(), and recHitEnergy().

771 {
772  DetId seedId = getMaximum( cluster, recHits ).first;
773  float meanDEta=0.;
774  float meanDPhi=0.;
775  float energySum=0.;
776 
777  std::vector<DetId> v_id = matrixDetId( topology,seedId, -2, 2, -2, 2 );
778  for ( std::vector<DetId>::const_iterator it = v_id.begin(); it != v_id.end(); ++it ) {
779  float energy = recHitEnergy(*it,recHits,flagsexcl, severitiesexcl, sevLv);
780  if(energy<0.) continue;//skipping negative energy crystals
781  meanDEta += energy * getNrCrysDiffInEta(*it,seedId);
782  meanDPhi += energy * getNrCrysDiffInPhi(*it,seedId);
783  energySum +=energy;
784  }
785  meanDEta /=energySum;
786  meanDPhi /=energySum;
787  return std::pair<float,float>(meanDEta,meanDPhi);
788 }
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)
static std::vector< DetId > matrixDetId(const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
static float getNrCrysDiffInPhi(const DetId &crysId, const DetId &orginId)
Definition: DetId.h:20
static float getNrCrysDiffInEta(const DetId &crysId, const DetId &orginId)
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
double energySum(const DataFrame &df, int fs, int ls)
std::pair< float, float > EcalClusterTools::mean5x5PositionInXY ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology 
)
staticprivate

Definition at line 796 of file EcalClusterTools.cc.

References EcalBarrel, relval_parameters_module::energy, CastorDataFrameFilter_impl::energySum(), getMaximum(), getNormedIX(), getNormedIY(), matrixDetId(), recHitEnergy(), and DetId::subdetId().

Referenced by localCovariances(), and scLocalCovariances().

797 {
798  DetId seedId = getMaximum( cluster, recHits ).first;
799 
800  std::pair<float,float> meanXY(0.,0.);
801  if(seedId.subdetId()==EcalBarrel) return meanXY;
802 
803  float energySum=0.;
804 
805  std::vector<DetId> v_id = matrixDetId( topology,seedId, -2, 2, -2, 2 );
806  for ( std::vector<DetId>::const_iterator it = v_id.begin(); it != v_id.end(); ++it ) {
807  float energy = recHitEnergy(*it,recHits);
808  if(energy<0.) continue;//skipping negative energy crystals
809  meanXY.first += energy * getNormedIX(*it);
810  meanXY.second += energy * getNormedIY(*it);
811  energySum +=energy;
812  }
813  meanXY.first/=energySum;
814  meanXY.second/=energySum;
815  return meanXY;
816 }
static float getNormedIX(const DetId &id)
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)
static std::vector< DetId > matrixDetId(const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
static float getNormedIY(const DetId &id)
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
double energySum(const DataFrame &df, int fs, int ls)
std::pair< float, float > EcalClusterTools::mean5x5PositionInXY ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
std::vector< int >  flagsexcl,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv 
)
staticprivate

Definition at line 818 of file EcalClusterTools.cc.

References EcalBarrel, relval_parameters_module::energy, CastorDataFrameFilter_impl::energySum(), getMaximum(), getNormedIX(), getNormedIY(), matrixDetId(), recHitEnergy(), and DetId::subdetId().

819 {
820  DetId seedId = getMaximum( cluster, recHits ).first;
821 
822  std::pair<float,float> meanXY(0.,0.);
823  if(seedId.subdetId()==EcalBarrel) return meanXY;
824 
825  float energySum=0.;
826 
827  std::vector<DetId> v_id = matrixDetId( topology,seedId, -2, 2, -2, 2 );
828  for ( std::vector<DetId>::const_iterator it = v_id.begin(); it != v_id.end(); ++it ) {
829  float energy = recHitEnergy(*it,recHits,flagsexcl, severitiesexcl, sevLv);
830  if(energy<0.) continue;//skipping negative energy crystals
831  meanXY.first += energy * getNormedIX(*it);
832  meanXY.second += energy * getNormedIY(*it);
833  energySum +=energy;
834  }
835  meanXY.first/=energySum;
836  meanXY.second/=energySum;
837  return meanXY;
838 }
static float getNormedIX(const DetId &id)
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)
static std::vector< DetId > matrixDetId(const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
static float getNormedIY(const DetId &id)
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
Definition: DetId.h:20
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
double energySum(const DataFrame &df, int fs, int ls)
math::XYZVector EcalClusterTools::meanClusterPosition ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
const CaloGeometry geometry 
)
staticprivate

Definition at line 714 of file EcalClusterTools.cc.

References e5x5(), first, CaloSubdetectorGeometry::getGeometry(), getMaximum(), CaloCellGeometry::getPosition(), CaloGeometry::getSubdetectorGeometry(), matrixDetId(), position, recHitEnergy(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by covariances().

715 {
716  // find mean energy position of a 5x5 cluster around the maximum
717  math::XYZVector meanPosition(0.0, 0.0, 0.0);
718  std::vector<DetId> v_id = matrixDetId( topology, getMaximum( cluster, recHits ).first, -2, 2, -2, 2 );
719  for ( std::vector<DetId>::const_iterator it = v_id.begin(); it != v_id.end(); ++it ) {
720  GlobalPoint positionGP = geometry->getSubdetectorGeometry( *it )->getGeometry( *it )->getPosition();
721  math::XYZVector position(positionGP.x(),positionGP.y(),positionGP.z());
722  meanPosition = meanPosition + recHitEnergy( *it, recHits ) * position;
723  }
724  return meanPosition / e5x5( cluster, recHits, topology );
725 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:43
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)
static std::vector< DetId > matrixDetId(const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
T y() const
Definition: PV3DBase.h:62
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
T z() const
Definition: PV3DBase.h:63
bool first
Definition: L1TdeRCT.cc:94
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
static int position[264][3]
Definition: ReadPGInfo.cc:509
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
static float e5x5(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
T x() const
Definition: PV3DBase.h:61
math::XYZVector EcalClusterTools::meanClusterPosition ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
const CaloGeometry geometry,
std::vector< int >  flagsexcl,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv 
)
staticprivate

Definition at line 729 of file EcalClusterTools.cc.

References e5x5(), first, CaloSubdetectorGeometry::getGeometry(), getMaximum(), CaloCellGeometry::getPosition(), CaloGeometry::getSubdetectorGeometry(), matrixDetId(), position, recHitEnergy(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

730 {
731  // find mean energy position of a 5x5 cluster around the maximum
732  math::XYZVector meanPosition(0.0, 0.0, 0.0);
733  std::vector<DetId> v_id = matrixDetId( topology, getMaximum( cluster, recHits ).first, -2, 2, -2, 2 );
734  for ( std::vector<DetId>::const_iterator it = v_id.begin(); it != v_id.end(); ++it ) {
735  GlobalPoint positionGP = geometry->getSubdetectorGeometry( *it )->getGeometry( *it )->getPosition();
736  math::XYZVector position(positionGP.x(),positionGP.y(),positionGP.z());
737  meanPosition = meanPosition + recHitEnergy( *it, recHits,flagsexcl, severitiesexcl, sevLv ) * position;
738  }
739  return meanPosition / e5x5( cluster, recHits, topology,flagsexcl, severitiesexcl, sevLv );
740 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:43
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)
static std::vector< DetId > matrixDetId(const CaloTopology *topology, DetId id, int ixMin, int ixMax, int iyMin, int iyMax)
T y() const
Definition: PV3DBase.h:62
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
T z() const
Definition: PV3DBase.h:63
bool first
Definition: L1TdeRCT.cc:94
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
static int position[264][3]
Definition: ReadPGInfo.cc:509
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
static float e5x5(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
T x() const
Definition: PV3DBase.h:61
float EcalClusterTools::recHitEnergy ( DetId  id,
const EcalRecHitCollection recHits 
)
static

Definition at line 70 of file EcalClusterTools.cc.

References edm::SortedCollection< T, SORT >::end(), and edm::SortedCollection< T, SORT >::find().

Referenced by covariances(), e2nd(), energyBasketFractionEta(), energyBasketFractionPhi(), getMaximum(), localCovariances(), matrixEnergy(), mean5x5PositionInLocalCrysCoord(), mean5x5PositionInXY(), meanClusterPosition(), and scLocalCovariances().

71 {
72  if ( id == DetId(0) ) {
73  return 0;
74  } else {
75  EcalRecHitCollection::const_iterator it = recHits->find( id );
76  if ( it != recHits->end() ) {
77  return (*it).energy();
78  } else {
79  //throw cms::Exception("EcalRecHitNotFound") << "The recHit corresponding to the DetId" << id.rawId() << " not found in the EcalRecHitCollection";
80  // the recHit is not in the collection (hopefully zero suppressed)
81  return 0;
82  }
83  }
84  return 0;
85 }
std::vector< EcalRecHit >::const_iterator const_iterator
const_iterator end() const
Definition: DetId.h:20
iterator find(key_type k)
float EcalClusterTools::recHitEnergy ( DetId  id,
const EcalRecHitCollection recHits,
std::vector< int >  flagsexcl,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv 
)
static

Definition at line 87 of file EcalClusterTools.cc.

References edm::SortedCollection< T, SORT >::end(), spr::find(), edm::SortedCollection< T, SORT >::find(), and EcalSeverityLevelAlgo::severityLevel().

88 {
89  if ( id == DetId(0) ) {
90  return 0;
91  } else {
92  EcalRecHitCollection::const_iterator it = recHits->find( id );
93  if ( it != recHits->end() ) {
94  // avoid anomalous channels (recoFlag based)
95  uint32_t rhFlag = (*it).recoFlag();
96  std::vector<int>::const_iterator vit = std::find( flagsexcl.begin(), flagsexcl.end(), rhFlag );
97  //if your flag was found to be one which is excluded, zero out
98  //this energy.
99  if ( vit != flagsexcl.end() ) return 0;
100 
101  int severityFlag = sevLv->severityLevel( it->id(), *recHits);
102  std::vector<int>::const_iterator sit = std::find(severitiesexcl.begin(), severitiesexcl.end(), severityFlag);
103  //if you were flagged by some condition (kWeird etc.)
104  //zero out this energy.
105  if (sit!= severitiesexcl.end())
106  return 0;
107  //If we make it here, you're a found, clean hit.
108  return (*it).energy();
109  } else {
110  //throw cms::Exception("EcalRecHitNotFound") << "The recHit corresponding to the DetId" << id.rawId() << " not found in the EcalRecHitCollection";
111  // the recHit is not in the collection (hopefully zero suppressed)
112  return 0;
113  }
114  }
115  return 0;
116 }
std::vector< EcalRecHit >::const_iterator const_iterator
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
const_iterator end() const
Definition: DetId.h:20
iterator find(key_type k)
EcalSeverityLevel::SeverityLevel severityLevel(const DetId &id, const EcalRecHitCollection &rhs) const
Evaluate status from id.
std::vector< float > EcalClusterTools::roundnessBarrelSuperClusters ( const reco::SuperCluster superCluster,
const EcalRecHitCollection recHits,
int  weightedPositionMethod = 0,
float  energyThreshold = 0.0 
)
static

Definition at line 1698 of file EcalClusterTools.cc.

References edm::SortedCollection< T, SORT >::end(), edm::SortedCollection< T, SORT >::find(), first, reco::CaloCluster::hitsAndFractions(), i, roundnessSelectedBarrelRecHits(), and groupFilesInBlocks::temp.

Referenced by EcalHaloAlgo::Calculate(), and PhotonMIPHaloTagger::GetMipTrailFit().

1698  {//int positionWeightingMethod=0){
1699  std::vector<const EcalRecHit*>RH_ptrs;
1700  std::vector< std::pair<DetId, float> > myHitsPair = superCluster.hitsAndFractions();
1701  std::vector<DetId> usedCrystals;
1702  for(unsigned int i=0; i< myHitsPair.size(); i++){
1703  usedCrystals.push_back(myHitsPair[i].first);
1704  }
1705  for(unsigned int i=0; i<usedCrystals.size(); i++){
1706  //get pointer to recHit object
1707  EcalRecHitCollection::const_iterator myRH = recHits.find(usedCrystals[i]);
1708  if( myRH != recHits.end() && myRH->energy() > energyThreshold){ //require rec hit to have positive energy
1709  RH_ptrs.push_back( &(*myRH) );
1710  }
1711  }
1712  std::vector<float> temp = EcalClusterTools::roundnessSelectedBarrelRecHits(RH_ptrs,weightedPositionMethod);
1713  return temp;
1714 }
int i
Definition: DBlmapReader.cc:9
std::vector< EcalRecHit >::const_iterator const_iterator
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:189
static std::vector< float > roundnessSelectedBarrelRecHits(std::vector< const EcalRecHit * >rhVector, int weightedPositionMethod=0)
bool first
Definition: L1TdeRCT.cc:94
const_iterator end() const
iterator find(key_type k)
std::vector< float > EcalClusterTools::roundnessBarrelSuperClustersUserExtended ( const reco::SuperCluster superCluster,
const EcalRecHitCollection recHits,
int  ieta_delta = 0,
int  iphi_delta = 0,
float  energyRHThresh = 0.00000,
int  weightedPositionMethod = 0 
)
static

Definition at line 1721 of file EcalClusterTools.cc.

References abs, edm::SortedCollection< T, SORT >::begin(), deltaIEta(), deltaIPhi(), edm::SortedCollection< T, SORT >::end(), edm::SortedCollection< T, SORT >::find(), first, getSeedPosition(), reco::CaloCluster::hitsAndFractions(), i, and roundnessSelectedBarrelRecHits().

1721  {
1722 
1723  std::vector<const EcalRecHit*>RH_ptrs;
1724  std::vector< std::pair<DetId, float> > myHitsPair = superCluster.hitsAndFractions();
1725  std::vector<DetId> usedCrystals;
1726  for(unsigned int i=0; i< myHitsPair.size(); i++){
1727  usedCrystals.push_back(myHitsPair[i].first);
1728  }
1729 
1730  for(unsigned int i=0; i<usedCrystals.size(); i++){
1731  //get pointer to recHit object
1732  EcalRecHitCollection::const_iterator myRH = recHits.find(usedCrystals[i]);
1733  if(myRH != recHits.end() && myRH->energy() > energyRHThresh)
1734  RH_ptrs.push_back( &(*myRH) );
1735  }
1736 
1737 
1738  std::vector<int> seedPosition = EcalClusterTools::getSeedPosition( RH_ptrs );
1739 
1740  for(EcalRecHitCollection::const_iterator rh = recHits.begin(); rh != recHits.end(); rh++){
1741  EBDetId EBdetIdi( rh->detid() );
1742  //if(rh != recHits.end())
1743  bool inEtaWindow = ( abs( deltaIEta(seedPosition[0],EBdetIdi.ieta()) ) <= ieta_delta );
1744  bool inPhiWindow = ( abs( deltaIPhi(seedPosition[1],EBdetIdi.iphi()) ) <= iphi_delta );
1745  bool passEThresh = ( rh->energy() > energyRHThresh );
1746  bool alreadyCounted = false;
1747 
1748  // figure out if the rechit considered now is already inside the SC
1749  bool is_SCrh_inside_recHits = false;
1750  for(unsigned int i=0; i<usedCrystals.size(); i++){
1751  EcalRecHitCollection::const_iterator SCrh = recHits.find(usedCrystals[i]);
1752  if(SCrh != recHits.end()){
1753  is_SCrh_inside_recHits = true;
1754  if( rh->detid() == SCrh->detid() ) alreadyCounted = true;
1755  }
1756  }//for loop over SC's recHits
1757 
1758  if( is_SCrh_inside_recHits && !alreadyCounted && passEThresh && inEtaWindow && inPhiWindow){
1759  RH_ptrs.push_back( &(*rh) );
1760  }
1761 
1762  }//for loop over rh
1763  return EcalClusterTools::roundnessSelectedBarrelRecHits(RH_ptrs,weightedPositionMethod);
1764 }
int i
Definition: DBlmapReader.cc:9
static std::vector< int > getSeedPosition(std::vector< const EcalRecHit * >RH_ptrs)
std::vector< EcalRecHit >::const_iterator const_iterator
#define abs(x)
Definition: mlp_lapack.h:159
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:189
static int deltaIEta(int seed_ieta, int rh_ieta)
static int deltaIPhi(int seed_iphi, int rh_iphi)
static std::vector< float > roundnessSelectedBarrelRecHits(std::vector< const EcalRecHit * >rhVector, int weightedPositionMethod=0)
bool first
Definition: L1TdeRCT.cc:94
const_iterator end() const
iterator find(key_type k)
const_iterator begin() const
std::vector< float > EcalClusterTools::roundnessSelectedBarrelRecHits ( std::vector< const EcalRecHit * >  rhVector,
int  weightedPositionMethod = 0 
)
static

Definition at line 1769 of file EcalClusterTools.cc.

References deltaIEta(), deltaIPhi(), RecoTauValidation_cfi::denominator, getSeedPosition(), getSumEnergy(), i, create_public_lumi_plots::log, max(), groupFilesInBlocks::temp, and CommonMethods::weight().

Referenced by roundnessBarrelSuperClusters(), and roundnessBarrelSuperClustersUserExtended().

1769  {//int weightedPositionMethod = 0){
1770  //positionWeightingMethod = 0 linear weighting, 1 log energy weighting
1771 
1772  std::vector<float> shapes; // this is the returning vector
1773 
1774  //make sure photon has more than one crystal; else roundness and angle suck
1775  if(RH_ptrs.size()<2){
1776  shapes.push_back( -3 );
1777  shapes.push_back( -3 );
1778  return shapes;
1779  }
1780 
1781  //Find highest E RH (Seed) and save info, compute sum total energy used
1782  std::vector<int> seedPosition = EcalClusterTools::getSeedPosition( RH_ptrs );// *recHits);
1783  int tempInt = seedPosition[0];
1784  if(tempInt <0) tempInt++;
1785  float energyTotal = EcalClusterTools::getSumEnergy( RH_ptrs );
1786 
1787  //1st loop over rechits: compute new weighted center position in coordinates centered on seed
1788  float centerIEta = 0.;
1789  float centerIPhi = 0.;
1790  float denominator = 0.;
1791 
1792  for(std::vector<const EcalRecHit*>::const_iterator rh_ptr = RH_ptrs.begin(); rh_ptr != RH_ptrs.end(); rh_ptr++){
1793  //get iEta, iPhi
1794  EBDetId EBdetIdi( (*rh_ptr)->detid() );
1795  if(fabs(energyTotal) < 0.0001){
1796  // don't /0, bad!
1797  shapes.push_back( -2 );
1798  shapes.push_back( -2 );
1799  return shapes;
1800  }
1801  float weight = 0;
1802  if(fabs(weightedPositionMethod)<0.0001){ //linear
1803  weight = (*rh_ptr)->energy()/energyTotal;
1804  }else{ //logrithmic
1805  weight = std::max(0.0, 4.2 + log((*rh_ptr)->energy()/energyTotal));
1806  }
1807  denominator += weight;
1808  centerIEta += weight*deltaIEta(seedPosition[0],EBdetIdi.ieta());
1809  centerIPhi += weight*deltaIPhi(seedPosition[1],EBdetIdi.iphi());
1810  }
1811  if(fabs(denominator) < 0.0001){
1812  // don't /0, bad!
1813  shapes.push_back( -2 );
1814  shapes.push_back( -2 );
1815  return shapes;
1816  }
1817  centerIEta = centerIEta / denominator;
1818  centerIPhi = centerIPhi / denominator;
1819 
1820 
1821  //2nd loop over rechits: compute inertia tensor
1822  TMatrixDSym inertia(2); //initialize 2d inertia tensor
1823  double inertia00 = 0.;
1824  double inertia01 = 0.;// = inertia10 b/c matrix should be symmetric
1825  double inertia11 = 0.;
1826  int i = 0;
1827  for(std::vector<const EcalRecHit*>::const_iterator rh_ptr = RH_ptrs.begin(); rh_ptr != RH_ptrs.end(); rh_ptr++){
1828  //get iEta, iPhi
1829  EBDetId EBdetIdi( (*rh_ptr)->detid() );
1830 
1831  if(fabs(energyTotal) < 0.0001){
1832  // don't /0, bad!
1833  shapes.push_back( -2 );
1834  shapes.push_back( -2 );
1835  return shapes;
1836  }
1837  float weight = 0;
1838  if(fabs(weightedPositionMethod) < 0.0001){ //linear
1839  weight = (*rh_ptr)->energy()/energyTotal;
1840  }else{ //logrithmic
1841  weight = std::max(0.0, 4.2 + log((*rh_ptr)->energy()/energyTotal));
1842  }
1843 
1844  float ieta_rh_to_center = deltaIEta(seedPosition[0],EBdetIdi.ieta()) - centerIEta;
1845  float iphi_rh_to_center = deltaIPhi(seedPosition[1],EBdetIdi.iphi()) - centerIPhi;
1846 
1847  inertia00 += weight*iphi_rh_to_center*iphi_rh_to_center;
1848  inertia01 -= weight*iphi_rh_to_center*ieta_rh_to_center;
1849  inertia11 += weight*ieta_rh_to_center*ieta_rh_to_center;
1850  i++;
1851  }
1852 
1853  inertia[0][0] = inertia00;
1854  inertia[0][1] = inertia01; // use same number here
1855  inertia[1][0] = inertia01; // and here to insure symmetry
1856  inertia[1][1] = inertia11;
1857 
1858 
1859  //step 1 find principal axes of inertia
1860  TMatrixD eVectors(2,2);
1861  TVectorD eValues(2);
1862  //std::cout<<"EcalClusterTools::showerRoundness- about to compute eVectors"<<std::endl;
1863  eVectors=inertia.EigenVectors(eValues); //ordered highest eV to lowest eV (I checked!)
1864  //and eVectors are in columns of matrix! I checked!
1865  //and they are normalized to 1
1866 
1867 
1868 
1869  //step 2 select eta component of smaller eVal's eVector
1870  TVectorD smallerAxis(2);//easiest to spin SC on this axis (smallest eVal)
1871  smallerAxis[0]=eVectors[0][1];//row,col //eta component
1872  smallerAxis[1]=eVectors[1][1]; //phi component
1873 
1874  //step 3 compute interesting quatities
1875  Double_t temp = fabs(smallerAxis[0]);// closer to 1 ->beamhalo, closer to 0 something else
1876  if(fabs(eValues[0]) < 0.0001){
1877  // don't /0, bad!
1878  shapes.push_back( -2 );
1879  shapes.push_back( -2 );
1880  return shapes;
1881  }
1882 
1883  float Roundness = eValues[1]/eValues[0];
1884  float Angle=acos(temp);
1885 
1886  if( -0.00001 < Roundness && Roundness < 0) Roundness = 0.;
1887  if( -0.00001 < Angle && Angle < 0 ) Angle = 0.;
1888 
1889  shapes.push_back( Roundness );
1890  shapes.push_back( Angle );
1891  return shapes;
1892 
1893 }
int i
Definition: DBlmapReader.cc:9
static std::vector< int > getSeedPosition(std::vector< const EcalRecHit * >RH_ptrs)
static int deltaIEta(int seed_ieta, int rh_ieta)
const T & max(const T &a, const T &b)
static float getSumEnergy(std::vector< const EcalRecHit * >RH_ptrs)
static int deltaIPhi(int seed_iphi, int rh_iphi)
Definition: Angle.h:17
std::vector< float > EcalClusterTools::scLocalCovariances ( const reco::SuperCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
float  w0 = 4.7 
)
static

Definition at line 1356 of file EcalClusterTools.cc.

References RecoTauValidation_cfi::denominator, dPhi(), e5x5(), EcalBarrel, relval_parameters_module::energy, first, getDPhiEndcap(), getMaximum(), getNrCrysDiffInEta(), getNrCrysDiffInPhi(), CaloTopology::getSubdetectorTopology(), reco::CaloCluster::hitsAndFractions(), i, create_public_lumi_plots::log, max(), mean5x5PositionInLocalCrysCoord(), mean5x5PositionInXY(), recHitEnergy(), reco::SuperCluster::seed(), DetId::subdetId(), v, and w().

Referenced by EcalClusterLazyTools::scLocalCovariances().

1357 {
1358  const reco::BasicCluster bcluster = *(cluster.seed());
1359 
1360  float e_5x5 = e5x5(bcluster, recHits, topology);
1361  float covEtaEta, covEtaPhi, covPhiPhi;
1362 
1363  if (e_5x5 >= 0.) {
1364  std::vector<std::pair<DetId, float> > v_id = cluster.hitsAndFractions();
1365  std::pair<float,float> mean5x5PosInNrCrysFromSeed = mean5x5PositionInLocalCrysCoord(bcluster, recHits, topology);
1366  std::pair<float,float> mean5x5XYPos = mean5x5PositionInXY(cluster,recHits,topology);
1367  // now we can calculate the covariances
1368  double numeratorEtaEta = 0;
1369  double numeratorEtaPhi = 0;
1370  double numeratorPhiPhi = 0;
1371  double denominator = 0;
1372 
1373  const double barrelCrysSize = 0.01745; //approximate size of crystal in eta,phi in barrel
1374  const double endcapCrysSize = 0.0447; //the approximate crystal size sigmaEtaEta was corrected to in the endcap
1375 
1376  DetId seedId = getMaximum(v_id, recHits).first;
1377  bool isBarrel=seedId.subdetId()==EcalBarrel;
1378 
1379  const double crysSize = isBarrel ? barrelCrysSize : endcapCrysSize;
1380 
1381  for (size_t i = 0; i < v_id.size(); ++i) {
1382  CaloNavigator<DetId> cursor = CaloNavigator<DetId>(v_id[i].first, topology->getSubdetectorTopology(v_id[i].first));
1383  float energy = recHitEnergy(*cursor, recHits);
1384 
1385  if (energy <= 0) continue;
1386 
1387  float dEta = getNrCrysDiffInEta(*cursor,seedId) - mean5x5PosInNrCrysFromSeed.first;
1388  float dPhi = 0;
1389  if(isBarrel) dPhi = getNrCrysDiffInPhi(*cursor,seedId) - mean5x5PosInNrCrysFromSeed.second;
1390  else dPhi = getDPhiEndcap(*cursor,mean5x5XYPos.first,mean5x5XYPos.second);
1391 
1392 
1393 
1394  double w = 0.;
1395  w = std::max(0.0, w0 + log( energy / e_5x5 ));
1396 
1397  denominator += w;
1398  numeratorEtaEta += w * dEta * dEta;
1399  numeratorEtaPhi += w * dEta * dPhi;
1400  numeratorPhiPhi += w * dPhi * dPhi;
1401  }
1402 
1403  //multiplying by crysSize to make the values compariable to normal covariances
1404  if (denominator != 0.0) {
1405  covEtaEta = crysSize*crysSize* numeratorEtaEta / denominator;
1406  covEtaPhi = crysSize*crysSize* numeratorEtaPhi / denominator;
1407  covPhiPhi = crysSize*crysSize* numeratorPhiPhi / denominator;
1408  } else {
1409  covEtaEta = 999.9;
1410  covEtaPhi = 999.9;
1411  covPhiPhi = 999.9;
1412  }
1413 
1414  } else {
1415  // Warn the user if there was no energy in the cells and return zeroes.
1416  // std::cout << "\ClusterShapeAlgo::Calculate_Covariances: no energy in supplied cells.\n";
1417  covEtaEta = 0;
1418  covEtaPhi = 0;
1419  covPhiPhi = 0;
1420  }
1421 
1422  std::vector<float> v;
1423  v.push_back( covEtaEta );
1424  v.push_back( covEtaPhi );
1425  v.push_back( covPhiPhi );
1426 
1427  return v;
1428 }
int i
Definition: DBlmapReader.cc:9
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:189
static std::pair< float, float > mean5x5PositionInLocalCrysCoord(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
double dPhi(double phi1, double phi2)
Definition: JetUtil.h:30
const T & max(const T &a, const T &b)
static std::pair< float, float > mean5x5PositionInXY(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
static float getNrCrysDiffInPhi(const DetId &crysId, const DetId &orginId)
static float getDPhiEndcap(const DetId &crysId, float meanX, float meanY)
bool first
Definition: L1TdeRCT.cc:94
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
Definition: DetId.h:20
static float getNrCrysDiffInEta(const DetId &crysId, const DetId &orginId)
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:26
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
static float e5x5(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:62
mathSSE::Vec4< T > v
T w() const
std::vector< float > EcalClusterTools::scLocalCovariances ( const reco::SuperCluster cluster,
const EcalRecHitCollection recHits,
const CaloTopology topology,
std::vector< int >  flagsexcl,
std::vector< int >  severitiesexcl,
const EcalSeverityLevelAlgo sevLv,
float  w0 = 4.7 
)
static

Definition at line 1433 of file EcalClusterTools.cc.

References RecoTauValidation_cfi::denominator, dPhi(), e5x5(), EcalBarrel, relval_parameters_module::energy, first, getDPhiEndcap(), getMaximum(), getNrCrysDiffInEta(), getNrCrysDiffInPhi(), CaloTopology::getSubdetectorTopology(), reco::CaloCluster::hitsAndFractions(), i, create_public_lumi_plots::log, max(), mean5x5PositionInLocalCrysCoord(), mean5x5PositionInXY(), recHitEnergy(), reco::SuperCluster::seed(), DetId::subdetId(), v, and w().

1434 {
1435  const reco::BasicCluster bcluster = *(cluster.seed());
1436 
1437  float e_5x5 = e5x5(bcluster, recHits, topology);
1438  float covEtaEta, covEtaPhi, covPhiPhi;
1439 
1440  if (e_5x5 >= 0.) {
1441  std::vector<std::pair<DetId, float> > v_id = cluster.hitsAndFractions();
1442  std::pair<float,float> mean5x5PosInNrCrysFromSeed = mean5x5PositionInLocalCrysCoord(bcluster, recHits, topology,flagsexcl, severitiesexcl, sevLv);
1443  std::pair<float,float> mean5x5XYPos = mean5x5PositionInXY(cluster,recHits,topology,flagsexcl, severitiesexcl, sevLv);
1444  // now we can calculate the covariances
1445  double numeratorEtaEta = 0;
1446  double numeratorEtaPhi = 0;
1447  double numeratorPhiPhi = 0;
1448  double denominator = 0;
1449 
1450  const double barrelCrysSize = 0.01745; //approximate size of crystal in eta,phi in barrel
1451  const double endcapCrysSize = 0.0447; //the approximate crystal size sigmaEtaEta was corrected to in the endcap
1452 
1453  DetId seedId = getMaximum(v_id, recHits).first;
1454  bool isBarrel=seedId.subdetId()==EcalBarrel;
1455 
1456  const double crysSize = isBarrel ? barrelCrysSize : endcapCrysSize;
1457 
1458  for (size_t i = 0; i < v_id.size(); ++i) {
1459  CaloNavigator<DetId> cursor = CaloNavigator<DetId>(v_id[i].first, topology->getSubdetectorTopology(v_id[i].first));
1460  float energy = recHitEnergy(*cursor, recHits,flagsexcl, severitiesexcl, sevLv);
1461 
1462  if (energy <= 0) continue;
1463 
1464  float dEta = getNrCrysDiffInEta(*cursor,seedId) - mean5x5PosInNrCrysFromSeed.first;
1465  float dPhi = 0;
1466  if(isBarrel) dPhi = getNrCrysDiffInPhi(*cursor,seedId) - mean5x5PosInNrCrysFromSeed.second;
1467  else dPhi = getDPhiEndcap(*cursor,mean5x5XYPos.first,mean5x5XYPos.second);
1468 
1469 
1470 
1471  double w = 0.;
1472  w = std::max(0.0, w0 + log( energy / e_5x5 ));
1473 
1474  denominator += w;
1475  numeratorEtaEta += w * dEta * dEta;
1476  numeratorEtaPhi += w * dEta * dPhi;
1477  numeratorPhiPhi += w * dPhi * dPhi;
1478  }
1479 
1480  //multiplying by crysSize to make the values compariable to normal covariances
1481  if (denominator != 0.0) {
1482  covEtaEta = crysSize*crysSize* numeratorEtaEta / denominator;
1483  covEtaPhi = crysSize*crysSize* numeratorEtaPhi / denominator;
1484  covPhiPhi = crysSize*crysSize* numeratorPhiPhi / denominator;
1485  } else {
1486  covEtaEta = 999.9;
1487  covEtaPhi = 999.9;
1488  covPhiPhi = 999.9;
1489  }
1490 
1491  } else {
1492  // Warn the user if there was no energy in the cells and return zeroes.
1493  // std::cout << "\ClusterShapeAlgo::Calculate_Covariances: no energy in supplied cells.\n";
1494  covEtaEta = 0;
1495  covEtaPhi = 0;
1496  covPhiPhi = 0;
1497  }
1498 
1499  std::vector<float> v;
1500  v.push_back( covEtaEta );
1501  v.push_back( covEtaPhi );
1502  v.push_back( covPhiPhi );
1503 
1504  return v;
1505 }
int i
Definition: DBlmapReader.cc:9
static float recHitEnergy(DetId id, const EcalRecHitCollection *recHits)
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:189
static std::pair< float, float > mean5x5PositionInLocalCrysCoord(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
double dPhi(double phi1, double phi2)
Definition: JetUtil.h:30
const T & max(const T &a, const T &b)
static std::pair< float, float > mean5x5PositionInXY(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
static float getNrCrysDiffInPhi(const DetId &crysId, const DetId &orginId)
static float getDPhiEndcap(const DetId &crysId, float meanX, float meanY)
bool first
Definition: L1TdeRCT.cc:94
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
Definition: DetId.h:20
static float getNrCrysDiffInEta(const DetId &crysId, const DetId &orginId)
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:26
static std::pair< DetId, float > getMaximum(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits)
static float e5x5(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:62
mathSSE::Vec4< T > v
T w() const
double EcalClusterTools::zernike20 ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloGeometry geometry,
double  R0 = 6.6,
bool  logW = true,
float  w0 = 4.7 
)
static

Definition at line 1146 of file EcalClusterTools.cc.

References absZernikeMoment().

Referenced by EcalClusterLazyTools::zernike20().

1147 {
1148  return absZernikeMoment( cluster, recHits, geometry, 2, 0, R0, logW, w0 );
1149 }
static double absZernikeMoment(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloGeometry *geometry, int n, int m, double R0, bool logW, float w0)
double EcalClusterTools::zernike42 ( const reco::BasicCluster cluster,
const EcalRecHitCollection recHits,
const CaloGeometry geometry,
double  R0 = 6.6,
bool  logW = true,
float  w0 = 4.7 
)
static

Definition at line 1153 of file EcalClusterTools.cc.

References absZernikeMoment().

Referenced by EcalClusterLazyTools::zernike42().

1154 {
1155  return absZernikeMoment( cluster, recHits, geometry, 4, 2, R0, logW, w0 );
1156 }
static double absZernikeMoment(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloGeometry *geometry, int n, int m, double R0, bool logW, float w0)