CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
hgcal::RecHitTools Class Reference

#include <RecHitTools.h>

Public Member Functions

std::pair< uint32_t, uint32_t > firstAndLastLayer (DetId::Detector det, int subdet) const
 
unsigned int firstLayerBH () const
 
std::pair< int, int > getCell (const DetId &) const
 
int getCellType (const DetId &id) const
 
float getEta (const GlobalPoint &position, const float &vertex_z=0.) const
 
float getEta (const DetId &id, const float &vertex_z=0.) const
 
const CaloGeometrygetGeometry () const
 
int getGeometryType () const
 
unsigned int getLayer (DetId::Detector type, bool nose=false) const
 
unsigned int getLayer (ForwardSubdetector type) const
 
unsigned int getLayer (const DetId &) const
 
unsigned int getLayerWithOffset (const DetId &) const
 
float getPhi (const GlobalPoint &position) const
 
float getPhi (const DetId &id) const
 
GlobalPoint getPosition (const DetId &id) const
 
GlobalPoint getPositionLayer (int layer, bool nose=false) const
 
float getPt (const GlobalPoint &position, const float &hitEnergy, const float &vertex_z=0.) const
 
float getPt (const DetId &id, const float &hitEnergy, const float &vertex_z=0.) const
 
std::float_t getRadiusToSide (const DetId &) const
 
std::pair< float, float > getScintDEtaDPhi (const DetId &) const
 
int getScintMaxIphi () const
 
int getSiThickIndex (const DetId &) const
 
std::float_t getSiThickness (const DetId &) const
 
const CaloSubdetectorGeometrygetSubdetectorGeometry (const DetId &id) const
 
std::pair< int, int > getWafer (const DetId &) const
 
bool isHalfCell (const DetId &) const
 
bool isOnlySilicon (const unsigned int layer) const
 
bool isScintillator (const DetId &) const
 
bool isSilicon (const DetId &) const
 
unsigned int lastLayer (bool nose=false) const
 
unsigned int lastLayerBH () const
 
unsigned int lastLayerEE (bool nose=false) const
 
unsigned int lastLayerFH () const
 
bool maskCell (const DetId &id, int corners=3) const
 
unsigned int maxNumberOfWafersPerLayer (bool nose=false) const
 
 RecHitTools ()
 
void setGeometry (CaloGeometry const &)
 
int zside (const DetId &id) const
 
 ~RecHitTools ()
 

Private Attributes

unsigned int bhFirstLayer_
 
unsigned int bhLastLayer_
 
int bhMaxIphi_
 
unsigned int bhOffset_
 
unsigned int eeOffset_
 
unsigned int fhLastLayer_
 
unsigned int fhOffset_
 
const CaloGeometrygeom_
 
int geometryType_
 
unsigned int maxNumberOfWafersNose_
 
unsigned int maxNumberOfWafersPerLayer_
 
unsigned int noseLastLayer_
 

Detailed Description

Definition at line 23 of file RecHitTools.h.

Constructor & Destructor Documentation

◆ RecHitTools()

hgcal::RecHitTools::RecHitTools ( )
inline

Definition at line 25 of file RecHitTools.h.

26  : geom_(nullptr),
27  eeOffset_(0),
28  fhOffset_(0),
29  bhFirstLayer_(0),
30  bhOffset_(0),
31  fhLastLayer_(0),
32  noseLastLayer_(0),
33  geometryType_(0) {}
unsigned int bhFirstLayer_
Definition: RecHitTools.h:91
unsigned int fhLastLayer_
Definition: RecHitTools.h:91
unsigned int fhOffset_
Definition: RecHitTools.h:91
unsigned int bhOffset_
Definition: RecHitTools.h:91
const CaloGeometry * geom_
Definition: RecHitTools.h:90
unsigned int eeOffset_
Definition: RecHitTools.h:91
unsigned int noseLastLayer_
Definition: RecHitTools.h:91

◆ ~RecHitTools()

hgcal::RecHitTools::~RecHitTools ( )
inline

Definition at line 34 of file RecHitTools.h.

34 {}

Member Function Documentation

◆ firstAndLastLayer()

std::pair< uint32_t, uint32_t > RecHitTools::firstAndLastLayer ( DetId::Detector  det,
int  subdet 
) const

Definition at line 521 of file RecHitTools.cc.

References bhFirstLayer_, bhLastLayer_, eeOffset_, fhLastLayer_, fhOffset_, DetId::Forward, HFNose, DetId::HGCalEE, DetId::HGCalHSi, HGCEE, HGCHEF, and noseLastLayer_.

521  {
522  if ((det == DetId::HGCalEE) || ((det == DetId::Forward) && (subdet == HGCEE))) {
523  return std::make_pair(eeOffset_ + 1, fhOffset_);
524  } else if ((det == DetId::HGCalHSi) || ((det == DetId::Forward) && (subdet == HGCHEF))) {
525  return std::make_pair(fhOffset_ + 1, fhLastLayer_);
526  } else if ((det == DetId::Forward) && (subdet == HFNose)) {
527  return std::make_pair(1, noseLastLayer_);
528  } else {
529  return std::make_pair(bhFirstLayer_, bhLastLayer_);
530  }
531 }
unsigned int bhFirstLayer_
Definition: RecHitTools.h:91
unsigned int fhLastLayer_
Definition: RecHitTools.h:91
unsigned int bhLastLayer_
Definition: RecHitTools.h:91
unsigned int fhOffset_
Definition: RecHitTools.h:91
unsigned int eeOffset_
Definition: RecHitTools.h:91
unsigned int noseLastLayer_
Definition: RecHitTools.h:91

◆ firstLayerBH()

unsigned int hgcal::RecHitTools::firstLayerBH ( ) const
inline

◆ getCell()

std::pair< int, int > RecHitTools::getCell ( const DetId id) const

Definition at line 408 of file RecHitTools.cc.

