CMS 3D CMS Logo

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 #include <memory>
13 
14 #ifdef ETISTATDEBUG
15 // #include<iostream>
16 namespace etiStat {
17  Count::~Count() {
18  // std::cout << "\nEgammaTowerIsolationNew " << create << "/" << comp << "/" << float(span)/float(comp)
19  // << std::endl<< std::endl;
20  }
21 
22  Count Count::count;
23 } // namespace etiStat
24 #endif
25 
26 namespace {
27  struct TLS {
28  std::unique_ptr<EgammaTowerIsolationNew<1>> newAlgo = nullptr;
29  ;
30  const CaloTowerCollection* oldTowers = nullptr;
31  ;
32  uint32_t id15 = 0;
33  };
34  thread_local TLS tls;
35 } // namespace
36 
38  float extRadiusI, float intRadiusI, float etLow, signed int depth, const CaloTowerCollection* towers)
39  : depth_(depth), extRadius(extRadiusI), intRadius(intRadiusI) {
40  assert(0 == etLow);
41 
42  // extremely poor in quality (test of performance)
43  if (tls.newAlgo.get() == nullptr || towers != tls.oldTowers || towers->size() != tls.newAlgo->nt ||
44  (towers->size() > 15 && (*towers)[15].id() != tls.id15)) {
45  tls.newAlgo = std::make_unique<EgammaTowerIsolationNew<1>>(&extRadius, &intRadius, *towers);
46  tls.oldTowers = towers;
47  tls.id15 = towers->size() > 15 ? (*towers)[15].id() : 0;
48  }
49 }
50 
52  reco::SuperCluster const& sc,
53  const std::vector<CaloTowerDetId>* detIdToExclude) const {
54  if (nullptr != detIdToExclude)
55  assert(0 == intRadius);
56 
57  // hack
58  tls.newAlgo->setRadius(&extRadius, &intRadius);
59 
61  if (detIdToExclude == nullptr) {
62  tls.newAlgo->compute(
63  et, sum, sc, static_cast<CaloTowerDetId const*>(nullptr), static_cast<CaloTowerDetId const*>(nullptr));
64  } else {
65  tls.newAlgo->compute(et, sum, sc, detIdToExclude->cbegin(), detIdToExclude->cend());
66  }
67 
68  switch (depth_) {
69  case AllDepths:
70  return detIdToExclude == nullptr ? sum.he[0] : sum.heBC[0];
71  case Depth1:
72  return detIdToExclude == nullptr ? sum.he[0] - sum.h2[0] : sum.heBC[0] - sum.h2BC[0];
73  case Depth2:
74  return detIdToExclude == nullptr ? sum.h2[0] : sum.h2BC[0];
75  default:
76  return 0;
77  }
78  return 0;
79 }
HLT_FULL_cff.towers
towers
Definition: HLT_FULL_cff.py:36362
EgammaTowerIsolationNew::Sum::h2
float h2[NC]
Definition: EgammaTowerIsolation.h:41
EgammaTowerIsolation::depth_
signed int depth_
Definition: EgammaTowerIsolation.h:225
reco::SuperCluster
Definition: SuperCluster.h:18
EgammaTowerIsolationNew::Sum::he
float he[NC]
Definition: EgammaTowerIsolation.h:40
electronEcalRecHitIsolationLcone_cfi.extRadius
extRadius
Definition: electronEcalRecHitIsolationLcone_cfi.py:16
EgammaTowerIsolationNew::Sum::heBC
float heBC[NC]
Definition: EgammaTowerIsolation.h:42
cms::cuda::assert
assert(be >=bs)
edm::SortedCollection< CaloTower >
EgammaTowerIsolationNew::Sum
Definition: EgammaTowerIsolation.h:38
EgammaTowerIsolation::Depth2
Definition: EgammaTowerIsolation.h:199
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
EgammaTowerIsolation.h
EgammaTowerIsolation::AllDepths
Definition: EgammaTowerIsolation.h:199
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
EgammaTowerIsolationNew::Sum::h2BC
float h2BC[NC]
Definition: EgammaTowerIsolation.h:43
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
EgammaTowerIsolation::extRadius
float extRadius
Definition: EgammaTowerIsolation.h:226
EgammaTowerIsolation::getSum
double getSum(bool et, reco::SuperCluster const &sc, const std::vector< CaloTowerDetId > *detIdToExclude) const
Definition: EgammaTowerIsolation.cc:51
electronHcalTowerIsolationLcone_cfi.intRadius
intRadius
Definition: electronHcalTowerIsolationLcone_cfi.py:5
EgammaTowerIsolation::Depth1
Definition: EgammaTowerIsolation.h:199
EgammaTowerIsolation::intRadius
float intRadius
Definition: EgammaTowerIsolation.h:227
EgammaTowerIsolation::EgammaTowerIsolation
EgammaTowerIsolation(float extRadiusI, float intRadiusI, float etLow, signed int depth, const CaloTowerCollection *towers)
Definition: EgammaTowerIsolation.cc:37