CMS 3D CMS Logo

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

#include <EGHcalRecHitSelector.h>

Public Member Functions

template<typename CollType >
void addDetIds (const reco::SuperCluster &superClus, const HBHERecHitCollection &recHits, CollType &detIdsToStore) const
 
 EGHcalRecHitSelector (const edm::ParameterSet &config, edm::ConsumesCollector)
 
void setup (const edm::EventSetup &iSetup)
 
 ~EGHcalRecHitSelector ()
 

Static Public Member Functions

static edm::ParameterSetDescription makePSetDescription ()
 

Private Member Functions

float getMinEnergyHCAL_ (HcalDetId id) const
 

Static Private Member Functions

static int calDIEta (int iEta1, int iEta2)
 
static int calDIPhi (int iPhi1, int iPhi2)
 

Private Attributes

int maxDIEta_
 
int maxDIPhi_
 
float minEnergyHB_
 
float minEnergyHEDefault_
 
float minEnergyHEDepth1_
 
edm::ESHandle
< CaloTowerConstituentsMap
towerMap_
 
edm::ESGetToken
< CaloTowerConstituentsMap,
CaloGeometryRecord
towerMapToken_
 

Detailed Description

Definition at line 19 of file EGHcalRecHitSelector.h.

Constructor & Destructor Documentation

EGHcalRecHitSelector::EGHcalRecHitSelector ( const edm::ParameterSet config,
edm::ConsumesCollector  cc 
)
explicit

Definition at line 5 of file EGHcalRecHitSelector.cc.

6  : maxDIEta_(config.getParameter<int>("maxDIEta")),
7  maxDIPhi_(config.getParameter<int>("maxDIPhi")),
8  minEnergyHB_(config.getParameter<double>("minEnergyHB")),
9  minEnergyHEDepth1_(config.getParameter<double>("minEnergyHEDepth1")),
10  minEnergyHEDefault_(config.getParameter<double>("minEnergyHEDefault")),
edm::ESGetToken< CaloTowerConstituentsMap, CaloGeometryRecord > towerMapToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
EGHcalRecHitSelector::~EGHcalRecHitSelector ( )
inline

Definition at line 22 of file EGHcalRecHitSelector.h.

22 {}

Member Function Documentation

template<typename CollType >
void EGHcalRecHitSelector::addDetIds ( const reco::SuperCluster superClus,
const HBHERecHitCollection recHits,
CollType &  detIdsToStore 
) const

Definition at line 49 of file EGHcalRecHitSelector.h.

References funct::abs(), calDIEta(), calDIPhi(), DetId::det(), DetId::Ecal, DetId::Forward, getMinEnergyHCAL_(), maxDIEta_, maxDIPhi_, reco::SuperCluster::seed(), ecaldqm::towerId(), and towerMap_.

Referenced by EgammaIsoHcalDetIdCollectionProducer::produce().

51  {
52  DetId seedId = superClus.seed()->seed();
53  if (seedId.det() != DetId::Ecal && seedId.det() != DetId::Forward) {
54  edm::LogError("EgammaIsoHcalDetIdCollectionProducerError")
55  << "Somehow the supercluster has a seed which is not ECAL, something is badly wrong";
56  return;
57  }
58  //so we are using CaloTowers to get the iEta/iPhi of the HCAL rec hit behind the seed cluster, this might go funny on tower 28 but shouldnt matter there
59 
60  if (seedId.det() == DetId::Forward)
61  return;
62 
63  CaloTowerDetId towerId(towerMap_->towerOf(seedId));
64  int seedHcalIEta = towerId.ieta();
65  int seedHcalIPhi = towerId.iphi();
66 
67  for (auto& recHit : recHits) {
68  int dIEtaAbs = std::abs(calDIEta(seedHcalIEta, recHit.id().ieta()));
69  int dIPhiAbs = std::abs(calDIPhi(seedHcalIPhi, recHit.id().iphi()));
70 
71  if (dIEtaAbs <= maxDIEta_ && dIPhiAbs <= maxDIPhi_ && recHit.energy() > getMinEnergyHCAL_(recHit.id()))
72  detIdsToStore.insert(detIdsToStore.end(), recHit.id().rawId());
73  }
74 }
static int calDIPhi(int iPhi1, int iPhi2)
edm::ESHandle< CaloTowerConstituentsMap > towerMap_
Log< level::Error, false > LogError
unsigned towerId(DetId const &, EcalElectronicsMapping const *)
static int calDIEta(int iEta1, int iEta2)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Definition: DetId.h:17
float getMinEnergyHCAL_(HcalDetId id) const
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:77
constexpr Detector det() const
get the detector field from this detid
Definition: DetId.h:46
int EGHcalRecHitSelector::calDIEta ( int  iEta1,
int  iEta2 
)
staticprivate

