CMS 3D CMS Logo

EgammaHcalIsolation.cc
Go to the documentation of this file.
1 //*****************************************************************************
2 // File: EgammaHcalIsolation.cc
3 // ----------------------------------------------------------------------------
4 // OrigAuth: Matthias Mozer
5 // Institute: IIHE-VUB
6 //=============================================================================
7 //*****************************************************************************
8 //C++ includes
9 #include <vector>
10 #include <functional>
11 
12 //ROOT includes
13 #include <Math/VectorUtil.h>
14 
15 //CMSSW includes
22 
23 using namespace std;
24 
25 double scaleToE(const double& eta) { return 1.0; }
26 double scaleToEt(const double& eta) { return sin(2 * atan(exp(-eta))); }
27 
29  double intRadius,
30  double eLowB,
31  double eLowE,
32  double etLowB,
33  double etLowE,
34  edm::ESHandle<CaloGeometry> theCaloGeom,
35  const HBHERecHitCollection& mhbhe)
36  : extRadius_(extRadius),
37  intRadius_(intRadius),
38  eLowB_(eLowB),
39  eLowE_(eLowE),
40  etLowB_(etLowB),
41  etLowE_(etLowE),
42  theCaloGeom_(theCaloGeom),
43  mhbhe_(mhbhe) {
44  //set up the geometry and selector
45  const CaloGeometry* caloGeom = theCaloGeom_.product();
47 }
48 
50 
52  const HcalDepth& depth,
53  double (*scale)(const double&)) const {
54  double sum = 0.;
55  if (!mhbhe_.empty()) {
56  //Compute the HCAL energy behind ECAL
57  doubleConeSel_->selectCallback(pclu, mhbhe_, [this, &sum, &depth, &scale](const HBHERecHit& i) {
58  double eta = theCaloGeom_.product()->getPosition(i.detid()).eta();
59  HcalDetId hcalDetId(i.detid());
60  if (hcalDetId.subdet() == HcalBarrel && //Is it in the barrel?
61  i.energy() > eLowB_ && //Does it pass the min energy?
62  i.energy() * scaleToEt(eta) > etLowB_ && //Does it pass the min et?
63  (depth == AllDepths || depth == Depth1)) { //Are we asking for the first depth?
64  sum += i.energy() * scale(eta);
65  }
66  if (hcalDetId.subdet() == HcalEndcap && //Is it in the endcap?
67  i.energy() > eLowE_ && //Does it pass the min energy?
68  i.energy() * scaleToEt(eta) > etLowE_) { //Does it pass the min et?
69  switch (depth) { //Which depth?
70  case AllDepths:
71  sum += i.energy() * scale(eta);
72  break;
73  case Depth1:
74  sum += (isDepth2(i.detid())) ? 0 : i.energy() * scale(eta);
75  break;
76  case Depth2:
77  sum += (isDepth2(i.detid())) ? i.energy() * scale(eta) : 0;
78  break;
79  }
80  }
81  });
82  }
83 
84  return sum;
85 }
86 
87 bool EgammaHcalIsolation::isDepth2(const DetId& detId) const {
88  if ((HcalDetId(detId).depth() == 2 && HcalDetId(detId).ietaAbs() >= 18 && HcalDetId(detId).ietaAbs() < 27) ||
89  (HcalDetId(detId).depth() == 3 && HcalDetId(detId).ietaAbs() == 27)) {
90  return true;
91 
92  } else {
93  return false;
94  }
95 }
constexpr float energy() const
Definition: CaloRecHit.h:29
bool isDepth2(const DetId &) const
double scaleToEt(const double &eta)
edm::ESHandle< CaloGeometry > theCaloGeom_
constexpr const DetId & detid() const
Definition: CaloRecHit.h:33
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
double scaleToE(const double &eta)
CaloDualConeSelector< HBHERecHit > * doubleConeSel_
const HBHERecHitCollection & mhbhe_
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:50
double getHcalSum(const GlobalPoint &, const HcalDepth &, double(*)(const double &)) const
EgammaHcalIsolation(double extRadius, double intRadius, double eLowB, double eLowE, double etLowB, double etLowE, edm::ESHandle< CaloGeometry > theCaloGeom, const HBHERecHitCollection &mhbhe)
Definition: DetId.h:17
void selectCallback(double eta, double phi, const edm::SortedCollection< T > &inputCollection, std::function< void(const T &)> callback)
T const * product() const
Definition: ESHandle.h:86