CMS 3D CMS Logo

EcalClusterIsoCalculator.cc
Go to the documentation of this file.
1 // ROOT includes
2 #include <Math/VectorUtil.h>
3 
6 
9 
14 
15 using namespace edm;
16 using namespace reco;
17 using namespace std;
18 
20  const edm::EventSetup &iSetup,
21  const edm::Handle<BasicClusterCollection> pEBclusters,
22  const edm::Handle<BasicClusterCollection> pEEclusters) {
23  if (pEBclusters.isValid())
24  fEBclusters_ = pEBclusters.product();
25  else
26  fEBclusters_ = nullptr;
27 
28  if (pEEclusters.isValid())
29  fEEclusters_ = pEEclusters.product();
30  else
31  fEEclusters_ = nullptr;
32 
33  ESHandle<CaloGeometry> geometryHandle;
34  iSetup.get<CaloGeometryRecord>().get(geometryHandle);
35  if (geometryHandle.isValid())
36  geometry_ = geometryHandle.product();
37  else
38  geometry_ = nullptr;
39 }
40 
42  const double x,
43  const double threshold) {
44  if (!fEBclusters_) {
45  return -100;
46  }
47 
48  if (!fEEclusters_) {
49  return -100;
50  }
51 
52  math::XYZVector SClusPoint(cluster->position().x(), cluster->position().y(), cluster->position().z());
53 
54  double TotalEt = 0;
55 
56  TotalEt = -cluster->rawEnergy() / cosh(cluster->eta());
57 
58  // Loop over barrel basic clusters
59  for (BasicClusterCollection::const_iterator iclu = fEBclusters_->begin(); iclu != fEBclusters_->end(); ++iclu) {
60  const BasicCluster *clu = &(*iclu);
61  math::XYZVector ClusPoint(clu->x(), clu->y(), clu->z());
62  double eta = ClusPoint.eta();
63 
64  double dR2 = reco::deltaR2(*clu, *cluster);
65 
66  if (dR2 < (x * x * 0.01)) {
67  double et = clu->energy() / cosh(eta);
68  if (et < threshold)
69  et = 0;
70  TotalEt += et;
71  }
72  }
73 
74  for (BasicClusterCollection::const_iterator iclu = fEEclusters_->begin(); iclu != fEEclusters_->end(); ++iclu) {
75  const BasicCluster *clu = &(*iclu);
76  const GlobalPoint clusPoint(clu->x(), clu->y(), clu->z());
77  math::XYZVector ClusPoint(clu->x(), clu->y(), clu->z());
78  double eta = ClusPoint.eta();
79 
80  double dR2 = reco::deltaR2(*clu, *cluster);
81 
82  if (dR2 < (x * x * 0.01)) {
83  double et = clu->energy() / cosh(eta);
84  if (et < threshold)
85  et = 0;
86  TotalEt += et;
87  }
88  }
89 
90  return TotalEt;
91 }
92 
94  const double x,
95  double const threshold) {
96  if (!fEBclusters_) {
97  return -100;
98  }
99 
100  if (!fEEclusters_) {
101  return -100;
102  }
103 
104  double SClusterEta = cluster->eta();
105  double TotalEt = 0;
106 
107  TotalEt = -cluster->rawEnergy() / cosh(cluster->eta());
108 
109  for (BasicClusterCollection::const_iterator iclu = fEBclusters_->begin(); iclu != fEBclusters_->end(); ++iclu) {
110  const BasicCluster *clu = &(*iclu);
111  math::XYZVector ClusPoint(clu->x(), clu->y(), clu->z());
112  double eta = ClusPoint.eta();
113 
114  double dEta = fabs(eta - SClusterEta);
115 
116  if (dEta < x * 0.1) {
117  double et = clu->energy() / cosh(eta);
118  if (et < threshold)
119  et = 0;
120  TotalEt += et;
121  }
122  }
123 
124  for (BasicClusterCollection::const_iterator iclu = fEEclusters_->begin(); iclu != fEEclusters_->end(); ++iclu) {
125  const BasicCluster *clu = &(*iclu);
126  math::XYZVector ClusPoint(clu->x(), clu->y(), clu->z());
127  double eta = ClusPoint.eta();
128  double dEta = fabs(eta - SClusterEta);
129 
130  if (dEta < x * 0.1) {
131  double et = clu->energy() / cosh(eta);
132  if (et < threshold)
133  et = 0;
134  TotalEt += et;
135  }
136  }
137 
138  double Cx = getEcalClusterIso(cluster, x, threshold);
139  double CCx = (Cx - TotalEt / 40.0 * x) * (1 / (1 - x / 40.));
140 
141  return CCx;
142 }
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
reco::CaloCluster::y
double y() const
y coordinate of cluster centroid
Definition: CaloCluster.h:175
Handle.h
MessageLogger.h
edm::Handle::product
T const * product() const
Definition: Handle.h:70
BasicCluster.h
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
edm
HLT enums.
Definition: AlignableModifier.h:19
reco::CaloCluster::z
double z() const
z coordinate of cluster centroid
Definition: CaloCluster.h:178
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
edm::Handle
Definition: AssociativeIterator.h:50
EcalClusterIsoCalculator.h
edm::Ref< SuperClusterCollection >
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
PVValHelper::eta
Definition: PVValidationHelpers.h:70
reco::CaloCluster
Definition: CaloCluster.h:31
edm::ESHandle< CaloGeometry >
Point3DBase< float, GlobalTag >
CaloGeometryRecord.h
CaloSubdetectorGeometry.h
EcalClusterIsoCalculator::EcalClusterIsoCalculator
EcalClusterIsoCalculator(const edm::Event &iEvent, const edm::EventSetup &iSetup, const edm::Handle< reco::BasicClusterCollection > barrel, const edm::Handle< reco::BasicClusterCollection > endcap)
Definition: EcalClusterIsoCalculator.cc:19
reco::deltaR2
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
edm::get
T const & get(Event const &event, InputTag const &tag) noexcept(false)
Definition: Event.h:675
math::XYZVector
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
iEvent
int iEvent
Definition: GenABIO.cc:224
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
edm::EventSetup
Definition: EventSetup.h:58
edm::ESHandleBase::isValid
bool isValid() const
Definition: ESHandle.h:44
std
Definition: JetResolutionObject.h:76
HLT_FULL_cff.dEta
dEta
Definition: HLT_FULL_cff.py:13702
SuperCluster.h
EcalClusterIsoCalculator::getBkgSubEcalClusterIso
double getBkgSubEcalClusterIso(const reco::SuperClusterRef clus, const double radius, const double threshold)
Return the background-subtracted ecal cluster energy in a cone around the SC.
Definition: EcalClusterIsoCalculator.cc:93
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
remoteMonitoring_LED_IterMethod_cfg.threshold
threshold
Definition: remoteMonitoring_LED_IterMethod_cfg.py:430
edm::Event
Definition: Event.h:73
Vector3D.h
reco::CaloCluster::energy
double energy() const
cluster energy
Definition: CaloCluster.h:149
reco::CaloCluster::x
double x() const
x coordinate of cluster centroid
Definition: CaloCluster.h:172
EcalClusterIsoCalculator::getEcalClusterIso
double getEcalClusterIso(const reco::SuperClusterRef clus, const double radius, const double threshold)
Return the ecal cluster energy in a cone around the SC.
Definition: EcalClusterIsoCalculator.cc:41