CMS 3D CMS Logo

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 
23  double etLow,
25  const reco::SuperClusterCollection* superClusterCollection)
26  : etMin(etLow),
28  basicClusterCollection_(basicClusterCollection),
29  superClusterCollection_(superClusterCollection) {}
30 
32 
34  double ecalIsol = 0.;
36  math::XYZVector position(sc.get()->position().x(), sc.get()->position().y(), sc.get()->position().z());
37 
38  // match the photon hybrid supercluster with those with Algo==0 (island)
39  double delta1 = 1000.;
40  double deltacur = 1000.;
41  const reco::SuperCluster* matchedsupercluster = nullptr;
42  bool MATCHEDSC = false;
43 
44  for (reco::SuperClusterCollection::const_iterator scItr = superClusterCollection_->begin();
45  scItr != superClusterCollection_->end();
46  ++scItr) {
47  const reco::SuperCluster* supercluster = &(*scItr);
48 
49  math::XYZVector currentPosition(
50  supercluster->position().x(), supercluster->position().y(), supercluster->position().z());
51 
52  if (supercluster->seed()->algo() == 0) {
53  deltacur = DeltaR(currentPosition, position);
54 
55  if (deltacur < delta1) {
56  delta1 = deltacur;
57  matchedsupercluster = supercluster;
58  MATCHEDSC = true;
59  }
60  }
61  }
62 
63  const reco::BasicCluster* cluster = nullptr;
64 
65  //loop over basic clusters
66  for (reco::BasicClusterCollection::const_iterator cItr = basicClusterCollection_->begin();
67  cItr != basicClusterCollection_->end();
68  ++cItr) {
69  cluster = &(*cItr);
70  // double ebc_bcchi2 = cluster->chi2();
71  int ebc_bcalgo = cluster->algo();
72  double ebc_bce = cluster->energy();
73  double ebc_bceta = cluster->eta();
74  double ebc_bcet = ebc_bce * sin(2 * atan(exp(ebc_bceta)));
75  double newDelta = 0.;
76 
77  if (ebc_bcet > etMin && ebc_bcalgo == 0) {
78  // if (ebc_bcchi2 < 30.) {
79 
80  if (MATCHEDSC) {
81  bool inSuperCluster = false;
82 
83  reco::CaloCluster_iterator theEclust = matchedsupercluster->clustersBegin();
84  // loop over the basic clusters of the matched supercluster
85  for (; theEclust != matchedsupercluster->clustersEnd(); theEclust++) {
86  if ((**theEclust) == (*cluster))
87  inSuperCluster = true;
88  }
89  if (!inSuperCluster) {
90  math::XYZVector basicClusterPosition(
91  cluster->position().x(), cluster->position().y(), cluster->position().z());
92  newDelta = DeltaR(basicClusterPosition, position);
93  if (newDelta < conesize) {
94  ecalIsol += ebc_bcet;
95  }
96  }
97  }
98  // } // matches ebc_bcchi2
99  } // matches ebc_bcet && ebc_bcalgo
100  }
101 
102  // std::cout << "Will return ecalIsol = " << ecalIsol << std::endl;
103  return ecalIsol;
104 }
double getEcalEtSum(const reco::Candidate *)
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:153
AlgoId algo() const
algorithm identifier
Definition: CaloCluster.h:189
T get() const
get a component
Definition: Candidate.h:221
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
CaloCluster_iterator clustersBegin() const
fist iterator over BasicCluster constituents
Definition: SuperCluster.h:88
CaloCluster_iterator clustersEnd() const
last iterator over BasicCluster constituents
Definition: SuperCluster.h:91
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
const reco::SuperClusterCollection * superClusterCollection_
double energy() const
cluster energy
Definition: CaloCluster.h:148
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:79
EgammaEcalIsolation(double extRadius, double etLow, const reco::BasicClusterCollection *, const reco::SuperClusterCollection *)
static int position[264][3]
Definition: ReadPGInfo.cc:289
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:232
const reco::BasicClusterCollection * basicClusterCollection_
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:180