test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
EgammaTowerIsolation Class Reference

#include <EgammaTowerIsolation.h>

Public Types

enum  HcalDepth { AllDepths =-1, Undefined =0, Depth1 =1, Depth2 =2 }
 

Public Member Functions

 EgammaTowerIsolation (float extRadiusI, float intRadiusI, float etLow, signed int depth, const CaloTowerCollection *towers)
 
double getTowerESum (const reco::Candidate *cand, const std::vector< CaloTowerDetId > *detIdToExclude=0) const
 
double getTowerESum (reco::SuperCluster const *sc, const std::vector< CaloTowerDetId > *detIdToExclude=0) const
 
double getTowerEtSum (const reco::Candidate *cand, const std::vector< CaloTowerDetId > *detIdToExclude=0) const
 
double getTowerEtSum (reco::SuperCluster const *sc, const std::vector< CaloTowerDetId > *detIdToExclude=0) const
 

Private Member Functions

double getSum (bool et, reco::SuperCluster const &sc, const std::vector< CaloTowerDetId > *detIdToExclude) const
 

Private Attributes

signed int depth_
 
float extRadius
 
float intRadius
 

Static Private Attributes

static thread_local uint32_t id15 =0
 
static thread_local
EgammaTowerIsolationNew< 1 > * 
newAlgo = 0
 
static thread_local const
CaloTowerCollection
oldTowers = 0
 

Detailed Description

Definition at line 208 of file EgammaTowerIsolation.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

EgammaTowerIsolation::EgammaTowerIsolation ( float  extRadiusI,
float  intRadiusI,
float  etLow,
signed int  depth,
const CaloTowerCollection towers 
)

Definition at line 31 of file EgammaTowerIsolation.cc.

References extRadius, id15, intRadius, newAlgo, EgammaTowerIsolationNew< NC >::nt, oldTowers, and edm::SortedCollection< T, SORT >::size().

35  :
36  depth_(depth),
37  extRadius(extRadiusI),
38  intRadius(intRadiusI)
39 {
40  assert(0==etLow);
41 
42  // extremely poor in quality (test of performance)
43  if (newAlgo==nullptr || towers!=oldTowers || towers->size()!=newAlgo->nt || (towers->size()>15 && (*towers)[15].id()!=id15)) {
44  delete newAlgo;
46  oldTowers=towers;
47  id15 = towers->size()>15 ? (*towers)[15].id() : 0;
48  }
49 }
static thread_local uint32_t id15
static thread_local EgammaTowerIsolationNew< 1 > * newAlgo
static thread_local const CaloTowerCollection * oldTowers
size_type size() const

Member Function Documentation

double EgammaTowerIsolation::getSum ( bool  et,
reco::SuperCluster const &  sc,
const std::vector< CaloTowerDetId > *  detIdToExclude 
) const
private

Definition at line 52 of file EgammaTowerIsolation.cc.

References AllDepths, EgammaTowerIsolationNew< NC >::compute(), Depth1, Depth2, depth_, extRadius, EgammaTowerIsolationNew< NC >::h2, EgammaTowerIsolationNew< NC >::he, intRadius, newAlgo, and EgammaTowerIsolationNew< NC >::setRadius().

Referenced by getTowerESum(), and getTowerEtSum().

52  {
53 
54  if (0!=detIdToExclude) assert(0==intRadius);
55 
56  // hack
58 
60  newAlgo->compute(et, sum, sc,
61  (detIdToExclude==0) ? nullptr : &((*detIdToExclude).front()),
62  (detIdToExclude==0) ? nullptr : (&(*detIdToExclude).back())+1
63  );
64 
65  switch(depth_){
66  case AllDepths: return detIdToExclude==0 ? sum.he[0] : sum.heBC[0];
67  case Depth1: return detIdToExclude==0 ? sum.he[0]-sum.h2[0] : sum.heBC[0]-sum.h2BC[0];
68  case Depth2:return detIdToExclude==0 ? sum.h2[0] : sum.h2BC[0];
69  default: return 0;
70  }
71  return 0;
72 }
static thread_local EgammaTowerIsolationNew< 1 > * newAlgo
void setRadius(float const extRadius[NC], float const intRadius[NC])
void compute(bool et, Sum &sum, reco::Candidate const &cand, CaloTowerDetId const *first, CaloTowerDetId const *last) const
double EgammaTowerIsolation::getTowerESum ( const reco::Candidate cand,
const std::vector< CaloTowerDetId > *  detIdToExclude = 0 
) const
inline

