CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SuperClusterHelper.cc
Go to the documentation of this file.
3 
4 
5 
6 
9  rechits_ = rechits ;
10  seedCluster_ = & (*(electron->superCluster()->seed()));
11  theSuperCluster_ = &(*electron->superCluster());
12 
13  eSubClusters_ = 0.;
14  // Store subclusters
17  for(; itscl < itsclE ; ++itscl) {
18  if((*itscl)==electron->superCluster()->seed()) continue; // skip seed cluster
19  theBasicClusters_.push_back(&(**itscl));
20  eSubClusters_ += (*itscl)->energy();
21  }
22  // sort subclusters
24  // Add seed cluster at the beginning
26 
28 
29  // Store ES clusters
30  eESClusters_ = 0. ;
33  for( ; itscl < itsclE ; ++ itscl) {
34  theESClusters_.push_back(&(**itscl));
35  eESClusters_ += (*itscl)->energy();
36  }
37  // sort ES clusters
39 
41 
42  topology_ = topo;
43  geometry_ = geom;
44  barrel_ = electron->isEB();
45  covComputed_ = false;
47 }
48 
50  theElectron_ = (const reco::GsfElectron*)electron;
51  rechits_ = rechits ;
52 // for(unsigned ir=0; ir<rechits_->size();++ir) {
53 // std::cout << "RecHit " << (*rechits_)[ir].id().rawId() << " " << (*rechits_)[ir] << std::endl;
54 // }
55  // Get the embedded objects
56  theSuperCluster_ = &(*electron->superCluster());
57  seedCluster_ = & (*(electron->seed()));
58  const std::vector<reco::CaloCluster>& basicClusters(electron->basicClusters());
59  nBasicClusters_ = basicClusters.size();
60  eSubClusters_ = 0. ;
61  // Store subclusters
62  for ( unsigned ib = 0; ib < nBasicClusters_ ; ++ib) {
63  if(fabs((basicClusters[ib].energy()-seedCluster_->energy())/seedCluster_->energy())<1.e-5 &&
64  fabs((basicClusters[ib].eta()-seedCluster_->eta())/seedCluster_->eta())<1.e-5 &&
65  fabs((basicClusters[ib].phi()-seedCluster_->phi())/seedCluster_->phi())<1.e-5
66  )
67  continue; // skip seed cluster
68  theBasicClusters_.push_back(&basicClusters[ib]);
69  eSubClusters_ += basicClusters[ib].energy();
70  }
71  // sort subclusters
73  // Add seed cluster at the beginning
75 
76  // Store ES clusters
77  const std::vector<reco::CaloCluster>& esClusters(electron->preshowerClusters());
78  nESClusters_ = esClusters.size();
79  eESClusters_ = 0. ;
80  for (unsigned ib = 0 ; ib < nESClusters_ ; ++ ib) {
81  theESClusters_.push_back(&esClusters[ib]);
82  eESClusters_ += esClusters[ib].energy();
83  }
84  // sort ES clusters
86 
87 // std::vector< std::pair<DetId, float> >::const_iterator it=seedCluster_->hitsAndFractions().begin();
88 // std::vector< std::pair<DetId, float> >::const_iterator itend=seedCluster_->hitsAndFractions().end();
89 // for( ; it!=itend ; ++it) {
90 // DetId id=it->first;
91 // std::cout << " Basic cluster " << id.rawId() << std::endl;
92 // }
93  topology_ = topo;
94  geometry_ = geom;
95  barrel_ = electron->isEB();
96  covComputed_ = false;
98 }
99 
101  if (!covComputed_) {
102  vCov_ = EcalClusterTools::localCovariances(*seedCluster_, rechits_, topology_, 4.7);
103  covComputed_ = true;
104 
105  spp_ = 0;
106  if (!isnan(vCov_[2])) spp_ = sqrt (vCov_[2]);
107 
108  if (theElectron_->sigmaIetaIeta()*spp_ > 0) {
109  sep_ = vCov_[1] / (theElectron_->sigmaIetaIeta() * spp_);
110  } else if (vCov_[1] > 0) {
111  sep_ = 1.0;
112  } else {
113  sep_ = -1.0;
114  }
115  }
116 }
117 
120  return spp_;
121 }
122 
125  return sep_;
126 }
127 
129  if (localCoordinatesComputed_) return;
130 
131  if (barrel_) {
133  } else {
135  }
137 }
138 
139 
141  return (nBasicClusters_ > i) ? theBasicClusters_[i]->energy() : 0.;
142 }
143 
144 float SuperClusterHelper::subClusterEta(unsigned i) const {
145  return (nBasicClusters_ > i) ? theBasicClusters_[i]->eta() : 999.;
146 }
147 
148 float SuperClusterHelper::subClusterPhi(unsigned i) const {
149  return (nBasicClusters_ > i) ? theBasicClusters_[i]->phi() : 999.;
150 }
151 
152 float SuperClusterHelper::subClusterEmax(unsigned i) const {
153  return (nBasicClusters_ > i) ? EcalClusterTools::eMax(*theBasicClusters_[i], rechits_) : 0.;
154 }
155 
156 float SuperClusterHelper::subClusterE3x3(unsigned i) const {
157  return (nBasicClusters_ > i) ? EcalClusterTools::e3x3(*theBasicClusters_[i], rechits_, topology_) : 0.;
158 }
159 
160 float SuperClusterHelper::esClusterEnergy(unsigned i) const {
161  return (nESClusters_ > i) ? theESClusters_[i]->energy() : 0. ;
162 }
163 
164 float SuperClusterHelper::esClusterEta(unsigned i) const {
165  return (nESClusters_ > i) ? theESClusters_[i]->eta() : 999. ;
166 }
167 
168 float SuperClusterHelper::esClusterPhi(unsigned i) const {
169  return (nESClusters_ > i) ? theESClusters_[i]->phi() : 999. ;
170 }
static bool sortClusters(const reco::CaloCluster *c1, const reco::CaloCluster *c2)
CaloCluster_iterator preshowerClustersBegin() const
fist iterator over PreshowerCluster constituents
Definition: SuperCluster.h:81
int i
Definition: DBlmapReader.cc:9
std::vector< float > vCov_
std::vector< const reco::CaloCluster * > theESClusters_
int ib
Definition: cuy.py:660
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
bool isEB() const
Definition: GsfElectron.h:350
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:163
SuperClusterHelper(const reco::GsfElectron *electron, const EcalRecHitCollection *rechits, const CaloTopology *, const CaloGeometry *)
const CaloTopology * topology_
float esClusterEta(unsigned i) const
reco::SuperClusterRef superCluster() const
override the reco::GsfElectron::superCluster method, to access the internal storage of the superclust...
float sigmaIetaIeta() const
Definition: GsfElectron.h:416
float subClusterEnergy(unsigned i) const
bool isnan(float x)
Definition: math.h:13
T sqrt(T t)
Definition: SSEVec.h:18
virtual SuperClusterRef superCluster() const
reference to a SuperCluster
Definition: GsfElectron.h:182
const reco::CaloCluster * seedCluster_
double energy() const
cluster energy
Definition: CaloCluster.h:121
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
void localCoordsEB(const reco::CaloCluster &bclus, const edm::EventSetup &es, float &etacry, float &phicry, int &ieta, int &iphi, float &thetatilt, float &phitilt) const
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:166
void localCoordsEE(const reco::CaloCluster &bclus, const edm::EventSetup &es, float &xcry, float &ycry, int &ix, int &iy, float &thetatilt, float &phitilt) const
EcalClusterLocal local_
CaloCluster_iterator preshowerClustersEnd() const
last iterator over PreshowerCluster constituents
Definition: SuperCluster.h:84
CaloCluster_iterator clustersEnd() const
last iterator over BasicCluster constituents
Definition: SuperCluster.h:78