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 526 of file RecHitTools.cc.

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

526  {
527  if ((det == DetId::HGCalEE) || ((det == DetId::Forward) && (subdet == HGCEE))) {
528  return std::make_pair(eeOffset_ + 1, fhOffset_);
529  } else if ((det == DetId::HGCalHSi) || ((det == DetId::Forward) && (subdet == HGCHEF))) {
530  return std::make_pair(fhOffset_ + 1, fhLastLayer_);
531  } else if ((det == DetId::Forward) && (subdet == HFNose)) {
532  return std::make_pair(1, noseLastLayer_);
533  } else {
534  return std::make_pair(bhFirstLayer_, bhLastLayer_);
535  }
536 }
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 413 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.

413  {
414  int cellU = std::numeric_limits<int>::max();
415  int cellV = 0;
416  if ((id.det() == DetId::HGCalEE) || (id.det() == DetId::HGCalHSi)) {
417  cellU = HGCSiliconDetId(id).cellU();
418  cellV = HGCSiliconDetId(id).cellV();
419  } else if (id.det() == DetId::Forward && id.subdetId() == static_cast<int>(HFNose)) {
420  cellU = HFNoseDetId(id).cellU();
421  cellV = HFNoseDetId(id).cellV();
422  } else if (id.det() == DetId::Forward) {
423  cellU = HGCalDetId(id).cell();
424  } else {
425  edm::LogError("getCell::InvalidSiliconDetid")
426  << "det id: " << std::hex << id.rawId() << std::dec << ":" << id.det() << " is not HGCal silicon!";
427  }
428  return std::pair<int, int>(cellU, cellV);
429 }
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 444 of file RecHitTools.cc.

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

444  {
445  auto layer_number = getLayerWithOffset(id);
446  auto thickness = getSiThickIndex(id);
447  auto geomNose =
449  auto isNose = geomNose ? true : false;
450  auto isEELayer = (layer_number <= lastLayerEE(isNose));
451  auto isScint = isScintillator(id);
452  int layerType = -1;
453 
454  if (isScint) {
455  layerType = CE_H_SCINT;
456  }
457  if (isEELayer) {
458  if (thickness == 0) {
459  layerType = CE_E_120;
460  } else if (thickness == 1) {
461  layerType = CE_E_200;
462  } else if (thickness == 2) {
463  layerType = CE_E_300;
464  }
465  } else {
466  if (thickness == 0) {
467  layerType = CE_H_120;
468  } else if (thickness == 1) {
469  layerType = CE_H_200;
470  } else if (thickness == 2) {
471  layerType = CE_H_300;
472  }
473  }
474  assert(layerType != -1);
475  return layerType;
476 }
assert(be >=bs)
const CaloGeometry * geom_
Definition: RecHitTools.h:90
bool isScintillator(const DetId &) const
Definition: RecHitTools.cc:483
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:381

◆ getEta() [1/2]

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

Definition at line 491 of file RecHitTools.cc.

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

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

491  {
492  GlobalPoint corrected_position = GlobalPoint(position.x(), position.y(), position.z() - vertex_z);
493  return corrected_position.eta();
494 }
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 496 of file RecHitTools.cc.

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

496  {
498  float eta = getEta(position, vertex_z);
499  return eta;
500 }
GlobalPoint getPosition(const DetId &id) const
Definition: RecHitTools.cc:140
float getEta(const GlobalPoint &position, const float &vertex_z=0.) const
Definition: RecHitTools.cc:491
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::Ecal, DetId::Forward, DetId::Hcal, HcalBarrel, HcalEmpty, HcalOuter, 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() != HcalEmpty) {
371  if (id.subdetId() == HcalBarrel)
372  layer = HcalDetId(id).depth();
373  else if (id.subdetId() == HcalOuter)
374  layer = HcalDetId(id).depth() + 1;
375  } else if (id.det() == DetId::Ecal) {
376  layer = 0;
377  }
378  return layer;
379 }
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 381 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(), RealisticSimClusterMapper::buildClusters(), TICLTrackstersEdgesValidation::dqmAnalyze(), TracksterLinksProducer::energyRegressionAndID(), TrackstersMergeProducer::energyRegressionAndID(), HGCalHitCalibration::fillWithRecHits(), ticl::ClusterFilterByAlgoAndSizeAndLayerRange::filter(), ticl::TracksterLinkingbySkeletons::findSkeletonNodes(), getCellType(), hgcal::ClusterTools::getLayer(), ticl::getLayerFromLC(), HGCalRecHitSimpleAlgo::makeRecHit(), HGCal3DClustering::organizeByLayer(), TICLLayerTileProducer::produce(), ALPAKA_ACCELERATOR_NAMESPACE::HGCalSoARecHitsProducer::produce(), HGCalIsoCalculator::produceHGCalIso(), and hgcal::EGammaPCAHelper::storeRecHits().

381  {
382  unsigned int layer = getLayer(id);
383  if (id.det() == DetId::Forward && id.subdetId() == HGCHEF) {
384  layer += fhOffset_;
385  } else if (id.det() == DetId::HGCalHSi || id.det() == DetId::HGCalHSc) {
386  // DetId::HGCalHSc hits include the offset w.r.t. EE already
387  layer += fhOffset_;
388  } else if (id.det() == DetId::Hcal && id.subdetId() == HcalEndcap) {
389  layer += bhOffset_;
390  }
391  // no need to add offset for HFnose
392  return layer;
393 }
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 502 of file RecHitTools.cc.