Definition at line 23 of file EGHcalRecHitSelector.cc.

Referenced by addDetIds().

23  {
24  int dEta = iEta1 - iEta2;
25  if (iEta1 * iEta2 < 0) { //-ve to +ve transistion and no crystal at zero
26  if (dEta < 0)
27  dEta++;
28  else
29  dEta--;
30  }
31  return dEta;
32 }
int EGHcalRecHitSelector::calDIPhi ( int  iPhi1,
int  iPhi2 
)
staticprivate

Definition at line 34 of file EGHcalRecHitSelector.cc.

Referenced by addDetIds().

34  {
35  int dPhi = iPhi1 - iPhi2;
36  if (dPhi > 72 / 2)
37  dPhi -= 72;
38  else if (dPhi < -72 / 2)
39  dPhi += 72;
40  return dPhi;
41 }
float EGHcalRecHitSelector::getMinEnergyHCAL_ ( HcalDetId  id) const
private

Definition at line 43 of file EGHcalRecHitSelector.cc.

References HLT_FULL_cff::depth, HcalBarrel, HcalEndcap, SiStripPI::max, minEnergyHB_, minEnergyHEDefault_, and minEnergyHEDepth1_.

Referenced by addDetIds().

43  {
44  if (id.subdetId() == HcalBarrel)
45  return minEnergyHB_;
46  else if (id.subdetId() == HcalEndcap) {
47  if (id.depth() == 1)
48  return minEnergyHEDepth1_;
49  else
50  return minEnergyHEDefault_;
51  } else
53 }
edm::ParameterSetDescription EGHcalRecHitSelector::makePSetDescription ( )
static

Definition at line 13 of file EGHcalRecHitSelector.cc.

References edm::ParameterSetDescription::add(), and submitPVResolutionJobs::desc.

Referenced by EgammaIsoHcalDetIdCollectionProducer::fillDescriptions().

13  {
15  desc.add<int>("maxDIEta", 5);
16  desc.add<int>("maxDIPhi", 5);
17  desc.add<double>("minEnergyHB", 0.8);
18  desc.add<double>("minEnergyHEDepth1", 0.1);
19  desc.add<double>("minEnergyHEDefault", 0.2);
20  return desc;
21 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void EGHcalRecHitSelector::setup ( const edm::EventSetup iSetup)
inline

Definition at line 29 of file EGHcalRecHitSelector.h.

References edm::EventSetup::getHandle(), towerMap_, and towerMapToken_.

Referenced by EgammaIsoHcalDetIdCollectionProducer::beginRun().

29 { towerMap_ = iSetup.getHandle(towerMapToken_); }
edm::ESHandle< CaloTowerConstituentsMap > towerMap_
edm::ESGetToken< CaloTowerConstituentsMap, CaloGeometryRecord > towerMapToken_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:157

Member Data Documentation

int EGHcalRecHitSelector::maxDIEta_
private

Definition at line 38 of file EGHcalRecHitSelector.h.

Referenced by addDetIds().

int EGHcalRecHitSelector::maxDIPhi_
private

Definition at line 39 of file EGHcalRecHitSelector.h.

Referenced by addDetIds().

float EGHcalRecHitSelector::minEnergyHB_
private

Definition at line 40 of file EGHcalRecHitSelector.h.

Referenced by getMinEnergyHCAL_().

float EGHcalRecHitSelector::minEnergyHEDefault_
private

Definition at line 42 of file EGHcalRecHitSelector.h.

Referenced by getMinEnergyHCAL_().

float EGHcalRecHitSelector::minEnergyHEDepth1_
private

Definition at line 41 of file EGHcalRecHitSelector.h.

Referenced by getMinEnergyHCAL_().

edm::ESHandle<CaloTowerConstituentsMap> EGHcalRecHitSelector::towerMap_
private

Definition at line 44 of file EGHcalRecHitSelector.h.

Referenced by addDetIds(), and setup().

edm::ESGetToken<CaloTowerConstituentsMap, CaloGeometryRecord> EGHcalRecHitSelector::towerMapToken_
private

Definition at line 45 of file EGHcalRecHitSelector.h.

Referenced by setup().