CMS 3D CMS Logo

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

#include <HGCalTriggerTools.h>

Public Member Functions

void eventSetup (const edm::EventSetup &)
 
float getEta (const GlobalPoint &position, const float &vertex_z=0.) const
 
float getLayerZ (const unsigned &layerWithOffset) const
 
float getLayerZ (const int &subdet, const unsigned &layer) const
 
float getPhi (const GlobalPoint &position) const
 
float getPt (const GlobalPoint &position, const float &hitEnergy, const float &vertex_z=0.) const
 
float getTCEta (const DetId &id, const float &vertex_z=0.) const
 
float getTCPhi (const DetId &id) const
 
GlobalPoint getTCPosition (const DetId &id) const
 
float getTCPt (const DetId &id, const float &hitEnergy, const float &vertex_z=0.) const
 
const HGCalTriggerGeometryBasegetTriggerGeometry () const
 
 HGCalTriggerTools ()
 
unsigned lastLayerBH () const
 
unsigned lastLayerEE () const
 
unsigned lastLayerFH () const
 
unsigned layer (const DetId &) const
 
unsigned layers (ForwardSubdetector type) const
 
unsigned layerWithOffset (const DetId &) const
 
 ~HGCalTriggerTools ()
 

Private Attributes

unsigned bhLayers_
 
unsigned eeLayers_
 
unsigned fhLayers_
 
const HGCalTriggerGeometryBasegeom_
 
unsigned totalLayers_
 

Detailed Description

Tools for handling HGCal trigger det-ID: in the current version of trhe HGCAL simulation only HGCalDetId for the TriggerCells (TC) are used and not HcalDetId as in the offline! As a consequence the class assumes that only DetIds of the first kind are used in the getTC* methods NOTE: this uses the trigger geometry hence would give wrong results when used for offline reco!!!!

Author
G. Cerminara (CERN), heavily "inspired" by HGCalRechHitTools ;)

Definition at line 30 of file HGCalTriggerTools.h.

Constructor & Destructor Documentation

HGCalTriggerTools::HGCalTriggerTools ( )
inline

Definition at line 32 of file HGCalTriggerTools.h.

32  : geom_(nullptr),
33  eeLayers_(0), fhLayers_(0), bhLayers_(0), totalLayers_(0){}
const HGCalTriggerGeometryBase * geom_
HGCalTriggerTools::~HGCalTriggerTools ( )
inline

Definition at line 34 of file HGCalTriggerTools.h.

References LayerTriplets::layers().

34 {}

Member Function Documentation

void HGCalTriggerTools::eventSetup ( const edm::EventSetup es)

Definition at line 59 of file HGCalTriggerTools.cc.

References bhLayers_, HGCalTriggerGeometryBase::bhTopology(), HGCalTopology::dddConstants(), HcalTopology::dddConstants(), eeLayers_, HGCalTriggerGeometryBase::eeTopology(), fhLayers_, HGCalTriggerGeometryBase::fhTopology(), geom_, edm::EventSetup::get(), HcalDDDRecConstants::getMaxDepth(), HGCalTriggerGeometryBase::hscTopology(), HGCalTriggerGeometryBase::isV9Geometry(), HGCalDDDConstants::layers(), edm::ESHandle< T >::product(), and totalLayers_.

Referenced by HGCalMulticlusteringImpl::eventSetup(), HGCalTriggerCellCalibration::eventSetup(), HGCalShowerShape::eventSetup(), HGCalTowerMap2DImpl::eventSetup(), HGCalClusteringImpl::eventSetup(), HGCalTriggerNtupleHGCClusters::fill(), HGCalTriggerNtupleHGCTriggerCells::fill(), and HGCalTriggerNtupleHGCDigis::fill().

60 {
62  es.get<CaloGeometryRecord>().get(triggerGeometry_);
63  geom_ = triggerGeometry_.product();
64 
67  if(geom_->isV9Geometry())
68  {
71  }
72  else
73  {
76  }
77 }
const HcalDDDRecConstants * dddConstants() const
Definition: HcalTopology.h:167
const HGCalTopology & eeTopology() const
const HGCalTriggerGeometryBase * geom_
unsigned int layers(bool reco) const
const HcalTopology & bhTopology() const
const HGCalDDDConstants & dddConstants() const
const HGCalTopology & hscTopology() const
int getMaxDepth(const int &type) const
T get() const
Definition: EventSetup.h:62
T const * product() const
Definition: ESHandle.h:86
const HGCalTopology & fhTopology() const
float HGCalTriggerTools::getEta ( const GlobalPoint position,
const float &  vertex_z = 0. 
) const

