CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 // $Id: EgammaHLTEcalIsolation.cc,v 1.5 2009/03/27 09:09:38 ghezzi Exp $
12 //
13 
14 // system include files
15 
16 // user include files
18 
19 #define PI 3.141592654
20 #define TWOPI 6.283185308
21 
22 
24  const std::vector<const reco::SuperCluster*> sclusters,
25  const std::vector<const reco::BasicCluster*> bclusters){
26 
27  float ecalIsol=0.;
28 
29  float candSCphi = recocandidate->superCluster()->phi();
30  float candSCeta = recocandidate->superCluster()->eta();
31 
32 
33  // match the photon hybrid supercluster with those with Algo==0 (island)
34  float delta1=1000.;
35  float deltacur=1000.;
36  const reco::SuperCluster *matchedsupercluster=0;
37  bool MATCHEDSC = false;
38 
39 
40 
41  for(std::vector<const reco::SuperCluster*>::const_iterator scItr = sclusters.begin(); scItr != sclusters.end(); ++scItr){
42 
43 
44  const reco::SuperCluster *supercluster = *scItr;
45 
46  float SCphi = supercluster->phi();
47  float SCeta = supercluster->eta();
48 
49  if(supercluster->seed()->algo() == algoType_){
50  float deltaphi;
51  if(candSCphi<0) candSCphi+=TWOPI;
52  if(SCphi<0) SCphi+=TWOPI;
53  deltaphi=fabs(candSCphi-SCphi);
54  if(deltaphi>TWOPI) deltaphi-=TWOPI;
55  if(deltaphi>PI) deltaphi=TWOPI-deltaphi;
56  float deltaeta=fabs(SCeta-candSCeta);
57  deltacur = sqrt(deltaphi*deltaphi+ deltaeta*deltaeta);
58 
59  if (deltacur < delta1) {
60  delta1=deltacur;
61  matchedsupercluster = supercluster;
62  MATCHEDSC = true;
63  }
64  }
65  }
66 
67  const reco::BasicCluster *cluster= 0;
68 
69  //loop over basic clusters
70  for(std::vector<const reco::BasicCluster*>::const_iterator cItr = bclusters.begin(); cItr != bclusters.end(); ++cItr){
71 
72  cluster = *cItr;
73 // float ebc_bcchi2 = cluster->chi2(); //chi2 for SC was useless and it is removed in 31x
74  int ebc_bcalgo = cluster->algo();
75  float ebc_bce = cluster->energy();
76  float ebc_bceta = cluster->eta();
77  float ebc_bcphi = cluster->phi();
78  float ebc_bcet = ebc_bce*sin(2*atan(exp(ebc_bceta)));
79  float newDelta;
80 
81 
82  if (ebc_bcet > etMin && ebc_bcalgo == algoType_ ) {
83  // if (ebc_bcchi2 < 30.) {
84 
85  if(MATCHEDSC){
86  bool inSuperCluster = false;
87 
88  reco::CaloCluster_iterator theEclust = matchedsupercluster->clustersBegin();
89  // loop over the basic clusters of the matched supercluster
90  for(;theEclust != matchedsupercluster->clustersEnd();
91  theEclust++) {
92  if (&(**theEclust) == cluster) inSuperCluster = true;
93  }
94  if (!inSuperCluster) {
95  float deltaphi;
96  if(ebc_bcphi<0) ebc_bcphi+=TWOPI;
97  if(candSCphi<0) candSCphi+=TWOPI;
98  deltaphi=fabs(ebc_bcphi-candSCphi);
99  if(deltaphi>TWOPI) deltaphi-=TWOPI;
100  if(deltaphi>PI) deltaphi=TWOPI-deltaphi;
101  float deltaeta=fabs(ebc_bceta-candSCeta);
102  newDelta= sqrt(deltaphi*deltaphi+ deltaeta*deltaeta);
103  if(newDelta < conesize) {
104  ecalIsol+=ebc_bcet;
105  }
106  }
107  }
108  // } // matches ebc_bcchi2
109  } // matches ebc_bcet && ebc_bcalgo
110 
111  }
112 
113 
114  return ecalIsol;
115 
116 }
#define PI
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:160
T sqrt(T t)
Definition: SSEVec.h:46
#define TWOPI
CaloCluster_iterator clustersBegin() const
fist iterator over BasicCluster constituents
Definition: SuperCluster.h:65
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:62
double phi() const
azimuthal angle of cluster centroid
Definition: CaloCluster.h:163
float isolPtSum(const reco::RecoCandidate *recocandidate, const std::vector< const reco::SuperCluster * > sclusters, const std::vector< const reco::BasicCluster * > bclusters)
virtual reco::SuperClusterRef superCluster() const
reference to a SuperCluster
CaloCluster_iterator clustersEnd() const
last iterator over BasicCluster constituents
Definition: SuperCluster.h:68