Definition at line 224 of file EgammaTowerIsolation.h.

References reco::Candidate::get(), and getSum().

Referenced by ConvertedPhotonProducer::buildCollections(), ConversionTrackCandidateProducer::buildCollections(), PhotonProducer::fillPhotonCollection(), GEDPhotonProducer::fillPhotonCollection(), ElectronHcalHelper::hcalESumDepth1(), and ElectronHcalHelper::hcalESumDepth2().

224  {
225  reco::SuperCluster const & sc = *cand->get<reco::SuperClusterRef>().get();
226  return getSum(false,sc,detIdToExclude);
227  }
double getSum(bool et, reco::SuperCluster const &sc, const std::vector< CaloTowerDetId > *detIdToExclude) const
T get() const
get a component
Definition: Candidate.h:219
double EgammaTowerIsolation::getTowerESum ( reco::SuperCluster const *  sc,
const std::vector< CaloTowerDetId > *  detIdToExclude = 0 
) const
inline

Definition at line 231 of file EgammaTowerIsolation.h.

References getSum().

231  {
232  return getSum(false,*sc,detIdToExclude);
233  }
double getSum(bool et, reco::SuperCluster const &sc, const std::vector< CaloTowerDetId > *detIdToExclude) const
double EgammaTowerIsolation::getTowerEtSum ( const reco::Candidate cand,
const std::vector< CaloTowerDetId > *  detIdToExclude = 0 
) const
inline

Definition at line 220 of file EgammaTowerIsolation.h.

References reco::Candidate::get(), and getSum().

Referenced by PhotonIsolationCalculator::calculateHcalTowerIso(), GsfElectronAlgo::createElectron(), and EgammaHLTBcHcalIsolationProducersRegional::produce().

220  {
221  reco::SuperCluster const & sc = *cand->get<reco::SuperClusterRef>().get();
222  return getSum(true,sc,detIdToExclude);
223  }
double getSum(bool et, reco::SuperCluster const &sc, const std::vector< CaloTowerDetId > *detIdToExclude) const
T get() const
get a component
Definition: Candidate.h:219
double EgammaTowerIsolation::getTowerEtSum ( reco::SuperCluster const *  sc,
const std::vector< CaloTowerDetId > *  detIdToExclude = 0 
) const
inline

Definition at line 228 of file EgammaTowerIsolation.h.

References getSum().

228  {
229  return getSum(true,*sc,detIdToExclude);
230  }
double getSum(bool et, reco::SuperCluster const &sc, const std::vector< CaloTowerDetId > *detIdToExclude) const

Member Data Documentation

signed int EgammaTowerIsolation::depth_
private

Definition at line 242 of file EgammaTowerIsolation.h.

Referenced by getSum().

float EgammaTowerIsolation::extRadius
private

Definition at line 243 of file EgammaTowerIsolation.h.

Referenced by EgammaTowerIsolation(), and getSum().

thread_local uint32_t EgammaTowerIsolation::id15 =0
staticprivate

Definition at line 241 of file EgammaTowerIsolation.h.

Referenced by EgammaTowerIsolation().

float EgammaTowerIsolation::intRadius
private

Definition at line 244 of file EgammaTowerIsolation.h.

Referenced by EgammaTowerIsolation(), and getSum().

thread_local EgammaTowerIsolationNew< 1 > * EgammaTowerIsolation::newAlgo = 0
staticprivate

Definition at line 239 of file EgammaTowerIsolation.h.

Referenced by EgammaTowerIsolation(), and getSum().

thread_local const CaloTowerCollection * EgammaTowerIsolation::oldTowers = 0
staticprivate

Definition at line 240 of file EgammaTowerIsolation.h.

Referenced by EgammaTowerIsolation().