References HGCalDetId::cell(), HFNoseDetId::cellU(), HGCSiliconDetId::cellU(), HFNoseDetId::cellV(), HGCSiliconDetId::cellV(), TauDecayModes::dec, DetId::Forward, HFNose, DetId::HGCalEE, DetId::HGCalHSi, and SiStripPI::max.

408  {
409  int cellU = std::numeric_limits<int>::max();
410  int cellV = 0;
411  if ((id.det() == DetId::HGCalEE) || (id.det() == DetId::HGCalHSi)) {
412  cellU = HGCSiliconDetId(id).cellU();
413  cellV = HGCSiliconDetId(id).cellV();
414  } else if (id.det() == DetId::Forward && id.subdetId() == static_cast<int>(HFNose)) {
415  cellU = HFNoseDetId(id).cellU();
416  cellV = HFNoseDetId(id).cellV();
417  } else if (id.det() == DetId::Forward) {
418  cellU = HGCalDetId(id).cell();
419  } else {
420  edm::LogError("getCell::InvalidSiliconDetid")
421  << "det id: " << std::hex << id.rawId() << std::dec << ":" << id.det() << " is not HGCal silicon!";
422  }
423  return std::pair<int, int>(cellU, cellV);
424 }
Log< level::Error, false > LogError
int cellU() const
get the cell #&#39;s in u,v or in x,y
Definition: HFNoseDetId.h:60
constexpr int32_t cellU() const
get the cell #&#39;s in u,v or in x,y
int cell() const
get the absolute value of the cell #&#39;s in x and y
Definition: HGCalDetId.h:37
int cellV() const
Definition: HFNoseDetId.h:61
constexpr int32_t cellV() const

◆ getCellType()

int RecHitTools::getCellType ( const DetId id) const

Definition at line 439 of file RecHitTools.cc.

References cms::cuda::assert(), DetId::Forward, geom_, getLayerWithOffset(), getSiThickIndex(), CaloGeometry::getSubdetectorGeometry(), HFNose, isScintillator(), lastLayerEE(), Calorimetry_cff::thickness, and funct::true.

Referenced by TICLDumper::analyze().

439  {
440  auto layer_number = getLayerWithOffset(id);
441  auto thickness = getSiThickIndex(id);
442  auto geomNose =
444  auto isNose = geomNose ? true : false;
445  auto isEELayer = (layer_number <= lastLayerEE(isNose));
446  auto isScint = isScintillator(id);
447  int layerType = -1;
448 
449  if (isScint) {
450  layerType = CE_H_SCINT;
451  }
452  if (isEELayer) {
453  if (thickness == 0) {
454  layerType = CE_E_120;
455  } else if (thickness == 1) {
456  layerType = CE_E_200;
457  } else if (thickness == 2) {
458  layerType = CE_E_300;
459  }
460  } else {
461  if (thickness == 0) {
462  layerType = CE_H_120;
463  } else if (thickness == 1) {
464  layerType = CE_H_200;
465  } else if (thickness == 2) {
466  layerType = CE_H_300;
467  }
468  }
469  assert(layerType != -1);
470  return layerType;
471 }
assert(be >=bs)
const CaloGeometry * geom_
Definition: RecHitTools.h:90
bool isScintillator(const DetId &) const
Definition: RecHitTools.cc:478
int getSiThickIndex(const DetId &) const
Definition: RecHitTools.cc:216
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
unsigned int lastLayerEE(bool nose=false) const
Definition: RecHitTools.h:76
unsigned int getLayerWithOffset(const DetId &) const
Definition: RecHitTools.cc:376

◆ getEta() [1/2]

float RecHitTools::getEta ( const GlobalPoint position,
const float &  vertex_z = 0. 
) const

Definition at line 486 of file RecHitTools.cc.

References PV3DBase< T, PVType, FrameType >::eta(), and position.

Referenced by getEta(), getPt(), and HGCalIsoCalculator::setRecHits().

486  {
487  GlobalPoint corrected_position = GlobalPoint(position.x(), position.y(), position.z() - vertex_z);
488  return corrected_position.eta();
489 }
T eta() const
Definition: PV3DBase.h:73
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
static int position[264][3]
Definition: ReadPGInfo.cc:289

◆ getEta() [2/2]

float RecHitTools::getEta ( const DetId id,
const float &  vertex_z = 0. 
) const

Definition at line 491 of file RecHitTools.cc.

References PVValHelper::eta, getEta(), getPosition(), and position.

491  {
493  float eta = getEta(position, vertex_z);
494  return eta;
495 }
GlobalPoint getPosition(const DetId &id) const
Definition: RecHitTools.cc:140
float getEta(const GlobalPoint &position, const float &vertex_z=0.) const
Definition: RecHitTools.cc:486
static int position[264][3]
Definition: ReadPGInfo.cc:289

◆ getGeometry()

const CaloGeometry* hgcal::RecHitTools::getGeometry ( ) const
inline

Definition at line 75 of file RecHitTools.h.

References geom_.

75 { return geom_; };
const CaloGeometry * geom_
Definition: RecHitTools.h:90

◆ getGeometryType()

int hgcal::RecHitTools::getGeometryType ( ) const
inline

Definition at line 86 of file RecHitTools.h.

References geometryType_.

Referenced by RealisticSimClusterMapper::buildClusters().

86 { return geometryType_; }

◆ getLayer() [1/3]

unsigned int RecHitTools::getLayer ( DetId::Detector  type,
bool  nose = false 
) const

Definition at line 318 of file RecHitTools.cc.

References DetId::Forward, ForwardEmpty, geom_, CaloGeometry::getSubdetectorGeometry(), HFNose, DetId::HGCalEE, DetId::HGCalHSc, DetId::HGCalHSi, and hgcalTBTopologyTester_cfi::layers.

Referenced by RealisticSimClusterMapper::buildClusters(), and getLayerWithOffset().

