CMS 3D CMS Logo

SuperClusterHelper.cc
Go to the documentation of this file.
5 
7  const EcalRecHitCollection* rechits,
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 
53  const EcalRecHitCollection* rechits,
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  const auto& vCov_ = EcalClusterTools::localCovariances(*seedCluster_, rechits_, topology_, 4.7);
108  covComputed_ = true;
109 
110  spp_ = 0;
111  if (edm::isFinite(vCov_[2]))
112  spp_ = sqrt(vCov_[2]);
113 
114  if (theElectron_->sigmaIetaIeta() * spp_ > 0) {
115  sep_ = vCov_[1] / (theElectron_->sigmaIetaIeta() * spp_);
116  } else if (vCov_[1] > 0) {
117  sep_ = 1.0;
118  } else {
119  sep_ = -1.0;
120  }
121  }
122 }
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 }
static bool sortClusters(const reco::CaloCluster *c1, const reco::CaloCluster *c2)
float subClusterPhi(unsigned i) const
void localEcalClusterCoordsEB(const reco::CaloCluster &bclus, const CaloGeometry &geom, float &etacry, float &phicry, int &ieta, int &iphi, float &thetatilt, float &phitilt)
std::vector< const reco::CaloCluster * > theESClusters_
float subClusterEnergy(unsigned i) const
std::vector< const reco::CaloCluster * > theBasicClusters_
float sigmaIetaIeta() const
Definition: GsfElectron.h:419
CaloCluster_iterator clustersBegin() const
fist iterator over BasicCluster constituents
Definition: SuperCluster.h:88
CaloCluster_iterator preshowerClustersBegin() const
fist iterator over PreshowerCluster constituents
Definition: SuperCluster.h:94
constexpr bool isFinite(T x)
double phi() const
azimuthal angle of cluster centroid
Definition: CaloCluster.h:183
CaloCluster_iterator clustersEnd() const
last iterator over BasicCluster constituents
Definition: SuperCluster.h:91
SuperClusterHelper(const reco::GsfElectron *electron, const EcalRecHitCollection *rechits, const CaloTopology *, const CaloGeometry *)
const CaloTopology * topology_
float esClusterPhi(unsigned i) const
T sqrt(T t)
Definition: SSEVec.h:19
float esClusterEnergy(unsigned i) const
const reco::CaloCluster * seedCluster_
void localEcalClusterCoordsEE(const reco::CaloCluster &bclus, const CaloGeometry &geom, float &xcry, float &ycry, int &ix, int &iy, float &thetatilt, float &phitilt)
CaloCluster_iterator preshowerClustersEnd() const
last iterator over PreshowerCluster constituents
Definition: SuperCluster.h:97
const reco::SuperCluster * theSuperCluster_
const EcalRecHitCollection * rechits_
float esClusterEta(unsigned i) const
double energy() const
cluster energy
Definition: CaloCluster.h:148
const CaloGeometry * geometry_
bool localCoordinatesComputed_
local coordinates
Analysis-level electron class.
Definition: Electron.h:51
float subClusterE3x3(unsigned i) const
const reco::GsfElectron * theElectron_
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:180
float subClusterEmax(unsigned i) const
float subClusterEta(unsigned i) const
ib
Definition: cuy.py:661