Definition at line 145 of file HGCalTriggerTools.cc.

References PV3DBase< T, PVType, FrameType >::eta(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by getPt(), and getTCEta().

145  {
146  GlobalPoint corrected_position = GlobalPoint(position.x(), position.y(), position.z()-vertex_z);
147  return corrected_position.eta();
148 }
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:63
T z() const
Definition: PV3DBase.h:64
T eta() const
Definition: PV3DBase.h:76
T x() const
Definition: PV3DBase.h:62
float HGCalTriggerTools::getLayerZ ( const unsigned &  layerWithOffset) const

Definition at line 176 of file HGCalTriggerTools.cc.

References HcalEndcap, HGCEE, HGCHEF, lastLayerEE(), lastLayerFH(), and PFRecoTauDiscriminationByIsolation_cfi::offset.

176  {
177  int subdet = ForwardSubdetector::HGCEE;
178  unsigned offset = 0;
181  offset = lastLayerEE();
182  } else if(layerWithOffset > lastLayerFH()) {
184  offset = lastLayerFH();
185  }
186  return getLayerZ(subdet, layerWithOffset - offset);
187 }
unsigned lastLayerEE() const
float getLayerZ(const unsigned &layerWithOffset) const
unsigned layerWithOffset(const DetId &) const
unsigned lastLayerFH() const
float HGCalTriggerTools::getLayerZ ( const int &  subdet,
const unsigned &  layer 
) const

Definition at line 189 of file HGCalTriggerTools.cc.

References HGCalTriggerGeometryBase::bhTopology(), HGCalTopology::dddConstants(), HcalTopology::dddConstants(), HGCalTriggerGeometryBase::eeTopology(), HGCalTriggerGeometryBase::fhTopology(), geom_, HcalDDDRecConstants::getEtaRange(), HcalDDDRecConstants::getRZ(), HcalEndcap, HGCEE, HGCHEB, HGCHEF, HGCalTriggerGeometryBase::hscTopology(), HGCalTriggerGeometryBase::isV9Geometry(), layer(), and HGCalDDDConstants::waferZ().

189  {
190  float layerGlobalZ = 0.;
191  if(subdet == ForwardSubdetector::HGCEE) {
192  layerGlobalZ = geom_->eeTopology().dddConstants().waferZ(layer, true);
193  } else if(subdet == ForwardSubdetector::HGCHEF) {
194  layerGlobalZ = geom_->fhTopology().dddConstants().waferZ(layer, true);
195  } else if(subdet == HcalSubdetector::HcalEndcap || subdet == ForwardSubdetector::HGCHEB) {
196  if(geom_->isV9Geometry())
197  {
198  layerGlobalZ = geom_->hscTopology().dddConstants().waferZ(layer, true);
199  }
200  else
201  {
202  layerGlobalZ = geom_->bhTopology().dddConstants()->getRZ(
204  geom_->bhTopology().dddConstants()->getEtaRange(1).second,
205  layer);
206  }
207  }
208  return layerGlobalZ;
209 }
unsigned layer(const DetId &) const
const HcalDDDRecConstants * dddConstants() const
Definition: HcalTopology.h:167
const HGCalTopology & eeTopology() const
const HGCalTriggerGeometryBase * geom_
std::pair< int, int > getEtaRange(const int &i) const
const HcalTopology & bhTopology() const
double getRZ(const int &subdet, const int &ieta, const int &depth) const
double waferZ(int layer, bool reco) const
const HGCalDDDConstants & dddConstants() const
const HGCalTopology & hscTopology() const
const HGCalTopology & fhTopology() const
float HGCalTriggerTools::getPhi ( const GlobalPoint position) const

Definition at line 155 of file HGCalTriggerTools.cc.