318  {
319  int layer;
320  switch (type) {
321  case (DetId::HGCalEE): {
322  auto geomEE =
324  layer = (geomEE->topology().dddConstants()).layers(true);
325  break;
326  }
327  case (DetId::HGCalHSi): {
328  auto geomFH =
330  layer = (geomFH->topology().dddConstants()).layers(true);
331  break;
332  }
333  case (DetId::HGCalHSc): {
334  auto geomBH =
336  layer = (geomBH->topology().dddConstants()).layers(true);
337  break;
338  }
339  case (DetId::Forward): {
340  if (nose) {
341  auto geomHFN = static_cast<const HGCalGeometry*>(
343  layer = (geomHFN->topology().dddConstants()).layers(true);
344  } else {
345  auto geomEE = static_cast<const HGCalGeometry*>(
347  layer = (geomEE->topology().dddConstants()).layers(true);
348  auto geomFH = static_cast<const HGCalGeometry*>(
350  layer += (geomFH->topology().dddConstants()).layers(true);
351  }
352  break;
353  }
354  default:
355  layer = 0;
356  }
357  return (unsigned int)(layer);
358 }
const CaloGeometry * geom_
Definition: RecHitTools.h:90
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34

◆ getLayer() [2/3]

unsigned int RecHitTools::getLayer ( ForwardSubdetector  type) const

Definition at line 268 of file RecHitTools.cc.

References DetId::Forward, ForwardEmpty, geom_, CaloGeometry::getSubdetectorGeometry(), DetId::Hcal, HcalEndcap, HFNose, HGCEE, HGCHEB, HGCHEF, and hgcalTBTopologyTester_cfi::layers.

268  {
269  int layer(0);
270  switch (type) {
271  case (ForwardSubdetector::HGCEE): {
272  auto geomEE =
274  layer = (geomEE->topology().dddConstants()).layers(true);
275  break;
276  }
278  auto geomFH =
280  layer = (geomFH->topology().dddConstants()).layers(true);
281  break;
282  }
284  auto geomBH =
286  layer = (geomBH->topology().dddConstants())->getMaxDepth(1);
287  break;
288  }
290  auto geomEE =
292  layer = (geomEE->topology().dddConstants()).layers(true);
293  auto geomFH =
295  layer += (geomFH->topology().dddConstants()).layers(true);
296  auto geomBH =
298  if (geomBH)
299  layer += (geomBH->topology().dddConstants())->getMaxDepth(1);
300  auto geomBH2 =
302  if (geomBH2)
303  layer += (geomBH2->topology().dddConstants()).layers(true);
304  break;
305  }
307  auto geomHFN =
309  layer = (geomHFN->topology().dddConstants()).layers(true);
310  break;
311  }
312  default:
313  layer = 0;
314  }
315  return (unsigned int)(layer);
316 }
const CaloGeometry * geom_
Definition: RecHitTools.h:90
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34

◆ getLayer() [3/3]

unsigned int RecHitTools::getLayer ( const DetId id) const

Definition at line 360 of file RecHitTools.cc.

References HcalDetId::depth(), DetId::Forward, DetId::Hcal, HcalEndcap, HFNose, DetId::HGCalEE, DetId::HGCalHSc, DetId::HGCalHSi, HGCalDetId::layer(), HFNoseDetId::layer(), HGCScintillatorDetId::layer(), HGCSiliconDetId::layer(), and SiStripPI::max.

360  {
362  if (id.det() == DetId::HGCalEE || id.det() == DetId::HGCalHSi) {
363  layer = HGCSiliconDetId(id).layer();
364  } else if (id.det() == DetId::HGCalHSc) {
366  } else if (id.det() == DetId::Forward && id.subdetId() == static_cast<int>(HFNose)) {
367  layer = HFNoseDetId(id).layer();
368  } else if (id.det() == DetId::Forward) {
369  layer = HGCalDetId(id).layer();
370  } else if (id.det() == DetId::Hcal && id.subdetId() == HcalEndcap) {
371  layer = HcalDetId(id).depth();
372  }
373  return layer;
374 }
int layer() const
get the layer #
Definition: HFNoseDetId.h:57
int layer() const
get the layer #
Definition: HGCalDetId.h:46
constexpr int32_t layer() const
get the layer #
constexpr int layer() const
get the layer #
constexpr int depth() const
get the tower depth
Definition: HcalDetId.h:164

◆ getLayerWithOffset()

unsigned int RecHitTools::getLayerWithOffset ( const DetId id) const

Definition at line 376 of file RecHitTools.cc.

References bhOffset_, fhOffset_, DetId::Forward, getLayer(), DetId::Hcal, HcalEndcap, DetId::HGCalHSc, DetId::HGCalHSi, and HGCHEF.

Referenced by FWRecoGeometryESProducer::addCaloGeometry(), HGCalShowerSeparation::analyze(), HGCalHitCalibration::analyze(), TICLDumper::analyze(), RealisticSimClusterMapper::buildClusters(), TICLTrackstersEdgesValidation::dqmAnalyze(), TrackstersMergeProducerV3::energyRegressionAndID(), TrackstersMergeProducer::energyRegressionAndID(), HGCalHitCalibration::fillWithRecHits(), ticl::ClusterFilterByAlgoAndSizeAndLayerRange::filter(), getCellType(), hgcal::ClusterTools::getLayer(), HGCalRecHitSimpleAlgo::makeRecHit(), HGCal3DClustering::organizeByLayer(), TICLLayerTileProducer::produce(), HGCalIsoCalculator::produceHGCalIso(), and hgcal::EGammaPCAHelper::storeRecHits().

376  {
377  unsigned int layer = getLayer(id);
378  if (id.det() == DetId::Forward && id.subdetId() == HGCHEF) {
379  layer += fhOffset_;
380  } else if (id.det() == DetId::HGCalHSi || id.det() == DetId::HGCalHSc) {
381  // DetId::HGCalHSc hits include the offset w.r.t. EE already
382  layer += fhOffset_;
383  } else if (id.det() == DetId::Hcal && id.subdetId() == HcalEndcap) {
384  layer += bhOffset_;
385  }
386  // no need to add offset for HFnose
387  return layer;
388 }
unsigned int getLayer(DetId::Detector type, bool nose=false) const
Definition: RecHitTools.cc:318
unsigned int fhOffset_
Definition: RecHitTools.h:91
unsigned int bhOffset_
Definition: RecHitTools.h:91

