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
21 
22 using namespace std;
23 
24 double scaleToE(const double& eta) { return 1.0; }
25 double scaleToEt(const double& eta) { return sin(2 * atan(exp(-eta))); }
26 
28  double intRadius,
29  double eLowB,
30  double eLowE,
31  double etLowB,
32  double etLowE,
33  edm::ESHandle<CaloGeometry> theCaloGeom,
34  const HBHERecHitCollection& mhbhe)
35  : extRadius_(extRadius),
36  intRadius_(intRadius),
37  eLowB_(eLowB),
38  eLowE_(eLowE),
39  etLowB_(etLowB),
40  etLowE_(etLowE),
41  theCaloGeom_(theCaloGeom),
42  mhbhe_(mhbhe) {
43  //set up the geometry and selector
44  const CaloGeometry* caloGeom = theCaloGeom_.product();
46 }
47 
49 
51  const HcalDepth& depth,
52  double (*scale)(const double&)) const {
53  double sum = 0.;
54  if (!mhbhe_.empty()) {
55  //Compute the HCAL energy behind ECAL
56  doubleConeSel_->selectCallback(pclu, mhbhe_, [this, &sum, &depth, &scale](const HBHERecHit& i) {
57  double eta = theCaloGeom_.product()->getPosition(i.detid()).eta();
58  HcalDetId hcalDetId(i.detid());
59  if (hcalDetId.subdet() == HcalBarrel && //Is it in the barrel?
60  i.energy() > eLowB_ && //Does it pass the min energy?
61  i.energy() * scaleToEt(eta) > etLowB_ && //Does it pass the min et?
62  (depth == AllDepths || depth == Depth1)) { //Are we asking for the first depth?
63  sum += i.energy() * scale(eta);
64  }
65  if (hcalDetId.subdet() == HcalEndcap && //Is it in the endcap?
66  i.energy() > eLowE_ && //Does it pass the min energy?
67  i.energy() * scaleToEt(eta) > etLowE_) { //Does it pass the min et?
68  switch (depth) { //Which depth?
69  case AllDepths:
70  sum += i.energy() * scale(eta);
71  break;
72  case Depth1:
73  sum += (isDepth2(i.detid())) ? 0 : i.energy() * scale(eta);
74  break;
75  case Depth2:
76  sum += (isDepth2(i.detid())) ? i.energy() * scale(eta) : 0;
77  break;
78  }
79  }
80  });
81  }
82 
83  return sum;
84 }
85 
86 bool EgammaHcalIsolation::isDepth2(const DetId& detId) const {
87  if ((HcalDetId(detId).depth() == 2 && HcalDetId(detId).ietaAbs() >= 18 && HcalDetId(detId).ietaAbs() < 27) ||
88  (HcalDetId(detId).depth() == 3 && HcalDetId(detId).ietaAbs() == 27)) {
89  return true;
90 
91  } else {
92  return false;
93  }
94 }
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
mps_fire.i
i
Definition: mps_fire.py:428
EgammaHcalIsolation::Depth1
Definition: EgammaHcalIsolation.h:32
L1EGammaCrystalsEmulatorProducer_cfi.scale
scale
Definition: L1EGammaCrystalsEmulatorProducer_cfi.py:10
EgammaHcalIsolation::doubleConeSel_
CaloDualConeSelector< HBHERecHit > * doubleConeSel_
Definition: EgammaHcalIsolation.h:107
CaloGeometry::getPosition
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:50
electronEcalRecHitIsolationLcone_cfi.extRadius
extRadius
Definition: electronEcalRecHitIsolationLcone_cfi.py:18
HBHERecHit
Definition: HBHERecHit.h:13
DetId::Hcal
Definition: DetId.h:28
EgammaHcalIsolation::getHcalSum
double getHcalSum(const GlobalPoint &, const HcalDepth &, double(*)(const double &)) const
Definition: EgammaHcalIsolation.cc:50
EgammaHcalIsolation::~EgammaHcalIsolation
~EgammaHcalIsolation()
Definition: EgammaHcalIsolation.cc:48
edm::SortedCollection
Definition: SortedCollection.h:49
TrackingGeometry.h
HcalBarrel
Definition: HcalAssistant.h:33
EgammaHcalIsolation::etLowB_
double etLowB_
Definition: EgammaHcalIsolation.h:101
RecoCandidate.h
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
scaleToE
double scaleToE(const double &eta)
Definition: EgammaHcalIsolation.cc:24
DetId
Definition: DetId.h:17
CaloGeometry
Definition: CaloGeometry.h:21
EgammaHcalIsolation::eLowE_
double eLowE_
Definition: EgammaHcalIsolation.h:100
EgammaHcalIsolation::eLowB_
double eLowB_
Definition: EgammaHcalIsolation.h:99
PVValHelper::eta
Definition: PVValidationHelpers.h:69
EgammaHcalIsolation::extRadius_
double extRadius_
Definition: EgammaHcalIsolation.h:97
edm::ESHandle< CaloGeometry >
CaloDualConeSelector::selectCallback
void selectCallback(double eta, double phi, const edm::SortedCollection< T > &inputCollection, std::function< void(const T &)> callback)
Definition: CaloDualConeSelector.h:22
Point3DBase< float, GlobalTag >
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
EgammaHcalIsolation::Depth2
Definition: EgammaHcalIsolation.h:32
EgammaHcalIsolation::HcalDepth
HcalDepth
Definition: EgammaHcalIsolation.h:32
TrackerDigiGeometryRecord.h
scaleToEt
double scaleToEt(const double &eta)
Definition: EgammaHcalIsolation.cc:25
EgammaHcalIsolation::AllDepths
Definition: EgammaHcalIsolation.h:32
HcalDetId.h
EgammaHcalIsolation::etLowE_
double etLowE_
Definition: EgammaHcalIsolation.h:102
HcalDetId
Definition: HcalDetId.h:12
CaloDualConeSelector< HBHERecHit >
EgammaHcalIsolation::EgammaHcalIsolation
EgammaHcalIsolation(double extRadius, double intRadius, double eLowB, double eLowE, double etLowB, double etLowE, edm::ESHandle< CaloGeometry > theCaloGeom, const HBHERecHitCollection &mhbhe)
Definition: EgammaHcalIsolation.cc:27
EgammaHcalIsolation::intRadius_
double intRadius_
Definition: EgammaHcalIsolation.h:98
EgammaHcalIsolation::theCaloGeom_
edm::ESHandle< CaloGeometry > theCaloGeom_
Definition: EgammaHcalIsolation.h:104
std
Definition: JetResolutionObject.h:76
HcalEndcap
Definition: HcalAssistant.h:34
EgammaHcalIsolation::isDepth2
bool isDepth2(const DetId &) const
Definition: EgammaHcalIsolation.cc:86
electronHcalTowerIsolationLcone_cfi.intRadius
intRadius
Definition: electronHcalTowerIsolationLcone_cfi.py:5
EgammaHcalIsolation::mhbhe_
const HBHERecHitCollection & mhbhe_
Definition: EgammaHcalIsolation.h:105
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
edm::SortedCollection::empty
bool empty() const
Definition: SortedCollection.h:210
EgammaHcalIsolation.h