CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EgammaTowerIsolation.cc
Go to the documentation of this file.
1 //*****************************************************************************
2 // File: EgammaTowerIsolation.cc
3 // ----------------------------------------------------------------------------
4 // OrigAuth: Matthias Mozer
5 // Institute: IIHE-VUB
6 //=============================================================================
7 //*****************************************************************************
8 
9 //CMSSW includes
11 #include<cassert>
12 
13 
14 // #include<iostream>
15 namespace etiStat {
17  // std::cout << "\nEgammaTowerIsolationNew " << create << "/" << comp << "/" << float(span)/float(comp)
18  // << std::endl<< std::endl;
19  }
20 
22 }
23 
24 
25 
29 
31  float intRadiusI,
32  float etLow,
33  signed int depth,
34  const CaloTowerCollection* towers ) :
35  depth_(depth),
36  extRadius(extRadiusI),
37  intRadius(intRadiusI)
38 {
39  assert(0==etLow);
40 
41  // cheating (test of performance)
42  if (newAlgo==nullptr || towers!=oldTowers || towers->size()!=newAlgo->nt || (towers->size()>15 && (*towers)[15].id()!=id15)) {
43  delete newAlgo;
45  oldTowers=towers;
46  id15 = (*towers)[15].id();
47  }
48 }
49 
50 
51 double EgammaTowerIsolation::getSum (bool et, reco::SuperCluster const & sc, const std::vector<CaloTowerDetId> * detIdToExclude) const{
52 
53  if (0!=detIdToExclude) assert(0==intRadius);
54 
55  // hack
57 
59  newAlgo->compute(et, sum, sc,
60  (detIdToExclude==0) ? nullptr : &((*detIdToExclude).front()),
61  (detIdToExclude==0) ? nullptr : (&(*detIdToExclude).back())+1
62  );
63 
64  switch(depth_){
65  case AllDepths: return detIdToExclude==0 ? sum.he[0] : sum.heBC[0];
66  case Depth1: return detIdToExclude==0 ? sum.he[0]-sum.h2[0] : sum.heBC[0]-sum.h2BC[0];
67  case Depth2:return detIdToExclude==0 ? sum.h2[0] : sum.h2BC[0];
68  default: return 0;
69  }
70  return 0;
71 }
72 
double getSum(bool et, reco::SuperCluster const &sc, const std::vector< CaloTowerDetId > *detIdToExclude) const
static EgammaTowerIsolationNew< 1 > * newAlgo
void setRadius(float const extRadius[NC], float const intRadius[NC])
static const CaloTowerCollection * oldTowers
size_type size() const
EgammaTowerIsolation(float extRadiusI, float intRadiusI, float etLow, signed int depth, const CaloTowerCollection *towers)
void compute(bool et, Sum &sum, reco::Candidate const &cand, CaloTowerDetId const *first, CaloTowerDetId const *last) const