◆ getPhi() [1/2]

float RecHitTools::getPhi ( const GlobalPoint position) const

Definition at line 497 of file RecHitTools.cc.

References position.

Referenced by HGCalIsoCalculator::setRecHits().

497  {
498  float phi = atan2(position.y(), position.x());
499  return phi;
500 }
static int position[264][3]
Definition: ReadPGInfo.cc:289

◆ getPhi() [2/2]

float RecHitTools::getPhi ( const DetId id) const

Definition at line 502 of file RecHitTools.cc.

References getPosition(), and position.

502  {
504  float phi = atan2(position.y(), position.x());
505  return phi;
506 }
GlobalPoint getPosition(const DetId &id) const
Definition: RecHitTools.cc:140
static int position[264][3]
Definition: ReadPGInfo.cc:289

◆ getPosition()

GlobalPoint RecHitTools::getPosition ( const DetId id) const

Definition at line 140 of file RecHitTools.cc.

References relativeConstraints::geom, HGCalGeometry::getPosition(), getSubdetectorGeometry(), DetId::Hcal, and position.

Referenced by HGCalShowerSeparation::analyze(), RealisticSimClusterMapper::buildClusters(), HGCalLayerClusterProducer::calculatePosition(), getEta(), getPhi(), getPt(), hgcal::ClusterTools::getWidths(), HGCalIsoCalculator::setRecHits(), and hgcal::EGammaPCAHelper::storeRecHits().

