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),
27  conesize(extRadius),
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 }
photonAnalyzer_cfi.etMin
etMin
Definition: photonAnalyzer_cfi.py:54
EgammaEcalIsolation::~EgammaEcalIsolation
~EgammaEcalIsolation()
Definition: EgammaEcalIsolation.cc:31
EgammaEcalIsolation.h
EgammaEcalIsolation::etMin
double etMin
Definition: EgammaEcalIsolation.h:42
reco::SuperCluster
Definition: SuperCluster.h:18
electronEcalRecHitIsolationLcone_cfi.extRadius
extRadius
Definition: electronEcalRecHitIsolationLcone_cfi.py:16
edm::Ref::get
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:232
edm::PtrVectorItr
Definition: PtrVector.h:51
EgammaEcalIsolation::EgammaEcalIsolation
EgammaEcalIsolation(double extRadius, double etLow, const reco::BasicClusterCollection *, const reco::SuperClusterCollection *)
Definition: EgammaEcalIsolation.cc:22
reco::Candidate::get
T get() const
get a component
Definition: Candidate.h:221
RecoCandidate.h
edm::Ref< SuperClusterCollection >
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
reco::SuperClusterCollection
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
Definition: SuperClusterFwd.h:9
EgammaEcalIsolation::superClusterCollection_
const reco::SuperClusterCollection * superClusterCollection_
Definition: EgammaEcalIsolation.h:46
reco::CaloCluster
Definition: CaloCluster.h:31
reco::BasicClusterCollection
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
Definition: BasicClusterFwd.h:16
reco::SuperCluster::seed
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:77
reco::CaloCluster::eta
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:181
math::XYZVector
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
reco::SuperCluster::clustersBegin
CaloCluster_iterator clustersBegin() const
fist iterator over BasicCluster constituents
Definition: SuperCluster.h:86
electronAnalyzer_cfi.DeltaR
DeltaR
Definition: electronAnalyzer_cfi.py:33
reco::CaloCluster::position
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:154
reco::Candidate
Definition: Candidate.h:27
reco::CaloCluster::algo
AlgoId algo() const
algorithm identifier
Definition: CaloCluster.h:190
EgammaEcalIsolation::basicClusterCollection_
const reco::BasicClusterCollection * basicClusterCollection_
Definition: EgammaEcalIsolation.h:45
reco::SuperCluster::clustersEnd
CaloCluster_iterator clustersEnd() const
last iterator over BasicCluster constituents
Definition: SuperCluster.h:89
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
reco::CaloCluster::energy
double energy() const
cluster energy
Definition: CaloCluster.h:149
EgammaEcalIsolation::conesize
double conesize
Definition: EgammaEcalIsolation.h:43
EgammaEcalIsolation::getEcalEtSum
double getEcalEtSum(const reco::Candidate *)
Definition: EgammaEcalIsolation.cc:33
EcalPileUpDepMonitor_cfi.basicClusterCollection
basicClusterCollection
Definition: EcalPileUpDepMonitor_cfi.py:5