References position.

Referenced by HGCalIsoCalculator::setRecHits().

502  {
503  float phi = atan2(position.y(), position.x());
504  return phi;
505 }
static int position[264][3]
Definition: ReadPGInfo.cc:289

◆ getPhi() [2/2]

float RecHitTools::getPhi ( const DetId id) const

Definition at line 507 of file RecHitTools.cc.

References getPosition(), and position.

507  {
509  float phi = atan2(position.y(), position.x());
510  return phi;
511 }
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

◆ 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 ticl::TracksterLinkingbySkeletons::areCompatible(), PositionAtECalEntranceComputer::beginEvent(), ticl::GeneralInterpretationAlgo::buildLayers(), ticl::LinkingAlgoByDirectionGeometric::buildLayers(), ticl::TracksterLinkingbySkeletons::buildLayers(), DetectorTools::DetectorTools(), hgcal::EGammaPCAHelper::findZFirstLayer(), ticl::LinkingAlgoByDirectionGeometric::linkTracksters(), ticl::GeneralInterpretationAlgo::makeCandidates(), TracksterLinksProducer::produce(), TrackstersMergeProducer::produce(), SimTrackstersProducer::produce(), and TICLCandidateProducer::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 513 of file RecHitTools.cc.

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

513  {
514  float eta = getEta(position, vertex_z);
515  float pt = hitEnergy / cosh(eta);
516  return pt;
517 }
float getEta(const GlobalPoint &position, const float &vertex_z=0.) const
Definition: RecHitTools.cc:491
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 519 of file RecHitTools.cc.

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

519  {
521  float eta = getEta(position, vertex_z);
522  float pt = hitEnergy / cosh(eta);
523  return pt;
524 }
GlobalPoint getPosition(const DetId &id) const
Definition: RecHitTools.cc:140
float getEta(const GlobalPoint &position, const float &vertex_z=0.) const
Definition: RecHitTools.cc:491
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:483
#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(), ALPAKA_ACCELERATOR_NAMESPACE::HGCalSoARecHitsProducer::produce(), 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 395 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().

395  {
397  int waferV = 0;
398  if ((id.det() == DetId::HGCalEE) || (id.det() == DetId::HGCalHSi)) {
399  waferU = HGCSiliconDetId(id).waferU();
400  waferV = HGCSiliconDetId(id).waferV();
401  } else if (id.det() == DetId::Forward && id.subdetId() == static_cast<int>(HFNose)) {
402  waferU = HFNoseDetId(id).waferU();
403  waferV = HFNoseDetId(id).waferV();
404  } else if (id.det() == DetId::Forward) {
405  waferU = HGCalDetId(id).wafer();
406  } else {
407  edm::LogError("getWafer::InvalidSiliconDetid")
408  << "det id: " << std::hex << id.rawId() << std::dec << ":" << id.det() << " is not HGCal silicon!";
409  }
410  return std::pair<int, int>(waferU, waferV);
411 }
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 431 of file RecHitTools.cc.

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

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

◆ isOnlySilicon()

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

Definition at line 485 of file RecHitTools.cc.

References bhLastLayer_, and bhOffset_.

485  {
486  // HFnose TODO
487  bool isonlysilicon = (layer % bhLastLayer_) < bhOffset_;
488  return isonlysilicon;
489 }
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 483 of file RecHitTools.cc.

References DetId::HGCalHSc.

Referenced by getCellType(), and getScintDEtaDPhi().

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

◆ isSilicon()

bool RecHitTools::isSilicon ( const DetId id) const

Definition at line 478 of file RecHitTools.cc.

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

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

478  {
479  return (id.det() == DetId::HGCalEE || id.det() == DetId::HGCalHSi ||
480  (id.det() == DetId::Forward && id.subdetId() == static_cast<int>(HFNose)));
481 }

◆ lastLayer()

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

◆ 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 538 of file RecHitTools.cc.

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

538  {
539  if (id.det() == DetId::Hcal) {
540  return false;
541  } else {
542  auto hg = static_cast<const HGCalGeometry*>(getSubdetectorGeometry(id));
543  return hg->topology().dddConstants().maskCell(id, corners);
544  }
545 }
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(), TracksterLinksProducer::beginRun(), TICLCandidateProducer::beginRun(), TrackstersMergeProducer::beginRun(), DetectorTools::DetectorTools(), TICLTrackstersEdgesValidation::dqmBeginRun(), HGCalEgammaIDHelper::eventInit(), hgcal::ClusterTools::getEventSetup(), HGCalDepthPreClusterer::getEventSetup(), HGCal3DClustering::getEventSetup(), PFHGCalRecHitCreator< DET, Layer, det, subdet >::importRecHits(), ALPAKA_ACCELERATOR_NAMESPACE::HGCalSoARecHitsProducer::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(), TICLLayerTileProducer::produce(), and ALPAKA_ACCELERATOR_NAMESPACE::HGCalSoARecHitsProducer::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().