CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EgammaEcalIsolation.cc
Go to the documentation of this file.
1 //*****************************************************************************
2 // File: EgammaEcalIsolation.cc
3 // ----------------------------------------------------------------------------
4 // OrigAuth: Gilles De Lentdecker
5 // Institute: IIHE-ULB
6 //=============================================================================
7 //*****************************************************************************
8 
9 //C++ includes
10 #include <vector>
11 #include <functional>
12 
13 //ROOT includes
14 #include <Math/VectorUtil.h>
15 
16 //CMSSW includes
19 
20 using namespace ROOT::Math::VectorUtil ;
21 
22 
24  double etLow,
25  const reco::BasicClusterCollection* basicClusterCollection,
26  const reco::SuperClusterCollection* superClusterCollection):
27  etMin(etLow),
28  conesize(extRadius),
29  basicClusterCollection_(basicClusterCollection),
30  superClusterCollection_(superClusterCollection)
31 {
32 }
33 
35 
37 
38 
39  double ecalIsol=0.;
41  math::XYZVector position(sc.get()->position().x(),
42  sc.get()->position().y(),
43  sc.get()->position().z());
44 
45  // match the photon hybrid supercluster with those with Algo==0 (island)
46  double delta1=1000.;
47  double deltacur=1000.;
48  const reco::SuperCluster *matchedsupercluster=0;
49  bool MATCHEDSC = false;
50 
51  for(reco::SuperClusterCollection::const_iterator scItr = superClusterCollection_->begin(); scItr != superClusterCollection_->end(); ++scItr){
52 
53  const reco::SuperCluster *supercluster = &(*scItr);
54 
55  math::XYZVector currentPosition(supercluster->position().x(),
56  supercluster->position().y(),
57  supercluster->position().z());
58 
59 
60  if(supercluster->seed()->algo() == 0){
61  deltacur = DeltaR(currentPosition, position);
62 
63  if (deltacur < delta1) {
64  delta1=deltacur;
65  matchedsupercluster = supercluster;
66  MATCHEDSC = true;
67  }
68  }
69  }
70 
71  const reco::BasicCluster *cluster= 0;
72 
73  //loop over basic clusters
74  for(reco::BasicClusterCollection::const_iterator cItr = basicClusterCollection_->begin(); cItr != basicClusterCollection_->end(); ++cItr){
75 
76  cluster = &(*cItr);
77 // double ebc_bcchi2 = cluster->chi2();
78  int ebc_bcalgo = cluster->algo();
79  double ebc_bce = cluster->energy();
80  double ebc_bceta = cluster->eta();
81  double ebc_bcet = ebc_bce*sin(2*atan(exp(ebc_bceta)));
82  double newDelta = 0.;
83 
84 
85  if (ebc_bcet > etMin && ebc_bcalgo == 0) {
86  // if (ebc_bcchi2 < 30.) {
87 
88  if(MATCHEDSC){
89  bool inSuperCluster = false;
90 
91  reco::CaloCluster_iterator theEclust = matchedsupercluster->clustersBegin();
92  // loop over the basic clusters of the matched supercluster
93  for(;theEclust != matchedsupercluster->clustersEnd();
94  theEclust++) {
95  if ((**theEclust) == (*cluster) ) inSuperCluster = true;
96  }
97  if (!inSuperCluster) {
98 
99  math::XYZVector basicClusterPosition(cluster->position().x(),
100  cluster->position().y(),
101  cluster->position().z());
102  newDelta=DeltaR(basicClusterPosition,position);
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  // std::cout << "Will return ecalIsol = " << ecalIsol << std::endl;
114  return ecalIsol;
115 
116 }
double getEcalEtSum(const reco::Candidate *)
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:126
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:244
const reco::SuperClusterCollection * superClusterCollection_
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
EgammaEcalIsolation(double extRadius, double etLow, const reco::BasicClusterCollection *, const reco::SuperClusterCollection *)
static int position[264][3]
Definition: ReadPGInfo.cc:509
CaloCluster_iterator clustersBegin() const
fist iterator over BasicCluster constituents
Definition: SuperCluster.h:75
T get() const
get a component
Definition: Candidate.h:217
const reco::BasicClusterCollection * basicClusterCollection_
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:66
CaloCluster_iterator clustersEnd() const
last iterator over BasicCluster constituents
Definition: SuperCluster.h:78