CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
HGCalTowerMap2DImpl Class Reference

#include <HGCalTowerMap2DImpl.h>

Public Member Functions

template<class T >
void buildTowerMap2D (const std::vector< edm::Ptr< T >> &ptrs, l1t::HGCalTowerMapBxCollection &towerMaps)
 
 HGCalTowerMap2DImpl (const edm::ParameterSet &conf)
 
void resetTowerMaps ()
 
void setGeometry (const HGCalTriggerGeometryBase *const geom)
 

Private Member Functions

std::unordered_map< int, l1t::HGCalTowerMapnewTowerMaps ()
 

Private Attributes

std::vector< double > layerWeights_
 
HGCalTriggerTowerGeometryHelper towerGeometryHelper_
 
HGCalTriggerTools triggerTools_
 
bool useLayerWeights_
 

Detailed Description

Author
: Thomas Strebler

Description: first iteration of HGCal Tower Maps

Definition at line 13 of file HGCalTowerMap2DImpl.h.

Constructor & Destructor Documentation

◆ HGCalTowerMap2DImpl()

HGCalTowerMap2DImpl::HGCalTowerMap2DImpl ( const edm::ParameterSet conf)

Definition at line 13 of file HGCalTowerMap2DImpl.cc.

14  : useLayerWeights_(conf.getParameter<bool>("useLayerWeights")),
15  layerWeights_(conf.getParameter<std::vector<double>>("layerWeights")),
16  towerGeometryHelper_(conf.getParameter<edm::ParameterSet>("L1TTriggerTowerConfig")) {}
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::vector< double > layerWeights_
HGCalTriggerTowerGeometryHelper towerGeometryHelper_

Member Function Documentation

◆ buildTowerMap2D()

template<class T >
void HGCalTowerMap2DImpl::buildTowerMap2D ( const std::vector< edm::Ptr< T >> &  ptrs,
l1t::HGCalTowerMapBxCollection towerMaps 
)
inline

Definition at line 20 of file HGCalTowerMap2DImpl.h.

References Exception, HGCalTriggerTowerGeometryHelper::getTriggerTower(), mps_fire::i, HGCalTriggerTools::isNose(), HGCalTriggerTools::lastLayerEE(), pixelTopology::layer, layerWeights_, HGCalTriggerTools::layerWithOffset(), newTowerMaps(), BXVector< T >::resize(), BXVector< T >::set(), towerGeometryHelper_, triggerTools_, and useLayerWeights_.

20  {
21  std::unordered_map<int, l1t::HGCalTowerMap> towerMapsTmp = newTowerMaps();
22 
23  for (const auto& ptr : ptrs) {
24  bool isNose = triggerTools_.isNose(ptr->detId());
25  unsigned layer = triggerTools_.layerWithOffset(ptr->detId());
26 
27  if (towerMapsTmp.find(layer) == towerMapsTmp.end()) {
28  throw cms::Exception("Out of range")
29  << "HGCalTowerMap2dImpl: Found trigger sum in layer " << layer << " for which there is no tower map\n";
30  }
31  // FIXME: should actually sum the energy not the Et...
32  double calibPt = ptr->pt();
33  if (useLayerWeights_)
34  calibPt = layerWeights_[layer] * ptr->mipPt();
35 
36  double etEm = layer <= triggerTools_.lastLayerEE(isNose) ? calibPt : 0;
37  double etHad = layer > triggerTools_.lastLayerEE(isNose) ? calibPt : 0;
38 
39  towerMapsTmp[layer].addEt(towerGeometryHelper_.getTriggerTower(*ptr), etEm, etHad);
40  }
41 
42  /* store towerMaps in the persistent collection */
43  towerMaps.resize(0, towerMapsTmp.size());
44  int i = 0;
45  for (const auto& towerMap : towerMapsTmp) {
46  towerMaps.set(0, i, towerMap.second);
47  i++;
48  }
49  }
std::vector< double > layerWeights_
HGCalTriggerTools triggerTools_
std::unordered_map< int, l1t::HGCalTowerMap > newTowerMaps()
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
bool isNose(const DetId &) const
void set(int bx, unsigned i, const T &object)
unsigned layerWithOffset(const DetId &) const
HGCalTriggerTowerGeometryHelper towerGeometryHelper_
void resize(int bx, unsigned size)
unsigned lastLayerEE(bool nose=false) const
unsigned short getTriggerTower(const l1t::HGCalTriggerCell &) const

◆ newTowerMaps()

std::unordered_map< int, l1t::HGCalTowerMap > HGCalTowerMap2DImpl::newTowerMaps ( )
private

Definition at line 18 of file HGCalTowerMap2DImpl.cc.

References HGCalTriggerTowerGeometryHelper::getTowerCoordinates(), HGCalTriggerTowerGeometryHelper::isNose(), HGCalTriggerTools::lastLayer(), HGCalTriggerTools::lastLayerEE(), pixelTopology::layer, towerGeometryHelper_, and triggerTools_.

Referenced by buildTowerMap2D().

18  {
19  bool isNose = towerGeometryHelper_.isNose();
20 
21  std::unordered_map<int, l1t::HGCalTowerMap> towerMaps;
22  for (unsigned layer = 1; layer <= triggerTools_.lastLayer(isNose); layer++) {
23  // FIXME: this is hardcoded...quite ugly
24  if (!isNose && layer <= triggerTools_.lastLayerEE(isNose) && layer % 2 == 0)
25  continue;
26 
28  }
29 
30  return towerMaps;
31 }
const std::vector< l1t::HGCalTowerCoord > & getTowerCoordinates() const
HGCalTriggerTools triggerTools_
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
unsigned lastLayer(bool nose=false) const
HGCalTriggerTowerGeometryHelper towerGeometryHelper_
unsigned lastLayerEE(bool nose=false) const

◆ resetTowerMaps()

void HGCalTowerMap2DImpl::resetTowerMaps ( )

◆ setGeometry()

void HGCalTowerMap2DImpl::setGeometry ( const HGCalTriggerGeometryBase *const  geom)
inline

Definition at line 51 of file HGCalTowerMap2DImpl.h.

References relativeConstraints::geom, HGCalTriggerTowerGeometryHelper::setGeometry(), HGCalTriggerTools::setGeometry(), towerGeometryHelper_, and triggerTools_.

51  {
54  }
void setGeometry(const HGCalTriggerGeometryBase *const geom)
HGCalTriggerTools triggerTools_
void setGeometry(const HGCalTriggerGeometryBase *const)
HGCalTriggerTowerGeometryHelper towerGeometryHelper_

Member Data Documentation

◆ layerWeights_

std::vector<double> HGCalTowerMap2DImpl::layerWeights_
private

Definition at line 58 of file HGCalTowerMap2DImpl.h.

Referenced by buildTowerMap2D().

◆ towerGeometryHelper_

HGCalTriggerTowerGeometryHelper HGCalTowerMap2DImpl::towerGeometryHelper_
private

Definition at line 62 of file HGCalTowerMap2DImpl.h.

Referenced by buildTowerMap2D(), newTowerMaps(), and setGeometry().

◆ triggerTools_

HGCalTriggerTools HGCalTowerMap2DImpl::triggerTools_
private

Definition at line 59 of file HGCalTowerMap2DImpl.h.

Referenced by buildTowerMap2D(), newTowerMaps(), and setGeometry().

◆ useLayerWeights_

bool HGCalTowerMap2DImpl::useLayerWeights_
private

Definition at line 57 of file HGCalTowerMap2DImpl.h.

Referenced by buildTowerMap2D().