CMS 3D CMS Logo

SuperClusterHelper.cc
Go to the documentation of this file.
5 
6 
7 
10  rechits_ = rechits ;
11  seedCluster_ = & (*(electron->superCluster()->seed()));
12  theSuperCluster_ = &(*electron->superCluster());
13 
14  eSubClusters_ = 0.;
15  // Store subclusters
18  for(; itscl < itsclE ; ++itscl) {
19  if((*itscl)==electron->superCluster()->seed()) continue; // skip seed cluster
20  theBasicClusters_.push_back(&(**itscl));
21  eSubClusters_ += (*itscl)->energy();
22  }
23  // sort subclusters
25  // Add seed cluster at the beginning
27 
29 
30  // Store ES clusters
31  eESClusters_ = 0. ;
34  for( ; itscl < itsclE ; ++ itscl) {
35  theESClusters_.push_back(&(**itscl));
36  eESClusters_ += (*itscl)->energy();
37  }
38  // sort ES clusters
40 
42 
43  topology_ = topo;
44  geometry_ = geom;
45  barrel_ = electron->isEB();
46  covComputed_ = false;
48 }
49 
51  theElectron_ = (const reco::GsfElectron*)electron;
52  rechits_ = rechits ;
53 // for(unsigned ir=0; ir<rechits_->size();++ir) {
54 // std::cout << "RecHit " << (*rechits_)[ir].id().rawId() << " " << (*rechits_)[ir] << std::endl;
55 // }
56  // Get the embedded objects
57  theSuperCluster_ = &(*electron->superCluster());
58  seedCluster_ = & (*(electron->seed()));
59  const std::vector<reco::CaloCluster>& basicClusters(electron->basicClusters());
60  nBasicClusters_ = basicClusters.size();
61  eSubClusters_ = 0. ;
62  // Store subclusters
63  for ( unsigned ib = 0; ib < nBasicClusters_ ; ++ib) {
64  if(fabs((basicClusters[ib].energy()-seedCluster_->energy())/seedCluster_->energy())<1.e-5 &&
65  fabs((basicClusters[ib].eta()-seedCluster_->eta())/seedCluster_->eta())<1.e-5 &&
66  fabs((basicClusters[ib].phi()-seedCluster_->phi())/seedCluster_->phi())<1.e-5
67  )
68  continue; // skip seed cluster
69  theBasicClusters_.push_back(&basicClusters[ib]);
70  eSubClusters_ += basicClusters[ib].energy();
71  }
72  // sort subclusters
74  // Add seed cluster at the beginning
76 
77  // Store ES clusters
78  const std::vector<reco::CaloCluster>& esClusters(electron->preshowerClusters());
79  nESClusters_ = esClusters.size();
80  eESClusters_ = 0. ;
81  for (unsigned ib = 0 ; ib < nESClusters_ ; ++ ib) {
82  theESClusters_.push_back(&esClusters[ib]);
83  eESClusters_ += esClusters[ib].energy();
84  }
85  // sort ES clusters
87 
88 // std::vector< std::pair<DetId, float> >::const_iterator it=seedCluster_->hitsAndFractions().begin();
89 // std::vector< std::pair<DetId, float> >::const_iterator itend=seedCluster_->hitsAndFractions().end();
90 // for( ; it!=itend ; ++it) {
91 // DetId id=it->first;
92 // std::cout << " Basic cluster " << id.rawId() << std::endl;
93 // }
94  topology_ = topo;
95  geometry_ = geom;
96  barrel_ = electron->isEB();
97  covComputed_ = false;
99 }
100 
102  if (!covComputed_) {
103  vCov_ = EcalClusterTools::localCovariances(*seedCluster_, rechits_, topology_, 4.7);
104  covComputed_ = true;
105 
106  spp_ = 0;
107  if (edm::isFinite(vCov_[2])) spp_ = sqrt (vCov_[2]);
108 
109  if (theElectron_->sigmaIetaIeta()*spp_ > 0) {
110  sep_ = vCov_[1] / (theElectron_->sigmaIetaIeta() * spp_);
111  } else if (vCov_[1] > 0) {
112  sep_ = 1.0;
113  } else {
114  sep_ = -1.0;
115  }
116  }
117 }
118 
121  return spp_;
122 }
123 
126  return sep_;
127 }
128 
130  if (localCoordinatesComputed_) return;
131 
132  if (barrel_) {
134  } else {
136  }
138 }
139 
140 
142  return (nBasicClusters_ > i) ? theBasicClusters_[i]->energy() : 0.;
143 }
144 
145 float SuperClusterHelper::subClusterEta(unsigned i) const {
146  return (nBasicClusters_ > i) ? theBasicClusters_[i]->eta() : 999.;
147 }
148 
149 float SuperClusterHelper::subClusterPhi(unsigned i) const {
150  return (nBasicClusters_ > i) ? theBasicClusters_[i]->phi() : 999.;
151 }
152 
153 float SuperClusterHelper::subClusterEmax(unsigned i) const {
155 }
156 
157 float SuperClusterHelper::subClusterE3x3(unsigned i) const {
158  return (nBasicClusters_ > i) ? EcalClusterTools::e3x3(*theBasicClusters_[i], rechits_, topology_) : 0.;
159 }
160 
161 float SuperClusterHelper::esClusterEnergy(unsigned i) const {
162  return (nESClusters_ > i) ? theESClusters_[i]->energy() : 0. ;
163 }
164 
165 float SuperClusterHelper::esClusterEta(unsigned i) const {
166  return (nESClusters_ > i) ? theESClusters_[i]->eta() : 999. ;
167 }
168 
169 float SuperClusterHelper::esClusterPhi(unsigned i) const {
170  return (nESClusters_ > i) ? theESClusters_[i]->phi() : 999. ;
171 }
static bool sortClusters(const reco::CaloCluster *c1, const reco::CaloCluster *c2)
CaloCluster_iterator preshowerClustersBegin() const
fist iterator over PreshowerCluster constituents
Definition: SuperCluster.h:81
std::vector< float > vCov_
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_
std::vector< const reco::CaloCluster * > theBasicClusters_
float esClusterEnergy(unsigned i) const
const std::vector< reco::CaloCluster > & basicClusters() const
Definition: Electron.h:89
float subClusterE3x3(unsigned i) const
constexpr bool isFinite(T x)
bool isEB() const
Definition: GsfElectron.h:356
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:168
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:440
float subClusterEnergy(unsigned i) const
T sqrt(T t)
Definition: SSEVec.h:18
const reco::CaloCluster * seedCluster_
double energy() const
cluster energy
Definition: CaloCluster.h:126
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:52
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:185
CaloCluster_iterator clustersBegin() const
fist iterator over BasicCluster constituents
Definition: SuperCluster.h:75
const reco::GsfElectron * theElectron_
reco::CaloClusterPtr seed() const
direct access to the seed cluster
const std::vector< reco::CaloCluster > & preshowerClusters() const
Definition: Electron.h:91
float subClusterEta(unsigned i) const
double phi() const
azimuthal angle of cluster centroid
Definition: CaloCluster.h:171
reco::SuperClusterRef superCluster() const override
override the reco::GsfElectron::superCluster method, to access the internal storage of the superclust...
CaloCluster_iterator preshowerClustersEnd() const
last iterator over PreshowerCluster constituents
Definition: SuperCluster.h:84
ib
Definition: cuy.py:662
CaloCluster_iterator clustersEnd() const
last iterator over BasicCluster constituents
Definition: SuperCluster.h:78