CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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) {
56  theElectron_ = (const reco::GsfElectron*)electron;
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 {
161  return (nBasicClusters_ > i) ? EcalClusterTools::eMax(*theBasicClusters_[i], rechits_) : 0.;
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)
CaloCluster_iterator preshowerClustersBegin() const
fist iterator over PreshowerCluster constituents
Definition: SuperCluster.h:92
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_
int ib
Definition: cuy.py:661
std::vector< const reco::CaloCluster * > theBasicClusters_
float esClusterEnergy(unsigned i) const
const std::vector< reco::CaloCluster > & basicClusters() const
Definition: Electron.h:86
float subClusterE3x3(unsigned i) const
reco::SuperClusterRef superCluster() const override
override the reco::GsfElectron::superCluster method, to access the internal storage of the superclust...
constexpr bool isFinite(T x)
bool isEB() const
Definition: GsfElectron.h:328
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:181
SuperClusterHelper(const reco::GsfElectron *electron, const EcalRecHitCollection *rechits, const CaloTopology *, const CaloGeometry *)
const CaloTopology * topology_
float esClusterEta(unsigned i) const
float sigmaIetaIeta() const
Definition: GsfElectron.h:419
float subClusterEnergy(unsigned i) const
T sqrt(T t)
Definition: SSEVec.h:19
const reco::CaloCluster * seedCluster_
double energy() const
cluster energy
Definition: CaloCluster.h:149
void localEcalClusterCoordsEE(const reco::CaloCluster &bclus, const CaloGeometry &geom, float &xcry, float &ycry, int &ix, int &iy, float &thetatilt, float &phitilt)
const reco::SuperCluster * theSuperCluster_
const EcalRecHitCollection * rechits_
float subClusterEmax(unsigned i) const
const CaloGeometry * geometry_
float esClusterPhi(unsigned i) const
float subClusterPhi(unsigned i) const
bool localCoordinatesComputed_
local coordinates
Analysis-level electron class.
Definition: Electron.h:51
CaloCluster_iterator clustersBegin() const
fist iterator over BasicCluster constituents
Definition: SuperCluster.h:86
const reco::GsfElectron * theElectron_
reco::CaloClusterPtr seed() const
direct access to the seed cluster
const std::vector< reco::CaloCluster > & preshowerClusters() const
Definition: Electron.h:88
float subClusterEta(unsigned i) const
double phi() const
azimuthal angle of cluster centroid
Definition: CaloCluster.h:184
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:155
CaloCluster_iterator preshowerClustersEnd() const
last iterator over PreshowerCluster constituents
Definition: SuperCluster.h:95
CaloCluster_iterator clustersEnd() const
last iterator over BasicCluster constituents
Definition: SuperCluster.h:89