140  {
141  auto geom = getSubdetectorGeometry(id);
143  if (id.det() == DetId::Hcal) {
144  position = geom->getGeometry(id)->getPosition();
145  } else {
146  auto hg = static_cast<const HGCalGeometry*>(geom);
147  position = hg->getPosition(id);
148  }
149  return position;
150 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
Definition: RecHitTools.cc:130
static int position[264][3]
Definition: ReadPGInfo.cc:289

◆ getPositionLayer()

GlobalPoint RecHitTools::getPositionLayer ( int  layer,
bool  nose = false 
) const

Definition at line 152 of file RecHitTools.cc.

References funct::abs(), fhOffset_, DetId::Forward, geom_, geometryType_, CaloGeometry::getSubdetectorGeometry(), HFNose, and HGCalDDDConstants::waferZ().

Referenced by PositionAtECalEntranceComputer::beginEvent(), ticl::LinkingAlgoByDirectionGeometric::buildLayers(), TICLDumper::buildLayers(), hgcal::EGammaPCAHelper::findZFirstLayer(), ticl::LinkingAlgoByDirectionGeometric::linkTracksters(), TrackstersMergeProducerV3::produce(), SimTrackstersProducer::produce(), and TrackstersMergeProducer::produce().

152  {
153  unsigned int lay = std::abs(layer);
154  double z(0);
155  if (nose) {
156  auto geomNose =
158  if (geomNose) {
159  const HGCalDDDConstants* ddd = &(geomNose->topology().dddConstants());
160  if (ddd)
161  z = (layer > 0) ? ddd->waferZ(lay, true) : -ddd->waferZ(lay, true);
162  }
163  } else {
164  const HGCalDDDConstants* ddd = get_ddd(geom_, geometryType_, fhOffset_, lay);
165  if (geometryType_ == 1) {
166  if (lay > fhOffset_)
167  lay -= fhOffset_;
168  }
169  z = (layer > 0) ? ddd->waferZ(lay, true) : -ddd->waferZ(lay, true);
170  }
171  return GlobalPoint(0, 0, z);
172 }
double waferZ(int layer, bool reco) const
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
unsigned int fhOffset_
Definition: RecHitTools.h:91
const CaloGeometry * geom_
Definition: RecHitTools.h:90
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34

◆ getPt() [1/2]

float RecHitTools::getPt ( const GlobalPoint position,
const float &  hitEnergy,
const float &  vertex_z = 0. 
) const

Definition at line 508 of file RecHitTools.cc.

References PVValHelper::eta, getEta(), position, and DiDispStaMuonMonitor_cfi::pt.

508  {
509  float eta = getEta(position, vertex_z);
510  float pt = hitEnergy / cosh(eta);
511  return pt;
512 }
float getEta(const GlobalPoint &position, const float &vertex_z=0.) const
Definition: RecHitTools.cc:486
static int position[264][3]
Definition: ReadPGInfo.cc:289

◆ getPt() [2/2]

float RecHitTools::getPt ( const DetId id,
const float &  hitEnergy,
const float &  vertex_z = 0. 
) const

Definition at line 514 of file RecHitTools.cc.

References PVValHelper::eta, getEta(), getPosition(), position, and DiDispStaMuonMonitor_cfi::pt.

514  {
516  float eta = getEta(position, vertex_z);
517  float pt = hitEnergy / cosh(eta);
518  return pt;
519 }
GlobalPoint getPosition(const DetId &id) const
Definition: RecHitTools.cc:140
float getEta(const GlobalPoint &position, const float &vertex_z=0.) const
Definition: RecHitTools.cc:486
static int position[264][3]
Definition: ReadPGInfo.cc:289

◆ getRadiusToSide()

std::float_t RecHitTools::getRadiusToSide ( const DetId id) const

Definition at line 246 of file RecHitTools.cc.

References HGCalDDDConstants::cellSizeHex(), TauDecayModes::dec, DetId::Forward, relativeConstraints::geom, getSubdetectorGeometry(), HFNose, DetId::HGCalEE, DetId::HGCalHSi, SiStripPI::max, HFNoseDetId::type(), HGCSiliconDetId::type(), and HGCalDetId::waferType().

246  {
247  auto geom = getSubdetectorGeometry(id);
249  if (id.det() == DetId::HGCalEE || id.det() == DetId::HGCalHSi) {
250  const HGCSiliconDetId hid(id);
251  auto ddd = get_ddd(geom, hid);
252  size = ddd->cellSizeHex(hid.type());
253  } else if (id.det() == DetId::Forward && id.subdetId() == static_cast<int>(HFNose)) {
254  const HFNoseDetId hid(id);
255  auto ddd = get_ddd(geom, hid);
256  size = ddd->cellSizeHex(hid.type());
257  } else if (id.det() == DetId::Forward) {
258  const HGCalDetId hid(id);
259  auto ddd = get_ddd(geom, hid);
260  size = ddd->cellSizeHex(hid.waferType());
261  } else {
262  edm::LogError("getRadiusToSide::InvalidSiliconDetid")
263  << "det id: " << std::hex << id.rawId() << std::dec << ":" << id.det() << " is not HGCal silicon!";
264  }
265  return size;
266 }
size
Write out results.
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
Definition: RecHitTools.cc:130
Log< level::Error, false > LogError

◆ getScintDEtaDPhi()

std::pair< float, float > RecHitTools::getScintDEtaDPhi ( const DetId id) const

Definition at line 236 of file RecHitTools.cc.

References TauDecayModes::dec, CaloSubdetectorGeometry::getGeometry(), getSubdetectorGeometry(), isScintillator(), and LogDebug.

236  {
237  if (!isScintillator(id)) {
238  LogDebug("getScintDEtaDPhi::InvalidScintDetid")
239  << "det id: " << std::hex << id.rawId() << std::dec << ":" << id.det() << " is not HGCal scintillator!";
240  return {0.f, 0.f};
241  }
242  auto cellGeom = getSubdetectorGeometry(id)->getGeometry(id);
243  return {cellGeom->etaSpan(), cellGeom->phiSpan()};
244 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
Definition: RecHitTools.cc:130
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
bool isScintillator(const DetId &) const
Definition: RecHitTools.cc:478
#define LogDebug(id)

◆ getScintMaxIphi()

int hgcal::RecHitTools::getScintMaxIphi ( ) const
inline

Definition at line 85 of file RecHitTools.h.

References bhMaxIphi_.

Referenced by HGCalClusteringAlgoBase::getEventSetup().

85 { return bhMaxIphi_; }

◆ getSiThickIndex()

int RecHitTools::getSiThickIndex ( const DetId id) const

Definition at line 216 of file RecHitTools.cc.

References cms::cuda::assert(), DetId::Forward, getSiThickness(), HFNose, DetId::HGCalEE, DetId::HGCalHSi, Calorimetry_cff::thickness, HFNoseDetId::type(), and HGCSiliconDetId::type().

Referenced by FWRecoGeometryESProducer::addCaloGeometry(), HGCalLayerClusterProducer::calculatePosition(), getCellType(), and hgcal::EGammaPCAHelper::storeRecHits().

216  {
217  int thickIndex = -1;
218  if (id.det() == DetId::HGCalEE || id.det() == DetId::HGCalHSi) {
219  thickIndex = HGCSiliconDetId(id).type();
220  } else if (id.det() == DetId::Forward && id.subdetId() == static_cast<int>(HFNose)) {
221  thickIndex = HFNoseDetId(id).type();
222  } else if (id.det() == DetId::Forward) {
223  float thickness = getSiThickness(id);
224  if (thickness > 99. && thickness < 121.)
225  thickIndex = 0;
226  else if (thickness > 199. && thickness < 201.)
227  thickIndex = 1;
228  else if (thickness > 299. && thickness < 301.)
229  thickIndex = 2;
230  else
231  assert(thickIndex > 0 && "ERROR - silicon thickness has a nonsensical value");
232  }
233  return thickIndex;
234 }
assert(be >=bs)
int type() const
get the type
Definition: HFNoseDetId.h:51
constexpr int32_t type() const
get the type
std::float_t getSiThickness(const DetId &) const
Definition: RecHitTools.cc:190

◆ getSiThickness()

std::float_t RecHitTools::getSiThickness ( const DetId id) const

Definition at line 190 of file RecHitTools.cc.

References HGCalDDDConstants::cellThickness(), TauDecayModes::dec, DetId::Forward, relativeConstraints::geom, getSubdetectorGeometry(), HFNose, DetId::HGCalEE, DetId::HGCalHSi, HGCalDetId::layer(), HFNoseDetId::layer(), HGCSiliconDetId::layer(), LogDebug, HGCalDetId::wafer(), HFNoseDetId::waferU(), HGCSiliconDetId::waferU(), HFNoseDetId::waferV(), and HGCSiliconDetId::waferV().

Referenced by HGCalHitCalibration::analyze(), HGCalHitCalibration::fillWithRecHits(), and getSiThickIndex().

190  {
191  auto geom = getSubdetectorGeometry(id);
192  std::float_t thick(0.37);
193  if (id.det() == DetId::HGCalEE || id.det() == DetId::HGCalHSi) {
194  const HGCSiliconDetId hid(id);
195  auto ddd = get_ddd(geom, hid);
196  thick = ddd->cellThickness(hid.layer(), hid.waferU(), hid.waferV());
197  } else if (id.det() == DetId::Forward && id.subdetId() == static_cast<int>(HFNose)) {
198  const HFNoseDetId hid(id);
199  auto ddd = get_ddd(geom, hid);
200  thick = ddd->cellThickness(hid.layer(), hid.waferU(), hid.waferV());
201  } else if (id.det() == DetId::Forward) {
202  const HGCalDetId hid(id);
203  auto ddd = get_ddd(geom, hid);
204  thick = ddd->cellThickness(hid.layer(), hid.wafer(), 0);
205  } else {
206  LogDebug("getSiThickness::InvalidSiliconDetid")
207  << "det id: " << std::hex << id.rawId() << std::dec << ":" << id.det() << " is not HGCal silicon!";
208  // It does not make any sense to return 0.37 as thickness for a detector
209  // that is not Silicon(does it?). Mark it as 0. to be able to distinguish
210  // the case.
211  thick = 0.f;
212  }
213  return thick;
214 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
Definition: RecHitTools.cc:130
#define LogDebug(id)

◆ getSubdetectorGeometry()

const CaloSubdetectorGeometry * RecHitTools::getSubdetectorGeometry ( const DetId id) const

Definition at line 130 of file RecHitTools.cc.

References ForwardEmpty, relativeConstraints::geom, geom_, CaloGeometry::getSubdetectorGeometry(), DetId::HGCalEE, DetId::HGCalHSc, and DetId::HGCalHSi.

Referenced by getPosition(), getRadiusToSide(), getScintDEtaDPhi(), getSiThickness(), isHalfCell(), and maskCell().

130  {
131  DetId::Detector det = id.det();
132  int subdet = (det == DetId::HGCalEE || det == DetId::HGCalHSi || det == DetId::HGCalHSc)
134  : id.subdetId();
135  auto geom = geom_->getSubdetectorGeometry(det, subdet);
136  check_geom(geom);
137  return geom;
138 }
const CaloGeometry * geom_
Definition: RecHitTools.h:90
Detector
Definition: DetId.h:24
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34

◆ getWafer()

std::pair< int, int > RecHitTools::getWafer ( const DetId id) const

Definition at line 390 of file RecHitTools.cc.

References TauDecayModes::dec, DetId::Forward, HFNose, DetId::HGCalEE, DetId::HGCalHSi, SiStripPI::max, HGCalDetId::wafer(), HGCalWaferIndex::waferU(), HFNoseDetId::waferU(), HGCSiliconDetId::waferU(), HGCalWaferIndex::waferV(), HFNoseDetId::waferV(), and HGCSiliconDetId::waferV().

390  {
392  int waferV = 0;
393  if ((id.det() == DetId::HGCalEE) || (id.det() == DetId::HGCalHSi)) {
394  waferU = HGCSiliconDetId(id).waferU();
395  waferV = HGCSiliconDetId(id).waferV();
396  } else if (id.det() == DetId::Forward && id.subdetId() == static_cast<int>(HFNose)) {
397  waferU = HFNoseDetId(id).waferU();
398  waferV = HFNoseDetId(id).waferV();
399  } else if (id.det() == DetId::Forward) {
400  waferU = HGCalDetId(id).wafer();
401  } else {
402  edm::LogError("getWafer::InvalidSiliconDetid")
403  << "det id: " << std::hex << id.rawId() << std::dec << ":" << id.det() << " is not HGCal silicon!";
404  }
405  return std::pair<int, int>(waferU, waferV);
406 }
int wafer() const
get the wafer #
Definition: HGCalDetId.h:40
int32_t waferU(const int32_t index)
int waferU() const
Definition: HFNoseDetId.h:76
Log< level::Error, false > LogError
constexpr int32_t waferV() const
int waferV() const
Definition: HFNoseDetId.h:79
int32_t waferV(const int32_t index)
constexpr int32_t waferU() const

◆ isHalfCell()

bool RecHitTools::isHalfCell ( const DetId id) const

Definition at line 426 of file RecHitTools.cc.

References HGCalDetId::cell(), DetId::Forward, relativeConstraints::geom, getSubdetectorGeometry(), HGCalDDDConstants::isHalfCell(), HGCalDetId::waferType(), and HGCalDDDConstants::waferTypeT().

426  {
427  bool ishalf = false;
428  if (id.det() == DetId::Forward) {
429  HGCalDetId hid(id);
430  auto geom = getSubdetectorGeometry(hid);
431  auto ddd = get_ddd(geom, hid);
432  const int waferType = ddd->waferTypeT(hid.waferType());
433  return ddd->isHalfCell(waferType, hid.cell());
434  }
435  //new geometry is always false
436  return ishalf;
437 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
Definition: RecHitTools.cc:130

◆ isOnlySilicon()

bool RecHitTools::isOnlySilicon ( const unsigned int  layer) const

Definition at line 480 of file RecHitTools.cc.

References bhLastLayer_, and bhOffset_.

480  {
481  // HFnose TODO
482  bool isonlysilicon = (layer % bhLastLayer_) < bhOffset_;
483  return isonlysilicon;
484 }
unsigned int bhLastLayer_
Definition: RecHitTools.h:91
unsigned int bhOffset_
Definition: RecHitTools.h:91

◆ isScintillator()

bool RecHitTools::isScintillator ( const DetId id) const

Definition at line 478 of file RecHitTools.cc.

References DetId::HGCalHSc.

Referenced by getCellType(), and getScintDEtaDPhi().

478 { return id.det() == DetId::HGCalHSc; }

◆ isSilicon()

bool RecHitTools::isSilicon ( const DetId id) const

Definition at line 473 of file RecHitTools.cc.

References DetId::Forward, HFNose, DetId::HGCalEE, and DetId::HGCalHSi.

Referenced by FWRecoGeometryESProducer::addCaloGeometry(), ticl::ClusterFilterByAlgoAndSize::filter(), and ticl::ClusterFilterByAlgoAndSizeAndLayerRange::filter().

473  {
474  return (id.det() == DetId::HGCalEE || id.det() == DetId::HGCalHSi ||
475  (id.det() == DetId::Forward && id.subdetId() == static_cast<int>(HFNose)));
476 }

◆ lastLayer()

unsigned int hgcal::RecHitTools::lastLayer ( bool  nose = false) const
inline

Definition at line 80 of file RecHitTools.h.

References bhLastLayer_, and noseLastLayer_.

Referenced by HGCalClusteringAlgoBase::getEventSetup(), TICLLayerTileProducer::produce(), and setGeometry().

80 { return (nose ? noseLastLayer_ : bhLastLayer_); }
unsigned int bhLastLayer_
Definition: RecHitTools.h:91
unsigned int noseLastLayer_
Definition: RecHitTools.h:91

◆ lastLayerBH()

unsigned int hgcal::RecHitTools::lastLayerBH ( ) const
inline

Definition at line 79 of file RecHitTools.h.

References bhLastLayer_.

Referenced by HGCal3DClustering::getEventSetup(), and hgcal::EGammaPCAHelper::setRecHitTools().

79 { return bhLastLayer_; }
unsigned int bhLastLayer_
Definition: RecHitTools.h:91

◆ lastLayerEE()

unsigned int hgcal::RecHitTools::lastLayerEE ( bool  nose = false) const
inline

◆ lastLayerFH()

unsigned int hgcal::RecHitTools::lastLayerFH ( ) const
inline

Definition at line 77 of file RecHitTools.h.

References fhLastLayer_.

Referenced by RealisticSimClusterMapper::buildClusters(), and HGCalClusteringAlgoBase::getEventSetup().

77 { return fhLastLayer_; }
unsigned int fhLastLayer_
Definition: RecHitTools.h:91

◆ maskCell()

bool RecHitTools::maskCell ( const DetId id,
int  corners = 3 
) const

Definition at line 533 of file RecHitTools.cc.

References HGCalTopology::dddConstants(), getSubdetectorGeometry(), DetId::Hcal, HGCalDDDConstants::maskCell(), and HGCalGeometry::topology().

533  {
534  if (id.det() == DetId::Hcal) {
535  return false;
536  } else {
537  auto hg = static_cast<const HGCalGeometry*>(getSubdetectorGeometry(id));
538  return hg->topology().dddConstants().maskCell(id, corners);
539  }
540 }
bool maskCell(const DetId &id, int corners) const
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
Definition: RecHitTools.cc:130
const HGCalTopology & topology() const
const HGCalDDDConstants & dddConstants() const
Definition: HGCalTopology.h:98

◆ maxNumberOfWafersPerLayer()

unsigned int hgcal::RecHitTools::maxNumberOfWafersPerLayer ( bool  nose = false) const
inline

Definition at line 82 of file RecHitTools.h.

References maxNumberOfWafersNose_, and maxNumberOfWafersPerLayer_.

82  {
84  }
unsigned int maxNumberOfWafersNose_
Definition: RecHitTools.h:92
unsigned int maxNumberOfWafersPerLayer_
Definition: RecHitTools.h:92

◆ setGeometry()

void RecHitTools::setGeometry ( CaloGeometry const &  geom)

Definition at line 79 of file RecHitTools.cc.

References bhFirstLayer_, bhLastLayer_, bhMaxIphi_, bhOffset_, eeOffset_, fhLastLayer_, fhOffset_, DetId::Forward, ForwardEmpty, relativeConstraints::geom, geom_, geometryType_, CaloGeometry::getSubdetectorGeometry(), DetId::Hcal, HcalEndcap, HFNose, DetId::HGCalEE, DetId::HGCalHSc, DetId::HGCalHSi, HGCEE, HGCHEF, lastLayer(), hgcalTBTopologyTester_cfi::layers, SiStripPI::max, maxNumberOfWafersNose_, maxNumberOfWafersPerLayer_, and noseLastLayer_.

Referenced by FWRecoGeometryESProducer::addCaloGeometry(), HeterogeneousHGCalRecHitsValidator::analyze(), HGCalShowerSeparation::analyze(), HGCalHitCalibration::analyze(), PositionAtECalEntranceComputer::beginEvent(), TICLLayerTileProducer::beginRun(), FilteredLayerClustersProducer::beginRun(), TrackstersMergeProducer::beginRun(), TICLDumper::beginRun(), TICLTrackstersEdgesValidation::dqmBeginRun(), HGCalEgammaIDHelper::eventInit(), hgcal::ClusterTools::getEventSetup(), HGCal3DClustering::getEventSetup(), HGCalDepthPreClusterer::getEventSetup(), PFHGCalRecHitCreator< DET, Layer, det, subdet >::importRecHits(), TrackstersMergeProducerV3::produce(), SimTrackstersProducer::produce(), HGCalLayerClusterProducer::produce(), HGCalRecHitAbsAlgo::set(), and RealisticSimClusterMapper::update().

79  {
80  geom_ = &geom;
81  unsigned int wmaxEE(0), wmaxFH(0);
82  auto geomEE = static_cast<const HGCalGeometry*>(
84  //check if it's the new geometry
85  if (geomEE) {
86  geometryType_ = 1;
87  eeOffset_ = (geomEE->topology().dddConstants()).getLayerOffset();
88  wmaxEE = (geomEE->topology().dddConstants()).waferCount(0);
89  auto geomFH = static_cast<const HGCalGeometry*>(
91  fhOffset_ = (geomFH->topology().dddConstants()).getLayerOffset();
92  wmaxFH = (geomFH->topology().dddConstants()).waferCount(0);
93  fhLastLayer_ = fhOffset_ + (geomFH->topology().dddConstants()).lastLayer(true);
94  auto geomBH = static_cast<const HGCalGeometry*>(
96  bhOffset_ = (geomBH->topology().dddConstants()).getLayerOffset();
97  bhFirstLayer_ = bhOffset_ + (geomBH->topology().dddConstants()).firstLayer();
98  bhLastLayer_ = bhOffset_ + (geomBH->topology().dddConstants()).lastLayer(true);
99  bhMaxIphi_ = geomBH->topology().dddConstants().maxCells(true);
100  } else {
101  geometryType_ = 0;
102  geomEE =
104  eeOffset_ = (geomEE->topology().dddConstants()).getLayerOffset();
105  wmaxEE = 1 + (geomEE->topology().dddConstants()).waferMax();
106  auto geomFH =
108  fhOffset_ = (geomFH->topology().dddConstants()).getLayerOffset();
109  fhLastLayer_ = fhOffset_ + (geomFH->topology().dddConstants()).layers(true);
111  bhFirstLayer_ = bhOffset_ + 1;
112  wmaxFH = 1 + (geomFH->topology().dddConstants()).waferMax();
113  auto geomBH =
115  bhLastLayer_ = bhOffset_ + (geomBH->topology().dddConstants())->getMaxDepth(1);
116  }
117  maxNumberOfWafersPerLayer_ = std::max(wmaxEE, wmaxFH);
118  // For nose geometry
119  auto geomNose =
121  if (geomNose) {
122  maxNumberOfWafersNose_ = (geomNose->topology().dddConstants()).waferCount(0);
123  noseLastLayer_ = (geomNose->topology().dddConstants()).layers(true);
124  } else {
126  noseLastLayer_ = 0;
127  }
128 }
unsigned int bhFirstLayer_
Definition: RecHitTools.h:91
unsigned int fhLastLayer_
Definition: RecHitTools.h:91
unsigned int bhLastLayer_
Definition: RecHitTools.h:91
unsigned int maxNumberOfWafersNose_
Definition: RecHitTools.h:92
unsigned int fhOffset_
Definition: RecHitTools.h:91
unsigned int bhOffset_
Definition: RecHitTools.h:91
unsigned int maxNumberOfWafersPerLayer_
Definition: RecHitTools.h:92
const CaloGeometry * geom_
Definition: RecHitTools.h:90
unsigned int eeOffset_
Definition: RecHitTools.h:91
unsigned int noseLastLayer_
Definition: RecHitTools.h:91
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
unsigned int lastLayer(bool nose=false) const
Definition: RecHitTools.h:80

◆ zside()

int RecHitTools::zside ( const DetId id) const

Definition at line 174 of file RecHitTools.cc.

References DetId::Forward, DetId::Hcal, HcalEndcap, HFNose, DetId::HGCalEE, DetId::HGCalHSc, DetId::HGCalHSi, HGCalDetId::zside(), HFNoseDetId::zside(), HGCScintillatorDetId::zside(), HGCSiliconDetId::zside(), and HcalDetId::zside().

Referenced by FWRecoGeometryESProducer::addCaloGeometry(), and TICLLayerTileProducer::produce().

174  {
175  int zside = 0;
176  if (id.det() == DetId::HGCalEE || id.det() == DetId::HGCalHSi) {
177  zside = HGCSiliconDetId(id).zside();
178  } else if (id.det() == DetId::HGCalHSc) {
180  } else if (id.det() == DetId::Forward && id.subdetId() == static_cast<int>(HFNose)) {
181  zside = HFNoseDetId(id).zside();
182  } else if (id.det() == DetId::Forward) {
183  zside = HGCalDetId(id).zside();
184  } else if (id.det() == DetId::Hcal && id.subdetId() == HcalEndcap) {
185  zside = HcalDetId(id).zside();
186  }
187  return zside;
188 }
constexpr int zside() const
get the z-side of the cell (1/-1)
Definition: HcalDetId.h:141
constexpr int zside() const
get the z-side of the cell (1/-1)
int zside(const DetId &id) const
Definition: RecHitTools.cc:174
constexpr int32_t zside() const
get the z-side of the cell (1/-1)
int zside() const
get the z-side of the cell (1/-1)
Definition: HGCalDetId.h:49
int zside() const
get the z-side of the cell (1/-1)
Definition: HFNoseDetId.h:54

Member Data Documentation

◆ bhFirstLayer_

unsigned int hgcal::RecHitTools::bhFirstLayer_
private

Definition at line 91 of file RecHitTools.h.

Referenced by firstAndLastLayer(), firstLayerBH(), and setGeometry().

◆ bhLastLayer_

unsigned int hgcal::RecHitTools::bhLastLayer_
private

Definition at line 91 of file RecHitTools.h.

Referenced by firstAndLastLayer(), isOnlySilicon(), lastLayer(), lastLayerBH(), and setGeometry().

◆ bhMaxIphi_

int hgcal::RecHitTools::bhMaxIphi_
private

Definition at line 94 of file RecHitTools.h.

Referenced by getScintMaxIphi(), and setGeometry().

◆ bhOffset_

unsigned int hgcal::RecHitTools::bhOffset_
private

Definition at line 91 of file RecHitTools.h.

Referenced by getLayerWithOffset(), isOnlySilicon(), and setGeometry().

◆ eeOffset_

unsigned int hgcal::RecHitTools::eeOffset_
private

Definition at line 91 of file RecHitTools.h.

Referenced by firstAndLastLayer(), and setGeometry().

◆ fhLastLayer_

unsigned int hgcal::RecHitTools::fhLastLayer_
private

Definition at line 91 of file RecHitTools.h.

Referenced by firstAndLastLayer(), lastLayerFH(), and setGeometry().

◆ fhOffset_

unsigned int hgcal::RecHitTools::fhOffset_
private

◆ geom_

const CaloGeometry* hgcal::RecHitTools::geom_
private

◆ geometryType_

int hgcal::RecHitTools::geometryType_
private

Definition at line 93 of file RecHitTools.h.

Referenced by getGeometryType(), getPositionLayer(), and setGeometry().

◆ maxNumberOfWafersNose_

unsigned int hgcal::RecHitTools::maxNumberOfWafersNose_
private

Definition at line 92 of file RecHitTools.h.

Referenced by maxNumberOfWafersPerLayer(), and setGeometry().

◆ maxNumberOfWafersPerLayer_

unsigned int hgcal::RecHitTools::maxNumberOfWafersPerLayer_
private

Definition at line 92 of file RecHitTools.h.

Referenced by maxNumberOfWafersPerLayer(), and setGeometry().

◆ noseLastLayer_

unsigned int hgcal::RecHitTools::noseLastLayer_
private

Definition at line 91 of file RecHitTools.h.

Referenced by firstAndLastLayer(), lastLayer(), and setGeometry().