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 ,
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 
57 double EgammaHcalIsolation::getHcalSum(const GlobalPoint &pclu, const HcalDepth &depth,
58  double(*scale)(const double&) ) const
59 {
60  double sum = 0.;
61  if (mhbhe_)
62  {
63  //Compute the HCAL energy behind ECAL
64  double eta;
65  std::auto_ptr<CaloRecHitMetaCollectionV> chosen = doubleConeSel_->select(pclu,*mhbhe_);
67  for (i = chosen->begin () ; i!= chosen->end () ; ++i)
68  {
69  eta = theCaloGeom_.product()->getPosition(i->detid()).eta();
70  HcalDetId hcalDetId(i->detid());
71  if(hcalDetId.subdet() == HcalBarrel && //Is it in the barrel?
72  i->energy() > eLowB_ && //Does it pass the min energy?
73  i->energy()*scaleToEt(eta) > etLowB_ && //Does it pass the min et?
74  (depth == AllDepths || depth == Depth1)) { //Are we asking for the first depth?
75  sum += i->energy() * scale(eta);
76  }
77  if(hcalDetId.subdet() == HcalEndcap && //Is it in the endcap?
78  i->energy() > eLowE_ && //Does it pass the min energy?
79  i->energy()*scaleToEt(eta) > etLowE_ ) { //Does it pass the min et?
80  switch(depth) { //Which depth?
81  case AllDepths: sum += i->energy() * scale(eta); break;
82  case Depth1: sum += (isDepth2(i->detid())) ? 0 : i->energy() * scale(eta); break;
83  case Depth2: sum += (isDepth2(i->detid())) ? i->energy() * scale(eta) : 0; break;
84  }
85  }
86  }
87  }
88  return sum ;
89 }
90 
91 bool EgammaHcalIsolation::isDepth2(const DetId& detId) const {
92 
93  if( (HcalDetId(detId).depth()==2 && HcalDetId(detId).ietaAbs()>=18 && HcalDetId(detId).ietaAbs()<27) ||
94  (HcalDetId(detId).depth()==3 && HcalDetId(detId).ietaAbs()==27) ) {
95 
96  return true;
97 
98  } else {
99  return false;
100  }
101 }
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
T eta() const
EgammaHcalIsolation(double extRadius, double intRadius, double eLowB, double eLowE, double etLowB, double etLowE, edm::ESHandle< CaloGeometry > theCaloGeom, HBHERecHitMetaCollection *mhbhe)
std::auto_ptr< CaloRecHitMetaCollectionV > select(double eta, double phi, const CaloRecHitMetaCollectionV &inputCollection)
float energy() const
Definition: CaloRecHit.h:17
CaloDualConeSelector * doubleConeSel_
double getHcalSum(const GlobalPoint &, const HcalDepth &, double(*)(const double &)) const
HBHERecHitMetaCollection * mhbhe_
Definition: DetId.h:18
T const * product() const
Definition: ESHandle.h:62
double scaleToEt(const double &eta)
double scaleToE(const double &eta)