CMS 3D CMS Logo

SuperClusterHelper.cc
Go to the documentation of this file.
5 
8  const CaloTopology* topo,
9  const CaloGeometry* geom) {
11  rechits_ = rechits;
12  seedCluster_ = &(*(electron->superCluster()->seed()));
13  theSuperCluster_ = &(*electron->superCluster());
14 
15  eSubClusters_ = 0.;
16  // Store subclusters
19  for (; itscl < itsclE; ++itscl) {
20  if ((*itscl) == electron->superCluster()->seed())
21  continue; // skip seed cluster
22  theBasicClusters_.push_back(&(**itscl));
23  eSubClusters_ += (*itscl)->energy();
24  }
25  // sort subclusters
27  // Add seed cluster at the beginning
29 
31 
32  // Store ES clusters
33  eESClusters_ = 0.;
36  for (; itscl < itsclE; ++itscl) {
37  theESClusters_.push_back(&(**itscl));
38  eESClusters_ += (*itscl)->energy();
39  }
40  // sort ES clusters
42 
44 
45  topology_ = topo;
46  geometry_ = geom;
47  barrel_ = electron->isEB();
48  covComputed_ = false;
50 }
51 
54  const CaloTopology* topo,
55  const CaloGeometry* geom) {
57  rechits_ = rechits;
58  // for(unsigned ir=0; ir<rechits_->size();++ir) {
59  // std::cout << "RecHit " << (*rechits_)[ir].id().rawId() << " " << (*rechits_)[ir] << std::endl;
60  // }
61  // Get the embedded objects
62  theSuperCluster_ = &(*electron->superCluster());
63  seedCluster_ = &(*(electron->seed()));
64  const std::vector<reco::CaloCluster>& basicClusters(electron->basicClusters());
65  nBasicClusters_ = basicClusters.size();
66  eSubClusters_ = 0.;
67  // Store subclusters
68  for (unsigned ib = 0; ib < nBasicClusters_; ++ib) {
69  if (fabs((basicClusters[ib].energy() - seedCluster_->energy()) / seedCluster_->energy()) < 1.e-5 &&
70  fabs((basicClusters[ib].eta() - seedCluster_->eta()) / seedCluster_->eta()) < 1.e-5 &&
71  fabs((basicClusters[ib].phi() - seedCluster_->phi()) / seedCluster_->phi()) < 1.e-5)
72  continue; // skip seed cluster
73  theBasicClusters_.push_back(&basicClusters[ib]);
74  eSubClusters_ += basicClusters[ib].energy();
75  }
76  // sort subclusters
78  // Add seed cluster at the beginning
80 
81  // Store ES clusters
82  const std::vector<reco::CaloCluster>& esClusters(electron->preshowerClusters());
83  nESClusters_ = esClusters.size();
84  eESClusters_ = 0.;
85  for (unsigned ib = 0; ib < nESClusters_; ++ib) {
86  theESClusters_.push_back(&esClusters[ib]);
87  eESClusters_ += esClusters[ib].energy();
88  }
89  // sort ES clusters
91 
92  // std::vector< std::pair<DetId, float> >::const_iterator it=seedCluster_->hitsAndFractions().begin();
93  // std::vector< std::pair<DetId, float> >::const_iterator itend=seedCluster_->hitsAndFractions().end();
94  // for( ; it!=itend ; ++it) {
95  // DetId id=it->first;
96  // std::cout << " Basic cluster " << id.rawId() << std::endl;
97  // }
98  topology_ = topo;
99  geometry_ = geom;
100  barrel_ = electron->isEB();
101  covComputed_ = false;
103 }
104 
106  if (!covComputed_) {
107  vCov_ = EcalClusterTools::localCovariances(*seedCluster_, rechits_, topology_, 4.7);
108  covComputed_ = true;
109 
110  spp_ = 0;
111  if (edm::isFinite(vCov_[2]))
112  spp_ = sqrt(vCov_[2]);
113 
114  if (theElectron_->sigmaIetaIeta() * spp_ > 0) {
115  sep_ = vCov_[1] / (theElectron_->sigmaIetaIeta() * spp_);
116  } else if (vCov_[1] > 0) {
117  sep_ = 1.0;
118  } else {
119  sep_ = -1.0;
120  }
121  }
122 }
123 
126  return spp_;
127 }
128 
131  return sep_;
132 }
133 
136  return;
137 
138  if (barrel_) {
141  } else {
144  }
146 }
147 
149  return (nBasicClusters_ > i) ? theBasicClusters_[i]->energy() : 0.;
150 }
151 
152 float SuperClusterHelper::subClusterEta(unsigned i) const {
153  return (nBasicClusters_ > i) ? theBasicClusters_[i]->eta() : 999.;
154 }
155 
156 float SuperClusterHelper::subClusterPhi(unsigned i) const {
157  return (nBasicClusters_ > i) ? theBasicClusters_[i]->phi() : 999.;
158 }
159 
160 float SuperClusterHelper::subClusterEmax(unsigned i) const {
162 }
163 
164 float SuperClusterHelper::subClusterE3x3(unsigned i) const {
165  return (nBasicClusters_ > i) ? EcalClusterTools::e3x3(*theBasicClusters_[i], rechits_, topology_) : 0.;
166 }
167 
168 float SuperClusterHelper::esClusterEnergy(unsigned i) const {
169  return (nESClusters_ > i) ? theESClusters_[i]->energy() : 0.;
170 }
171 
172 float SuperClusterHelper::esClusterEta(unsigned i) const {
173  return (nESClusters_ > i) ? theESClusters_[i]->eta() : 999.;
174 }
175 
176 float SuperClusterHelper::esClusterPhi(unsigned i) const {
177  return (nESClusters_ > i) ? theESClusters_[i]->phi() : 999.;
178 }
SuperClusterHelper::nESClusters_
unsigned nESClusters_
Definition: SuperClusterHelper.h:122
reco::CaloCluster::phi
double phi() const
azimuthal angle of cluster centroid
Definition: CaloCluster.h:184
SuperClusterHelper::localCoordinatesComputed_
bool localCoordinatesComputed_
local coordinates
Definition: SuperClusterHelper.h:114
SuperClusterHelper::phi
float phi() const
Definition: SuperClusterHelper.h:26
SuperClusterHelper::ietaSeed_
int ietaSeed_
Definition: SuperClusterHelper.h:115
SuperClusterHelper::nBasicClusters_
unsigned nBasicClusters_
Definition: SuperClusterHelper.h:121
mps_fire.i
i
Definition: mps_fire.py:428
SuperClusterHelper::seedCluster_
const reco::CaloCluster * seedCluster_
Definition: SuperClusterHelper.h:101
SuperClusterHelper::spp
float spp()
Definition: SuperClusterHelper.cc:124
SuperClusterHelper::subClusterE3x3
float subClusterE3x3(unsigned i) const
Definition: SuperClusterHelper.cc:164
SuperClusterHelper::covComputed_
bool covComputed_
Definition: SuperClusterHelper.h:109
SuperClusterHelper::theESClusters_
std::vector< const reco::CaloCluster * > theESClusters_
Definition: SuperClusterHelper.h:100
SuperClusterHelper.h
SuperClusterHelper::computeLocalCovariances
void computeLocalCovariances()
Definition: SuperClusterHelper.cc:105
edm::PtrVectorItr
Definition: PtrVector.h:51
SuperClusterHelper::esClusterPhi
float esClusterPhi(unsigned i) const
Definition: SuperClusterHelper.cc:176
SuperClusterHelper::geometry_
const CaloGeometry * geometry_
Definition: SuperClusterHelper.h:104
edm::SortedCollection< EcalRecHit >
egammaTools::localEcalClusterCoordsEE
void localEcalClusterCoordsEE(const reco::CaloCluster &bclus, const CaloGeometry &geom, float &xcry, float &ycry, int &ix, int &iy, float &thetatilt, float &phitilt)
Definition: EcalClusterLocal.cc:88
SuperClusterHelper::eESClusters_
float eESClusters_
Definition: SuperClusterHelper.h:124
SuperClusterHelper::sortClusters
static bool sortClusters(const reco::CaloCluster *c1, const reco::CaloCluster *c2)
Definition: SuperClusterHelper.h:130
SuperClusterHelper::sep
float sep()
Definition: SuperClusterHelper.cc:129
SuperClusterHelper::subClusterEnergy
float subClusterEnergy(unsigned i) const
Definition: SuperClusterHelper.cc:148
CaloTopology
Definition: CaloTopology.h:19
SuperClusterHelper::theSuperCluster_
const reco::SuperCluster * theSuperCluster_
Definition: SuperClusterHelper.h:98
reco::SuperCluster::preshowerClustersBegin
CaloCluster_iterator preshowerClustersBegin() const
fist iterator over PreshowerCluster constituents
Definition: SuperCluster.h:92
CaloGeometry
Definition: CaloGeometry.h:21
SuperClusterHelper::phiCrySeed_
float phiCrySeed_
Definition: SuperClusterHelper.h:118
SuperClusterHelper::thetaTilt_
float thetaTilt_
Definition: SuperClusterHelper.h:119
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
metsig::electron
Definition: SignAlgoResolutions.h:48
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
SuperClusterHelper::eSubClusters_
float eSubClusters_
Definition: SuperClusterHelper.h:123
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
HI_PhotonSkim_cff.rechits
rechits
Definition: HI_PhotonSkim_cff.py:76
SuperClusterHelper::SuperClusterHelper
SuperClusterHelper(const reco::GsfElectron *electron, const EcalRecHitCollection *rechits, const CaloTopology *, const CaloGeometry *)
Definition: SuperClusterHelper.cc:6
reco::GsfElectron
Definition: GsfElectron.h:35
SuperClusterHelper::esClusterEta
float esClusterEta(unsigned i) const
Definition: SuperClusterHelper.cc:172
egammaTools::localEcalClusterCoordsEB
void localEcalClusterCoordsEB(const reco::CaloCluster &bclus, const CaloGeometry &geom, float &etacry, float &phicry, int &ieta, int &iphi, float &thetatilt, float &phitilt)
Definition: EcalClusterLocal.cc:14
SuperClusterHelper::theElectron_
const reco::GsfElectron * theElectron_
Definition: SuperClusterHelper.h:97
SuperClusterHelper::rechits_
const EcalRecHitCollection * rechits_
Definition: SuperClusterHelper.h:102
SuperClusterHelper::eta
float eta() const
Definition: SuperClusterHelper.h:25
reco::CaloCluster::eta
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:181
cosmicPhotonAnalyzer_cfi.eMax
eMax
Definition: cosmicPhotonAnalyzer_cfi.py:10
SuperClusterHelper::vCov_
std::vector< float > vCov_
Definition: SuperClusterHelper.h:110
reco::SuperCluster::clustersBegin
CaloCluster_iterator clustersBegin() const
fist iterator over BasicCluster constituents
Definition: SuperCluster.h:86
SuperClusterHelper::esClusterEnergy
float esClusterEnergy(unsigned i) const
Definition: SuperClusterHelper.cc:168
cuy.ib
ib
Definition: cuy.py:662
SuperClusterHelper::spp_
float spp_
Definition: SuperClusterHelper.h:111
SuperClusterHelper::sep_
float sep_
Definition: SuperClusterHelper.h:112
SuperClusterHelper::theBasicClusters_
std::vector< const reco::CaloCluster * > theBasicClusters_
Definition: SuperClusterHelper.h:99
reco::GsfElectron::sigmaIetaIeta
float sigmaIetaIeta() const
Definition: GsfElectron.h:419
CaloTopology.h
EcalClusterLocal.h
SuperClusterHelper::localCoordinates
void localCoordinates()
Definition: SuperClusterHelper.cc:134
SuperClusterHelper::subClusterEmax
float subClusterEmax(unsigned i) const
Definition: SuperClusterHelper.cc:160
isFinite.h
SuperClusterHelper::subClusterPhi
float subClusterPhi(unsigned i) const
Definition: SuperClusterHelper.cc:156
reco::SuperCluster::preshowerClustersEnd
CaloCluster_iterator preshowerClustersEnd() const
last iterator over PreshowerCluster constituents
Definition: SuperCluster.h:95
SuperClusterHelper::barrel_
bool barrel_
Definition: SuperClusterHelper.h:105
SuperClusterHelper::topology_
const CaloTopology * topology_
Definition: SuperClusterHelper.h:103
SuperClusterHelper::phiTilt_
float phiTilt_
Definition: SuperClusterHelper.h:120
SuperClusterHelper::iphiSeed_
int iphiSeed_
Definition: SuperClusterHelper.h:116
pat::Electron
Analysis-level electron class.
Definition: Electron.h:51
edm::isFinite
constexpr bool isFinite(T x)
reco::SuperCluster::clustersEnd
CaloCluster_iterator clustersEnd() const
last iterator over BasicCluster constituents
Definition: SuperCluster.h:89
SuperClusterHelper::subClusterEta
float subClusterEta(unsigned i) const
Definition: SuperClusterHelper.cc:152
reco::CaloCluster::energy
double energy() const
cluster energy
Definition: CaloCluster.h:149
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
SuperClusterHelper::etaCrySeed_
float etaCrySeed_
Definition: SuperClusterHelper.h:117