References phi, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by getTCPhi().

155  {
156  float phi = atan2(position.y(),position.x());
157  return phi;
158 }
T y() const
Definition: PV3DBase.h:63
T x() const
Definition: PV3DBase.h:62
float HGCalTriggerTools::getPt ( const GlobalPoint position,
const float &  hitEnergy,
const float &  vertex_z = 0. 
) const

Definition at line 165 of file HGCalTriggerTools.cc.

References PVValHelper::eta, getEta(), and EnergyCorrector::pt.

Referenced by getTCPt().

165  {
166  float eta = getEta(position, vertex_z);
167  float pt = hitEnergy / cosh(eta);
168  return pt;
169 }
float getEta(const GlobalPoint &position, const float &vertex_z=0.) const
float HGCalTriggerTools::getTCEta ( const DetId id,
const float &  vertex_z = 0. 
) const

Definition at line 150 of file HGCalTriggerTools.cc.

References getEta(), getTCPosition(), and position.

150  {
152  return getEta(position, vertex_z);
153 }
float getEta(const GlobalPoint &position, const float &vertex_z=0.) const
static int position[264][3]
Definition: ReadPGInfo.cc:509
GlobalPoint getTCPosition(const DetId &id) const
float HGCalTriggerTools::getTCPhi ( const DetId id) const

Definition at line 160 of file HGCalTriggerTools.cc.

References getPhi(), getTCPosition(), and position.

160  {
162  return getPhi(position);
163 }
float getPhi(const GlobalPoint &position) const
static int position[264][3]
Definition: ReadPGInfo.cc:509
GlobalPoint getTCPosition(const DetId &id) const
GlobalPoint HGCalTriggerTools::getTCPosition ( const DetId id) const

Definition at line 79 of file HGCalTriggerTools.cc.

References Exception, geom_, HGCalTriggerGeometryBase::getTriggerCellPosition(), DetId::Hcal, layers(), and position.

Referenced by getTCEta(), getTCPhi(), and getTCPt().

79  {
80  if(id.det() == DetId::Hcal) {
81  throw cms::Exception("hgcal::HGCalTriggerTools")
82  << "method getTCPosition called for DetId not belonging to a TC";
83  // FIXME: this would actually need a better test...but at the moment I can not think to anything better
84  // to distinguish a TC detId
85  }
86 
88  return position;
89 }
const HGCalTriggerGeometryBase * geom_
static int position[264][3]
Definition: ReadPGInfo.cc:509
virtual GlobalPoint getTriggerCellPosition(const unsigned trigger_cell_det_id) const =0
float HGCalTriggerTools::getTCPt ( const DetId id,
const float &  hitEnergy,
const float &  vertex_z = 0. 
) const

Definition at line 171 of file HGCalTriggerTools.cc.

References getPt(), getTCPosition(), and position.

171  {
173  return getPt(position, hitEnergy, vertex_z);
174 }
float getPt(const GlobalPoint &position, const float &hitEnergy, const float &vertex_z=0.) const
static int position[264][3]
Definition: ReadPGInfo.cc:509
GlobalPoint getTCPosition(const DetId &id) const
const HGCalTriggerGeometryBase* HGCalTriggerTools::getTriggerGeometry ( ) const
inline

Definition at line 56 of file HGCalTriggerTools.h.

56 {return geom_;};
const HGCalTriggerGeometryBase * geom_
unsigned HGCalTriggerTools::lastLayerBH ( ) const
inline

Definition at line 44 of file HGCalTriggerTools.h.

References position.

Referenced by HGCalTowerMap2DImpl::newTowerMaps().

44 {return totalLayers_;}
unsigned HGCalTriggerTools::lastLayerEE ( ) const
inline
unsigned HGCalTriggerTools::lastLayerFH ( ) const
inline

Definition at line 43 of file HGCalTriggerTools.h.

Referenced by getLayerZ().

unsigned HGCalTriggerTools::layer ( const DetId id) const

Definition at line 119 of file HGCalTriggerTools.cc.

References HcalDetId::depth(), DetId::Forward, DetId::Hcal, HcalEndcap, HGCalDetId::layer(), layerWithOffset(), and SiStripPI::max.

