test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 extRadius,
30  double intRadius,
31  double eLowB,
32  double eLowE,
33  double etLowB,
34  double etLowE,
35  edm::ESHandle<CaloGeometry> theCaloGeom ,
36  const HBHERecHitCollection& mhbhe
37 ) :
38  extRadius_(extRadius),
39  intRadius_(intRadius),
40  eLowB_(eLowB),
41  eLowE_(eLowE),
42  etLowB_(etLowB),
43  etLowE_(etLowE),
44  theCaloGeom_(theCaloGeom) ,
45  mhbhe_(mhbhe)
46 {
47  //set up the geometry and selector
48  const CaloGeometry* caloGeom = theCaloGeom_.product();
50 }
51 
53 {
54  delete doubleConeSel_;
55 }
56 
58  double(*scale)(const double&) ) const
59 {
60  double sum = 0.;
61  if (! mhbhe_.empty())
62  {
63  //Compute the HCAL energy behind ECAL
64  doubleConeSel_->selectCallback(pclu, mhbhe_, [this, &sum, &depth, &scale](const HBHERecHit& i) {
65  double eta = theCaloGeom_.product()->getPosition(i.detid()).eta();
66  HcalDetId hcalDetId(i.detid());
67  if(hcalDetId.subdet() == HcalBarrel && //Is it in the barrel?
68  i.energy() > eLowB_ && //Does it pass the min energy?
69  i.energy()*scaleToEt(eta) > etLowB_ && //Does it pass the min et?
70  (depth == AllDepths || depth == Depth1)) { //Are we asking for the first depth?
71  sum += i.energy() * scale(eta);
72  }
73  if(hcalDetId.subdet() == HcalEndcap && //Is it in the endcap?
74  i.energy() > eLowE_ && //Does it pass the min energy?
75  i.energy()*scaleToEt(eta) > etLowE_ ) { //Does it pass the min et?
76  switch(depth) { //Which depth?
77  case AllDepths: sum += i.energy() * scale(eta); break;
78  case Depth1: sum += (isDepth2(i.detid())) ? 0 : i.energy() * scale(eta); break;
79  case Depth2: sum += (isDepth2(i.detid())) ? i.energy() * scale(eta) : 0; break;
80  }
81  }
82  });
83  }
84 
85  return sum ;
86 }
87 
88 bool EgammaHcalIsolation::isDepth2(const DetId& detId) const {
89 
90  if( (HcalDetId(detId).depth()==2 && HcalDetId(detId).ietaAbs()>=18 && HcalDetId(detId).ietaAbs()<27) ||
91  (HcalDetId(detId).depth()==3 && HcalDetId(detId).ietaAbs()==27) ) {
92 
93  return true;
94 
95  } else {
96  return false;
97  }
98 }
bool isDepth2(const DetId &) const
int i
Definition: DBlmapReader.cc:9
const DetId & detid() const
Definition: CaloRecHit.h:20
edm::ESHandle< CaloGeometry > theCaloGeom_
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
CaloDualConeSelector< HBHERecHit > * doubleConeSel_
const HBHERecHitCollection & mhbhe_
float energy() const
Definition: CaloRecHit.h:17
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:18
T const * product() const
Definition: ESHandle.h:86
double scaleToEt(const double &eta)
double scaleToE(const double &eta)
void selectCallback(double eta, double phi, const edm::SortedCollection< T > &inputCollection, std::function< void(const T &)> callback)