CMS 3D CMS Logo

EgammaHLTEcalIsolation.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: EgammaHLTAlgos
4 // Class : EgammaHLTEcalIsolation
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Monica Vazquez Acosta
10 // Created: Tue Jun 13 12:16:00 CEST 2006
11 //
12 
13 // system include files
14 
15 // user include files
17 
18 #define PI 3.141592654
19 #define TWOPI 6.283185308
20 
21 
23  const std::vector<const reco::SuperCluster*>& sclusters,
24  const std::vector<const reco::BasicCluster*>& bclusters){
25 
26  float ecalIsol=0.;
27 
28  float candSCphi = recocandidate->superCluster()->phi();
29  float candSCeta = recocandidate->superCluster()->eta();
30 
31 
32  // match the photon hybrid supercluster with those with Algo==0 (island)
33  float delta1=1000.;
34  float deltacur=1000.;
35  const reco::SuperCluster *matchedsupercluster=nullptr;
36  bool MATCHEDSC = false;
37 
38 
39 
40  for(std::vector<const reco::SuperCluster*>::const_iterator scItr = sclusters.begin(); scItr != sclusters.end(); ++scItr){
41 
42 
43  const reco::SuperCluster *supercluster = *scItr;
44 
45  float SCphi = supercluster->phi();
46  float SCeta = supercluster->eta();
47 
48  if(supercluster->seed()->algo() == algoType_){
49  float deltaphi;
50  if(candSCphi<0) candSCphi+=TWOPI;
51  if(SCphi<0) SCphi+=TWOPI;
52  deltaphi=fabs(candSCphi-SCphi);
53  if(deltaphi>TWOPI) deltaphi-=TWOPI;
54  if(deltaphi>PI) deltaphi=TWOPI-deltaphi;
55  float deltaeta=fabs(SCeta-candSCeta);
56  deltacur = sqrt(deltaphi*deltaphi+ deltaeta*deltaeta);
57 
58  if (deltacur < delta1) {
59  delta1=deltacur;
60  matchedsupercluster = supercluster;
61  MATCHEDSC = true;
62  }
63  }
64  }
65 
66  const reco::BasicCluster *cluster= nullptr;
67 
68  //loop over basic clusters
69  for(std::vector<const reco::BasicCluster*>::const_iterator cItr = bclusters.begin(); cItr != bclusters.end(); ++cItr){
70 
71  cluster = *cItr;
72 // float ebc_bcchi2 = cluster->chi2(); //chi2 for SC was useless and it is removed in 31x
73  int ebc_bcalgo = cluster->algo();
74  float ebc_bce = cluster->energy();
75  float ebc_bceta = cluster->eta();
76  float ebc_bcphi = cluster->phi();
77  float ebc_bcet = ebc_bce*sin(2*atan(exp(ebc_bceta)));
78  float newDelta;
79 
80 
81  if (ebc_bcet > etMin && ebc_bcalgo == algoType_ ) {
82  // if (ebc_bcchi2 < 30.) {
83 
84  if(MATCHEDSC){
85  bool inSuperCluster = false;
86 
87  reco::CaloCluster_iterator theEclust = matchedsupercluster->clustersBegin();
88  // loop over the basic clusters of the matched supercluster
89  for(;theEclust != matchedsupercluster->clustersEnd();
90  theEclust++) {
91  if (&(**theEclust) == cluster) inSuperCluster = true;
92  }
93  if (!inSuperCluster) {
94  float deltaphi;
95  if(ebc_bcphi<0) ebc_bcphi+=TWOPI;
96  if(candSCphi<0) candSCphi+=TWOPI;
97  deltaphi=fabs(ebc_bcphi-candSCphi);
98  if(deltaphi>TWOPI) deltaphi-=TWOPI;
99  if(deltaphi>PI) deltaphi=TWOPI-deltaphi;
100  float deltaeta=fabs(ebc_bceta-candSCeta);
101  newDelta= sqrt(deltaphi*deltaphi+ deltaeta*deltaeta);
102  if(newDelta < conesize) {
103  ecalIsol+=ebc_bcet;
104  }
105  }
106  }
107  // } // matches ebc_bcchi2
108  } // matches ebc_bcet && ebc_bcalgo
109 
110  }
111 
112 
113  return ecalIsol;
114 
115 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:166
float isolPtSum(const reco::RecoCandidate *recocandidate, const std::vector< const reco::SuperCluster * > &sclusters, const std::vector< const reco::BasicCluster * > &bclusters)
T sqrt(T t)
Definition: SSEVec.h:18
#define PI
#define TWOPI
CaloCluster_iterator clustersBegin() const
fist iterator over BasicCluster constituents
Definition: SuperCluster.h:75
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:66
double phi() const
azimuthal angle of cluster centroid
Definition: CaloCluster.h:169
virtual reco::SuperClusterRef superCluster() const
reference to a SuperCluster
CaloCluster_iterator clustersEnd() const
last iterator over BasicCluster constituents
Definition: SuperCluster.h:78