Referenced by getLayerZ(), geometryXMLparser.DTAlignable::index(), geometryXMLparser.CSCAlignable::index(), layers(), and layerWithOffset().

119  {
121  if( id.det() == DetId::Forward) {
122  const HGCalDetId hid(id);
123  layer = hid.layer();
124  } else if( id.det() == DetId::Hcal && id.subdetId() == HcalEndcap) {
125  const HcalDetId hcid(id);
126  layer = hcid.depth();
127  }
128  return layer;
129 }
unsigned layer(const DetId &) const
unsigned HGCalTriggerTools::layers ( ForwardSubdetector  type) const

Definition at line 94 of file HGCalTriggerTools.cc.

References bhLayers_, eeLayers_, fhLayers_, ForwardEmpty, HGCEE, HGCHEB, HGCHEF, layer(), and totalLayers_.

Referenced by HGCalClusteringImpl::clusterizeNN(), HGCalShowerShape::coreShowerLength(), and getTCPosition().

95 {
96  unsigned layers = 0;
97  switch(type)
98  {
100  layers = eeLayers_;
101  break;
103  layers = fhLayers_;
104  break;
106  layers = bhLayers_;
107  break;
109  layers = totalLayers_;
110  break;
111  default:
112  break;
113  };
114  return layers;
115 }
type
Definition: HCALResponse.h:21
unsigned layers(ForwardSubdetector type) const
unsigned HGCalTriggerTools::layerWithOffset ( const DetId id) const

Definition at line 133 of file HGCalTriggerTools.cc.

References eeLayers_, fhLayers_, DetId::Forward, geom_, DetId::Hcal, HcalEndcap, HGCHEB, HGCHEF, HGCalTriggerGeometryBase::isV9Geometry(), checklumidiff::l, and layer().

Referenced by HGCalTowerMap2DImpl::buildTowerMap2D(), HGCalTriggerCellCalibration::calibrateMipTinGeV(), HGCalClusteringImpl::calibratePt(), HGCalShowerShape::eMax(), HGCalTriggerNtupleHGCClusters::fill(), HGCalTriggerNtupleHGCTriggerCells::fill(), HGCalTriggerNtupleHGCDigis::fill(), HGCalShowerShape::firstLayer(), HGCalShowerShape::lastLayer(), layer(), HGCalShowerShape::maxLayer(), HGCalShowerShape::sigmaEtaEtaMax(), HGCalShowerShape::sigmaPhiPhiMax(), HGCalShowerShape::sigmaRRMax(), HGCalShowerShape::sigmaRRMean(), and HGCalClusteringImpl::triggerCellReshuffling().

133  {
134  unsigned int l = layer(id);
135  if( id.det() == DetId::Forward && id.subdetId() == HGCHEF ) {
136  l += eeLayers_;
137  } else if( (id.det() == DetId::Hcal && id.subdetId() == HcalEndcap) ||
138  (id.det() == DetId::Forward && id.subdetId() == HGCHEB) ) {
139  if(geom_->isV9Geometry()) l += eeLayers_;
140  else l += eeLayers_ + fhLayers_;
141  }
142  return l;
143 }
unsigned layer(const DetId &) const
const HGCalTriggerGeometryBase * geom_

Member Data Documentation

unsigned HGCalTriggerTools::bhLayers_
private

Definition at line 67 of file HGCalTriggerTools.h.

Referenced by eventSetup(), and layers().

unsigned HGCalTriggerTools::eeLayers_
private

Definition at line 65 of file HGCalTriggerTools.h.

Referenced by eventSetup(), layers(), and layerWithOffset().

unsigned HGCalTriggerTools::fhLayers_
private

Definition at line 66 of file HGCalTriggerTools.h.

Referenced by eventSetup(), layers(), and layerWithOffset().

const HGCalTriggerGeometryBase* HGCalTriggerTools::geom_
private

Definition at line 64 of file HGCalTriggerTools.h.

Referenced by eventSetup(), getLayerZ(), getTCPosition(), and layerWithOffset().

unsigned HGCalTriggerTools::totalLayers_
private

Definition at line 68 of file HGCalTriggerTools.h.

Referenced by eventSetup(), and layers().